1# SPDX-License-Identifier: GPL-2.0-only
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/regulator/maxim,max8997.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Maxim MAX8997 Power Management IC
8
9maintainers:
10  - Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
11
12description: |
13  The Maxim MAX8997 is a Power Management IC which includes voltage and current
14  regulators, charger controller with fuel gauge, RTC, clock outputs, haptic
15  motor driver, flash LED driver and Micro-USB Interface Controller.
16
17  The binding here is not complete and describes only regulator and charger
18  controller parts.
19
20properties:
21  compatible:
22    const: maxim,max8997-pmic
23
24  charger-supply:
25    description: |
26      Regulator node for charging current.
27
28  interrupts:
29    items:
30      - description: irq1 interrupt
31      - description: alert interrupt
32
33  max8997,pmic-buck1-dvs-voltage:
34    $ref: /schemas/types.yaml#/definitions/uint32-array
35    minItems: 1
36    maxItems: 8
37    description: |
38      A set of 8 voltage values in micro-volt (uV) units for buck1 when
39      changing voltage using GPIO DVS.
40      If none of max8997,pmic-buck[1/2/5]-uses-gpio-dvs optional property is
41      specified, the max8997,pmic-buck[1/2/5]-dvs-voltage property should
42      specify at least one voltage level (which would be a safe operating
43      voltage).
44
45  max8997,pmic-buck2-dvs-voltage:
46    $ref: /schemas/types.yaml#/definitions/uint32-array
47    minItems: 1
48    maxItems: 8
49    description: |
50      A set of 8 voltage values in micro-volt (uV) units for buck2 when
51      changing voltage using GPIO DVS.
52      If none of max8997,pmic-buck[1/2/5]-uses-gpio-dvs optional property is
53      specified, the max8997,pmic-buck[1/2/5]-dvs-voltage property should
54      specify at least one voltage level (which would be a safe operating
55      voltage).
56
57  max8997,pmic-buck5-dvs-voltage:
58    $ref: /schemas/types.yaml#/definitions/uint32-array
59    minItems: 1
60    maxItems: 8
61    description: |
62      A set of 8 voltage values in micro-volt (uV) units for buck5 when
63      changing voltage using GPIO DVS.
64      If none of max8997,pmic-buck[1/2/5]-uses-gpio-dvs optional property is
65      specified, the max8997,pmic-buck[1/2/5]-dvs-voltage property should
66      specify at least one voltage level (which would be a safe operating
67      voltage).
68
69  max8997,pmic-buck1-uses-gpio-dvs:
70    type: boolean
71    description: |
72      buck1 can be controlled by GPIO DVS.
73
74  max8997,pmic-buck2-uses-gpio-dvs:
75    type: boolean
76    description: |
77      buck2 can be controlled by GPIO DVS.
78
79  max8997,pmic-buck5-uses-gpio-dvs:
80    type: boolean
81    description: |
82      buck5 can be controlled by GPIO DVS.
83
84  max8997,pmic-buck125-default-dvs-idx:
85    $ref: /schemas/types.yaml#/definitions/uint32
86    minimum: 0
87    maximum: 7
88    default: 0
89    description: |
90      Default voltage setting selected from the possible 8 options selectable
91      by the dvs gpios. The value of this property should be between 0 and 7.
92      If not specified or if out of range, the default value of this property
93      is set to 0.
94
95  max8997,pmic-buck125-dvs-gpios:
96    minItems: 3
97    maxItems: 3
98    description: |
99      GPIO specifiers for three host gpio's used for DVS.
100
101  max8997,pmic-ignore-gpiodvs-side-effect:
102    type: boolean
103    description: |
104      When GPIO-DVS mode is used for multiple bucks, changing the voltage value
105      of one of the bucks may affect that of another buck, which is the side
106      effect of the change (set_voltage).  Use this property to ignore such
107      side effects and change the voltage.
108
109  reg:
110    maxItems: 1
111
112  regulators:
113    type: object
114    description:
115      List of child nodes that specify the regulators.
116
117    patternProperties:
118      # 1-18 and 21 LDOs
119      "^LDO([1-9]|1[0-8]|21)$":
120        type: object
121        $ref: regulator.yaml#
122        description:
123          Properties for single LDO regulator.
124
125        properties:
126          regulator-name: true
127
128        required:
129          - regulator-name
130
131        unevaluatedProperties: false
132
133      # 7 bucks
134      "^BUCK[1-7]$":
135        type: object
136        $ref: regulator.yaml#
137        description:
138          Properties for single BUCK regulator.
139
140        properties:
141          regulator-name: true
142
143        required:
144          - regulator-name
145
146        unevaluatedProperties: false
147
148      "^EN32KHZ_[AC]P$":
149        type: object
150        $ref: regulator.yaml#
151        description:
152          32768 Hz clock output (modelled as regulator)
153
154        properties:
155          regulator-name: true
156          regulator-always-on: true
157          regulator-boot-on: true
158
159        required:
160          - regulator-name
161
162        additionalProperties: false
163
164    properties:
165      CHARGER:
166        type: object
167        $ref: regulator.yaml#
168        description: main battery charger current control
169
170        properties:
171          regulator-name: true
172
173        required:
174          - regulator-name
175
176        unevaluatedProperties: false
177
178      CHARGER_CV:
179        type: object
180        $ref: regulator.yaml#
181        description: main battery charger voltage control
182
183        properties:
184          regulator-name: true
185
186        required:
187          - regulator-name
188
189        unevaluatedProperties: false
190
191      CHARGER_TOPOFF:
192        type: object
193        $ref: regulator.yaml#
194        description: end of charge current threshold level
195
196        properties:
197          regulator-name: true
198
199        required:
200          - regulator-name
201
202        unevaluatedProperties: false
203
204      ENVICHG:
205        type: object
206        $ref: regulator.yaml#
207        description: |
208          Battery Charging Current Monitor Output. This is a fixed voltage type
209          regulator
210        properties:
211          regulator-name: true
212
213        required:
214          - regulator-name
215
216        unevaluatedProperties: false
217
218      ESAFEOUT1:
219        type: object
220        $ref: regulator.yaml#
221        description: LDO19
222
223        properties:
224          regulator-name: true
225
226        required:
227          - regulator-name
228
229        unevaluatedProperties: false
230
231      ESAFEOUT2:
232        type: object
233        $ref: regulator.yaml#
234        description: LDO20
235
236        properties:
237          regulator-name: true
238
239        required:
240          - regulator-name
241
242        unevaluatedProperties: false
243
244required:
245  - compatible
246  - max8997,pmic-buck1-dvs-voltage
247  - max8997,pmic-buck2-dvs-voltage
248  - max8997,pmic-buck5-dvs-voltage
249  - reg
250  - regulators
251
252dependencies:
253  max8997,pmic-buck1-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
254  max8997,pmic-buck2-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
255  max8997,pmic-buck5-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
256
257additionalProperties: false
258
259if:
260  anyOf:
261    - required:
262        - max8997,pmic-buck1-uses-gpio-dvs
263    - required:
264        - max8997,pmic-buck2-uses-gpio-dvs
265    - required:
266        - max8997,pmic-buck5-uses-gpio-dvs
267then:
268  properties:
269    max8997,pmic-buck1-dvs-voltage:
270      minItems: 8
271      maxItems: 8
272    max8997,pmic-buck2-dvs-voltage:
273      minItems: 8
274      maxItems: 8
275    max8997,pmic-buck5-dvs-voltage:
276      minItems: 8
277      maxItems: 8
278
279examples:
280  - |
281    #include <dt-bindings/gpio/gpio.h>
282    #include <dt-bindings/interrupt-controller/irq.h>
283
284    i2c {
285        #address-cells = <1>;
286        #size-cells = <0>;
287
288        pmic@66 {
289            compatible = "maxim,max8997-pmic";
290            reg = <0x66>;
291
292            interrupts-extended = <&gpx0 7 IRQ_TYPE_LEVEL_LOW>,
293                                  <&gpx2 3 IRQ_TYPE_EDGE_FALLING>;
294
295            max8997,pmic-buck1-uses-gpio-dvs;
296            max8997,pmic-buck2-uses-gpio-dvs;
297            max8997,pmic-buck5-uses-gpio-dvs;
298
299            max8997,pmic-ignore-gpiodvs-side-effect;
300            max8997,pmic-buck125-default-dvs-idx = <0>;
301
302            max8997,pmic-buck125-dvs-gpios = <&gpx0 5 GPIO_ACTIVE_HIGH>,
303                                             <&gpx0 6 GPIO_ACTIVE_HIGH>,
304                                             <&gpl0 0 GPIO_ACTIVE_HIGH>;
305
306            max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>,
307                                             <1250000>, <1200000>,
308                                             <1150000>, <1100000>,
309                                             <1000000>, <950000>;
310
311            max8997,pmic-buck2-dvs-voltage = <1100000>, <1000000>,
312                                             <950000>,  <900000>,
313                                             <1100000>, <1000000>,
314                                             <950000>,  <900000>;
315
316            max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>,
317                                             <1200000>, <1200000>,
318                                             <1200000>, <1200000>,
319                                             <1200000>, <1200000>;
320
321            pinctrl-0 = <&max8997_irq>, <&otg_gp>, <&usb_sel>;
322            pinctrl-names = "default";
323
324            charger-supply = <&charger_reg>;
325
326            regulators {
327                LDO1 {
328                    regulator-name = "VADC_3.3V_C210";
329                    regulator-min-microvolt = <3300000>;
330                    regulator-max-microvolt = <3300000>;
331                    regulator-always-on;
332                };
333
334                LDO2 {
335                    regulator-name = "VALIVE_1.1V_C210";
336                    regulator-min-microvolt = <1100000>;
337                    regulator-max-microvolt = <1100000>;
338                    regulator-always-on;
339                };
340
341                BUCK1 {
342                    regulator-name = "VARM_1.2V_C210";
343                    regulator-min-microvolt = <65000>;
344                    regulator-max-microvolt = <2225000>;
345                    regulator-always-on;
346                };
347
348                // ...
349
350                BUCK7 {
351                    regulator-name = "VCC_SUB_2.0V";
352                    regulator-min-microvolt = <2000000>;
353                    regulator-max-microvolt = <2000000>;
354                    regulator-always-on;
355                };
356
357                ESAFEOUT1 {
358                    regulator-name = "SAFEOUT1";
359                };
360
361                ESAFEOUT2 {
362                    regulator-name = "SAFEOUT2";
363                    regulator-boot-on;
364                };
365
366                EN32KHZ_AP {
367                    regulator-name = "EN32KHZ_AP";
368                    regulator-always-on;
369                };
370
371                EN32KHZ_CP {
372                    regulator-name = "EN32KHZ_CP";
373                    regulator-always-on;
374                };
375
376                CHARGER {
377                    regulator-name = "CHARGER";
378                    regulator-min-microamp = <200000>;
379                    regulator-max-microamp = <950000>;
380                };
381
382                CHARGER_CV {
383                    regulator-name = "CHARGER_CV";
384                    regulator-min-microvolt = <4200000>;
385                    regulator-max-microvolt = <4200000>;
386                    regulator-always-on;
387                };
388
389                CHARGER_TOPOFF {
390                    regulator-name = "CHARGER_TOPOFF";
391                    regulator-min-microamp = <200000>;
392                    regulator-max-microamp = <200000>;
393                    regulator-always-on;
394                };
395            };
396        };
397    };
398
399  - |
400    #include <dt-bindings/interrupt-controller/irq.h>
401
402    i2c {
403        #address-cells = <1>;
404        #size-cells = <0>;
405
406        pmic@66 {
407            compatible = "maxim,max8997-pmic";
408            reg = <0x66>;
409
410            interrupt-parent = <&gpx0>;
411            interrupts = <4 IRQ_TYPE_LEVEL_LOW>,
412                         <3 IRQ_TYPE_EDGE_FALLING>;
413            pinctrl-names = "default";
414            pinctrl-0 = <&max8997_irq>;
415
416            max8997,pmic-buck1-dvs-voltage = <1350000>;
417            max8997,pmic-buck2-dvs-voltage = <1100000>;
418            max8997,pmic-buck5-dvs-voltage = <1200000>;
419
420            regulators {
421                LDO1 {
422                    regulator-name = "VDD_ABB_3.3V";
423                    regulator-min-microvolt = <3300000>;
424                    regulator-max-microvolt = <3300000>;
425                };
426
427                // ...
428
429                BUCK1 {
430                    regulator-name = "VDD_ARM_1.2V";
431                    regulator-min-microvolt = <950000>;
432                    regulator-max-microvolt = <1350000>;
433                    regulator-always-on;
434                    regulator-boot-on;
435                };
436
437                // ...
438
439                EN32KHZ_AP {
440                    regulator-name = "EN32KHZ_AP";
441                    regulator-always-on;
442                };
443            };
444        };
445    };
446