regulator: gpio-regulator: Catch 'no states property' misuse
A selection of voltage or current values (AKA states) should always be specified when using a GPIO regulator. If there are no switchable states then the fixed regulators should be used instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
f8a9f757cb
commit
216f2b9c95
|
@ -2,11 +2,12 @@ GPIO controlled regulators
|
||||||
|
|
||||||
Required properties:
|
Required properties:
|
||||||
- compatible : Must be "regulator-gpio".
|
- compatible : Must be "regulator-gpio".
|
||||||
|
- states : Selection of available voltages and GPIO configs.
|
||||||
|
if there are no states, then use a fixed regulator
|
||||||
|
|
||||||
Optional properties:
|
Optional properties:
|
||||||
- enable-gpio : GPIO to use to enable/disable the regulator.
|
- enable-gpio : GPIO to use to enable/disable the regulator.
|
||||||
- gpios : GPIO group used to control voltage.
|
- gpios : GPIO group used to control voltage.
|
||||||
- states : Selection of available voltages and GPIO configs.
|
|
||||||
- startup-delay-us : Startup time in microseconds.
|
- startup-delay-us : Startup time in microseconds.
|
||||||
- enable-active-high : Polarity of GPIO is active high (default is low).
|
- enable-active-high : Polarity of GPIO is active high (default is low).
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
|
||||||
|
|
||||||
/* Fetch states. */
|
/* Fetch states. */
|
||||||
prop = of_find_property(np, "states", NULL);
|
prop = of_find_property(np, "states", NULL);
|
||||||
|
if (!prop) {
|
||||||
|
dev_err(dev, "No 'states' property found\n");
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
proplen = prop->length / sizeof(int);
|
proplen = prop->length / sizeof(int);
|
||||||
|
|
||||||
config->states = devm_kzalloc(dev,
|
config->states = devm_kzalloc(dev,
|
||||||
|
|
Loading…
Reference in a new issue