public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value
Date: Sat, 12 Mar 2016 13:19:04 +0800	[thread overview]
Message-ID: <1457759944-8306-1-git-send-email-van.freenix@gmail.com> (raw)

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

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@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

             reply	other threads:[~2016-03-12  5:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12  5:19 Peng Fan [this message]
2016-03-13  2:51 ` [U-Boot] [PATCH] power: regulator: fixed: set gpio direction before set value Simon Glass
2016-03-13  9:19   ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457759944-8306-1-git-send-email-van.freenix@gmail.com \
    --to=van.freenix@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox