summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2013-08-06 15:29:18 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 13:39:34 -0700
commit1c9a121ff05c8a03a2c387c3b2c14081e7494d70 (patch)
treeff724bae47ad0e5107428c825f33608607ee90ea /drivers/regulator
parent786997285942b7b4a149adab6e1d3c1fcde72014 (diff)
regulator: tps51632: add support for GPIO to control rails
The TPS51632 regulator is externally controlled by default and this can be connected to the GPIO on some system. Add support to pass the GPIO number to control the rail through GPIOs. Change-Id: I602a6a3e5c489b54dc9ead75476429c0d44f76d0 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/258664
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps51632-regulator.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index f91ede3562f8..a30e9861d566 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -26,6 +26,7 @@
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/init.h>
+#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -385,7 +386,13 @@ static int tps51632_probe(struct i2c_client *client,
config.driver_data = tps;
config.regmap = tps->regmap;
config.of_node = client->dev.of_node;
-
+ if (pdata->ena_gpio) {
+ config.ena_gpio = pdata->ena_gpio;
+ config.ena_gpio_flags = GPIOF_OUT_INIT_HIGH;
+ } else {
+ config.ena_gpio = -EINVAL;
+ config.ena_gpio_flags = 0;
+ }
rdev = regulator_register(&tps->desc, &config);
if (IS_ERR(rdev)) {
dev_err(tps->dev, "regulator register failed\n");