Re: [PATCH v4 1/4] pwm: pca9685: Switch to atomic API

From: Sven Van Asbroeck
Date: Mon Dec 07 2020 - 17:36:07 EST


Hi Uwe,

On Mon, Dec 7, 2020 at 5:00 PM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
> This is not acceptable, if you have two PWM outputs and a consumer
> modifies one of them the other must change. So if this chip only
> supports a single period length of all channels, the first consumer
> enabling a channel defines the period to be used. All later consumers
> must live with that. (Also the first must be denied modifying the period
> if a second consumer has enabled its PWM.)

That makes sense. However, a possible wrinkle: when more than one pwm channel
is requested, which one is able to change the period?

Example:
1. start with all pwms free
2. pwm_request(0), pwm_apply(period=200Hz)
3. pwm_request(1)
4. pwm_apply(1, period=400Hz) fails?
5. pwm_apply(0, period=400Hz) succeeds?

And if (5) succeeds, then pwm_get_state(1) will still return period=200Hz,
because the pwm core doesn't realize anything has changed. Are you ok
with this behaviour?