From: Marek Vasut <marex@denx.de>
To: "Frank Li" <Frank.Li@nxp.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, pratikmanvar09@gmail.com,
francesco@dolcini.it, Liu Ying <victor.liu@nxp.com>
Subject: Re: [PATCH v3 3/3] pwm: imx27: Add optional 32k clock for pwm in i.MX8QXP MIPI subsystem
Date: Wed, 11 Sep 2024 22:31:40 +0200 [thread overview]
Message-ID: <40ecdbb2-8470-4e33-8a74-ccae6532174a@denx.de> (raw)
In-Reply-To: <20240910-pwm-v3-3-fbb047896618@nxp.com>
On 9/10/24 9:07 PM, Frank Li wrote:
> From: Liu Ying <victor.liu@nxp.com>
>
> PWM in i.MX8QXP MIPI subsystem needs the clock '32k'. Use it if the DTS
> provides that.
>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> Change from v2 to v3
> - use buck clk API
>
> Change from v1 to v2
> - remove if check for clk
> - use dev_err_probe
> - remove int val
> ---
> drivers/pwm/pwm-imx27.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c
> index ce9208540f1b8..2a9fba6f9d0a8 100644
> --- a/drivers/pwm/pwm-imx27.c
> +++ b/drivers/pwm/pwm-imx27.c
> @@ -81,10 +81,11 @@
> #define MX3_PWMPR_MAX 0xfffe
>
> static const char * const pwm_imx27_clks[] = {"ipg", "per"};
> +static const char * const pwm_imx27_opt_clks[] = {"32k"};
> #define PWM_IMX27_PER 1
>
> struct pwm_imx27_chip {
> - struct clk_bulk_data clks[ARRAY_SIZE(pwm_imx27_clks)];
> + struct clk_bulk_data clks[ARRAY_SIZE(pwm_imx27_clks) + ARRAY_SIZE(pwm_imx27_opt_clks)];
> int clks_cnt;
> void __iomem *mmio_base;
>
> @@ -371,6 +372,16 @@ static int pwm_imx27_probe(struct platform_device *pdev)
> return dev_err_probe(&pdev->dev, ret,
> "getting clocks failed\n");
>
> + for (i = 0; i < ARRAY_SIZE(pwm_imx27_opt_clks); i++)
> + imx->clks[i + imx->clks_cnt].id = pwm_imx27_opt_clks[i];
> +
> + ret = devm_clk_bulk_get_optional(&pdev->dev, ARRAY_SIZE(pwm_imx27_opt_clks),
> + imx->clks + imx->clks_cnt);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "get optional clocks failed\n");
> +
> + imx->clks_cnt += ARRAY_SIZE(pwm_imx27_opt_clks);
> +
This will succeed even if the regular PWM clock are invalid or not
present, wouldn't it? I don't think removing that protection is an
improvement.
Also, it is not clear whether the 32kHz clock are really supplying the
PWM, see my comment on 1/3 in this series.
next prev parent reply other threads:[~2024-09-11 20:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 19:07 [PATCH v3 0/3] pwm: imx: add 32k clock for 8qm/qxp Frank Li
2024-09-10 19:07 ` [PATCH v3 1/3] dt-bindings: pwm: imx: Add optional clock '32k' Frank Li
2024-09-11 20:28 ` Marek Vasut
2024-09-11 21:10 ` Frank Li
2024-09-11 21:14 ` Marek Vasut
2024-09-11 22:19 ` Frank Li
2024-09-12 0:15 ` Marek Vasut
2024-09-10 19:07 ` [PATCH v3 2/3] pwm: imx27: Use clk_bulk_*() API to simplify clock handling Frank Li
2024-10-22 6:53 ` Uwe Kleine-König
2024-10-22 16:01 ` Frank Li
2024-10-29 8:07 ` Uwe Kleine-König
2024-09-10 19:07 ` [PATCH v3 3/3] pwm: imx27: Add optional 32k clock for pwm in i.MX8QXP MIPI subsystem Frank Li
2024-09-11 20:31 ` Marek Vasut [this message]
2024-09-11 21:28 ` Frank Li
2024-09-11 21:33 ` Marek Vasut
2024-09-11 20:27 ` [PATCH v3 0/3] pwm: imx: add 32k clock for 8qm/qxp 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=40ecdbb2-8470-4e33-8a74-ccae6532174a@denx.de \
--to=marex@denx.de \
--cc=Frank.Li@nxp.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=francesco@dolcini.it \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pratikmanvar09@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=ukleinek@kernel.org \
--cc=victor.liu@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