ASoC: soc-pcm: fix up bad merge
authorJohan Hovold <johan+linaro@kernel.org>
Thu, 23 Nov 2023 09:18:15 +0000 (10:18 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 23 Nov 2023 12:41:44 +0000 (12:41 +0000)
A recent change to address pops and clicks with codecs like WSA883X
touched the same code paths as a fix for clearing DAI parameters and
resulted in a bad merge.

Specifically, commit f0220575e65a ("ASoC: soc-dai: add flag to mute and
unmute stream during trigger") made mute at stream close conditional,
while commit 3efcb471f871 ("ASoC: soc-pcm.c: Make sure DAI parameters
cleared if the DAI becomes inactive") moved that same mute call back to
soc_pcm_hw_clean().

Fix up the bad merge by dropping the second mute call from
soc_pcm_clean() and making sure that the call in soc_pcm_hw_clean() is
conditional as intended.

Fixes: bdb7e1922052 ("ASoC: Merge up workaround for CODECs that play noise on stopped stream")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231123091815.21933-1-johan+linaro@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c

index 323e4d7b6adfe12162a8c1ac43bbb4caa2d5cdd2..f6d1b2e11795fb07d21ef33369c5c95a22a7aa49 100644 (file)
@@ -704,11 +704,6 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd,
                        if (snd_soc_dai_active(dai) == 0 &&
                            (dai->rate || dai->channels || dai->sample_bits))
                                soc_pcm_set_dai_params(dai, NULL);
-
-                       if (snd_soc_dai_stream_active(dai, substream->stream) ==  0) {
-                               if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
-                                       snd_soc_dai_digital_mute(dai, 1, substream->stream);
-                       }
                }
        }
 
@@ -947,8 +942,10 @@ static int soc_pcm_hw_clean(struct snd_soc_pcm_runtime *rtd,
                if (snd_soc_dai_active(dai) == 1)
                        soc_pcm_set_dai_params(dai, NULL);
 
-               if (snd_soc_dai_stream_active(dai, substream->stream) == 1)
-                       snd_soc_dai_digital_mute(dai, 1, substream->stream);
+               if (snd_soc_dai_stream_active(dai, substream->stream) == 1) {
+                       if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
+                               snd_soc_dai_digital_mute(dai, 1, substream->stream);
+               }
        }
 
        /* run the stream event */