kernel: backport support for multicolor & RGB LEDs to 5.4
authorRafał Miłecki <rafal@milecki.pl>
Thu, 16 Dec 2021 06:07:34 +0000 (07:07 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 3 Jan 2022 13:28:13 +0000 (14:28 +0100)
This is a requirement for backporting DT files defining such LEDs.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 85ad48c9579c0482c98fc6b69e885102511e9194)

target/linux/generic/backport-5.4/900-v5.9-0001-dt-bindings-Add-multicolor-class-dt-bindings-documen.patch [new file with mode: 0644]
target/linux/generic/backport-5.4/900-v5.9-0002-leds-Add-multicolor-ID-to-the-color-ID-list.patch [new file with mode: 0644]
target/linux/generic/backport-5.4/900-v5.9-0003-leds-add-RGB-color-option-as-that-is-different-from-.patch [new file with mode: 0644]

diff --git a/target/linux/generic/backport-5.4/900-v5.9-0001-dt-bindings-Add-multicolor-class-dt-bindings-documen.patch b/target/linux/generic/backport-5.4/900-v5.9-0001-dt-bindings-Add-multicolor-class-dt-bindings-documen.patch
new file mode 100644 (file)
index 0000000..acc32b6
--- /dev/null
@@ -0,0 +1,76 @@
+From 5c7f8ffe741daae7f8d811a2037b2693f02c90c5 Mon Sep 17 00:00:00 2001
+From: Dan Murphy <dmurphy@ti.com>
+Date: Mon, 13 Jul 2020 10:45:31 -0500
+Subject: [PATCH] dt: bindings: Add multicolor class dt bindings documention
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add DT bindings for the LEDs multicolor class framework.
+Add multicolor ID to the color ID list for device tree bindings.
+
+CC: Rob Herring <robh@kernel.org>
+Reviewed-by: Rob Herring <robh@kernel.org>
+Acked-by: Pavel Machek <pavel@ucw.cz>
+Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
+Signed-off-by: Dan Murphy <dmurphy@ti.com>
+Reviewed-by: Marek Behún <marek.behun@nic.cz>
+Signed-off-by: Pavel Machek <pavel@ucw.cz>
+---
+ .../bindings/leds/leds-class-multicolor.yaml  | 37 +++++++++++++++++++
+ include/dt-bindings/leds/common.h             |  3 +-
+ 2 files changed, 39 insertions(+), 1 deletion(-)
+ create mode 100644 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
+
+--- /dev/null
++++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
+@@ -0,0 +1,37 @@
++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
++%YAML 1.2
++---
++$id: http://devicetree.org/schemas/leds/leds-class-multicolor.yaml#
++$schema: http://devicetree.org/meta-schemas/core.yaml#
++
++title: Common properties for the multicolor LED class.
++
++maintainers:
++  - Dan Murphy <dmurphy@ti.com>
++
++description: |
++  Bindings for multi color LEDs show how to describe current outputs of
++  either integrated multi-color LED elements (like RGB, RGBW, RGBWA-UV
++  etc.) or standalone LEDs, to achieve logically grouped multi-color LED
++  modules. This is achieved by adding multi-led nodes layer to the
++  monochrome LED bindings.
++  The nodes and properties defined in this document are unique to the multicolor
++  LED class.  Common LED nodes and properties are inherited from the common.txt
++  within this documentation directory.
++
++patternProperties:
++  "^multi-led@([0-9a-f])$":
++    type: object
++    description: Represents the LEDs that are to be grouped.
++    properties:
++      color:
++        const: 8  # LED_COLOR_ID_MULTI
++        description: |
++          For multicolor LED support this property should be defined as
++          LED_COLOR_ID_MULTI which can be found in include/linux/leds/common.h.
++
++    $ref: "common.yaml#"
++
++    required:
++      - color
++...
+--- a/include/dt-bindings/leds/common.h
++++ b/include/dt-bindings/leds/common.h
+@@ -29,7 +29,8 @@
+ #define LED_COLOR_ID_VIOLET   5
+ #define LED_COLOR_ID_YELLOW   6
+ #define LED_COLOR_ID_IR               7
+-#define LED_COLOR_ID_MAX      8
++#define LED_COLOR_ID_MULTI    8
++#define LED_COLOR_ID_MAX      9
+ /* Standard LED functions */
+ #define LED_FUNCTION_ACTIVITY "activity"
diff --git a/target/linux/generic/backport-5.4/900-v5.9-0002-leds-Add-multicolor-ID-to-the-color-ID-list.patch b/target/linux/generic/backport-5.4/900-v5.9-0002-leds-Add-multicolor-ID-to-the-color-ID-list.patch
new file mode 100644 (file)
index 0000000..5de5dbd
--- /dev/null
@@ -0,0 +1,29 @@
+From 10d3e0d815879129e916cd83e1034438e06efdaa Mon Sep 17 00:00:00 2001
+From: Dan Murphy <dmurphy@ti.com>
+Date: Mon, 13 Jul 2020 10:45:32 -0500
+Subject: [PATCH] leds: Add multicolor ID to the color ID list
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add a new color ID that is declared as MULTICOLOR as with the
+multicolor framework declaring a definitive color is not accurate
+as the node can contain multiple colors.
+
+Signed-off-by: Dan Murphy <dmurphy@ti.com>
+Reviewed-by: Marek Behún <marek.behun@nic.cz>
+Signed-off-by: Pavel Machek <pavel@ucw.cz>
+---
+ drivers/leds/led-core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/leds/led-core.c
++++ b/drivers/leds/led-core.c
+@@ -34,6 +34,7 @@ const char * const led_colors[LED_COLOR_
+       [LED_COLOR_ID_VIOLET] = "violet",
+       [LED_COLOR_ID_YELLOW] = "yellow",
+       [LED_COLOR_ID_IR] = "ir",
++      [LED_COLOR_ID_MULTI] = "multicolor",
+ };
+ EXPORT_SYMBOL_GPL(led_colors);
diff --git a/target/linux/generic/backport-5.4/900-v5.9-0003-leds-add-RGB-color-option-as-that-is-different-from-.patch b/target/linux/generic/backport-5.4/900-v5.9-0003-leds-add-RGB-color-option-as-that-is-different-from-.patch
new file mode 100644 (file)
index 0000000..17c2814
--- /dev/null
@@ -0,0 +1,48 @@
+From 54212f5a1ba3123281877e54c1e5f672bf7563d8 Mon Sep 17 00:00:00 2001
+From: Pavel Machek <pavel@ucw.cz>
+Date: Mon, 3 Aug 2020 13:20:06 +0200
+Subject: [PATCH] leds: add RGB color option, as that is different from
+ multicolor.
+
+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           | 1 +
+ drivers/leds/leds-lp55xx-common.c | 2 +-
+ include/dt-bindings/leds/common.h | 6 ++++--
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/leds/led-core.c
++++ b/drivers/leds/led-core.c
+@@ -35,6 +35,7 @@ const char * const led_colors[LED_COLOR_
+       [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);
+--- a/include/dt-bindings/leds/common.h
++++ b/include/dt-bindings/leds/common.h
+@@ -29,8 +29,10 @@
+ #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 */
+ #define LED_FUNCTION_ACTIVITY "activity"