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