diff options
-rw-r--r-- | Documentation/devicetree/bindings/regulator/gpio-regulator.txt | 3 | ||||
-rw-r--r-- | drivers/regulator/gpio-regulator.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt index f71f8083c2ae..63c659800c03 100644 --- a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt | |||
@@ -2,11 +2,12 @@ GPIO controlled regulators | |||
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : Must be "regulator-gpio". | 4 | - compatible : Must be "regulator-gpio". |
5 | - states : Selection of available voltages and GPIO configs. | ||
6 | if there are no states, then use a fixed regulator | ||
5 | 7 | ||
6 | Optional properties: | 8 | Optional properties: |
7 | - enable-gpio : GPIO to use to enable/disable the regulator. | 9 | - enable-gpio : GPIO to use to enable/disable the regulator. |
8 | - gpios : GPIO group used to control voltage. | 10 | - gpios : GPIO group used to control voltage. |
9 | - states : Selection of available voltages and GPIO configs. | ||
10 | - startup-delay-us : Startup time in microseconds. | 11 | - startup-delay-us : Startup time in microseconds. |
11 | - enable-active-high : Polarity of GPIO is active high (default is low). | 12 | - enable-active-high : Polarity of GPIO is active high (default is low). |
12 | 13 | ||
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index faa2f712eb0d..dc9260545b80 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c | |||
@@ -183,6 +183,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) | |||
183 | 183 | ||
184 | /* Fetch states. */ | 184 | /* Fetch states. */ |
185 | prop = of_find_property(np, "states", NULL); | 185 | prop = of_find_property(np, "states", NULL); |
186 | if (!prop) { | ||
187 | dev_err(dev, "No 'states' property found\n"); | ||
188 | return ERR_PTR(-EINVAL); | ||
189 | } | ||
190 | |||
186 | proplen = prop->length / sizeof(int); | 191 | proplen = prop->length / sizeof(int); |
187 | 192 | ||
188 | config->states = devm_kzalloc(dev, | 193 | config->states = devm_kzalloc(dev, |