Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: Convert gpio-regulator to json-schema

Convert the gpio-regulator binding to DT schema format using
json-schema.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Rob Herring and committed by
Mark Brown
673e401e 1914a996

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