1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/leds/backlight/qcom-wled.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Binding for Qualcomm Technologies, Inc. WLED driver
8
9maintainers:
10  - Bjorn Andersson <bjorn.andersson@linaro.org>
11  - Kiran Gunda <kgunda@codeaurora.org>
12
13description: |
14  WLED (White Light Emitting Diode) driver is used for controlling display
15  backlight that is part of PMIC on Qualcomm Technologies, Inc. reference
16  platforms. The PMIC is connected to the host processor via SPMI bus.
17
18properties:
19  compatible:
20    enum:
21      - qcom,pm8941-wled
22      - qcom,pmi8998-wled
23      - qcom,pm660l-wled
24      - qcom,pm8150l-wled
25
26  reg:
27    maxItems: 1
28
29  default-brightness:
30    description: |
31      brightness value on boot.
32
33  label: true
34
35  max-brightness:
36    description: |
37      Maximum brightness level.
38
39  qcom,cs-out:
40    description: |
41      enable current sink output.
42      This property is supported only for WLED3.
43    type: boolean
44
45  qcom,cabc:
46    description: |
47      enable content adaptive backlight control.
48    type: boolean
49
50  qcom,ext-gen:
51    description: |
52      use externally generated modulator signal to dim.
53      This property is supported only for WLED3.
54    type: boolean
55
56  qcom,current-limit:
57    description: |
58      mA; per-string current limit.
59      This property is supported only for WLED3.
60    allOf:
61      - $ref: /schemas/types.yaml#/definitions/uint32
62    default: 20
63    minimum: 0
64    maximum: 25
65
66  qcom,current-limit-microamp:
67    description: |
68      uA; per-string current limit.
69    default: 25
70    minimum: 0
71    maximum: 30000
72    multipleOf: 25
73
74  qcom,current-boost-limit:
75    description: |
76      mA; boost current limit.
77    allOf:
78      - $ref: /schemas/types.yaml#/definitions/uint32
79
80  qcom,switching-freq:
81    description: |
82      kHz; switching frequency.
83    allOf:
84      - $ref: /schemas/types.yaml#/definitions/uint32
85      - enum: [ 600, 640, 685, 738, 800, 872, 960, 1066, 1200, 1371, 1600, 1920, 2400, 3200, 4800, 9600 ]
86
87  qcom,ovp:
88    description: |
89      V; Over-voltage protection limit.
90      This property is supported only for WLED3.
91    allOf:
92      - $ref: /schemas/types.yaml#/definitions/uint32
93      - enum: [ 27, 29, 32, 35 ]
94      - default: 29
95
96  qcom,ovp-millivolt:
97    description: |
98      Over-voltage protection limit. This property is for WLED4 only.
99    allOf:
100      - $ref: /schemas/types.yaml#/definitions/uint32
101      - enum: [ 18100, 19600, 29600, 31100 ]
102      - default: 29600
103
104  qcom,num-strings:
105    description: |
106      number of led strings attached.
107    allOf:
108      - $ref: /schemas/types.yaml#/definitions/uint32
109
110  qcom,enabled-strings:
111    description: |
112      Array of the WLED strings numbered from 0 to 3. Each
113      string of leds are operated individually. Specify the
114      list of strings used by the device. Any combination of
115      led strings can be used.
116    allOf:
117      - $ref: /schemas/types.yaml#/definitions/uint32-array
118    minItems: 1
119    maxItems: 4
120
121  qcom,external-pfet:
122    description: |
123      Specify if external PFET control for short circuit
124      protection is used. This property is supported only
125      for WLED4.
126    type: boolean
127
128  qcom,auto-string-detection:
129    description: |
130      Enables auto-detection of the WLED string configuration.
131      This feature is not supported for WLED3.
132    type: boolean
133
134  interrupts:
135    minItems: 1
136    items:
137      - description: over voltage protection interrupt.
138      - description: short circuit interrupt.
139
140  interrupt-names:
141    minItems: 1
142    items:
143      - const: ovp
144      - const: short
145
146  qcom,modulator-sel:
147    description: |
148      Selects the modulator used for brightness modulation.
149      Allowed values are,
150           0 - Modulator A
151           1 - Modulator B
152      This property is applicable only to WLED5 peripheral.
153    allOf:
154      - $ref: /schemas/types.yaml#/definitions/uint32
155      - enum: [ 0, 1 ]
156      - default: 0
157
158  qcom,cabc-sel:
159    description: |
160      Selects the CABC pin signal used for brightness modulation.
161      Allowed values are,
162           0 - CABC disabled
163           1 - CABC 1
164           2 - CABC 2
165           3 - External signal (e.g. LPG) is used for dimming
166      This property is applicable only to WLED5 peripheral.
167    allOf:
168      - $ref: /schemas/types.yaml#/definitions/uint32
169      - enum: [ 0, 1, 2, 3 ]
170
171allOf:
172  - if:
173      properties:
174        compatible:
175          contains:
176            const: qcom,pm8941-wled
177
178    then:
179      properties:
180        qcom,current-boost-limit:
181          enum: [ 105, 385, 525, 805, 980, 1260, 1400, 1680 ]
182          default: 805
183
184        qcom,switching-freq:
185          default: 1600
186
187        qcom,num-strings:
188          enum: [ 1, 2, 3 ]
189
190        interrupts:
191          maxItems: 1
192
193        interrupt-names:
194          maxItems: 1
195
196    else:
197      properties:
198        qcom,current-boost-limit:
199          enum: [ 105, 280, 450, 620, 970, 1150, 1300, 1500 ]
200          default: 970
201
202        qcom,switching-freq:
203          default: 800
204
205        qcom,num-strings:
206          enum: [ 1, 2, 3, 4 ]
207
208        interrupts:
209          minItems: 2
210
211        interrupt-names:
212          minItems: 2
213  - if:
214      properties:
215        compatible:
216          contains:
217            enum:
218              - qcom,pm8150l-wled
219
220    then:
221      properties:
222        default-brightness:
223          minimum: 0
224          maximum: 32767
225
226        max-brightness:
227          minimum: 0
228          maximum: 32767
229
230    else:
231      properties:
232        default-brightness:
233          minimum: 0
234          maximum: 4095
235
236        max-brightness:
237          minimum: 0
238          maximum: 4095
239
240required:
241  - compatible
242  - reg
243  - label
244
245additionalProperties: false
246
247examples:
248  - |
249    backlight@d800 {
250        compatible = "qcom,pm8941-wled";
251        reg = <0xd800 0x100>;
252        label = "backlight";
253
254        qcom,cs-out;
255        qcom,current-limit = <20>;
256        qcom,current-boost-limit = <805>;
257        qcom,switching-freq = <1600>;
258        qcom,ovp = <29>;
259        qcom,num-strings = <2>;
260        qcom,enabled-strings = <0 1>;
261     };
262