From: Andreas Henriksson <andreas@fatal.se>
To: Fabio Estevam <festevam@gmail.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
"Xiubo Li" <Xiubo.Lee@gmail.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
"Shengjiu Wang" <shengjiu.wang@nxp.com>,
"Takashi Iwai" <tiwai@suse.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Nicolin Chen" <nicoleotsuka@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Hans Söderlund" <hans.soderlund@realbit.se>,
"Shengjiu Wang" <shengjiu.wang@gmail.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode
Date: Thu, 6 Jul 2023 14:34:01 +0200 [thread overview]
Message-ID: <20230706123401.kctossjho26bry7e@fatal.se> (raw)
In-Reply-To: <CAOMZO5BtrKwrMwrjVDbYn3ivt2uV9rzbSDxd8qfiYjOBMvKBgg@mail.gmail.com>
Hello Fabio,
Maybe I shouldn't comment as I'm already on deep water, but...
On Thu, Jul 06, 2023 at 08:32:57AM -0300, Fabio Estevam wrote:
> On Thu, Jul 6, 2023 at 8:19 AM Shengjiu Wang <shengjiu.wang@gmail.com> 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);
This is exactly the same as and thus redundant to the code already in
the probe function?!
If I understood it correctly, the problem Shengjiu was trying to adress
was that apparently on i.MX8MM (and only imx8mm?!), even when using MCLK
in *input*, you still need to enable it because otherwise BCLK will not
be generated. (I personally don't know anything about this or the imx8mm
variant though.)
The problem could probably equally well be worked around by always setting the
fsl,sai-mclk-direction-output; devicetree property on imx8mm, even when
using MCLK in input..... But I'm just guessing here to be honest. This
is just as I understood what purpose the initial patch that was merged
had.
The current state affects more devices than imx8mm though, making MCLK
in input mode not possible.
I think your initial review comment was spot on Fabio. There probably
needs to be a(n imx8mm) specific flag that says when this workaround
should be applied and gate the code in bclk function on that.
Atleast that's the only thing I can think of if my interpretation of the
problem for imx8mm is correct.
Regards,
Andreas Henriksson
next prev parent reply other threads:[~2023-07-06 13:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 12:36 [PATCH] ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode Shengjiu Wang
2022-05-19 13:23 ` Fabio Estevam
2022-05-19 13:41 ` Shengjiu Wang
2023-07-06 8:47 ` Andreas Henriksson
2023-07-06 11:06 ` Shengjiu Wang
2023-07-06 11:08 ` Fabio Estevam
2023-07-06 11:19 ` Shengjiu Wang
2023-07-06 11:32 ` Fabio Estevam
2023-07-06 12:34 ` Andreas Henriksson [this message]
2023-07-06 13:22 ` Fabio Estevam
2023-07-06 22:00 ` Fabio Estevam
2022-06-08 20:46 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230706123401.kctossjho26bry7e@fatal.se \
--to=andreas@fatal.se \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=hans.soderlund@realbit.se \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=shengjiu.wang@gmail.com \
--cc=shengjiu.wang@nxp.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).