xref: /linux/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml (revision 0c7c237b1c35011ef0b8d30c1d5c20bc6ae7b69b)
1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/regulator/gpio-regulator.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: GPIO controlled regulators
8
9maintainers:
10  - Liam Girdwood <lgirdwood@gmail.com>
11  - Mark Brown <broonie@kernel.org>
12
13description:
14  Any property defined as part of the core regulator binding, defined in
15  regulator.txt, can also be used.
16
17allOf:
18  - $ref: regulator.yaml#
19
20properties:
21  compatible:
22    const: regulator-gpio
23
24  regulator-name: true
25
26  enable-gpios:
27    description: GPIO to use to enable/disable the regulator.
28      Warning, the GPIO phandle flags are ignored and the GPIO polarity is
29      controlled solely by the presence of "enable-active-high" DT property.
30      This is due to compatibility with old DTs.
31    maxItems: 1
32
33  gpios:
34    description: Array of one or more GPIO pins used to select the regulator
35      voltage/current listed in "states".
36    minItems: 1
37    maxItems: 8  # Should be enough...
38
39  gpios-states:
40    description: |
41      On operating systems, that don't support reading back gpio values in
42      output mode (most notably linux), this array provides the state of GPIO
43      pins set when requesting them from the gpio controller. Systems, that are
44      capable of preserving state when requesting the lines, are free to ignore
45      this property.
46        0: LOW
47        1: HIGH
48      Default is LOW if nothing else is specified.
49    $ref: /schemas/types.yaml#/definitions/uint32-array
50    maxItems: 8
51    items:
52      enum: [0, 1]
53      default: 0
54
55  states:
56    description: Selection of available voltages/currents provided by this
57      regulator and matching GPIO configurations to achieve them. If there are
58      no states in the "states" array, use a fixed regulator instead.
59    $ref: /schemas/types.yaml#/definitions/uint32-matrix
60    maxItems: 8
61    items:
62      items:
63        - description: Voltage in microvolts
64        - description: GPIO group state value
65
66  startup-delay-us:
67    description: startup time in microseconds
68
69  enable-active-high:
70    description: Polarity of "enable-gpio" GPIO is active HIGH. Default is
71      active LOW.
72    type: boolean
73
74  gpio-open-drain:
75    description:
76      GPIO is open drain type. If this property is missing then default
77      assumption is false.
78    type: boolean
79
80  regulator-type:
81    description: Specifies what is being regulated.
82    $ref: /schemas/types.yaml#/definitions/string
83    enum:
84      - voltage
85      - current
86    default: voltage
87
88  vin-supply:
89    description: Input supply phandle.
90
91required:
92  - compatible
93  - regulator-name
94  - gpios
95  - states
96
97unevaluatedProperties: false
98
99examples:
100  - |
101    gpio-regulator {
102      compatible = "regulator-gpio";
103
104      regulator-name = "mmci-gpio-supply";
105      regulator-min-microvolt = <1800000>;
106      regulator-max-microvolt = <2600000>;
107      regulator-boot-on;
108
109      enable-gpios = <&gpio0 23 0x4>;
110      gpios = <&gpio0 24 0x4
111        &gpio0 25 0x4>;
112      states = <1800000 0x3>,
113        <2200000 0x2>,
114        <2600000 0x1>,
115        <2900000 0x0>;
116
117      startup-delay-us = <100000>;
118      enable-active-high;
119    };
120...
121