Re: [PATCH] ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode

From: Fabio Estevam
Date: Thu Jul 06 2023 - 07:33:13 EST


On Thu, Jul 6, 2023 at 8:19 AM Shengjiu Wang <shengjiu.wang@xxxxxxxxx> wrote:

> No, this is the code in probe().
> The code with the issue is in fsl_sai_set_bclk().

Yes, I put it in the wrong place.

> The clean way for fixing is to remove the code in fsl_sai_set_bclk()
> and add "fsl,sai-mclk-direction-output;" property in dts for some
> node.

Yes, what about this?

--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -507,7 +507,7 @@ static int fsl_sai_set_bclk(struct snd_soc_dai
*dai, bool tx, u32 freq)
savediv / 2 - 1);
}

- if (sai->soc_data->max_register >= FSL_SAI_MCTL) {
+ if (sai->soc_data->max_register >= FSL_SAI_MCTL &&
sai->mclk_direction_output) {
/* 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);