Re: led: hw-trigger, global brightness and multi-colored leds

From: Pavel Machek
Date: Thu May 03 2018 - 17:53:01 EST


Hi!

> > "Native mode" is quite common. We have it for example on Nokia N900
> > here (charger has hw option to automatically control the LED).
>
> git grep -i n900 -- drivers/leds doesn't yield any output. Do I miss
> anything?

Try grepping arch/arm/boot/..*.dts :-).

drivers/leds/leds-lp5523.c

But the hardware/software switch is pretty well hidden. In the charger
code, probably. Aha, here:

echo 0 > /sys/class/power_supply/bq24150a-0/stat_pin_enable

That one influences R and G channels of the RGB LED.

> >> Another feature of the LED device is that there is a global brightness
> >> register that influences all LED's brightness (if on) independent of the
> >> operating mode.
> >
> > We can't describe that easily.
>
> Given that I can give an RGB value (i.e. 3x 8 bit) for the LED, I can
> change brightness per LED. Have to play around a bit.

Ok, so do we need global brightness support at all?

> >> Further the color of each LED can be set to an RGB triplet.
> >
> > We normally handle RGB LED as three independend LEDs, like
> > notify::red, notify::green, notify::blue. Again, example is Nokia N900
> > or Motorola Droid 4.
>
> I cannot find source code for LEDs on the Droid 4 either.

That would be

arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi
motorola,cpcap-led-red

> An ugly property here is that the hardware trigger only operates on all
> three colors at once. Hmm, will think a bit about the way to go.

Fun.

So... it would be nice to treat RGB LED as one LED, not three. I even
made some patches in that direction, but I went to HSV colors and that
did not work well.

Sorry, I should sleep.

Good luck,
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