18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci%YAML 1.2
38c2ecf20Sopenharmony_ci---
48c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/regulator/gpio-regulator.yaml#
58c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cititle: GPIO controlled regulators
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cimaintainers:
108c2ecf20Sopenharmony_ci  - Liam Girdwood <lgirdwood@gmail.com>
118c2ecf20Sopenharmony_ci  - Mark Brown <broonie@kernel.org>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cidescription:
148c2ecf20Sopenharmony_ci  Any property defined as part of the core regulator binding, defined in
158c2ecf20Sopenharmony_ci  regulator.txt, can also be used.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciallOf:
188c2ecf20Sopenharmony_ci  - $ref: "regulator.yaml#"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciproperties:
218c2ecf20Sopenharmony_ci  compatible:
228c2ecf20Sopenharmony_ci    const: regulator-gpio
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci  regulator-name: true
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci  enable-gpios:
278c2ecf20Sopenharmony_ci    description: GPIO to use to enable/disable the regulator.
288c2ecf20Sopenharmony_ci      Warning, the GPIO phandle flags are ignored and the GPIO polarity is
298c2ecf20Sopenharmony_ci      controlled solely by the presence of "enable-active-high" DT property.
308c2ecf20Sopenharmony_ci      This is due to compatibility with old DTs.
318c2ecf20Sopenharmony_ci    maxItems: 1
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci  gpios:
348c2ecf20Sopenharmony_ci    description: Array of one or more GPIO pins used to select the regulator
358c2ecf20Sopenharmony_ci      voltage/current listed in "states".
368c2ecf20Sopenharmony_ci    minItems: 1
378c2ecf20Sopenharmony_ci    maxItems: 8  # Should be enough...
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci  gpios-states:
408c2ecf20Sopenharmony_ci    description: |
418c2ecf20Sopenharmony_ci      On operating systems, that don't support reading back gpio values in
428c2ecf20Sopenharmony_ci      output mode (most notably linux), this array provides the state of GPIO
438c2ecf20Sopenharmony_ci      pins set when requesting them from the gpio controller. Systems, that are
448c2ecf20Sopenharmony_ci      capable of preserving state when requesting the lines, are free to ignore
458c2ecf20Sopenharmony_ci      this property.
468c2ecf20Sopenharmony_ci        0: LOW
478c2ecf20Sopenharmony_ci        1: HIGH
488c2ecf20Sopenharmony_ci      Default is LOW if nothing else is specified.
498c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32-array
508c2ecf20Sopenharmony_ci    maxItems: 8
518c2ecf20Sopenharmony_ci    items:
528c2ecf20Sopenharmony_ci      enum: [0, 1]
538c2ecf20Sopenharmony_ci      default: 0
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci  states:
568c2ecf20Sopenharmony_ci    description: Selection of available voltages/currents provided by this
578c2ecf20Sopenharmony_ci      regulator and matching GPIO configurations to achieve them. If there are
588c2ecf20Sopenharmony_ci      no states in the "states" array, use a fixed regulator instead.
598c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32-matrix
608c2ecf20Sopenharmony_ci    maxItems: 8
618c2ecf20Sopenharmony_ci    items:
628c2ecf20Sopenharmony_ci      items:
638c2ecf20Sopenharmony_ci        - description: Voltage in microvolts
648c2ecf20Sopenharmony_ci        - description: GPIO group state value
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci  startup-delay-us:
678c2ecf20Sopenharmony_ci    description: startup time in microseconds
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci  enable-active-high:
708c2ecf20Sopenharmony_ci    description: Polarity of "enable-gpio" GPIO is active HIGH. Default is
718c2ecf20Sopenharmony_ci      active LOW.
728c2ecf20Sopenharmony_ci    type: boolean
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci  gpio-open-drain:
758c2ecf20Sopenharmony_ci    description:
768c2ecf20Sopenharmony_ci      GPIO is open drain type. If this property is missing then default
778c2ecf20Sopenharmony_ci      assumption is false.
788c2ecf20Sopenharmony_ci    type: boolean
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci  regulator-type:
818c2ecf20Sopenharmony_ci    description: Specifies what is being regulated.
828c2ecf20Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/string
838c2ecf20Sopenharmony_ci    enum:
848c2ecf20Sopenharmony_ci      - voltage
858c2ecf20Sopenharmony_ci      - current
868c2ecf20Sopenharmony_ci    default: voltage
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_cirequired:
898c2ecf20Sopenharmony_ci  - compatible
908c2ecf20Sopenharmony_ci  - regulator-name
918c2ecf20Sopenharmony_ci  - gpios
928c2ecf20Sopenharmony_ci  - states
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciunevaluatedProperties: false
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ciexamples:
978c2ecf20Sopenharmony_ci  - |
988c2ecf20Sopenharmony_ci    gpio-regulator {
998c2ecf20Sopenharmony_ci      compatible = "regulator-gpio";
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci      regulator-name = "mmci-gpio-supply";
1028c2ecf20Sopenharmony_ci      regulator-min-microvolt = <1800000>;
1038c2ecf20Sopenharmony_ci      regulator-max-microvolt = <2600000>;
1048c2ecf20Sopenharmony_ci      regulator-boot-on;
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci      enable-gpios = <&gpio0 23 0x4>;
1078c2ecf20Sopenharmony_ci      gpios = <&gpio0 24 0x4
1088c2ecf20Sopenharmony_ci        &gpio0 25 0x4>;
1098c2ecf20Sopenharmony_ci      states = <1800000 0x3>,
1108c2ecf20Sopenharmony_ci        <2200000 0x2>,
1118c2ecf20Sopenharmony_ci        <2600000 0x1>,
1128c2ecf20Sopenharmony_ci        <2900000 0x0>;
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci      startup-delay-us = <100000>;
1158c2ecf20Sopenharmony_ci      enable-active-high;
1168c2ecf20Sopenharmony_ci    };
1178c2ecf20Sopenharmony_ci...
118