[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230804-jaundice-outpost-b8fbc9044e0d@wendy>
Date: Fri, 4 Aug 2023 10:09:27 +0100
From: Conor Dooley <conor.dooley@...rochip.com>
To: Nylon Chen <nylon.chen@...ive.com>
CC: <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-riscv@...ts.infradead.org>, <geert+renesas@...der.be>,
<pavel@....cz>, <vincent.chen@...ive.com>,
<emil.renner.berthing@...onical.com>, <aou@...s.berkeley.edu>,
<palmer@...belt.com>, <paul.walmsley@...ive.com>,
<krzysztof.kozlowski+dt@...aro.org>, <robh+dt@...nel.org>,
<conor@...nel.org>, <zong.li@...ive.com>
Subject: Re: [PATCH v4 0/1] Change PWM-controlled LED pin active mode and
algorithm
On Fri, Aug 04, 2023 at 02:54:33PM +0800, Nylon Chen wrote:
> Hi Conor,
>
> Thank you for patiently giving me advice. I appreciate your help.
>
> Not long ago, I said, "This patch needs to be accompanied by
> modifications to the pwm_sifive_apply() function to make sense."
>
> I recently reviewed the v3 version, and after discussing it with Emil,
> there are several areas that require modification. I will provide the
> necessary changes for each of them:
>
> 1. polarity check. (Suggestion from Uwe)
> - if (state->polarity != PWM_POLARITY_INVERSED)
> + if (state->polarity != PWM_POLARITY_NORMAL)
> 2. avoid using old periodperiod, not state->period
> - period = max(state->period, ddata->approx_period);
> - frac = DIV64_U64_ROUND_CLOSEST(num, state->period);
> + frac = DIV64_U64_ROUND_CLOSEST(num, period);
> 3. add a conditional check can be added in the code to set
> ddata->approx_period to state->period when state->period is smaller
> than ddata->approx_period
> if (state->period != ddata->approx_period) {
> ...
> + if (state->period < ddata->approx_period) {
> + ddata->approx_period = state->period;
> + }
> - ddata->approx_period = state->period;
> + period = ddata->approx_period;
>
> I will use 'unmatched' on my end to verify again. If there are any
> other errors, feel free to point them out. Thank you.
I'm not sure of the driver details without going and looking into the
code itself, but this sounds like it makes a lot more sense than just
flipping the polarity in the dts. Thanks for taking another look!
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists