From: Joonyoung Shim <dofmind@gmail.com>
To: Tony Lindgren <tony@atomide.com>,
David Brownell <dbrownell@users.sourceforge.net>
Cc: linux-arm-kernel@lists.arm.linux.org.uk,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org
Subject: [PATCH] twl4030-gpio: Fix getting the value of the TWL4030 GPIO output pin
Date: Sat, 7 Feb 2009 15:13:35 +0900 [thread overview]
Message-ID: <4e1455be0902062213o769a4d15ha0c892508839dbad@mail.gmail.com> (raw)
If TWL4030 GPIO pin is output, must read the value from REG_GPIODATAOUTx
register in twl4030_get_gpio_datainout().
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c
index afad147..890518a 100644
--- a/drivers/gpio/twl4030-gpio.c
+++ b/drivers/gpio/twl4030-gpio.c
@@ -183,7 +183,7 @@ static int twl4030_set_gpio_dataout(int gpio, int enable)
return gpio_twl4030_write(base, d_msk);
}
-static int twl4030_get_gpio_datain(int gpio)
+static int twl4030_get_gpio_datainout(int gpio)
{
u8 d_bnk = gpio >> 3;
u8 d_off = gpio & 0x7;
@@ -194,7 +194,17 @@ static int twl4030_get_gpio_datain(int gpio)
|| !(gpio_usage_count & BIT(gpio))))
return -EPERM;
- base = REG_GPIODATAIN1 + d_bnk;
+ base = REG_GPIODATADIR1 + d_bnk;
+ ret = gpio_twl4030_read(base);
+ if (ret > 0)
+ ret = (ret >> d_off) & 0x1;
+ else
+ return ret;
+
+ if (ret)
+ base = REG_GPIODATAOUT1 + d_bnk;
+ else
+ base = REG_GPIODATAIN1 + d_bnk;
ret = gpio_twl4030_read(base);
if (ret > 0)
ret = (ret >> d_off) & 0x1;
next reply other threads:[~2009-02-07 6:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 6:13 Joonyoung Shim [this message]
2009-02-07 8:00 ` David Brownell
2009-02-09 13:02 ` Joonyoung Shim
2009-02-12 2:16 ` David Brownell
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=4e1455be0902062213o769a4d15ha0c892508839dbad@mail.gmail.com \
--to=dofmind@gmail.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.com \
/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
Powered by JetHome