MLK-11479-05 ASoC: fsl: Fix set-mute-failed issue after WM8962 capture
authorNicolin Chen <b42378@freescale.com>
Fri, 30 Aug 2013 08:02:35 +0000 (16:02 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:21 +0000 (14:48 -0500)
cherry-pick below patch from v3.14.y:
ENGR00277471 ASoC: fsl: Fix set-mute-failed issue after WM8962 capture

We only need to mute WM8962 after playback, so add direction check
before doing mute.

And a mute failure would cause hw_free() abruptly return after it,
which might drop the essential procedure code for FLL controlling.
Thus put mute before FLL controlling code and drop its return check.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit 3133b6cfb31b202805d31d449bfa70383e5e1c75)

sound/soc/fsl/imx-wm8962.c

index 7b2542a..876416b 100644 (file)
@@ -124,6 +124,13 @@ static int imx_hifi_hw_free(struct snd_pcm_substream *substream)
        priv->second_stream = NULL;
 
        if (!priv->first_stream) {
+               /*
+                * Continuously setting FLL would cause playback distortion.
+                * We can fix it just by mute codec after playback.
+                */
+               if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+                       snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
+
                /*
                 * WM8962 doesn't allow us to continuously setting FLL,
                 * So we set MCLK as sysclk once, which'd remove the limitation.
@@ -135,16 +142,6 @@ static int imx_hifi_hw_free(struct snd_pcm_substream *substream)
                        return ret;
                }
 
-               /*
-                * Continuously setting FLL would cause playback distortion.
-                * We can fix it just by mute codec after playback.
-                */
-               ret = snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
-               if (ret < 0) {
-                       dev_err(dev, "failed to set MUTE: %d\n", ret);
-                       return ret;
-               }
-
                /* Disable FLL and let codec do pm_runtime_put() */
                ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL,
                                WM8962_FLL_MCLK, 0, 0);