diff mbox series

[v3,1/2] dt-bindings: leds: Add multi-color default-intensities property

Message ID eef2dba9633a860063527628a72f6a4523aaf6cd.1651744128.git.sven.schwermer@disruptive-technologies.com
State New
Headers show
Series [v3,1/2] dt-bindings: leds: Add multi-color default-intensities property | expand

Commit Message

Sven Schwermer May 5, 2022, 9:50 a.m. UTC
From: Sven Schwermer <sven.schwermer@disruptive-technologies.com>

This allows to assign intensity values to the individual sub LEDs
(colors) at driver probe time, i.e. most commonly at kernel boot time.
This is crucial for setting a specific color early in the boot process.

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
---

Notes:
    V1->V2: no changes
    V2->V3:
    - Use color-intensity mapping instead of simple intensity array
    - Add example DTS snippet

 .../bindings/leds/leds-class-multicolor.yaml  | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Rob Herring May 17, 2022, 12:08 a.m. UTC | #1
On Thu, 05 May 2022 11:50:08 +0200, Sven Schwermer wrote:
> From: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
> 
> This allows to assign intensity values to the individual sub LEDs
> (colors) at driver probe time, i.e. most commonly at kernel boot time.
> This is crucial for setting a specific color early in the boot process.
> 
> Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
> ---
> 
> Notes:
>     V1->V2: no changes
>     V2->V3:
>     - Use color-intensity mapping instead of simple intensity array
>     - Add example DTS snippet
> 
>  .../bindings/leds/leds-class-multicolor.yaml  | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
index f41d021ed677..41050de496f6 100644
--- a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
@@ -31,6 +31,19 @@  patternProperties:
           include/linux/leds/common.h.
         enum: [ 8, 9 ]
 
+      default-intensities:
+        description: |
+          This parameter, if present, sets the initial intensities of the
+          individual colors. The format is a list of pairs, mapping an intensity
+          value to a sub LED identified by its color.
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        items:
+          minItems: 2
+          maxItems: 2
+          items:
+            - description: color identifier (LED_COLOR_ID_*)
+            - description: intensity value
+
     $ref: "common.yaml#"
 
     required:
@@ -38,4 +51,28 @@  patternProperties:
 
 additionalProperties: true
 
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    multi-led {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      color = <LED_COLOR_ID_RGB>;
+      default-intensities = <LED_COLOR_ID_RED 64>,
+                            <LED_COLOR_ID_BLUE 0>;
+      led@0 {
+        reg = <0>;
+        color = <LED_COLOR_ID_RED>;
+      };
+      led@1 {
+        reg = <1>;
+        color = <LED_COLOR_ID_GREEN>;
+      };
+      led@2 {
+        reg = <2>;
+        color = <LED_COLOR_ID_BLUE>;
+      };
+    };
 ...