summaryrefslogtreecommitdiff
path: root/drivers/regulator/da9211-regulator.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2018-02-12 14:17:02 +0100
committerMark Brown <broonie@kernel.org>2018-02-16 17:05:52 +0000
commit11da04af0d3b4c24ab057dd17f54dbc854d735de (patch)
tree64b2dac11d0b4be9115cfe271a497f5ef436b1af /drivers/regulator/da9211-regulator.c
parent8d05560d1d011e5a842556efdbd70cc8a21499bb (diff)
regulator: da9211: Pass descriptors instead of GPIO numbers
This augments the DA9211 regulator driver to fetch its GPIO descriptors directly from the device tree using the newly exported devm_get_gpiod_from_child(). Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/da9211-regulator.c')
-rw-r--r--drivers/regulator/da9211-regulator.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index 9b8f47617724..6c122b3df5d0 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -15,7 +15,6 @@
*/
#include <linux/err.h>
-#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -25,7 +24,7 @@
#include <linux/regmap.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
-#include <linux/of_gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/da9211.h>
#include "da9211-regulator.h"
@@ -294,9 +293,12 @@ 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);
+ pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev,
+ da9211_matches[i].of_node,
+ "enable",
+ 0,
+ GPIOD_OUT_HIGH,
+ "da9211-enable");
n++;
}
@@ -382,13 +384,10 @@ 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;
- }
+ if (chip->pdata->gpiod_ren[i])
+ config.ena_gpiod = chip->pdata->gpiod_ren[i];
+ else
+ config.ena_gpiod = NULL;
chip->rdev[i] = devm_regulator_register(chip->dev,
&da9211_regulators[i], &config);