ASoC: soc-pcm: Do Digital Mute for both CPU/Codec in same timing.
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 6 Mar 2020 01:10:17 +0000 (10:10 +0900)
committerMark Brown <broonie@kernel.org>
Fri, 6 Mar 2020 14:47:24 +0000 (14:47 +0000)
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>
Link: https://lore.kernel.org/r/87imjip9ty.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c

index af0e17bfeeab4b949623dd242455f562f7bf63e5..90d26fccb0da32d285426815b8c894eccf7f5c19 100644 (file)
@@ -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);
 
@@ -1232,6 +1229,14 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
                                                 substream->stream);
        }
 
+       for_each_rtd_cpu_dai(rtd, i, cpu_dai) {
+               int active = cpu_dai->stream_active[substream->stream];
+
+               if (active == 1)
+                       snd_soc_dai_digital_mute(cpu_dai, 1,
+                                                substream->stream);
+       }
+
        /* free any machine hw params */
        soc_rtd_hw_free(rtd, substream);