linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: linux-leds@vger.kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	pavel@ucw.cz, robh@kernel.org, dtor@google.com,
	linux@roeck-us.net, jacek.anaszewski@gmail.com,
	Baolin Wang <baolin.wang@linaro.org>, Dan Murphy <dmurphy@ti.com>,
	Daniel Mack <daniel@zonque.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Oleh Kravchenko <oleg@kaa.org.ua>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Simon Shields <simon@lineageos.org>
Subject: [PATCH v4 05/26] dt-bindings: leds: Add properties for LED name construction
Date: Wed, 17 Apr 2019 22:54:18 +0200	[thread overview]
Message-ID: <20190417205439.17685-6-jacek.anaszewski@gmail.com> (raw)
In-Reply-To: <20190417205439.17685-1-jacek.anaszewski@gmail.com>

Introduce dedicated properties for conveying information about
LED function and color. Mark old "label" property as deprecated.

Additionally function-enumerator property is being provided
for the cases when neither function nor color can be used
for LED differentiation.

Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Baolin Wang <baolin.wang@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Daniel Mack <daniel@zonque.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Oleh Kravchenko <oleg@kaa.org.ua>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Simon Shields <simon@lineageos.org>
---
 Documentation/devicetree/bindings/leds/common.txt | 62 ++++++++++++++++++++---
 1 file changed, 54 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/common.txt b/Documentation/devicetree/bindings/leds/common.txt
index 70876ac11367..9fa6f9795d50 100644
--- a/Documentation/devicetree/bindings/leds/common.txt
+++ b/Documentation/devicetree/bindings/leds/common.txt
@@ -10,14 +10,30 @@ can influence the way of the LED device initialization, the LED components
 have to be tightly coupled with the LED device binding. They are represented
 by child nodes of the parent LED device binding.
 
+
 Optional properties for child nodes:
 - led-sources : List of device current outputs the LED is connected to. The
 		outputs are identified by the numbers that must be defined
 		in the LED device binding documentation.
+
+- function: LED functon. Use one of the LED_FUNCTION_* prefixed definitions
+	    from the header include/dt-bindings/leds/common.h.
+	    If there is no matching LED_FUNCTION available, add a new one.
+
+- color : 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.
+
+- function-enumerator: Integer to be used when more than one instance
+                       of the same function is needed, differing only with
+		       an ordinal number.
+
 - label : The label for this LED. If omitted, the label is taken from the node
 	  name (excluding the unit address). It has to uniquely identify
 	  a device, i.e. no other LED class device can be assigned the same
-	  label.
+	  label. This property is deprecated - use 'function' and 'color'
+	  properties instead. function-enumerator has no effect when this
+	  property is present.
 
 - default-state : The initial state of the LED. Valid values are "on", "off",
   and "keep". If the LED is already on or off and the default-state property is
@@ -99,29 +115,59 @@ Required properties for trigger source:
 
 * Examples
 
-gpio-leds {
+#include <dt-bindings/leds/common.h>
+
+led-controller@0 {
 	compatible = "gpio-leds";
 
-	system-status {
-		label = "Status";
+	led0 {
+		function = LED_FUNCTION_STATUS;
 		linux,default-trigger = "heartbeat";
 		gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
 	};
 
-	usb {
+	led1 {
+		function = LED_FUNCTION_USB;
 		gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
 		trigger-sources = <&ohci_port1>, <&ehci_port1>;
 	};
 };
 
-max77693-led {
+led-controller@0 {
 	compatible = "maxim,max77693-led";
 
-	camera-flash {
-		label = "Flash";
+	led {
+		function = LED_FUNCTION_FLASH;
+		color = <LED_COLOR_ID_WHITE>;
 		led-sources = <0>, <1>;
 		led-max-microamp = <50000>;
 		flash-max-microamp = <320000>;
 		flash-max-timeout-us = <500000>;
 	};
 };
+
+led-controller@30 {
+        compatible = "panasonic,an30259a";
+        reg = <0x30>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led@1 {
+		reg = <1>;
+		linux,default-trigger = "heartbeat";
+		function = LED_FUNCTION_INDICATOR;
+		function-enumerator = <1>;
+        };
+
+        led@2 {
+		reg = <2>;
+		function = LED_FUNCTION_INDICATOR;
+		function-enumerator = <2>;
+        };
+
+        led@3 {
+		reg = <3>;
+		function = LED_FUNCTION_INDICATOR;
+		function-enumerator = <3>;
+        };
+};
-- 
2.11.0


  parent reply	other threads:[~2019-04-17 20:55 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 20:54 [PATCH v4 00/26] Add generic support for composing LED class device name Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 01/26] ALSA: line6: Avoid polluting led_* namespace Jacek Anaszewski
2019-04-18  5:17   ` Takashi Iwai
2019-04-18 12:21     ` Pavel Machek
2019-04-18 12:24       ` Takashi Iwai
2019-04-18 17:12         ` Jacek Anaszewski
2019-04-18 18:46           ` Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 02/26] leds: class: Improve LED and LED flash class registration API Jacek Anaszewski
2019-04-24 13:46   ` Pavel Machek
2019-04-24 18:04     ` Jacek Anaszewski
2019-04-24 18:25       ` Pavel Machek
2019-04-24 18:56         ` Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 03/26] dt-bindings: leds: Add LED_FUNCTION definitions Jacek Anaszewski
2019-04-26 18:47   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 04/26] dt-bindings: leds: Add LED_COLOR_ID definitions Jacek Anaszewski
2019-04-24 13:49   ` Pavel Machek
2019-04-24 18:14     ` Jacek Anaszewski
2019-04-26 18:47   ` Rob Herring
2019-04-17 20:54 ` Jacek Anaszewski [this message]
2019-04-26 18:58   ` [PATCH v4 05/26] dt-bindings: leds: Add properties for LED name construction Rob Herring
2019-04-17 20:54 ` [PATCH v4 06/26] leds: core: Add support for composing LED class device names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 07/26] dt-bindings: sc27xx-blt: Add function and color properties Jacek Anaszewski
2019-04-26 18:58   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 08/26] leds: sc27xx-blt: Use generic support for composing LED names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 09/26] dt-bindings: lt3593: Add function and color properties Jacek Anaszewski
2019-04-26 18:58   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 10/26] leds: lt3593: Use generic support for composing LED names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 11/26] dt-bindings: lp8860: Add function and color properties Jacek Anaszewski
2019-04-18 12:28   ` Dan Murphy
2019-04-18 17:18     ` Jacek Anaszewski
2019-04-26 18:59   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 12/26] leds: lp8860: Use generic support for composing LED names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 13/26] dt-bindings: lm3692x: Add function and color properties Jacek Anaszewski
2019-04-26 19:21   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 14/26] leds: lm3692x: Use generic support for composing LED names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 15/26] dt-bindings: lm36010: Add function and color properties Jacek Anaszewski
2019-04-26 19:21   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 16/26] leds: lm3601x: Use generic support for composing LED names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 17/26] dt-bindings: cr0014114: Add function and color properties Jacek Anaszewski
2019-04-26 19:22   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 18/26] leds: cr0014114: Use generic support for composing LED names Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 19/26] dt-bindings: aat1290: Add function and color properties Jacek Anaszewski
2019-04-26 19:22   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 20/26] leds: aat1290: Use generic support for composing LED names Jacek Anaszewski
2019-04-24 13:57   ` Pavel Machek
2019-04-24 18:16     ` Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 21/26] dt-bindings: as3645a: Add function and color properties Jacek Anaszewski
2019-04-26 19:23   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 22/26] leds: as3645a: Use generic support for composing LED names Jacek Anaszewski
2019-04-24 14:01   ` Pavel Machek
2019-04-24 18:18     ` Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 23/26] dt-bindings: leds-gpio: Add function and color properties Jacek Anaszewski
2019-04-26 19:23   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 24/26] leds: gpio: Use generic support for composing LED names Jacek Anaszewski
2019-04-24 14:04   ` Pavel Machek
2019-04-24 19:02     ` Jacek Anaszewski
2019-04-17 20:54 ` [PATCH v4 25/26] dt-bindings: an30259a: Add function and color properties Jacek Anaszewski
2019-04-26 19:23   ` Rob Herring
2019-04-17 20:54 ` [PATCH v4 26/26] leds: an30259a: Use generic support for composing LED names Jacek Anaszewski
2019-04-24 14:05   ` Pavel Machek

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=20190417205439.17685-6-jacek.anaszewski@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=daniel@zonque.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=dtor@google.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=oleg@kaa.org.ua \
    --cc=pavel@ucw.cz \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=simon@lineageos.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).