diff mbox series

[RFC,v2,2/3] dt-bindings: leds: Shiji Lighting APA102C LED driver

Message ID 1582727592-4510-3-git-send-email-nbelin@baylibre.com
State New
Headers show
Series None | expand

Commit Message

Nicolas Belin Feb. 26, 2020, 2:33 p.m. UTC
Document Shiji Lighting APA102C LED driver device tree bindings.

Signed-off-by: Nicolas Belin <nbelin@baylibre.com>
---
 .../devicetree/bindings/leds/leds-apa102c.yaml     | 154 +++++++++++++++++++++
 1 file changed, 154 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-apa102c.yaml
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-apa102c.yaml b/Documentation/devicetree/bindings/leds/leds-apa102c.yaml
new file mode 100644
index 000000000000..90c827ab5a5a
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-apa102c.yaml
@@ -0,0 +1,154 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-apa102c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for Shiji Lighting - APA102C
+
+maintainers:
+  - Nicolas Belin <nbelin@baylibre.com>
+
+description:
+  Each RGB LED is represented as a multi-led sub-node of the leds-apa102c
+  device.  Each LED
+  is a three color rgb LED with 32 levels brightness adjustment that can be
+  cascaded so that multiple LEDs can be set with a single command.
+
+properties:
+  compatible:
+    const: shiji,apa102c
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 1000000
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^multi-led@[0-9]+$":
+    type: object
+    description: |
+      Properties for an array of connected LEDs.
+
+    properties:
+      reg:
+        description: |
+          This property corresponds to the led index. It has to be between 0
+          and the number of managed leds minus 1
+        maxItems: 1
+
+      label:
+        description: |
+          This property corresponds to the name of the led. If not set,
+          the led index will be used to create the led name instead
+        maxItems: 1
+
+      color:
+        const: 8
+
+      linux,default-trigger: true
+
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^led@[0-9]+$":
+        type: object
+        description: |
+          Properties for the LED color components.
+
+        properties:
+          reg:
+            maxItems: 1
+
+          color:
+            oneOf:
+              - enum: [ 1, 2, 3 ]
+
+        required:
+          - reg
+          - color
+
+    required:
+      - reg
+      - color
+      - '#address-cells'
+      - '#size-cells'
+
+required:
+  - compatible
+  - reg
+  - spi-max-frequency
+  - '#address-cells'
+  - '#size-cells'
+
+examples:
+  - |
+
+    #include <dt-bindings/leds/common.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        led-controller@0 {
+            compatible = "shiji,apa102c";
+            reg = <0>;
+            spi-max-frequency = <1000000>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            multi-led@0 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg = <0>;
+                color = <LED_COLOR_ID_MULTI>;
+                label = "rgb_led1";
+
+                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>;
+                };
+            };
+            multi-led@1 {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                reg = <1>;
+                color = <LED_COLOR_ID_MULTI>;
+                label = "rgb_led2";
+
+                led@3 {
+                reg = <3>;
+                color = <LED_COLOR_ID_RED>;
+                };
+
+                led@4 {
+                reg = <4>;
+                color = <LED_COLOR_ID_GREEN>;
+                };
+
+                led@5 {
+                reg = <5>;
+                color = <LED_COLOR_ID_BLUE>;
+                };
+            };
+        };
+    };