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