[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <djdio3t54er4vqnjp4yjeoghopd5gdkybktvojzzvhs5ijxmwg@4db2hsmtoh6e>
Date: Mon, 8 Jan 2024 10:25:33 +0100
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Nylon Chen <nylon.chen@...ive.com>
Cc: linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, devicetree@...r.kernel.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org, paul.walmsley@...ive.com,
palmer@...belt.com, aou@...s.berkeley.edu, thierry.reding@...il.com,
emil.renner.berthing@...onical.com, vincent.chen@...ive.com, greentime.hu@...ive.com,
zong.li@...ive.com, nylon7717@...il.com
Subject: Re: [v5 2/2] pwm: sifive: change the PWM controlled LED algorithm
Hello Nylon,
On Mon, Jan 08, 2024 at 04:27:40PM +0800, Nylon Chen wrote:
> Uwe Kleine-König <u.kleine-koenig@...gutronix.de> 於 2023年12月12日 週二 上午4:50寫道:
> > On Tue, Oct 24, 2023 at 06:19:02PM +0800, Nylon Chen wrote:
> > > diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c
> > > index eabddb7c7820..353c2342fbf1 100644
> > > --- a/drivers/pwm/pwm-sifive.c
> > > +++ b/drivers/pwm/pwm-sifive.c
> > > @@ -101,7 +101,7 @@ static void pwm_sifive_update_clock(struct pwm_sifive_ddata *ddata,
> > >
> > > /* As scale <= 15 the shift operation cannot overflow. */
> > > num = (unsigned long long)NSEC_PER_SEC << (PWM_SIFIVE_CMPWIDTH + scale);
> > > - ddata->real_period = div64_ul(num, rate);
> > > + ddata->real_period = DIV_ROUND_UP_ULL(num, rate);
> >
> > It's unclear to me, why you changed that.
> Because there is a gap in idempotent tests.
> e.g.
> root@...atched:~# echo 110 >
> /sys/devices/platform/led-controller-1/leds/d12/brightness
> [ 706.987712] .apply is not idempotent (ena=1 pol=0 1739692/4032985)
> -> (ena=1 pol=0 1739630/4032985)
> root@...atched:~# echo 120 >
> /sys/devices/platform/led-controller-1/leds/d12/brightness
> [ 709.817554] .apply is not idempotent (ena=1 pol=0 1897846/4032985)
> -> (ena=1 pol=0 1897784/4032985)
>
> Round the result to the nearest whole number. This ensures that
> real_period is always a reasonable integer that is not lower than the
> actual value.
>
> After modification, idempotent errors can be avoided.
That's very welcome, however I think this should be a separate change.
I'll think about the rest of your changes when you send a new patch.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists