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, 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  multi-led:
67    type: object
68    $ref: leds-class-multicolor.yaml#
69    unevaluatedProperties: false
70
71    properties:
72      "#address-cells":
73        const: 1
74
75      "#size-cells":
76        const: 0
77
78    patternProperties:
79      "^led@[0-9a-f]$":
80        type: object
81        $ref: common.yaml#
82        unevaluatedProperties: false
83
84        properties:
85          reg:
86            maxItems: 1
87
88        required:
89          - reg
90
91patternProperties:
92  "^led@[0-9a-f]$":
93    type: object
94    $ref: common.yaml#
95    unevaluatedProperties: false
96
97    properties:
98      reg:
99        maxItems: 1
100
101    required:
102      - reg
103
104required:
105  - compatible
106
107additionalProperties: false
108
109examples:
110  - |
111    #include <dt-bindings/leds/common.h>
112
113    led-controller {
114      compatible = "qcom,pmi8994-lpg";
115
116      #address-cells = <1>;
117      #size-cells = <0>;
118
119      qcom,power-source = <1>;
120
121      qcom,dtest = <0 0>,
122                   <0 0>,
123                   <0 0>,
124                   <4 1>;
125
126      led@1 {
127        reg = <1>;
128        color = <LED_COLOR_ID_GREEN>;
129        function = LED_FUNCTION_INDICATOR;
130        function-enumerator = <1>;
131      };
132
133      led@2 {
134        reg = <2>;
135        color = <LED_COLOR_ID_GREEN>;
136        function = LED_FUNCTION_INDICATOR;
137        function-enumerator = <0>;
138        default-state = "on";
139      };
140
141      led@3 {
142        reg = <3>;
143        color = <LED_COLOR_ID_GREEN>;
144        function = LED_FUNCTION_INDICATOR;
145        function-enumerator = <2>;
146      };
147
148      led@4 {
149        reg = <4>;
150        color = <LED_COLOR_ID_GREEN>;
151        function = LED_FUNCTION_INDICATOR;
152        function-enumerator = <3>;
153      };
154    };
155  - |
156    #include <dt-bindings/leds/common.h>
157
158    led-controller {
159      compatible = "qcom,pmi8994-lpg";
160
161      #address-cells = <1>;
162      #size-cells = <0>;
163
164      qcom,power-source = <1>;
165
166      multi-led {
167        color = <LED_COLOR_ID_RGB>;
168        function = LED_FUNCTION_STATUS;
169
170        #address-cells = <1>;
171        #size-cells = <0>;
172
173        led@1 {
174          reg = <1>;
175          color = <LED_COLOR_ID_RED>;
176        };
177
178        led@2 {
179          reg = <2>;
180          color = <LED_COLOR_ID_GREEN>;
181        };
182
183        led@3 {
184          reg = <3>;
185          color = <LED_COLOR_ID_BLUE>;
186        };
187      };
188    };
189  - |
190    pwm-controller {
191      compatible = "qcom,pm8916-pwm";
192      #pwm-cells = <2>;
193    };
194...
195