On Fri, 12 Mar 2021 04:48:52 +0000
Hermes Zhang <[email protected]> wrote:

> > 
> > Sorry, leds-regulator has only a binary state LED.
> > 
> > Maybe you could extend leds-regulator to be able to use all regulator 
> > states?
> > 
> > Or you can extend leds-gpio driver to support N states via log N gpios,
> > instead of adding new driver.  
> 
> It seems a good idea to extend leds-gpio, so in my case, I should have such 
> dts:
> 
>  63         leds {
>  64                 compatible = "gpio-leds";
>  65 
>  66                 recording_front {
>  67                         label = "recording_front:red";
>  68                         gpios = <&gpio 130 GPIO_ACTIVE_HIGH>, <&gpio 129 
> GPIO_ACTIVE_HIGH>;
>  69                         default-state = "off";
>  70                 };
>  71         };
> 
> For my case, two leds is enough, but it sill easy to extend the support 
> number bigger than two. And the length of gpios array is not fixed, so it 
> could compatible with exist "gpio-leds" dts, right? 
> 
> If this idea work, should I create a new commit or still in this track (V2)?

However you want :)

Look at the states property of gpio regulator:
https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml

It is possible to have a multi-GPIO LED which brightness is set via N
GPIOs and it has 2^N brightness states encoded by binary values of
those GPIOs, but it is entirely possible to have less than 2^N states,
or that the states are encoded in a different way.

In the first version though imlpemenent just the simplest case: N GPIOs
with 2^N states.

Marek

Reply via email to