[v2,7/8] ASoC: soc-pcm: Do Digital Mute for both CPU/Codec in same timing.
diff mbox series

Message ID 87eeug7q0y.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series
  • ASoC: soc-pcm cleanup step5
Related show

Commit Message

Kuninori Morimoto Feb. 27, 2020, 1:55 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Digital Mute for CPU   is done at soc_pcm_close(), and
Digital Mute for Codec is done at soc_pcm_hw_free().
It is just confusable.
This patch do Digital Mute for both CPU/Codec in same timing.
Then, it cares DAI activity

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
v1 -> v2

	- add Reviewed-by from Ranjani / Pierre-Louis

 sound/soc/soc-pcm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index b83e13565e2a..ea900ab06d84 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -760,9 +760,6 @@  static int soc_pcm_close(struct snd_pcm_substream *substream)
 
 	snd_soc_runtime_deactivate(rtd, substream->stream);
 
-	for_each_rtd_cpu_dai(rtd, i, cpu_dai)
-		snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream);
-
 	for_each_rtd_cpu_dai(rtd, i, cpu_dai)
 		snd_soc_dai_shutdown(cpu_dai, substream);
 
@@ -1229,6 +1226,11 @@  static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
 			snd_soc_dai_digital_mute(codec_dai, 1,
 						 substream->stream);
 
+	for_each_rtd_cpu_dai(rtd, i, cpu_dai)
+		if (cpu_dai->active)
+			snd_soc_dai_digital_mute(cpu_dai, 1,
+						 substream->stream);
+
 	/* free any machine hw params */
 	soc_rtd_hw_free(rtd, substream);