lkml.org 
[lkml]   [2022]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 1/2] dt-bindings: leds: Add multi-color default-intensities property
Date
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(+)

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>;
+ };
+ };
...
--
2.36.0
\
 
 \ /
  Last update: 2022-05-05 11:51    [W:0.038 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site