Generic RGB LED support was Re: [PATCH 2/2] leds: lp5024: Add the LP5024/18 RGB LED driver
From: Pavel Machek
Date: Sat Jan 05 2019 - 17:31:07 EST
Hi!
> >Grab yourself an RGB LED and play with it; you'll see what the
> >problems are. It is hard to explain colors over email...
>
> Video [0] gives some overview of lp5024 capabilities.
>
> I don't see any problems in exposing separate red,green,blue
> files and brightness for the devices with hardware support for
> that.
Well, that's what we do today, as three separate LEDs, right?
I don't have problem with that, either; other drivers already do
that. He's free to use existing same interface.
But that is insufficient, as it does not allow simple stuff, such as
turning led "white".
So... perhaps we should agree on requirements, first, and then we can
discuss solutions?
Requirements for RGB LED interface:
1) Userspace should be able to set the white color
2) Userspace should be able to arbitrary color from well known list
and it should approximately match what would CRT, LCD or OLED monitor display
2a) LEDs probably slightly change color as they age. That's out of
scope, unless the variation is much greater than on monitors.
2b) Manufacturing differences cause small color variation. Again,
that's out of scope, unless the variation is much greater than on
monitors.
Nice to have features:
3) Full range of available colors/intensities should be available to
userspace
4) Interface should work well with existing triggers
5) It would be nice if userland knew how many lumens are produced at
each wavelength for each setting (again, minus aging and manufacturing
variations).
6) Complexity of math in kernel should be low, and preferably it
should be integer or fixed point
Problems:
a) RGB LEDs are usually not balanced. Setting 100% PWM on
red/green/blue channels will result in nothing close to white
light. In fact, to get white light on N900, blue and green channel's
PWM needs to be set pretty low, as in 5%.
b) LED class does not define any relation between "brightness" in
sysfs and ammount of light in lumens. Some drivers use close to linear
relation, some use exponential relation. Human eyes percieve logarithm
of lumens. RGB color model uses even more complex function.
c) Except for white LEDs, LEDs are basically sources of single
wavelength of light, while CRTs and LCDs produce broader
spectrums.
d) RG, RGBW and probably other LED combinations exist.
e) Not all "red" LEDs will produce same wavelength. Similar
differences will exist for other colors.
f) We have existing RGB LEDs represented as three separate
monochromatic LEDs in sysfs.
--
(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