Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

From: Marek Behun
Date: Thu Mar 25 2021 - 08:27:31 EST


On Thu, 25 Mar 2021 06:04:43 +0000
Hermes Zhang <Hermes.Zhang@xxxxxxxx> wrote:

> > LED_FULL / LED_OFF are deprecated, don't use them.
>
> Then could I use just 0 (instead LED_OFF) and led_cdev->max_brightness
>
> (instead of LED_FULL) here? The idea here is map the states defined in dts
>
> to the full brightness range.

Yes, you can and should use 0 insted of LED_OFF.

> > + priv->cdev.max_brightness = LED_FULL;
> > ???? max_brightness is not 255 (= LED_FULL). max_brightness must be
> > derived from the led-states property.
>
> Yeah, I will fix this. the max-brightness should for the whole LED,
> right? So
>
> it will at same level with led-states.

max_brightness should be (the number of states - 1). I.e. if you have 4
gpios and the LED supports full 2^4 = 16 states, max brightness should
be 15.

Marek