GNU Linux-libre 5.19-rc6-gnu
[releases.git] / Documentation / devicetree / bindings / mfd / x-powers,axp152.yaml
1 # SPDX-License-Identifier: GPL-2.0
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/mfd/x-powers,axp152.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: X-Powers AXP PMIC Device Tree Bindings
8
9 maintainers:
10   - Chen-Yu Tsai <wens@csie.org>
11
12 allOf:
13   - if:
14       properties:
15         compatible:
16           contains:
17             enum:
18               - x-powers,axp152
19               - x-powers,axp202
20               - x-powers,axp209
21
22     then:
23       properties:
24         regulators:
25           properties:
26             x-powers,dcdc-freq:
27               minimum: 750
28               maximum: 1875
29               default: 1500
30
31     else:
32       properties:
33         regulators:
34           properties:
35             x-powers,dcdc-freq:
36               minimum: 1800
37               maximum: 4050
38               default: 3000
39
40   - if:
41       properties:
42         compatible:
43           contains:
44             enum:
45               - x-powers,axp152
46               - x-powers,axp202
47               - x-powers,axp209
48
49     then:
50       not:
51         required:
52           - x-powers,drive-vbus-en
53
54   - if:
55       not:
56         properties:
57           compatible:
58             contains:
59               const: x-powers,axp806
60
61     then:
62       allOf:
63         - not:
64             required:
65               - x-powers,self-working-mode
66
67         - not:
68             required:
69               - x-powers,master-mode
70
71   - if:
72       not:
73         properties:
74           compatible:
75             contains:
76               const: x-powers,axp305
77
78     then:
79       required:
80         - interrupts
81
82 properties:
83   compatible:
84     oneOf:
85       - enum:
86           - x-powers,axp152
87           - x-powers,axp202
88           - x-powers,axp209
89           - x-powers,axp221
90           - x-powers,axp223
91           - x-powers,axp803
92           - x-powers,axp806
93           - x-powers,axp809
94           - x-powers,axp813
95       - items:
96           - const: x-powers,axp805
97           - const: x-powers,axp806
98       - items:
99           - const: x-powers,axp305
100           - const: x-powers,axp805
101           - const: x-powers,axp806
102       - items:
103           - const: x-powers,axp818
104           - const: x-powers,axp813
105
106   reg:
107     maxItems: 1
108
109   interrupts:
110     maxItems: 1
111
112   interrupt-controller: true
113
114   "#interrupt-cells":
115     const: 1
116
117   x-powers,drive-vbus-en:
118     type: boolean
119     description: >
120       Set this when the N_VBUSEN pin is used as an output pin to control an
121       external regulator to drive the OTG VBus, rather then as an input pin
122       which signals whether the board is driving OTG VBus or not.
123
124   x-powers,self-working-mode:
125     type: boolean
126     description: >
127       Set this when the PMIC is wired for self-working mode through the MODESET
128       pin.
129
130   x-powers,master-mode:
131     type: boolean
132     description: >
133       Set this when the PMIC is wired for master mode through the MODESET pin.
134
135   vin1-supply:
136     description: >
137       DCDC1 power supply node, if present.
138
139   vin2-supply:
140     description: >
141       DCDC2 power supply node, if present.
142
143   vin3-supply:
144     description: >
145       DCDC3 power supply node, if present.
146
147   vin4-supply:
148     description: >
149       DCDC4 power supply node, if present.
150
151   vin5-supply:
152     description: >
153       DCDC5 power supply node, if present.
154
155   vin6-supply:
156     description: >
157       DCDC6 power supply node, if present.
158
159   vin7-supply:
160     description: >
161       DCDC7 power supply node, if present.
162
163   vina-supply:
164     description: >
165       DCDCA power supply node, if present.
166
167   vinb-supply:
168     description: >
169       DCDCB power supply node, if present.
170
171   vinc-supply:
172     description: >
173       DCDCC power supply node, if present.
174
175   vind-supply:
176     description: >
177       DCDCD power supply node, if present.
178
179   vine-supply:
180     description: >
181       DCDCE power supply node, if present.
182
183   acin-supply:
184     description: >
185       LDO1 power supply node, if present.
186
187   ldo24in-supply:
188     description: >
189       LDO2 and LDO4 power supply node, if present.
190
191   ldo3in-supply:
192     description: >
193       LDO3 power supply node, if present.
194
195   ldo5in-supply:
196     description: >
197       LDO5 power supply node, if present.
198
199   aldoin-supply:
200     description: >
201       ALDO* power supply node, if present.
202
203   bldoin-supply:
204     description: >
205       BLDO* power supply node, if present.
206
207   cldoin-supply:
208     description: >
209       CLDO* power supply node, if present.
210
211   dldoin-supply:
212     description: >
213       DLDO* power supply node, if present.
214
215   eldoin-supply:
216     description: >
217       ELDO* power supply node, if present.
218
219   fldoin-supply:
220     description: >
221       FLDO* power supply node, if present.
222
223   ips-supply:
224     description: >
225       LDO_IO0, LDO_IO1 and RTC_LDO power supply node, if present.
226
227   drivevbus-supply:
228     description: >
229       DRIVEVBUS power supply node, if present.
230
231   swin-supply:
232     description: >
233       SW power supply node, if present.
234
235   adc:
236     $ref: /schemas/iio/adc/x-powers,axp209-adc.yaml#
237
238   gpio:
239     $ref: /schemas/gpio/x-powers,axp209-gpio.yaml#
240
241   ac-power:
242     $ref: /schemas/power/supply/x-powers,axp20x-ac-power-supply.yaml#
243
244   battery-power:
245     $ref: /schemas/power/supply/x-powers,axp20x-battery-power-supply.yaml#
246
247   usb-power:
248     $ref: /schemas/power/supply/x-powers,axp20x-usb-power-supply.yaml#
249
250   regulators:
251     type: object
252
253     properties:
254       x-powers,dcdc-freq:
255         $ref: /schemas/types.yaml#/definitions/uint32
256         description: >
257           Defines the work frequency of DC-DC in kHz.
258
259     patternProperties:
260       "^(([a-f])?ldo[0-9]|dcdc[0-7a-e]|ldo(_|-)io(0|1)|(dc1)?sw|rtc(_|-)ldo|drivevbus|dc5ldo)$":
261         $ref: /schemas/regulator/regulator.yaml#
262         type: object
263
264         properties:
265           regulator-ramp-delay:
266             description: >
267               Only 800 and 1600 are valid for the DCDC2 and LDO3 regulators on
268               the AXP209.
269
270           regulator-soft-start:
271             description: >
272               Only valid for the LDO3 regulator.
273
274           x-powers,dcdc-workmode:
275             $ref: /schemas/types.yaml#/definitions/uint32
276             enum: [0, 1]
277             description: >
278               Only valid for DCDC regulators. Setup 1 for PWM mode, 0
279               for AUTO (PWM/PFM) mode. The DCDC regulators work in a
280               mixed PWM/PFM mode, using PFM under light loads and
281               switching to PWM for heavier loads. Forcing PWM mode
282               trades efficiency under light loads for lower output
283               noise. This probably makes sense for HiFi audio related
284               applications that aren't battery constrained.
285
286     additionalProperties: false
287
288 required:
289   - compatible
290   - reg
291   - "#interrupt-cells"
292   - interrupt-controller
293
294 additionalProperties: false
295
296 examples:
297   - |
298       i2c0 {
299           #address-cells = <1>;
300           #size-cells = <0>;
301
302           pmic@30 {
303               compatible = "x-powers,axp152";
304               reg = <0x30>;
305               interrupts = <0>;
306               interrupt-controller;
307               #interrupt-cells = <1>;
308           };
309       };
310
311   - |
312       #include <dt-bindings/interrupt-controller/irq.h>
313
314       i2c0 {
315           #address-cells = <1>;
316           #size-cells = <0>;
317
318           pmic@34 {
319               compatible = "x-powers,axp209";
320               reg = <0x34>;
321               interrupt-parent = <&nmi_intc>;
322               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
323               interrupt-controller;
324               #interrupt-cells = <1>;
325
326               ac_power_supply: ac-power {
327                   compatible = "x-powers,axp202-ac-power-supply";
328               };
329
330               axp_adc: adc {
331                   compatible = "x-powers,axp209-adc";
332                   #io-channel-cells = <1>;
333               };
334
335               axp_gpio: gpio {
336                   compatible = "x-powers,axp209-gpio";
337                   gpio-controller;
338                   #gpio-cells = <2>;
339
340                   gpio0-adc-pin {
341                       pins = "GPIO0";
342                       function = "adc";
343                   };
344               };
345
346               battery_power_supply: battery-power {
347                   compatible = "x-powers,axp209-battery-power-supply";
348               };
349
350               regulators {
351                   /* Default work frequency for buck regulators */
352                   x-powers,dcdc-freq = <1500>;
353
354                   reg_dcdc2: dcdc2 {
355                       regulator-always-on;
356                       regulator-min-microvolt = <1000000>;
357                       regulator-max-microvolt = <1450000>;
358                       regulator-name = "vdd-cpu";
359                   };
360
361                   reg_dcdc3: dcdc3 {
362                       regulator-always-on;
363                       regulator-min-microvolt = <1000000>;
364                       regulator-max-microvolt = <1400000>;
365                       regulator-name = "vdd-int-dll";
366                   };
367
368                   reg_ldo1: ldo1 {
369                       /* LDO1 is a fixed output regulator */
370                       regulator-always-on;
371                       regulator-min-microvolt = <1300000>;
372                       regulator-max-microvolt = <1300000>;
373                       regulator-name = "vdd-rtc";
374                   };
375
376                   reg_ldo2: ldo2 {
377                       regulator-always-on;
378                       regulator-min-microvolt = <3000000>;
379                       regulator-max-microvolt = <3000000>;
380                       regulator-name = "avcc";
381                   };
382
383                   reg_ldo3: ldo3 {
384                       regulator-name = "ldo3";
385                   };
386
387                   reg_ldo4: ldo4 {
388                       regulator-name = "ldo4";
389                   };
390
391                   reg_ldo5: ldo5 {
392                       regulator-name = "ldo5";
393                   };
394               };
395
396               usb_power_supply: usb-power {
397                   compatible = "x-powers,axp202-usb-power-supply";
398               };
399           };
400       };