MLK-14448: ASoC: fsl_ssi: Fix capture and playback with master mode
authorShengjiu Wang <shengjiu.wang@freescale.com>
Wed, 15 Mar 2017 06:17:24 +0000 (14:17 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:21:58 +0000 (15:21 -0500)
Capture and Playback work in parallel in master mode, stop one substream,
the other substream will be conflicted, for clock is disabled.
The reason is that the clock counter is not increased in second substream,
the hw_param() function returned in the beginning for first substream is
enabled.
This patch is to move the clock enablement before the device enablement
checking in hw_param().

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
sound/soc/fsl/fsl_ssi.c

index 10d51e4..6cadb1c 100644 (file)
@@ -857,16 +857,6 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
        int enabled;
        u8 i2smode = ssi_private->i2s_mode;
 
-       regmap_read(regs, CCSR_SSI_SCR, &scr_val);
-       enabled = scr_val & CCSR_SSI_SCR_SSIEN;
-
-       /*
-        * If we're in synchronous mode, and the SSI is already enabled,
-        * then STCCR is already set properly.
-        */
-       if (enabled && ssi_private->cpu_dai_drv.symmetric_rates)
-               return 0;
-
        if (fsl_ssi_is_i2s_master(ssi_private)) {
                ret = fsl_ssi_set_bclk(substream, cpu_dai, hw_params);
                if (ret)
@@ -882,6 +872,16 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
                }
        }
 
+       regmap_read(regs, CCSR_SSI_SCR, &scr_val);
+       enabled = scr_val & CCSR_SSI_SCR_SSIEN;
+
+       /*
+        * If we're in synchronous mode, and the SSI is already enabled,
+        * then STCCR is already set properly.
+        */
+       if (enabled && ssi_private->cpu_dai_drv.symmetric_rates)
+               return 0;
+
        if (!fsl_ssi_is_ac97(ssi_private)) {
                /*
                 * Switch to normal net mode in order to have a frame sync