diff options
author | James Ban <james.ban.opensource@diasemi.com> | 2015-01-27 19:28:08 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-28 12:38:14 -0500 |
commit | 8c7dd8bce05345ca5fe249b64782e8feeb3b9259 (patch) | |
tree | 5f05ba25f52d9b01cf613fb2e1c5fc744ff0c018 /drivers/regulator | |
parent | 076c3b8e03e2737659a89660bb8e54e13587d974 (diff) |
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index 8e6957c63a69..01343419555e 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/regmap.h> | 24 | #include <linux/regmap.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/of_gpio.h> | ||
27 | #include <linux/regulator/of_regulator.h> | 28 | #include <linux/regulator/of_regulator.h> |
28 | #include <linux/regulator/da9211.h> | 29 | #include <linux/regulator/da9211.h> |
29 | #include "da9211-regulator.h" | 30 | #include "da9211-regulator.h" |
@@ -277,6 +278,9 @@ static struct da9211_pdata *da9211_parse_regulators_dt( | |||
277 | 278 | ||
278 | pdata->init_data[n] = da9211_matches[i].init_data; | 279 | pdata->init_data[n] = da9211_matches[i].init_data; |
279 | pdata->reg_node[n] = da9211_matches[i].of_node; | 280 | pdata->reg_node[n] = da9211_matches[i].of_node; |
281 | pdata->gpio_ren[n] = | ||
282 | of_get_named_gpio(da9211_matches[i].of_node, | ||
283 | "enable-gpios", 0); | ||
280 | n++; | 284 | n++; |
281 | } | 285 | } |
282 | 286 | ||
@@ -366,6 +370,14 @@ static int da9211_regulator_init(struct da9211 *chip) | |||
366 | config.regmap = chip->regmap; | 370 | config.regmap = chip->regmap; |
367 | config.of_node = chip->pdata->reg_node[i]; | 371 | config.of_node = chip->pdata->reg_node[i]; |
368 | 372 | ||
373 | if (gpio_is_valid(chip->pdata->gpio_ren[i])) { | ||
374 | config.ena_gpio = chip->pdata->gpio_ren[i]; | ||
375 | config.ena_gpio_initialized = true; | ||
376 | } else { | ||
377 | config.ena_gpio = -EINVAL; | ||
378 | config.ena_gpio_initialized = false; | ||
379 | } | ||
380 | |||
369 | chip->rdev[i] = devm_regulator_register(chip->dev, | 381 | chip->rdev[i] = devm_regulator_register(chip->dev, |
370 | &da9211_regulators[i], &config); | 382 | &da9211_regulators[i], &config); |
371 | if (IS_ERR(chip->rdev[i])) { | 383 | if (IS_ERR(chip->rdev[i])) { |