xref: /linux/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/leds/leds-qcom-lpg.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm Light Pulse Generator
8
9maintainers:
10  - Bjorn Andersson <bjorn.andersson@linaro.org>
11
12description: >
13  The Qualcomm Light Pulse Generator consists of three different hardware blocks;
14  a ramp generator with lookup table (LUT), the light pulse generator and a three
15  channel current sink. These blocks are found in a wide range of Qualcomm PMICs.
16
17properties:
18  compatible:
19    oneOf:
20      - enum:
21          - qcom,pm660l-lpg
22          - qcom,pm8150b-lpg
23          - qcom,pm8150l-lpg
24          - qcom,pm8350c-pwm
25          - qcom,pm8916-pwm
26          - qcom,pm8941-lpg
27          - qcom,pm8994-lpg
28          - qcom,pmc8180c-lpg
29          - qcom,pmi632-lpg
30          - qcom,pmi8950-pwm
31          - qcom,pmi8994-lpg
32          - qcom,pmi8998-lpg
33          - qcom,pmk8550-pwm
34      - items:
35          - enum:
36              - qcom,pm6150l-lpg
37          - const: qcom,pm8150l-lpg
38      - items:
39          - enum:
40              - qcom,pm8550-pwm
41          - const: qcom,pm8350c-pwm
42
43  "#pwm-cells":
44    const: 2
45
46  "#address-cells":
47    const: 1
48
49  "#size-cells":
50    const: 0
51
52  qcom,power-source:
53    $ref: /schemas/types.yaml#/definitions/uint32
54    description:
55      power-source used to drive the output, as defined in the datasheet.
56      Should be specified if the TRILED block is present
57    enum: [0, 1, 3]
58
59  qcom,dtest:
60    $ref: /schemas/types.yaml#/definitions/uint32-matrix
61    description: >
62      A list of integer pairs, where each pair represent the dtest line the
63      particular channel should be connected to and the flags denoting how the
64      value should be outputted, as defined in the datasheet. The number of
65      pairs should be the same as the number of channels.
66    items:
67      items:
68        - description: dtest line to attach
69        - description: flags for the attachment
70
71  nvmem:
72    description: >
73      This property is required for PMICs that supports PPG, which is when a
74      PMIC stores LPG per-channel data and pattern LUT in SDAM modules instead
75      of in a LUT peripheral. For PMICs, such as PM8350C, per-channel data
76      and pattern LUT is separated into 2 SDAM modules. In that case, phandles
77      to both SDAM modules need to be specified.
78    minItems: 1
79    maxItems: 2
80
81  nvmem-names:
82    minItems: 1
83    items:
84      - const: lpg_chan_sdam
85      - const: lut_sdam
86
87  qcom,pbs:
88    $ref: /schemas/types.yaml#/definitions/phandle
89    description: >
90      Phandle of the Qualcomm Programmable Boot Sequencer node (PBS).
91      PBS node is used to trigger LPG pattern sequences for PMICs that support
92      single SDAM PPG.
93
94  multi-led:
95    type: object
96    $ref: leds-class-multicolor.yaml#
97    unevaluatedProperties: false
98
99    properties:
100      "#address-cells":
101        const: 1
102
103      "#size-cells":
104        const: 0
105
106    patternProperties:
107      "^led@[0-9a-f]$":
108        type: object
109        $ref: common.yaml#
110        unevaluatedProperties: false
111
112        properties:
113          reg:
114            maxItems: 1
115
116        required:
117          - reg
118
119patternProperties:
120  "^led@[0-9a-f]$":
121    type: object
122    $ref: common.yaml#
123    unevaluatedProperties: false
124
125    properties:
126      reg:
127        maxItems: 1
128
129    required:
130      - reg
131
132required:
133  - compatible
134
135additionalProperties: false
136
137allOf:
138  - if:
139      properties:
140        compatible:
141          contains:
142            enum:
143              - qcom,pm660l-lpg
144              - qcom,pm8150b-lpg
145              - qcom,pm8150l-lpg
146              - qcom,pm8916-pwm
147              - qcom,pm8941-lpg
148              - qcom,pm8994-lpg
149              - qcom,pmc8180c-lpg
150              - qcom,pmi8950-pwm
151              - qcom,pmi8994-lpg
152              - qcom,pmi8998-lpg
153              - qcom,pmk8550-pwm
154    then:
155      properties:
156        nvmem: false
157        nvmem-names: false
158
159  - if:
160      properties:
161        compatible:
162          contains:
163            const: qcom,pmi632-lpg
164    then:
165      properties:
166        nvmem:
167          maxItems: 1
168        nvmem-names:
169          maxItems: 1
170
171  - if:
172      properties:
173        compatible:
174          contains:
175            enum:
176              - qcom,pm8350c-pwm
177    then:
178      properties:
179        nvmem:
180          minItems: 2
181        nvmem-names:
182          minItems: 2
183
184examples:
185  - |
186    #include <dt-bindings/leds/common.h>
187
188    led-controller {
189      compatible = "qcom,pmi8994-lpg";
190
191      #address-cells = <1>;
192      #size-cells = <0>;
193
194      qcom,power-source = <1>;
195
196      qcom,dtest = <0 0>,
197                   <0 0>,
198                   <0 0>,
199                   <4 1>;
200
201      led@1 {
202        reg = <1>;
203        color = <LED_COLOR_ID_GREEN>;
204        function = LED_FUNCTION_INDICATOR;
205        function-enumerator = <1>;
206      };
207
208      led@2 {
209        reg = <2>;
210        color = <LED_COLOR_ID_GREEN>;
211        function = LED_FUNCTION_INDICATOR;
212        function-enumerator = <0>;
213        default-state = "on";
214      };
215
216      led@3 {
217        reg = <3>;
218        color = <LED_COLOR_ID_GREEN>;
219        function = LED_FUNCTION_INDICATOR;
220        function-enumerator = <2>;
221      };
222
223      led@4 {
224        reg = <4>;
225        color = <LED_COLOR_ID_GREEN>;
226        function = LED_FUNCTION_INDICATOR;
227        function-enumerator = <3>;
228      };
229    };
230  - |
231    #include <dt-bindings/leds/common.h>
232
233    led-controller {
234      compatible = "qcom,pmi8994-lpg";
235
236      #address-cells = <1>;
237      #size-cells = <0>;
238
239      qcom,power-source = <1>;
240
241      multi-led {
242        color = <LED_COLOR_ID_RGB>;
243        function = LED_FUNCTION_STATUS;
244
245        #address-cells = <1>;
246        #size-cells = <0>;
247
248        led@1 {
249          reg = <1>;
250          color = <LED_COLOR_ID_RED>;
251        };
252
253        led@2 {
254          reg = <2>;
255          color = <LED_COLOR_ID_GREEN>;
256        };
257
258        led@3 {
259          reg = <3>;
260          color = <LED_COLOR_ID_BLUE>;
261        };
262      };
263    };
264  - |
265    pwm-controller {
266      compatible = "qcom,pm8916-pwm";
267      #pwm-cells = <2>;
268    };
269  - |
270    #include <dt-bindings/leds/common.h>
271
272    led-controller {
273      compatible = "qcom,pmi632-lpg";
274      #address-cells = <1>;
275      #size-cells = <0>;
276      #pwm-cells = <2>;
277      nvmem-names = "lpg_chan_sdam";
278      nvmem = <&pmi632_sdam_7>;
279      qcom,pbs = <&pmi632_pbs_client3>;
280
281      led@1 {
282        reg = <1>;
283        color = <LED_COLOR_ID_RED>;
284        label = "red";
285      };
286
287      led@2 {
288        reg = <2>;
289        color = <LED_COLOR_ID_GREEN>;
290        label = "green";
291      };
292
293      led@3 {
294        reg = <3>;
295        color = <LED_COLOR_ID_BLUE>;
296        label = "blue";
297      };
298    };
299