[U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value

Peng Fan van.freenix at gmail.com
Sat Mar 12 06:19:04 CET 2016


Before set value for a gpio, need to set its direction to
output first.

Signed-off-by: Peng Fan <van.freenix at gmail.com>
Cc: Przemyslaw Marczak <p.marczak at samsung.com>
Cc: Simon Glass <sjg at chromium.org>
---
 drivers/power/regulator/fixed.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index d053817..1b0d193 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -95,6 +95,11 @@ static int fixed_regulator_set_enable(struct udevice *dev, bool enable)
 	if (!dev_pdata->gpio.dev)
 		return -ENOSYS;
 
+	ret = dm_gpio_set_dir_flags(&dev_pdata->gpio, GPIOD_IS_OUT);
+	if (ret) {
+		error("Can't set out direction : %s gpio\n", dev->name);
+		return ret;
+	}
 	ret = dm_gpio_set_value(&dev_pdata->gpio, enable);
 	if (ret) {
 		error("Can't set regulator : %s gpio to: %d\n", dev->name,
-- 
2.6.2



More information about the U-Boot mailing list