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