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