default-state LED property (was Re: [PATCH v2] Extend pca9532 device tree support)

From: Pavel Machek
Date: Fri Apr 07 2017 - 07:58:08 EST


Hi!

> >> This seems to look for "pwm0" and "pwm1" strings, which do not seem to
> >> be documented.
> >>
> >> Plus... is it useful to have default-state? We already have default
> >> trigger. If we keep the value by default (on PC, we do something like
> >> that) this patch should not be neccessary?
> >
> > Thanks for the heads-up. Dropping the patch for now.
>
> No, please do not drop the patch.
>
> > I guess that pwm0/1 got propagated to v2 by an omission.
>
> Yes, I agree. However the two strings do not break anything and behave
> analog to the 'on' or 'keep' string. Though this code could be removed
> if absolutely necessary. An alternative would be to add a description
> for the strings. Just to be clear: these strings have nothing to with
> the exposition of device specific registers to the DT.

Well, they should be removed. No need to keep surprises in code.

> > Regarding default-on: Felix, do you have any use case that require
> > default-on set to "keep"?
>
> This patch is not about 'default-on' which is a value that could be
> assigned to the property 'linux,default-trigger' (according to DT
> bindings documentation file 'common.txt').
> My patch does not introduce anything new with the'keep' state, it rather
> completes the existing bindings according to the description in
> Documentation/devicetree/bindings/leds/common.txt which states:

Hmm, that was introduce by 1d1a77ddc8acfa3d506f1958e09a12085e71fc69
. I don't quite like the patch -- it duplicates default-trigger
functionality without good reason.

IMO we should

1) keep the led state by default

2) deprecate the default-state property

3) use default-triggers to emulate the functionality if someone really
needs it.

> One of my use cases is to turn a LED on by U-Boot. This LED must remain
> on until eventually, under certain conditions, some userland code
> changes it's state.
> Setting 'default-state' to 'keep' is how you can sort of tell the
> kernel, or better the driver, 'not to initialize the LED' which would
> turn it off.

Yes, that's reasonable. Perhaps 'keep' should be the default.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature