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