[PATCH] ASoC: pcm: send DAPM_STREAM_STOP event in dpcm_fe_dai_shutdown

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Wed Dec 2 20:33:43 CET 2020


A recent change removed the call to send the DAPM_STREAM_STOP
event in dpcm_fe_dai_shutdown. But this causes a regression
when a PCM prepare is not paired with a hw_free. So, add
the DAPM_STREAM_STOP event back to dpcm_fe_dai_shutdown()
to fix this.

The new sequence would be:
soc_pcm_prepare()
    -> SND_SOC_DAPM_STREAM_START

soc_pcm_hw_free()
    -> soc_pcm_hw_free()
	-> SND_SOC_DAPM_STREAM_STOP

dpcm_fe_dai_shutdown()
    -> SND_SOC_DAPM_STREAM_STOP

Note that the DAPM_STREAM_STOP will be called twice but it seems
harmless.

Fixes: a27b421f1d04 ('ASoC: pcm: call snd_soc_dapm_stream_stop() in soc_pcm_hw_clean')

Reported-by: Hans de Goede <hdegoede at redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 sound/soc/soc-pcm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 5250124dc8f5..ae062e4d1ce8 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1860,6 +1860,9 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
 	/* now shutdown the frontend */
 	soc_pcm_close(substream);
 
+	/* run the stream stop event */
+	dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
+
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
 	dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
 	return 0;
-- 
2.25.1



More information about the Alsa-devel mailing list