[PATCH] pwm: meson: simplify calculation in meson_pwm_get_state

Martin Blumenstingl martin.blumenstingl at googlemail.com
Sun Apr 23 10:59:40 PDT 2023


On Fri, Apr 21, 2023 at 9:14 PM Dmitry Rokosov <ddrokosov at sberdevices.ru> wrote:
[...]
> > > Inside this patch, in my opinion, you have not only simplified and
> > > optimized but have also modified the logic. It is important to provide
> > > more details on this modification. Previously, in cases where
> > > (channel->lo != 0) && (channel->lo < channel->hi), period and duty_cycle
> > > were not calculated. However, in your patchset, duty_cycle and polarity
> > > are calculated and returned to the caller in such cases.
> > > Can you please share the details of why this is the right solution?
> >
> > It's the obvious solution. I see no reason to return all zero's for
> > lo < hi, and also the commit that added this calculation doesn't provide
> > an explanation. It just references the calculation in meson_pwm_calc(),
> > however I fail to see that lo < hi is treated differently there.
> >
> > c375bcbaabdb ("pwm: meson: Read the full hardware state in meson_pwm_get_state()")
> >
>
> Actually, I don't see any arguments to bypass the case where lo < hi,
> so the current implementation of get_state() is questionable.
> I think it would be better to wait Martin's opinion why meson_pwm_calc()
> logic was inversed with such conditions.
To be honest: I don't recall why I did it like that. So please go with
Dmitry's suggestion (to update the patch description that this
"optimization" is now gone).



More information about the linux-arm-kernel mailing list