regulator: gpio: add gpios-status for DT
config->gpios[x].flags indicates initial pin status, and it will be used for drvdata->state on gpio_regulator_probe(). But, current of_get_gpio_regulator_config() doesn't care about this flags. This patch adds new gpios-status property in order to care about initial pin status. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
9c25960cbb
commit
0094050d78
|
@ -8,6 +8,7 @@ Required properties:
|
||||||
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.
|
||||||
|
- gpios-states : gpios pin's initial states. 1 means HIGH
|
||||||
- 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).
|
||||||
|
|
||||||
|
|
|
@ -172,11 +172,22 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
|
||||||
if (!config->gpios)
|
if (!config->gpios)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
prop = of_find_property(np, "gpios-states", NULL);
|
||||||
|
if (prop) {
|
||||||
|
proplen = prop->length / sizeof(int);
|
||||||
|
if (proplen != config->nr_gpios) {
|
||||||
|
/* gpios <-> gpios-states mismatch */
|
||||||
|
prop = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < config->nr_gpios; i++) {
|
for (i = 0; i < config->nr_gpios; i++) {
|
||||||
gpio = of_get_named_gpio(np, "gpios", i);
|
gpio = of_get_named_gpio(np, "gpios", i);
|
||||||
if (gpio < 0)
|
if (gpio < 0)
|
||||||
break;
|
break;
|
||||||
config->gpios[i].gpio = gpio;
|
config->gpios[i].gpio = gpio;
|
||||||
|
if (prop && be32_to_cpup((int *)prop->value + i))
|
||||||
|
config->gpios[i].flags = GPIOF_OUT_INIT_HIGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fetch states. */
|
/* Fetch states. */
|
||||||
|
|
Loading…
Reference in New Issue