xref: /freebsd/sys/contrib/device-tree/Bindings/regulator/maxim,max8997.yaml (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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 <krzk@kernel.org>
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    additionalProperties: false
115    description:
116      List of child nodes that specify the regulators.
117
118    patternProperties:
119      # 1-18 and 21 LDOs
120      "^LDO([1-9]|1[0-8]|21)$":
121        type: object
122        $ref: regulator.yaml#
123        description:
124          Properties for single LDO regulator.
125
126        properties:
127          regulator-name: true
128
129        required:
130          - regulator-name
131
132        unevaluatedProperties: false
133
134      # 7 bucks
135      "^BUCK[1-7]$":
136        type: object
137        $ref: regulator.yaml#
138        description:
139          Properties for single BUCK regulator.
140
141        properties:
142          regulator-name: true
143
144        required:
145          - regulator-name
146
147        unevaluatedProperties: false
148
149      "^EN32KHZ_[AC]P$":
150        type: object
151        $ref: regulator.yaml#
152        description:
153          32768 Hz clock output (modelled as regulator)
154
155        properties:
156          regulator-name: true
157          regulator-always-on: true
158          regulator-boot-on: true
159
160        required:
161          - regulator-name
162
163        additionalProperties: false
164
165    properties:
166      CHARGER:
167        type: object
168        $ref: regulator.yaml#
169        description: main battery charger current control
170
171        properties:
172          regulator-name: true
173
174        required:
175          - regulator-name
176
177        unevaluatedProperties: false
178
179      CHARGER_CV:
180        type: object
181        $ref: regulator.yaml#
182        description: main battery charger voltage control
183
184        properties:
185          regulator-name: true
186
187        required:
188          - regulator-name
189
190        unevaluatedProperties: false
191
192      CHARGER_TOPOFF:
193        type: object
194        $ref: regulator.yaml#
195        description: end of charge current threshold level
196
197        properties:
198          regulator-name: true
199
200        required:
201          - regulator-name
202
203        unevaluatedProperties: false
204
205      ENVICHG:
206        type: object
207        $ref: regulator.yaml#
208        description: |
209          Battery Charging Current Monitor Output. This is a fixed voltage type
210          regulator
211        properties:
212          regulator-name: true
213
214        required:
215          - regulator-name
216
217        unevaluatedProperties: false
218
219      ESAFEOUT1:
220        type: object
221        $ref: regulator.yaml#
222        description: LDO19
223
224        properties:
225          regulator-name: true
226
227        required:
228          - regulator-name
229
230        unevaluatedProperties: false
231
232      ESAFEOUT2:
233        type: object
234        $ref: regulator.yaml#
235        description: LDO20
236
237        properties:
238          regulator-name: true
239
240        required:
241          - regulator-name
242
243        unevaluatedProperties: false
244
245required:
246  - compatible
247  - max8997,pmic-buck1-dvs-voltage
248  - max8997,pmic-buck2-dvs-voltage
249  - max8997,pmic-buck5-dvs-voltage
250  - reg
251  - regulators
252
253dependencies:
254  max8997,pmic-buck1-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
255  max8997,pmic-buck2-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
256  max8997,pmic-buck5-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
257
258additionalProperties: false
259
260if:
261  anyOf:
262    - required:
263        - max8997,pmic-buck1-uses-gpio-dvs
264    - required:
265        - max8997,pmic-buck2-uses-gpio-dvs
266    - required:
267        - max8997,pmic-buck5-uses-gpio-dvs
268then:
269  properties:
270    max8997,pmic-buck1-dvs-voltage:
271      minItems: 8
272      maxItems: 8
273    max8997,pmic-buck2-dvs-voltage:
274      minItems: 8
275      maxItems: 8
276    max8997,pmic-buck5-dvs-voltage:
277      minItems: 8
278      maxItems: 8
279
280examples:
281  - |
282    #include <dt-bindings/gpio/gpio.h>
283    #include <dt-bindings/interrupt-controller/irq.h>
284
285    i2c {
286        #address-cells = <1>;
287        #size-cells = <0>;
288
289        pmic@66 {
290            compatible = "maxim,max8997-pmic";
291            reg = <0x66>;
292
293            interrupts-extended = <&gpx0 7 IRQ_TYPE_LEVEL_LOW>,
294                                  <&gpx2 3 IRQ_TYPE_EDGE_FALLING>;
295
296            max8997,pmic-buck1-uses-gpio-dvs;
297            max8997,pmic-buck2-uses-gpio-dvs;
298            max8997,pmic-buck5-uses-gpio-dvs;
299
300            max8997,pmic-ignore-gpiodvs-side-effect;
301            max8997,pmic-buck125-default-dvs-idx = <0>;
302
303            max8997,pmic-buck125-dvs-gpios = <&gpx0 5 GPIO_ACTIVE_HIGH>,
304                                             <&gpx0 6 GPIO_ACTIVE_HIGH>,
305                                             <&gpl0 0 GPIO_ACTIVE_HIGH>;
306
307            max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>,
308                                             <1250000>, <1200000>,
309                                             <1150000>, <1100000>,
310                                             <1000000>, <950000>;
311
312            max8997,pmic-buck2-dvs-voltage = <1100000>, <1000000>,
313                                             <950000>,  <900000>,
314                                             <1100000>, <1000000>,
315                                             <950000>,  <900000>;
316
317            max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>,
318                                             <1200000>, <1200000>,
319                                             <1200000>, <1200000>,
320                                             <1200000>, <1200000>;
321
322            pinctrl-0 = <&max8997_irq>, <&otg_gp>, <&usb_sel>;
323            pinctrl-names = "default";
324
325            charger-supply = <&charger_reg>;
326
327            regulators {
328                LDO1 {
329                    regulator-name = "VADC_3.3V_C210";
330                    regulator-min-microvolt = <3300000>;
331                    regulator-max-microvolt = <3300000>;
332                    regulator-always-on;
333                };
334
335                LDO2 {
336                    regulator-name = "VALIVE_1.1V_C210";
337                    regulator-min-microvolt = <1100000>;
338                    regulator-max-microvolt = <1100000>;
339                    regulator-always-on;
340                };
341
342                BUCK1 {
343                    regulator-name = "VARM_1.2V_C210";
344                    regulator-min-microvolt = <65000>;
345                    regulator-max-microvolt = <2225000>;
346                    regulator-always-on;
347                };
348
349                // ...
350
351                BUCK7 {
352                    regulator-name = "VCC_SUB_2.0V";
353                    regulator-min-microvolt = <2000000>;
354                    regulator-max-microvolt = <2000000>;
355                    regulator-always-on;
356                };
357
358                ESAFEOUT1 {
359                    regulator-name = "SAFEOUT1";
360                };
361
362                ESAFEOUT2 {
363                    regulator-name = "SAFEOUT2";
364                    regulator-boot-on;
365                };
366
367                EN32KHZ_AP {
368                    regulator-name = "EN32KHZ_AP";
369                    regulator-always-on;
370                };
371
372                EN32KHZ_CP {
373                    regulator-name = "EN32KHZ_CP";
374                    regulator-always-on;
375                };
376
377                CHARGER {
378                    regulator-name = "CHARGER";
379                    regulator-min-microamp = <200000>;
380                    regulator-max-microamp = <950000>;
381                };
382
383                CHARGER_CV {
384                    regulator-name = "CHARGER_CV";
385                    regulator-min-microvolt = <4200000>;
386                    regulator-max-microvolt = <4200000>;
387                    regulator-always-on;
388                };
389
390                CHARGER_TOPOFF {
391                    regulator-name = "CHARGER_TOPOFF";
392                    regulator-min-microamp = <200000>;
393                    regulator-max-microamp = <200000>;
394                    regulator-always-on;
395                };
396            };
397        };
398    };
399
400  - |
401    #include <dt-bindings/interrupt-controller/irq.h>
402
403    i2c {
404        #address-cells = <1>;
405        #size-cells = <0>;
406
407        pmic@66 {
408            compatible = "maxim,max8997-pmic";
409            reg = <0x66>;
410
411            interrupt-parent = <&gpx0>;
412            interrupts = <4 IRQ_TYPE_LEVEL_LOW>,
413                         <3 IRQ_TYPE_EDGE_FALLING>;
414            pinctrl-names = "default";
415            pinctrl-0 = <&max8997_irq>;
416
417            max8997,pmic-buck1-dvs-voltage = <1350000>;
418            max8997,pmic-buck2-dvs-voltage = <1100000>;
419            max8997,pmic-buck5-dvs-voltage = <1200000>;
420
421            regulators {
422                LDO1 {
423                    regulator-name = "VDD_ABB_3.3V";
424                    regulator-min-microvolt = <3300000>;
425                    regulator-max-microvolt = <3300000>;
426                };
427
428                // ...
429
430                BUCK1 {
431                    regulator-name = "VDD_ARM_1.2V";
432                    regulator-min-microvolt = <950000>;
433                    regulator-max-microvolt = <1350000>;
434                    regulator-always-on;
435                    regulator-boot-on;
436                };
437
438                // ...
439
440                EN32KHZ_AP {
441                    regulator-name = "EN32KHZ_AP";
442                    regulator-always-on;
443                };
444            };
445        };
446    };
447