All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schwermer <sven@svenschwermer.de>
To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	pavel@ucw.cz, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org
Cc: Sven Schwermer <sven.schwermer@disruptive-technologies.com>,
	schuchmann@schleissheimer.de
Subject: [PATCH v3 1/2] dt-bindings: leds: Add multi-color default-intensities property
Date: Thu,  5 May 2022 11:50:08 +0200	[thread overview]
Message-ID: <eef2dba9633a860063527628a72f6a4523aaf6cd.1651744128.git.sven.schwermer@disruptive-technologies.com> (raw)
In-Reply-To: <20220502204616.GA27288@ucw.cz>

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


  parent reply	other threads:[~2022-05-05  9:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 14:09 Initial multicolor LED intensities Sven Schwermer
2022-05-02 20:46 ` Pavel Machek
2022-05-03 11:04   ` [PATCH v1 1/2] dt-bindings: leds: Add multi-color default-intensities property Sven Schwermer
2022-05-03 11:04     ` [PATCH v1 2/2] leds: multicolor: Read " Sven Schwermer
2022-05-03 11:27   ` [PATCH v2 1/2] dt-bindings: leds: Add multi-color " Sven Schwermer
2022-05-03 11:27     ` [PATCH v2 2/2] leds: multicolor: Read " Sven Schwermer
2022-05-03 13:50     ` AW: [PATCH v2 1/2] dt-bindings: leds: Add multi-color " Sven Schuchmann
2022-05-03 18:58       ` Sven Schwermer
2022-05-04  7:17         ` AW: " Sven Schuchmann
2022-05-04  9:24           ` Sven Schwermer
2022-05-08 19:55             ` Jacek Anaszewski
2022-05-10 18:31               ` Sven Schwermer
2022-05-10 22:00                 ` Jacek Anaszewski
2022-05-05  9:50   ` Sven Schwermer [this message]
2022-05-05  9:50     ` [PATCH v3 2/2] leds: multicolor: Read " Sven Schwermer
2022-05-17  0:08     ` [PATCH v3 1/2] dt-bindings: leds: Add multi-color " Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eef2dba9633a860063527628a72f6a4523aaf6cd.1651744128.git.sven.schwermer@disruptive-technologies.com \
    --to=sven@svenschwermer.de \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=schuchmann@schleissheimer.de \
    --cc=sven.schwermer@disruptive-technologies.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.