MLK-14781-1: ASoC: fsl_ssi: fix noise issue for master and mono mode
authorShengjiu Wang <shengjiu.wang@freescale.com>
Wed, 3 May 2017 02:57:10 +0000 (10:57 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:22:06 +0000 (15:22 -0500)
The case is 32kHz/24bit/1channel bit stream, and ssi is in master mode.

The driver will switch to normal mode for 1 channel, so the slot width
is not fixed to 32 bit in this mode, and even in mono mode, the slot
number is 2, but the bit clock calulation still use the bit width=32,
and slot number=1, which cause the output frameclock is not correct.
So there will be noise in output sound.

This patch is to change the bit clock formula of mono mode, which is
2channels * params_width * sample rate.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
sound/soc/fsl/fsl_ssi.c

index 6cadb1c..c184590 100644 (file)
@@ -735,8 +735,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
        /* Prefer the explicitly set bitclock frequency */
        if (ssi_private->bitclk_freq)
                freq = ssi_private->bitclk_freq;
-       else
-               freq = params_channels(hw_params) * 32 * params_rate(hw_params);
+       else {
+               if (params_channels(hw_params) == 1)
+                       freq = 2 * params_width(hw_params) *
+                                       params_rate(hw_params);
+               else
+                       freq = params_channels(hw_params) * 32 *
+                                       params_rate(hw_params);
+       }
 
        /* Don't apply it to any non-baudclk circumstance */
        if (IS_ERR(ssi_private->baudclk))