Re: [PATCH v3 2/3] pwm: imx27: Use clk_bulk_*() API to simplify clock handling

From: Uwe Kleine-König
Date: Tue Oct 22 2024 - 02:54:08 EST


Hello,

On Tue, Sep 10, 2024 at 03:07:19PM -0400, Frank Li wrote:
> @@ -229,7 +209,7 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> int ret;
> u32 cr;
>
> - clkrate = clk_get_rate(imx->clk_per);
> + clkrate = clk_get_rate(imx->clks[PWM_IMX27_PER].clk);
> c = clkrate * state->period;

Unrelated to this patch: clk_get_rate() should only be called on enabled
clocks. Given that further down in that function (see next hunk)
pwm_imx27_clk_prepare_enable() (or clk_bulk_prepare_enable()
respectively) is called, that clk might be off?!

> do_div(c, NSEC_PER_SEC);
> @@ -259,7 +239,7 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> if (pwm->state.enabled) {
> pwm_imx27_wait_fifo_slot(chip, pwm);
> } else {
> - ret = pwm_imx27_clk_prepare_enable(imx);
> + ret = clk_bulk_prepare_enable(imx->clks_cnt, imx->clks);
> if (ret)
> return ret;
>

I applied just this patch to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
. The others are still under discussion, right?

I see you signed your patch (which is fine!), but I couldn't find your
key, neither on hkps://keys.openpgp.org/ nor on
hkps://keyserver.ubuntu.com nor in the kernel keyring. At least the
first two should be easy to fix.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature