ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in hw_free()
authorNicolin Chen <b42378@freescale.com>
Wed, 4 Dec 2013 03:18:36 +0000 (11:18 +0800)
committerJaroslav Kysela <perex@perex.cz>
Mon, 16 Dec 2013 09:56:16 +0000 (10:56 +0100)
The snd_soc_dai_digital_mute() here will be never executed because we only
decrease codec->active in snd_soc_close(). Thus correct it.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>

sound/soc/soc-pcm.c

index 11a90cd..891b9a9 100644 (file)
@@ -600,12 +600,13 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
        struct snd_soc_platform *platform = rtd->platform;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_codec *codec = rtd->codec;
+       bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
 
        mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
 
        /* apply codec digital mute */
-       if (!codec->active)
+       if ((playback && codec_dai->playback_active == 1) ||
+           (!playback && codec_dai->capture_active == 1))
                snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
 
        /* free any machine hw params */