d1: add new target
[openwrt/staging/mans0n.git] / target / linux / d1 / patches-6.1 / 0054-dt-bindings-leds-Add-Allwinner-A100-LED-controller.patch
1 From 31857adcc9db7244a047a3a3550219f7559d8846 Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Wed, 4 Aug 2021 21:36:26 -0500
4 Subject: [PATCH 054/117] dt-bindings: leds: Add Allwinner A100 LED controller
5
6 The Allwinner A100, R329, and D1 SoCs contain an LED controller designed
7 to drive a series of RGB LED pixels. It supports PIO and DMA transfers,
8 and has configurable timing and pixel format. All three implementations
9 appear to be identical, so use the oldest as the fallback compatible.
10
11 Series-changes: 2
12 - Fixed typo leading to duplicate t1h-ns property
13 - Removed "items" layer in definition of dmas/dma-names
14 - Replaced uint32 type reference with maxItems in timing properties
15
16 Series-changes: 3
17 - Removed quotes from enumeration values
18 - Added vendor prefix to timing/format properties
19 - Renamed "format" property to "pixel-format" for clarity
20 - Dropped "vled-supply" as it is unrelated to the controller hardware
21
22 Series-changes: 4
23 - Use "default" instead of "maxItems" for timing properties
24
25 Series-changes: 5
26 - A100 contains the original implementation, so use that as the base
27 compatible string, and rename the binding to match
28 - Add "unevaluatedProperties: false" to the child multi-led binding
29
30 Acked-by: Maxime Ripard <maxime@cerno.tech>
31 Reviewed-by: Rob Herring <robh@kernel.org>
32 Signed-off-by: Samuel Holland <samuel@sholland.org>
33 ---
34 .../leds/allwinner,sun50i-a100-ledc.yaml | 139 ++++++++++++++++++
35 1 file changed, 139 insertions(+)
36 create mode 100644 Documentation/devicetree/bindings/leds/allwinner,sun50i-a100-ledc.yaml
37
38 --- /dev/null
39 +++ b/Documentation/devicetree/bindings/leds/allwinner,sun50i-a100-ledc.yaml
40 @@ -0,0 +1,139 @@
41 +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
42 +%YAML 1.2
43 +---
44 +$id: http://devicetree.org/schemas/leds/allwinner,sun50i-a100-ledc.yaml#
45 +$schema: http://devicetree.org/meta-schemas/core.yaml#
46 +
47 +title: Allwinner A100 LED Controller Bindings
48 +
49 +maintainers:
50 + - Samuel Holland <samuel@sholland.org>
51 +
52 +description:
53 + The LED controller found in Allwinner sunxi SoCs uses a one-wire serial
54 + interface to drive up to 1024 RGB LEDs.
55 +
56 +properties:
57 + compatible:
58 + oneOf:
59 + - const: allwinner,sun50i-a100-ledc
60 + - items:
61 + - enum:
62 + - allwinner,sun20i-d1-ledc
63 + - allwinner,sun50i-r329-ledc
64 + - const: allwinner,sun50i-a100-ledc
65 +
66 + reg:
67 + maxItems: 1
68 +
69 + "#address-cells":
70 + const: 1
71 +
72 + "#size-cells":
73 + const: 0
74 +
75 + interrupts:
76 + maxItems: 1
77 +
78 + clocks:
79 + items:
80 + - description: Bus clock
81 + - description: Module clock
82 +
83 + clock-names:
84 + items:
85 + - const: bus
86 + - const: mod
87 +
88 + resets:
89 + maxItems: 1
90 +
91 + dmas:
92 + maxItems: 1
93 + description: TX DMA channel
94 +
95 + dma-names:
96 + const: tx
97 +
98 + allwinner,pixel-format:
99 + description: Pixel format (subpixel transmission order), default is "grb"
100 + enum:
101 + - bgr
102 + - brg
103 + - gbr
104 + - grb
105 + - rbg
106 + - rgb
107 +
108 + allwinner,t0h-ns:
109 + default: 336
110 + description: Length of high pulse when transmitting a "0" bit
111 +
112 + allwinner,t0l-ns:
113 + default: 840
114 + description: Length of low pulse when transmitting a "0" bit
115 +
116 + allwinner,t1h-ns:
117 + default: 882
118 + description: Length of high pulse when transmitting a "1" bit
119 +
120 + allwinner,t1l-ns:
121 + default: 294
122 + description: Length of low pulse when transmitting a "1" bit
123 +
124 + allwinner,treset-ns:
125 + default: 300000
126 + description: Minimum delay between transmission frames
127 +
128 +patternProperties:
129 + "^multi-led@[0-9a-f]+$":
130 + type: object
131 + $ref: leds-class-multicolor.yaml#
132 + unevaluatedProperties: false
133 + properties:
134 + reg:
135 + minimum: 0
136 + maximum: 1023
137 + description: Index of the LED in the series (must be contiguous)
138 +
139 + required:
140 + - reg
141 +
142 +required:
143 + - compatible
144 + - reg
145 + - interrupts
146 + - clocks
147 + - clock-names
148 + - resets
149 + - dmas
150 + - dma-names
151 +
152 +additionalProperties: false
153 +
154 +examples:
155 + - |
156 + #include <dt-bindings/interrupt-controller/irq.h>
157 + #include <dt-bindings/leds/common.h>
158 +
159 + ledc: led-controller@2008000 {
160 + compatible = "allwinner,sun20i-d1-ledc",
161 + "allwinner,sun50i-a100-ledc";
162 + reg = <0x2008000 0x400>;
163 + interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
164 + clocks = <&ccu 12>, <&ccu 34>;
165 + clock-names = "bus", "mod";
166 + resets = <&ccu 12>;
167 + dmas = <&dma 42>;
168 + dma-names = "tx";
169 + #address-cells = <1>;
170 + #size-cells = <0>;
171 +
172 + multi-led@0 {
173 + reg = <0x0>;
174 + color = <LED_COLOR_ID_RGB>;
175 + function = LED_FUNCTION_INDICATOR;
176 + };
177 + };
178 +
179 +...