summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorJames Ban <james.ban.opensource@diasemi.com>2015-01-28 09:28:08 +0900
committerMark Brown <broonie@kernel.org>2015-01-28 17:38:14 +0000
commit8c7dd8bce05345ca5fe249b64782e8feeb3b9259 (patch)
tree5f05ba25f52d9b01cf613fb2e1c5fc744ff0c018 /drivers/regulator
parent076c3b8e03e2737659a89660bb8e54e13587d974 (diff)
downloadop-kernel-dev-8c7dd8bce05345ca5fe249b64782e8feeb3b9259.zip
op-kernel-dev-8c7dd8bce05345ca5fe249b64782e8feeb3b9259.tar.gz
regulator: da9211: Add gpio control for enable/disable of buck
This is a patch for adding gpio control about enable/disable of buck. Signed-off-by: James Ban <james.ban.opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/da9211-regulator.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index 8e6957c..0134341 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -24,6 +24,7 @@
#include <linux/regmap.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
+#include <linux/of_gpio.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/da9211.h>
#include "da9211-regulator.h"
@@ -277,6 +278,9 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
pdata->init_data[n] = da9211_matches[i].init_data;
pdata->reg_node[n] = da9211_matches[i].of_node;
+ pdata->gpio_ren[n] =
+ of_get_named_gpio(da9211_matches[i].of_node,
+ "enable-gpios", 0);
n++;
}
@@ -366,6 +370,14 @@ static int da9211_regulator_init(struct da9211 *chip)
config.regmap = chip->regmap;
config.of_node = chip->pdata->reg_node[i];
+ if (gpio_is_valid(chip->pdata->gpio_ren[i])) {
+ config.ena_gpio = chip->pdata->gpio_ren[i];
+ config.ena_gpio_initialized = true;
+ } else {
+ config.ena_gpio = -EINVAL;
+ config.ena_gpio_initialized = false;
+ }
+
chip->rdev[i] = devm_regulator_register(chip->dev,
&da9211_regulators[i], &config);
if (IS_ERR(chip->rdev[i])) {
OpenPOWER on IntegriCloud