diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-01-30 21:25:14 -0800 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2015-02-04 11:13:27 +0100 |
commit | f2e95aae9ea3c62dfdf4420d20341a7eded56a81 (patch) | |
tree | 212b7732137db58ee8b0b3ae8db640388fa927d5 /drivers/regulator | |
parent | 379a5826d20f872add220fea9a679de015d8b57b (diff) | |
download | linux-stable-f2e95aae9ea3c62dfdf4420d20341a7eded56a81.tar.gz linux-stable-f2e95aae9ea3c62dfdf4420d20341a7eded56a81.tar.bz2 linux-stable-f2e95aae9ea3c62dfdf4420d20341a7eded56a81.zip |
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>
(cherry picked from commit 0094050d783bbadffe83effef11a0bda901153ce)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/gpio-regulator.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index bad44f366b3f..ac3a8c732dd8 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -172,11 +172,22 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) if (!config->gpios) 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++) { gpio = of_get_named_gpio(np, "gpios", i); if (gpio < 0) break; config->gpios[i].gpio = gpio; + if (prop && be32_to_cpup((int *)prop->value + i)) + config->gpios[i].flags = GPIOF_OUT_INIT_HIGH; } /* Fetch states. */ |