From 381343d4fbf2e434ea0ba9d9330bca49be43eda8 Mon Sep 17 00:00:00 2001 From: Xing Zheng Date: Mon, 31 Mar 2025 21:34:05 +0800 Subject: [PATCH] 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 Change-Id: I96e4bbcde035a700e2e18ee8782d75cdac2b18be --- sound/soc/codecs/rk_dsm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/soc/codecs/rk_dsm.c b/sound/soc/codecs/rk_dsm.c index 9a189b7fcea3..07e3793ae51b 100644 --- a/sound/soc/codecs/rk_dsm.c +++ b/sound/soc/codecs/rk_dsm.c @@ -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: