Linux-LEDs Archive on lore.kernel.org
 help / color / Atom feed
From: "Marek Behún" <marek.behun@nic.cz>
To: linux-leds@vger.kernel.org
Cc: "Pavel Machek" <pavel@ucw.cz>,
	"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
	"Marek Behún" <marek.behun@nic.cz>,
	"Rob Herring" <robh+dt@kernel.org>,
	devicetree@vger.kernel.org
Subject: [PATCH v2 1/2] dt-bindings: leds: add cznic,turris-omnia-leds binding
Date: Thu, 23 Apr 2020 08:50:59 +0200
Message-ID: <20200423065100.2652-2-marek.behun@nic.cz> (raw)
In-Reply-To: <20200423065100.2652-1-marek.behun@nic.cz>

Add device-tree bindings documentation for Turris Omnia RGB LEDs.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
---
 .../leds/cznic,turris-omnia-leds.yaml         | 113 ++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml

diff --git a/Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml b/Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml
new file mode 100644
index 000000000000..f3d13fa65df2
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml
@@ -0,0 +1,113 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/cznic,turris-omnia-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CZ.NIC's Turris Omnia LEDs driver
+
+maintainers:
+  - Marek Behún <marek.behun@nic.cz>
+
+description:
+  This module adds support for the RGB LEDs found on the fron panel of the
+  Turris Omnia router. There are 12 RGB LEDs, they are controlled by device's
+  microcontroller with which the system communicates via I2C. Each LED is
+  described as a subnode of this I2C device.
+
+properties:
+  compatible:
+    const: cznic,turris-omnia-leds
+
+  reg:
+    description: I2C slave address of the microcontroller.
+    maxItems: 1
+
+patternProperties:
+  "^led[0-9][0-9]?$":
+    type: object
+    allOf:
+      - $ref: /schemas/leds/common.yaml#
+    description:
+      This node can either represent one channel of a RGB LED or a whole RGB
+      LED.
+
+    properties:
+      led-sources:
+        description:
+          List of device current outputs the LED connects to. If one number is
+          given, the device described by this node will control one channel of a
+          RGB LED. If three numbers are given (one for each channel of a RGB
+          LED), the device described by this node will control one RGB LED. In
+          this case the numbers must increase by one and the first must be a
+          multiple of 3.
+        allOf:
+          - $ref: /schemas/leds/common.yaml#/properties/led-sources
+          - oneOf:
+              - items:
+                  minimum: 0
+                  maximum: 35
+                minItems: 1
+                maxItems: 1
+              - items:
+                  enum: [ [ 0, 1, 2 ], [ 3, 4, 5 ], [ 6, 7, 8 ], [ 9, 10, 11 ],
+                          [ 12, 13, 14 ], [ 15, 16, 17 ], [ 18, 19, 20 ],
+                          [ 21, 22, 23 ], [ 24, 25, 26 ], [ 27, 28, 29 ],
+                          [ 30, 31, 32 ], [ 33, 34, 35] ]
+
+      color:
+        description:
+          Should be one of LED_COLOR_ID_*. Allowed values are red, green or blue
+          if there is one item in led-sources, otherwise white.
+        allOf:
+          - $ref: /schemas/leds/common.yaml#/properties/color
+          - enum: [ 0, 1, 2, 3 ]
+
+    required:
+      - led-sources
+      - color
+
+examples:
+  - |
+
+    #include <dt-bindings/leds/common.h>
+
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@2b {
+            compatible = "cznic,turris-omnia-leds";
+            reg = <0x2b>;
+
+            led0 {
+                led-sources = <33 34 35>;
+                color = <LED_COLOR_ID_WHITE>;
+                function = LED_FUNCTION_POWER;
+                linux,default-trigger = "heartbeat";
+            };
+
+            led1 {
+                led-sources = <3>;
+                color = <LED_COLOR_ID_RED>;
+                function = LED_FUNCTION_INDICATOR;
+                function-enumerator = <1>;
+            };
+
+            led2 {
+                led-sources = <4>;
+                color = <LED_COLOR_ID_GREEN>;
+                function = LED_FUNCTION_INDICATOR;
+                function-enumerator = <1>;
+            };
+
+            led3 {
+                led-sources = <5>;
+                color = <LED_COLOR_ID_BLUE>;
+                function = LED_FUNCTION_INDICATOR;
+                function-enumerator = <1>;
+            };
+        };
+    };
+
+...
-- 
2.24.1


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23  6:50 [PATCH v2 0/2] Add Turris Omnia LEDs driver Marek Behún
2020-04-23  6:50 ` Marek Behún [this message]
2020-05-11 19:43   ` [PATCH v2 1/2] dt-bindings: leds: add cznic,turris-omnia-leds binding Rob Herring
2020-05-11 20:01     ` Marek Behun
2020-07-12  8:00       ` Pavel Machek
2020-04-23  6:51 ` [PATCH v2 2/2] leds: initial support for Turris Omnia LEDs Marek Behún
2020-05-11 19:54   ` Dan Murphy
2020-05-11 20:17     ` Marek Behun
2020-05-11 20:21       ` Dan Murphy

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=20200423065100.2652-2-marek.behun@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-leds@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

Linux-LEDs Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-leds/0 linux-leds/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-leds linux-leds/ https://lore.kernel.org/linux-leds \
		linux-leds@vger.kernel.org
	public-inbox-index linux-leds

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-leds


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git