devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: devicetree@vger.kernel.org, linux-leds@vger.kernel.org,
	pavel@ucw.cz, Andrew Lunn <andrew@lunn.ch>
Cc: robh+dt@kernel.org,
	"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Marek Behún" <kabel@kernel.org>
Subject: [PATCH 3/3] dt-bindings: leds: Allow for multiple colors in the `color` property
Date: Wed, 13 Oct 2021 22:44:24 +0200	[thread overview]
Message-ID: <20211013204424.10961-3-kabel@kernel.org> (raw)
In-Reply-To: <20211013204424.10961-1-kabel@kernel.org>

Some RJ-45 connectors have one green/yellow LED wired in the following
way:

        green
      +--|>|--+
      |       |
  A---+--|<|--+---B
        yellow

But semantically this is still just one (multi-color) LED (for example
it can be controlled by HW as one dual-LED).

This is a case that we do not support in device tree bindings; setting
  color = <LED_COLOR_ID_MULTI>;
or
  color = <LED_COLOR_ID_RGB>;
is wrong, because those are meant for when the controller can mix the
"channels", while for our case only one "channel" can be active at a
time.

Change the `color` property to accept an (non-empty) array of colors to
indicate this case.

Example:
  ethernet-phy {
    led@0 {
      reg = <0>;
      color = <LED_COLOR_ID_GREEN LED_COLOR_ID_YELLOW>;
      function = LED_FUNCTION_ID_LAN;
      trigger-sources = <&eth0>;
    };
  };

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 .../devicetree/bindings/leds/common.yaml         | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml
index 03759d2e125a..492dd3e7f9ac 100644
--- a/Documentation/devicetree/bindings/leds/common.yaml
+++ b/Documentation/devicetree/bindings/leds/common.yaml
@@ -37,13 +37,21 @@ properties:
     $ref: /schemas/types.yaml#/definitions/string
 
   color:
-    description:
+    description: |
       Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from
       the header include/dt-bindings/leds/common.h. If there is no matching
       LED_COLOR_ID available, add a new one.
-    $ref: /schemas/types.yaml#/definitions/uint32
-    minimum: 0
-    maximum: 9
+
+      For multi color LEDs there are two cases:
+        - the LED can mix the channels (i.e. RGB LED); in this case use
+          LED_COLOR_ID_MULTI or LED_COLOR_ID_RGB
+        - the LED cannot mix the channels, only one can be active; in this case
+          enumerate all the possible colors
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    items:
+      minimum: 0
+      maximum: 9
 
   function-enumerator:
     description:
-- 
2.32.0


  parent reply	other threads:[~2021-10-13 20:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 20:44 [PATCH 1/3] dt-bindings: leds: Deprecate `linux,default-trigger` property Marek Behún
2021-10-13 20:44 ` [PATCH 2/3] dt-bindings: leds: Add `excludes` property Marek Behún
2021-10-13 22:20   ` Rob Herring
2021-10-14 10:29   ` Pavel Machek
2021-10-14 10:43     ` Marek Behún
2021-10-14 11:30       ` Alexander Dahl
2021-10-14 11:58         ` Marek Behún
2021-10-13 20:44 ` Marek Behún [this message]
2021-10-26 20:44   ` [PATCH 3/3] dt-bindings: leds: Allow for multiple colors in the `color` property Rob Herring
2021-10-26 20:39 ` [PATCH 1/3] dt-bindings: leds: Deprecate `linux,default-trigger` property 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=20211013204424.10961-3-kabel@kernel.org \
    --to=kabel@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).