ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode
authorShengjiu Wang <shengjiu.wang@nxp.com>
Thu, 19 May 2022 12:36:48 +0000 (20:36 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 8 Jun 2022 17:03:51 +0000 (18:03 +0100)
On i.MX8MM, the MCTL_MCLK_EN bit it is not only the gate
for MCLK output to PAD, but also the gate bit between
root clock and SAI module, So it is need to be enabled
for master mode, otherwise there is no bclk generated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1652963808-14515-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_sai.c

index b65c9c7cf54a48c3a125be7a462853039d92c59d..b4dd3122c45e5b31159e1734c64c1bae3f24a761 100644 (file)
@@ -437,6 +437,12 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)
                                   FSL_SAI_CR2_DIV_MASK | FSL_SAI_CR2_BYP,
                                   savediv / 2 - 1);
 
+       if (sai->soc_data->max_register >= FSL_SAI_MCTL) {
+               /* SAI is in master mode at this point, so enable MCLK */
+               regmap_update_bits(sai->regmap, FSL_SAI_MCTL,
+                                  FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);
+       }
+
        return 0;
 }