[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87eh3o7mfc.wl%kuninori.morimoto.gx@gmail.com>
Date: Thu, 30 Jan 2014 21:25:14 -0800 (PST)
From: Kuninori Morimoto <kuninori.morimoto.gx@...il.com>
To: Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Lee Jones <lee.jones@...aro.org>
Cc: Simon <horms@...ge.net.au>, Magnus <magnus.damm@...il.com>,
Linux-SH <linux-sh@...r.kernel.org>, linux-kernel@...r.kernel.org
Subject: [PATCH] regulator: gpio: bugfix: add gpios-status for DT
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
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@...esas.com>
---
.../bindings/regulator/gpio-regulator.txt | 1 +
drivers/regulator/gpio-regulator.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt
index 63c6598..3ecb585 100644
--- a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt
@@ -8,6 +8,7 @@ Required properties:
Optional properties:
- enable-gpio : GPIO to use to enable/disable the regulator.
- gpios : GPIO group used to control voltage.
+- gpios-states : gpios pin's initial states. 1 means HIGH
- startup-delay-us : Startup time in microseconds.
- enable-active-high : Polarity of GPIO is active high (default is low).
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index c0a1d00..7c8e37a 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. */
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists