1# Copyright 2023 EPAM Systems
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  GPIO-controlled voltage of regulators
6
7  Example of dts node:
8    vccq_sd0: regulator-vccq-sd0 {
9      compatible = "regulator-gpio";
10
11      regulator-name = "SD0 VccQ";
12      regulator-min-microvolt = <1800000>;
13      regulator-max-microvolt = <3300000>;
14
15      enable-gpios = <&gpio5 3 GPIO_ACTIVE_HIGH>;
16
17      gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>, <&gpio5 2 GPIO_ACTIVE_HIGH>;
18      states = <3300000 2>, <2700000 1>, <1800000 0>;
19
20      regulator-boot-on;
21    };
22
23  In the above example, three GPIO pins are used for controlling the regulator:
24    * two of them for controlling voltage;
25    * third for enabling/disabling the regulator.
26
27include:
28  - name: base.yaml
29  - name: regulator.yaml
30    property-allowlist:
31      - regulator-name
32      - regulator-init-microvolt
33      - regulator-min-microvolt
34      - regulator-max-microvolt
35      - regulator-always-on
36      - regulator-boot-on
37      - startup-delay-us
38
39compatible: "regulator-gpio"
40
41properties:
42  regulator-name:
43    required: true
44
45  gpios:
46    type: phandle-array
47    required: true
48    description: |
49      GPIO to use to switch voltage.
50
51  states:
52    type: array
53    description: |
54      Selection of available voltages provided by this regulator and matching
55      GPIO configurations to achieve them. If there are no states in the
56      "states" array, use a fixed regulator instead. First value in an array
57      item is voltage in microvolts and the second is GPIO group state value.
58
59  enable-gpios:
60    type: phandle-array
61    description: |
62      GPIO to use to enable/disable the regulator.
63
64      Unlike the gpio property in the Linux bindings this array must provide
65      the GPIO polarity and open-drain status in the phandle selector. The
66      Linux enable-active-high and gpio-open-drain properties are not valid
67      for Zephyr devicetree files. Moreover, the driver isn't capable of
68      working with more than one GPIO and this property does not have a state
69      array. The driver simply sets or clears the appropriate GPIO bit when
70      it is requested to enable or disable the regulator.
71
72      Example:
73        enable-gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>;
74