swr-haptics: request and release swr device wakeup votes properly

Request and release swr device wakeup votes in PRE/POST PMU and
PRE/POST PMD events to allow system enter low power states.

Change-Id: I8acd648bcc8e11cadda7254d7e5369155d9597c9
Signed-off-by: Phani Kumar Uppalapati <quic_phaniu@quicinc.com>
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
This commit is contained in:
Phani Kumar Uppalapati 2023-12-19 14:59:16 -08:00 committed by Prasad Kumpatla
parent 641fe28ac7
commit 1104a060e4

View File

@ -313,6 +313,7 @@ static int hap_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
if (rc < 0) {
dev_err_ratelimited(swr_hap->dev, "%s: Enable hpwr_vreg failed, rc=%d\n",
__func__, rc);
swr_device_wakeup_unvote(swr_hap->swr_slave);
return rc;
}
@ -327,16 +328,20 @@ static int hap_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
swr_slvdev_datapath_control(swr_hap->swr_slave,
swr_hap->swr_slave->dev_num, false);
swr_hap_disable_hpwr_vreg(swr_hap);
swr_device_wakeup_unvote(swr_hap->swr_slave);
return rc;
}
swr_device_wakeup_unvote(swr_hap->swr_slave);
break;
case SND_SOC_DAPM_PRE_PMD:
swr_device_wakeup_vote(swr_hap->swr_slave);
/* stop SWR play */
val = SWR_PLAY_SRC_VAL_SWR;
rc = regmap_write(swr_hap->regmap, SWR_PLAY_REG, val);
if (rc) {
dev_err_ratelimited(swr_hap->dev, "%s: Enable SWR_PLAY failed, rc=%d\n",
__func__, rc);
swr_device_wakeup_unvote(swr_hap->swr_slave);
return rc;
}
@ -344,6 +349,7 @@ static int hap_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
if (rc < 0) {
dev_err_ratelimited(swr_hap->dev, "%s: Disable hpwr_vreg failed, rc=%d\n",
__func__, rc);
swr_device_wakeup_unvote(swr_hap->swr_slave);
return rc;
}
break;