leds: add RGB color option, as that is different from multicolor.
authorPavel Machek <pavel@ucw.cz>
Mon, 3 Aug 2020 11:20:06 +0000 (13:20 +0200)
committerPavel Machek <pavel@ucw.cz>
Mon, 3 Aug 2020 11:26:15 +0000 (13:26 +0200)
Multicolor is a bit too abstract. Yes, we can have
Green-Magenta-Ultraviolet LED, but so far all the LEDs we support are
RGB, and not even RGB-White or RGB-Yellow variants emerged.

Multicolor is not a good fit for RGB LED. It does not really know
about LED color.  In particular, there's no way to make LED "white".

Userspace is interested in knowing "this LED can produce arbitrary
color", which not all multicolor LEDs can.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
drivers/leds/led-core.c
drivers/leds/leds-lp55xx-common.c
include/dt-bindings/leds/common.h

index 846248a0693d0e2d58f7ab890cfa77496ecefc30..a6dce01dbd5eac09f4a7fbc14f0304d67911391c 100644 (file)
@@ -35,6 +35,7 @@ const char * const led_colors[LED_COLOR_ID_MAX] = {
        [LED_COLOR_ID_YELLOW] = "yellow",
        [LED_COLOR_ID_IR] = "ir",
        [LED_COLOR_ID_MULTI] = "multicolor",
+       [LED_COLOR_ID_RGB] = "rgb",
 };
 EXPORT_SYMBOL_GPL(led_colors);
 
index af14e2b2d5776b51eaaa013e554f69ae0d504ca1..56210f4ad919a07aab9a09213dea25216a31c824 100644 (file)
@@ -638,7 +638,7 @@ static int lp55xx_parse_logical_led(struct device_node *np,
        if (ret)
                return ret;
 
-       if (led_color == LED_COLOR_ID_MULTI)
+       if (led_color == LED_COLOR_ID_RGB)
                return lp55xx_parse_multi_led(np, cfg, child_number);
 
        ret =  lp55xx_parse_common_child(np, cfg, child_number, &chan_nr);
index a463ce6a8794b96c547f052bb5f04d5553ba5445..52b619d44ba257c4d4708141063b8f043ca5ba88 100644 (file)
 #define LED_COLOR_ID_VIOLET    5
 #define LED_COLOR_ID_YELLOW    6
 #define LED_COLOR_ID_IR                7
-#define LED_COLOR_ID_MULTI     8
-#define LED_COLOR_ID_MAX       9
+#define LED_COLOR_ID_MULTI     8       /* For multicolor LEDs */
+#define LED_COLOR_ID_RGB       9       /* For multicolor LEDs that can do arbitrary color,
+                                          so this would include RGBW and similar */
+#define LED_COLOR_ID_MAX       10
 
 /* Standard LED functions */
 /* Keyboard LEDs, usually it would be input4::capslock etc. */