ASoC: codecs: rk_dsm: Fix the silence during recover from XRUN

Here we need to restore the volume and ioswitch status.
Otherwise, there will be no sound if you restore from
the xrun state.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Change-Id: I96e4bbcde035a700e2e18ee8782d75cdac2b18be
This commit is contained in:
Xing Zheng
2025-03-31 21:34:05 +08:00
committed by Tao Huang
parent 49f88ec9c5
commit 381343d4fb

View File

@@ -520,6 +520,19 @@ static int rk_dsm_pcm_trigger(struct snd_pcm_substream *substream,
snd_soc_component_get_drvdata(dai->component);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
/**
* NOTE: Recover DAC volumes and switch RKDSM_ON_FUNC after hw_param()
* again, avoid to incorrect silence during recover from XRUN.
*/
regmap_write(rd->regmap, DACVOLL0, rd->vols.vol_l);
regmap_write(rd->regmap, DACVOLR0, rd->vols.vol_r);
regmap_write(rd->regmap, DACVOGP, rd->vols.polarity);
if (rd->data && rd->data->iomux_switch)
rd->data->iomux_switch(rd->dev, RKDSM_ON_FUNC);
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: