diff mbox series

[RFC,06/25] dt-bindings: leds: Add Titan Micro Electronics TM1628

Message ID 20191212033952.5967-7-afaerber@suse.de
State New
Headers show
Series [RFC,01/25] dt-bindings: vendor-prefixes: Add Xnano | expand

Commit Message

Andreas Färber Dec. 12, 2019, 3:39 a.m. UTC
Add a YAML schema binding for TM1628 LED controller.

Cc: zypeng@titanmec.com
Signed-off-by: Andreas Färber <afaerber@suse.de>

---
 @Rob: How could we express constraints on two-cell reg value ranges here?
       Should we also model constraints on reg range by #grids property?
 
 .../devicetree/bindings/leds/titanmec,tm1628.yaml  | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml

-- 
2.16.4
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml b/Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml
new file mode 100644
index 000000000000..024875656e79
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/titanmec,tm1628.yaml
@@ -0,0 +1,80 @@ 
+# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/titanmec,tm1628.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Titan Micro Electronics TM1628 LED controller
+
+maintainers:
+  - Andreas Färber <afaerber@suse.de>
+
+properties:
+  compatible:
+    enum:
+    - titanmec,tm1628
+
+  reg:
+    maxItems: 1
+
+  "#grids":
+    description: |
+      Number of GRID output lines to use.
+      This limits the number of available SEG output lines.
+    minimum: 4
+    maximum: 7
+
+  "#address-cells":
+    const: 2
+
+  "#size-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+
+patternProperties:
+  "^.*@[1-7],([1-9]|1[02-4])$":
+    type: object
+    description: |
+      Properties for a single LED.
+
+    properties:
+      reg:
+        description: |
+          1-based grid number, followed by 1-based segment number.
+        maxItems: 1
+
+      linux,default-trigger: true
+
+    required:
+      - reg
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@0 {
+            compatible = "titanmec,tm1628";
+            reg = <0>;
+            spi-3-wire;
+            spi-lsb-first;
+            spi-max-frequency = <500000>;
+            #grids = <7>;
+            #address-cells = <2>;
+            #size-cells = <0>;
+
+            colon@5,4 {
+                reg = <5 4>;
+                color = <LED_COLOR_ID_WHITE>;
+                function = LED_FUNCTION_INDICATOR;
+                linux,default-trigger = "heartbeat";
+            };
+        };
+    };
+...