Re: [PATCH v5 2/7] pwm: pca9685: Support hardware readout

From: Sven Van Asbroeck
Date: Fri Jan 29 2021 - 17:18:07 EST


Hi Clemens,

On Fri, Jan 29, 2021 at 4:24 PM Sven Van Asbroeck <thesven73@xxxxxxxxx> wrote:
>
> LEN_ON = 409, LED_OFF = 1228 and
> LED_ON = 419, LED_OFF = 1238
> produce the same result. you can't see the difference between the two
> when scoping the channel. there are probably more ways to do this,
> some might surprise us. It's a tricky chip.

Please ignore this example, it's bogus. In my defence, it's a Friday
afternoon here :)

But consider the following: imagine the bootloader has enabled a few
pwm channels, and the driver's .probe() has left them on/unchanged.
Then the user enables another pwm channel, and tries to change the
period/prescaler. How would pca9685_may_change_prescaler() know
if changing the prescaler is allowed?

And the following: imagine the bootloader has enabled a few
pwm channels, and the driver's .probe() has left them on/unchanged.
After .probe(), the runtime_pm will immediately put the chip to sleep,
because it's unaware that some channels are alive.

I'm sure I'm overlooking a few complications here. probe not changing
the existing configuration, will add a lot of complexity to the driver.
I'm not saying this is necessarily bad, just a tradeoff. Or, a management
decision.

Sven