summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorVignesh R <vigneshr@ti.com>2016-12-07 11:25:06 (GMT)
committerTom Rini <trini@konsulko.com>2016-12-27 13:22:57 (GMT)
commitbd2e9714c851770652253fab858cb50ecd95d329 (patch)
treef2fc4c7c6ad8e44367e7b5f20c5c6a6f3b1c3287 /drivers/power
parentd26a38fd615466e2d62baa577423ac06d2601d8f (diff)
downloadu-boot-bd2e9714c851770652253fab858cb50ecd95d329.tar.xz
regulator: fixed: Add support to handle enable-active-high DT property
Add support to handle enable-active-high DT property. This property is used to drive the gpio controlling fixed regulator as active high when claiming gpio line. Signed-off-by: Vignesh R <vigneshr@ti.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/regulator/fixed.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index 62dc47f..3d2d908 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -27,6 +27,8 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
struct dm_regulator_uclass_platdata *uc_pdata;
struct fixed_regulator_platdata *dev_pdata;
struct gpio_desc *gpio;
+ const void *blob = gd->fdt_blob;
+ int node = dev->of_offset, flags = GPIOD_IS_OUT;
int ret;
dev_pdata = dev_get_platdata(dev);
@@ -37,9 +39,12 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
/* Set type to fixed */
uc_pdata->type = REGULATOR_TYPE_FIXED;
+ if (fdtdec_get_bool(blob, node, "enable-active-high"))
+ flags |= GPIOD_IS_OUT_ACTIVE;
+
/* Get fixed regulator optional enable GPIO desc */
gpio = &dev_pdata->gpio;
- ret = gpio_request_by_name(dev, "gpio", 0, gpio, GPIOD_IS_OUT);
+ ret = gpio_request_by_name(dev, "gpio", 0, gpio, flags);
if (ret) {
debug("Fixed regulator optional enable GPIO - not found! Error: %d\n",
ret);