summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-06-17 16:12:42 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-21 06:09:59 +0200
commitcee2e7acd1119dcbb123c903a5555ef660e7d643 (patch)
tree4760f91894bb8e8e39905eae31bc8c83f0193c1f /drivers/regulator
parent59f9a95b1697b92c5e0752a1475dd92f1d7b4434 (diff)
downloadbarebox-cee2e7acd1119dcbb123c903a5555ef660e7d643.tar.gz
regulator: fixed: Use gpiod
Switch to gpiod_get() which makes the implementation a bit more straight forward. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210617141242.545-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/fixed.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 160a55163f..e35b294fb2 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -20,10 +20,10 @@
#include <of.h>
#include <of_gpio.h>
#include <gpio.h>
+#include <gpiod.h>
struct regulator_fixed {
int gpio;
- int active_low;
int always_on;
struct regulator_dev rdev;
struct regulator_desc rdesc;
@@ -36,7 +36,7 @@ static int regulator_fixed_enable(struct regulator_dev *rdev)
if (!gpio_is_valid(fix->gpio))
return 0;
- return gpio_direction_output(fix->gpio, !fix->active_low);
+ return gpio_direction_active(fix->gpio, true);
}
static int regulator_fixed_disable(struct regulator_dev *rdev)
@@ -49,7 +49,7 @@ static int regulator_fixed_disable(struct regulator_dev *rdev)
if (!gpio_is_valid(fix->gpio))
return 0;
- return gpio_direction_output(fix->gpio, fix->active_low);
+ return gpio_direction_active(fix->gpio, false);
}
const static struct regulator_ops fixed_ops = {
@@ -60,7 +60,6 @@ const static struct regulator_ops fixed_ops = {
static int regulator_fixed_probe(struct device_d *dev)
{
struct regulator_fixed *fix;
- enum of_gpio_flags gpioflags;
int ret;
if (!dev->device_node)
@@ -70,14 +69,11 @@ static int regulator_fixed_probe(struct device_d *dev)
fix->gpio = -EINVAL;
if (of_get_property(dev->device_node, "gpio", NULL)) {
- fix->gpio = of_get_named_gpio_flags(dev->device_node, "gpio", 0, &gpioflags);
+ fix->gpio = gpiod_get(dev, NULL, GPIOD_ASIS);
if (fix->gpio < 0) {
ret = fix->gpio;
goto err;
}
-
- if (gpioflags & OF_GPIO_ACTIVE_LOW)
- fix->active_low = 1;
}
fix->rdesc.ops = &fixed_ops;