All of lore.kernel.org
 help / color / mirror / Atom feed
* Clarification regarding multicolor leds
@ 2020-10-23 22:48 Luca Weiss
  2020-10-24  6:42 ` Alexander Dahl
  2020-10-24 19:34 ` Jacek Anaszewski
  0 siblings, 2 replies; 8+ messages in thread
From: Luca Weiss @ 2020-10-23 22:48 UTC (permalink / raw)
  To: Linux LED Subsystem; +Cc: bjorn.andersson

Hi,
I'm currently experimenting with the qcom lpg[0] which is a driver for the rgb 
notification led found on e.g. Snapdragon 801 devices (and many more), 
specifically my example is about the Fairphone 2 (msm8974-fairphone-fp2).

[0] https://lore.kernel.org/lkml/20201021201224.3430546-1-bjorn.andersson@linaro.org/

My dts is looking like the following (abbreviated):

    [in lpg node]
    multi-led {
        color = <LED_COLOR_ID_MULTI>;
        function = LED_FUNCTION_STATUS;
        ....
    };

I'm comparing this to the PinePhone where the leds are defined as follows:

    [in gpio-leds node]
    blue {
        function = LED_FUNCTION_INDICATOR;
        color = <LED_COLOR_ID_BLUE>;
    };
    
    green {
        function = LED_FUNCTION_INDICATOR;
        color = <LED_COLOR_ID_GREEN>;
    };
    
    red {
        function = LED_FUNCTION_INDICATOR;
        color = <LED_COLOR_ID_RED>;
    };

(sidenote: the LED_FUNCTION_INDICATOR should probably also be 
LED_FUNCTION_STATUS there; the dts was made before the better descriptions for 
the defines have been added)

This gets the following directories created in /sys/class/leds/:

    blue:indicator
    green:indicator
    red:indicator

But with the multicolor led on the Fairphone 2 only a directory with the name 
of "multi-led" gets created which I would have expected to be 
"multicolor:status" instead.


What's further confusing me is that include/dt-bindings/leds/common.h states 
(reformatted for clarity):

/* For multicolor LEDs */
#define LED_COLOR_ID_MULTI	8

/* For multicolor LEDs that can do arbitrary color, so this would include RGBW 
and similar */
#define LED_COLOR_ID_RGB	9

It sounds like these comments are the wrong way around as it says that RGB 
does RGBW & others while MULTI is normal RGB?

I have also found this commit[1] while browsing through lkml which seems to 
validate my suspicions that _ID_RGB should be used normally? This commit seems 
have been applied early September but hasn't been merged in the 5.10 merge 
window?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git/
commit/?h=for-next&id=3d93edc77515c6f51fa9bbbe2185e2ec32bad024

But drivers/leds/led-core.c also states "We want to label LEDs that can 
produce full range of colors as RGB, not multicolor" - not sure what "full 
range" means here.

Thanks for reading through my long email and I'd appreciate any clarification 
on the situation!
Regards,
Luca



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-26  3:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 22:48 Clarification regarding multicolor leds Luca Weiss
2020-10-24  6:42 ` Alexander Dahl
2020-10-24  6:48   ` Pavel Machek
2020-10-24  9:16   ` Luca Weiss
2020-10-24 21:50     ` Dan Murphy
2020-10-24 19:34 ` Jacek Anaszewski
2020-10-25 10:54   ` Luca Weiss
2020-10-26  3:26   ` Bjorn Andersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.