Patch "ASoC: fsl_ssi: Fix bclk calculation for mono channel" has been added to the 5.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: fsl_ssi: Fix bclk calculation for mono channel

to the 5.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-fsl_ssi-fix-bclk-calculation-for-mono-channel.patch
and it can be found in the queue-5.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0cdad1fe104b9df4fa9cd01312c5196c7545f555
Author: Shengjiu Wang <shengjiu.wang@xxxxxxx>
Date:   Tue Jun 16 10:53:48 2020 +0800

    ASoC: fsl_ssi: Fix bclk calculation for mono channel
    
    [ Upstream commit ed1220df6e666500ebf58c4f2fccc681941646fb ]
    
    For mono channel, SSI will switch to Normal mode.
    
    In Normal mode and Network mode, the Word Length Control bits
    control the word length divider in clock generator, which is
    different with I2S Master mode (the word length is fixed to
    32bit), it should be the value of params_width(hw_params).
    
    The condition "slots == 2" is not good for I2S Master mode,
    because for Network mode and Normal mode, the slots can also
    be 2. Then we need to use (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK)
    to check if it is I2S Master mode.
    
    So we refine the formula for mono channel, otherwise there
    will be sound issue for S24_LE.
    
    Fixes: b0a7043d5c2c ("ASoC: fsl_ssi: Caculate bit clock rate using slot number and width")
    Signed-off-by: Shengjiu Wang <shengjiu.wang@xxxxxxx>
    Reviewed-by: Nicolin Chen <nicoleotsuka@xxxxxxxxx>
    Link: https://lore.kernel.org/r/034eff1435ff6ce300b6c781130cefd9db22ab9a.1592276147.git.shengjiu.wang@xxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index bad89b0d129e7..1a2fa7f181423 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -678,8 +678,9 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
 	struct regmap *regs = ssi->regs;
 	u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
 	unsigned long clkrate, baudrate, tmprate;
-	unsigned int slots = params_channels(hw_params);
-	unsigned int slot_width = 32;
+	unsigned int channels = params_channels(hw_params);
+	unsigned int slot_width = params_width(hw_params);
+	unsigned int slots = 2;
 	u64 sub, savesub = 100000;
 	unsigned int freq;
 	bool baudclk_is_used;
@@ -688,10 +689,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
 	/* Override slots and slot_width if being specifically set... */
 	if (ssi->slots)
 		slots = ssi->slots;
-	/* ...but keep 32 bits if slots is 2 -- I2S Master mode */
-	if (ssi->slot_width && slots != 2)
+	if (ssi->slot_width)
 		slot_width = ssi->slot_width;
 
+	/* ...but force 32 bits for stereo audio using I2S Master Mode */
+	if (channels == 2 &&
+	    (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) == SSI_SCR_I2S_MODE_MASTER)
+		slot_width = 32;
+
 	/* Generate bit clock based on the slot number and slot width */
 	freq = slots * slot_width * params_rate(hw_params);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux