devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Adam Ford <aford173@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org, Peng Fan <peng.fan@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Marco Felsch <m.felsch@pengutronix.de>,
	Alexander Stein <alexander.stein@ew.tq-group.com>,
	Richard Leitner <richard.leitner@skidata.com>,
	Abel Vesa <abelvesa@kernel.org>, Jacky Bai <ping.bai@nxp.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Michael Turquette <mturquette@baylibre.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Richard Cochran <richardcochran@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX
Date: Wed, 30 Aug 2023 22:50:54 +0200	[thread overview]
Message-ID: <c8ab4eaa-20de-a586-0074-64cfe588a746@denx.de> (raw)
In-Reply-To: <CAHCN7xKGowhQbBDdnOKgcBptsM1VzD7YJB=ZAbL1Oge4rgnLUg@mail.gmail.com>

On 8/30/23 21:59, Adam Ford wrote:
> On Wed, Aug 30, 2023 at 2:10 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 8/30/23 04:44, Adam Ford wrote:
>>
>> Hi,
>>
>>> I have a question about the clocking for eASRC and PDM.
>>>
>>>> +
>>>> +                       audio_blk_ctrl: clock-controller@30e20000 {
>>>> +                               compatible = "fsl,imx8mp-audio-blk-ctrl";
>>>> +                               reg = <0x30e20000 0x10000>;
>>>> +                               #clock-cells = <1>;
>>>> +                               clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
>>>> +                                        <&clk IMX8MP_CLK_SAI1>,
>>>> +                                        <&clk IMX8MP_CLK_SAI2>,
>>>> +                                        <&clk IMX8MP_CLK_SAI3>,
>>>> +                                        <&clk IMX8MP_CLK_SAI5>,
>>>> +                                        <&clk IMX8MP_CLK_SAI6>,
>>>> +                                        <&clk IMX8MP_CLK_SAI7>;
>>>> +                               clock-names = "ahb",
>>>> +                                             "sai1", "sai2", "sai3",
>>>> +                                             "sai5", "sai6", "sai7";
>>>> +                               power-domains = <&pgc_audio>;
>>>> +                       };
>>>> +               };
>>>> +
>>>
>>> I am trying to plumb in the micfil driver with a PDM microphone on a
>>> Plus.  I have SAI3 and SAI5 audio working, but if I try to use the
>>> micfil, the PDM clock doesn't get turned on, and the micfil doesn't
>>> appear to see anything coming in.  I was curious why the
>>> audio_blk_ctrl has clock entries for IMX8MP_CLK_SAIx, but there isn't
>>> one for the PDM nor the ASRC clocks.
>>
>> I only ever needed SAI, so that was what was tested on the EVK .
> 
> That makes sense.
> 
>>
>>> I added the MICFIL noted to the
>>> 8mp in a previous patch [1], and I am trying to customize the MICFIL
>>> node as follows:
>>>
>>> &micfil {
>>> #sound-dai-cells = <0>;
>>> pinctrl-names = "default";
>>> pinctrl-0 = <&pinctrl_pdm>;
>>> assigned-clocks = <&clk IMX8MP_CLK_PDM>;
>>> assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
>>> assigned-clock-rates = <196608000>;
>>> status = "okay";
>>> };
>>>
>>> I also noticed in the down-stream kernel, the pdm_ipg_clk and
>>> pdm_root_clk are shared gates with separate parents.
>>>
>>> The PDM tree of the down-stream kernel looks like this:
>>>    audio_pll1_ref_sel                0        0        0    24000000
>>>        0     0  50000         Y
>>>          audio_pll1                     0        0        0   393216000
>>>           0     0  50000         Y
>>>             audio_pll1_bypass           0        0        0   393216000
>>>           0     0  50000         Y
>>>                audio_pll1_out           0        0        0   393216000
>>>           0     0  50000         N
>>>                   pdm                   0        0        0   196608000
>>>           0     0  50000         N
>>>                      pdm_root           0        0        0   196608000
>>>           0     0  50000         N
>>>                         pdm_sel         0        0        0   196608000
>>>           0     0  50000         Y
>>>                            pdm_root_clk       0        0        0
>>> 196608000          0     0  50000         N
>>>
>>> The PDM tree of the mainline looks like this:
>>>
>>>      audio_pll1_ref_sel                0        0        0    24000000
>>>          0     0  50000         Y
>>>          audio_pll1                     0        0        0   393216000
>>>           0     0  50000         Y
>>>             audio_pll1_bypass           0        0        0   393216000
>>>           0     0  50000         Y
>>>                audio_pll1_out           0        0        0   393216000
>>>           0     0  50000         N
>>>                   pdm                   0        0        0   196608000
>>>           0     0  50000         N
>>>                      pdm_root           0        0        0   196608000
>>>           0     0  50000         N
>>>                         pdm_sel         0        0        0   196608000
>>>           0     0  50000         Y
>>>
>>> It seems like the "pdm_root_clk" generated by the shared audo-blk
>>> down-sream driver is missing from the mainline.  I looked up the clock
>>> I referenced when I attempted to enable the miffil, but
>>> 'IMX8MP_CLK_AUDIOMIX_PDM_ROOT doesn't appear to be configured in
>>> either clk-imx8mp.c or clk-imx8mp-audiomix.c.  Maybe it's obscured by
>>> the macros, but it seems like the pdm_sel should somehow have an
>>> additional variable for the shared clock and an additional clock like
>>> pdm_root_clk assigned with it.
>>>
>>> I have similar configurations for Mini and Nano, and both of them are
>>> able to record audio, so I think there might be a clock issue
>>> somewhere related to the audiomix driver, and not a misconfiguration
>>> of the sound-card or the micfil itself.
>>
>> Shouldn't the micfil be somehow a consumer of the pdm_sel clock , and
>> enable those clock in the driver ?
> 
> Micfil references IMX8MP_CLK_AUDIOMIX_PDM_IPG, and
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT.  I am not convinced the
> IMX8MP_CLK_AUDIOMIX_PDM_ROOT exists beyond a #define in an include
> directory.  I tried making it use pdm_sel, but it threw an error.  I
> am not near my system, so I'm sorry I don't have more details.
> 
> In the downstream kernel IMX8MP_CLK_AUDIOMIX_PDM_ROOT was a child of
> pdm_sel, but I am not certain as to what the difference between them
> was since they appeared to be shared.

The pdm_sel is definitely a mux . Is there a follow-up gate after the mux ?

  reply	other threads:[~2023-08-30 21:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 11:42 [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Marek Vasut
2023-05-08 11:42 ` [PATCH v8 2/2] arm64: dts: imx8mp: Add analog audio output on i.MX8MP EVK Marek Vasut
2023-05-15  1:30 ` [PATCH v8 1/2] arm64: dts: imx8mp: Add SAI, SDMA, AudioMIX Shawn Guo
2023-08-30  2:44 ` Adam Ford
2023-08-30 19:10   ` Marek Vasut
2023-08-30 19:59     ` Adam Ford
2023-08-30 20:50       ` Marek Vasut [this message]
2023-08-31  4:32         ` Adam Ford
2023-08-31 13:36           ` Marek Vasut

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=c8ab4eaa-20de-a586-0074-64cfe588a746@denx.de \
    --to=marex@denx.de \
    --cc=abelvesa@kernel.org \
    --cc=aford173@gmail.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=m.felsch@pengutronix.de \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=richard.leitner@skidata.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /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).