From: Laurentiu Mihalcea <laurentiumihalcea111@gmail.com>
To: Peng Fan <peng.fan@oss.nxp.com>
Cc: Abel Vesa <abelvesa@kernel.org>, Peng Fan <peng.fan@nxp.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Daniel Baluta <daniel.baluta@nxp.com>,
Shengjiu Wang <shengjiu.wang@nxp.com>,
linux-clk@vger.kernel.org, imx@lists.linux.dev,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Pengutronix Kernel Team <kernel@pengutronix.de>
Subject: Re: [PATCH v2 3/8] clk: imx: add driver for imx8ulp's sim lpav
Date: Mon, 27 Oct 2025 02:50:58 -0700 [thread overview]
Message-ID: <9e5f5166-75c3-4c7c-804a-8cb24c67f416@gmail.com> (raw)
In-Reply-To: <20251022140315.GA11174@nxa18884-linux.ap.freescale.net>
On 10/22/2025 7:03 AM, Peng Fan wrote:
> Hi Laurentiu,
>
> On Fri, Oct 17, 2025 at 04:20:20AM -0700, Laurentiu Mihalcea wrote:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>>
>> The i.MX8ULP System Integration Module (SIM) LPAV module is a block
>> control module found inside the LPAV subsystem, which offers some clock
>> gating options and reset line assertion/de-assertion capabilities.
>>
>> Therefore, the clock gate management is supported by registering the
>> module's driver as a clock provider, while the reset capabilities are
>> managed via the auxiliary device API to allow the DT node to act as a
>> reset and clock provider.
>>
>> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>> ---
> ....
>> +struct clk_imx8ulp_sim_lpav_data {
>> + void __iomem *base;
>> + struct regmap *regmap;
>> + spinlock_t lock; /* shared by MUX, clock gate and reset */
>> + unsigned long flags; /* for spinlock usage */
> This does not need to be here, put it as function local variable should
> be fine.
>
>> + struct clk_hw_onecell_data clk_data; /* keep last */
>> +};
>> +
>> +struct clk_imx8ulp_sim_lpav_gate {
>> + const char *name;
>> + int id;
>> + const struct clk_parent_data parent;
>> + u8 bit;
>> +};
>> +
>> +static struct clk_imx8ulp_sim_lpav_gate gates[] = {
>> + IMX8ULP_HIFI_CLK_GATE("hifi_core", CORE, "hifi_core", 17),
>> + IMX8ULP_HIFI_CLK_GATE("hifi_pbclk", PBCLK, "lpav_bus", 18),
>> + IMX8ULP_HIFI_CLK_GATE("hifi_plat", PLAT, "hifi_plat", 19)
> For the parent name, my understanding is they should be the one
> from clk-imx8ulp.c, but I not find them, or may I miss something?
we want to use parent names local to the SIM LPAV provider (i.e. names specified via clock-names)
instead of the global ones. See definition of "struct clk_parent_data".
while we're at it, maybe it would be a good idea to drop the ".name = pname" assignment bit
as that won't work anyways since we're relying on local parent names?
>
>> +};
>> +
>> +#ifdef CONFIG_RESET_CONTROLLER
>> +static void clk_imx8ulp_sim_lpav_aux_reset_release(struct device *dev)
>> +{
>> + struct auxiliary_device *adev = to_auxiliary_dev(dev);
>> +
>> + kfree(adev);
>> +}
>> +
>> +static void clk_imx8ulp_sim_lpav_unregister_aux_reset(void *data)
>> +{
>> + struct auxiliary_device *adev = data;
>> +
>> + auxiliary_device_delete(adev);
>> + auxiliary_device_uninit(adev);
>> +}
>> +
>> +static int clk_imx8ulp_sim_lpav_register_aux_reset(struct platform_device *pdev)
>> +{
>> + struct auxiliary_device *adev __free(kfree) = NULL;
>> + int ret;
>> +
>> + adev = kzalloc(sizeof(*adev), GFP_KERNEL);
>> + if (!adev)
>> + return -ENOMEM;
>> +
>> + adev->name = "reset";
>> + adev->dev.parent = &pdev->dev;
>> + adev->dev.release = clk_imx8ulp_sim_lpav_aux_reset_release;
>> +
>> + ret = auxiliary_device_init(adev);
>> + if (ret) {
>> + dev_err(&pdev->dev, "failed to initialize aux dev\n");
>> + return ret;
>> + }
>> +
>> + ret = auxiliary_device_add(adev);
>> + if (ret) {
>> + auxiliary_device_uninit(adev);
>> + dev_err(&pdev->dev, "failed to add aux dev\n");
>> + return ret;
>> + }
>> +
>> + return devm_add_action_or_reset(&pdev->dev,
>> + clk_imx8ulp_sim_lpav_unregister_aux_reset,
>> + no_free_ptr(adev));
> clk_imx8ulp_sim_lpav_unregister_aux_reset() clean up the resources, if
> moving this before auxiliary_device_add(), then no need
> auxiliary_device_uninit() when add fails?
the whole chunk guarded by the #ifdef CONFIG_RESET_CONTROLLER should go away
anyways once I switch to devres as Frank suggested
>
>> +}
> Regards
> Peng
next prev parent reply other threads:[~2025-10-27 9:51 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 11:20 [PATCH v2 0/8] Add support for i.MX8ULP's SIM LPAV Laurentiu Mihalcea
2025-10-17 11:20 ` [PATCH v2 1/8] reset: imx8mp-audiomix: Fix bad mask values Laurentiu Mihalcea
2025-10-17 14:28 ` Frank Li
2025-10-20 10:57 ` Laurentiu Mihalcea
2025-10-24 3:36 ` Shengjiu Wang
2025-10-27 9:54 ` Daniel Baluta
2025-10-17 11:20 ` [PATCH v2 2/8] dt-bindings: clock: document 8ULP's SIM LPAV Laurentiu Mihalcea
2025-10-17 14:33 ` Frank Li
2025-10-19 10:04 ` Krzysztof Kozlowski
2025-10-17 14:59 ` Frank Li
2025-10-19 10:05 ` Krzysztof Kozlowski
2025-10-20 15:22 ` Frank Li
2025-10-20 15:50 ` Krzysztof Kozlowski
2025-10-22 12:47 ` Laurentiu Mihalcea
2025-10-19 10:03 ` Krzysztof Kozlowski
2025-10-22 14:08 ` Peng Fan
2025-10-22 16:16 ` Frank Li
2025-10-27 15:17 ` Laurentiu Mihalcea
2025-10-27 9:55 ` Daniel Baluta
2025-10-17 11:20 ` [PATCH v2 3/8] clk: imx: add driver for imx8ulp's sim lpav Laurentiu Mihalcea
2025-10-17 14:41 ` Frank Li
2025-10-20 11:40 ` Laurentiu Mihalcea
2025-10-18 4:15 ` kernel test robot
2025-10-18 11:33 ` kernel test robot
2025-10-18 15:55 ` kernel test robot
2025-10-22 14:03 ` Peng Fan
2025-10-23 7:59 ` Peng Fan
2025-10-27 9:50 ` Laurentiu Mihalcea [this message]
2025-10-17 11:20 ` [PATCH v2 4/8] reset: imx8mp-audiomix: Drop unneeded macros Laurentiu Mihalcea
2025-10-17 14:44 ` Frank Li
2025-10-27 10:02 ` Daniel Baluta
2025-10-17 11:20 ` [PATCH v2 5/8] reset: imx8mp-audiomix: Switch to using regmap API Laurentiu Mihalcea
2025-10-17 14:49 ` Frank Li
2025-10-22 11:35 ` Laurentiu Mihalcea
2025-10-17 11:20 ` [PATCH v2 6/8] reset: imx8mp-audiomix: Extend the driver usage Laurentiu Mihalcea
2025-10-17 14:56 ` Frank Li
2025-10-20 11:59 ` Laurentiu Mihalcea
2025-10-20 15:08 ` Frank Li
2025-10-20 14:06 ` Laurentiu Mihalcea
2025-10-20 14:52 ` Frank Li
2025-10-20 14:18 ` Daniel Baluta
2025-10-17 11:20 ` [PATCH v2 7/8] reset: imx8mp-audiomix: Support i.MX8ULP SIM LPAV Laurentiu Mihalcea
2025-10-17 14:57 ` Frank Li
2025-10-20 14:29 ` Laurentiu Mihalcea
2025-10-20 14:50 ` Frank Li
2025-10-21 13:16 ` Laurentiu Mihalcea
2025-10-21 15:06 ` Frank Li
2025-10-17 11:20 ` [PATCH v2 8/8] arm64: dts: imx8ulp: add sim lpav node Laurentiu Mihalcea
2025-10-27 10:07 ` Daniel Baluta
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=9e5f5166-75c3-4c7c-804a-8cb24c67f416@gmail.com \
--to=laurentiumihalcea111@gmail.com \
--cc=abelvesa@kernel.org \
--cc=conor+dt@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
--cc=shengjiu.wang@nxp.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