Re: [PATCH v7 11/12] leds: Add common LED binding parsing support to LED class/core
From: Vaittinen, Matti
Date: Mon Dec 30 2019 - 02:36:35 EST
Hello Again Pavel,
On Sat, 2019-12-21 at 20:37 +0100, Pavel Machek wrote:
> > +static void led_add_props(struct led_classdev *ld, struct
> > led_properties *props)
> > +{
> > + if (props->default_trigger)
> > + ld->default_trigger = props->default_trigger;
> > + /*
> > + * According to binding docs the LED is by-default turned OFF
> > unless
> > + * default_state is used to indicate it should be ON or that
> > state
> > + * should be kept as is
> > + */
> > + if (props->default_state) {
> > + ld->brightness = LED_OFF;
> > + if (!strcmp(props->default_state, "on"))
> > + ld->brightness = LED_FULL;
>
> Max brightness is not always == LED_FULL these days.
I took another look at this and changed this to:
if (!strcmp(props->default_state, "on")) {
if (!ld->max_brightness)
ld->brightness = LED_FULL;
else
ld->brightness = ld->max_brightness;
}
I hope this is what you were suggesting. I'll send the v8 (hopefully)
soon(ish).
Best Regards
Matti