[lkml]   [2020]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v4 1/4] pwm: pca9685: Switch to atomic API
Hello Sven,

On Mon, Dec 07, 2020 at 05:34:58PM -0500, Sven Van Asbroeck wrote:
> On Mon, Dec 7, 2020 at 5:00 PM Uwe Kleine-König
> <> 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?

Yes, pwm_apply_state is supposed to fail here (Sidenote: period
is measured in ns, not Hz)

> 5. pwm_apply(0, period=400Hz) succeeds?

This succeeds iff channel 1 isn't enabled. (Unless changing might
change the polarity of pwm #1 even if disabled.)

> 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?

"if (5) succeeds" implies channel 1 is disabled (it might otherwise have
been enabled by the bootloader or a previous consumer).

With that sorted out, I'm ok that pwm_get_state() reports .period=200Hz
(or whatever other value) because it also reports .enabled = false which
makes every interpretation of the other values in pwm_state (apart from
.polarity) moot.

Best regards

Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | |
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2020-12-08 10:20    [W:0.114 / U:4.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site