summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-rcar.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2013-06-17 08:41:52 +0900
committerLinus Walleij <linus.walleij@linaro.org>2013-06-17 10:34:36 +0200
commitae9550f635533b1ca5d0b50e24a720426ad237c6 (patch)
treee705e0d097e9110b4c581ab34e99d0624f0b5995 /drivers/gpio/gpio-rcar.c
parentcd73891647a19f4b52f23d23f5c68175b93b56fe (diff)
downloadop-kernel-dev-ae9550f635533b1ca5d0b50e24a720426ad237c6.zip
op-kernel-dev-ae9550f635533b1ca5d0b50e24a720426ad237c6.tar.gz
gpio-rcar: Use OUTDT when reading GPIOs configured as output
Testing on r8a7790 shows that INDT does not indicate the correct pin state when reading a GPIO configured as output, so update the gpio_rcar_get() function to handle this case. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-rcar.c')
-rw-r--r--drivers/gpio/gpio-rcar.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index b4ca450..6b78ad9 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -214,7 +214,14 @@ static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset)
{
- return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & BIT(offset));
+ u32 bit = BIT(offset);
+
+ /* testing on r8a7790 shows that INDT does not show correct pin state
+ * when configured as output, so use OUTDT in case of output pins */
+ if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit)
+ return (int)(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit);
+ else
+ return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit);
}
static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)
OpenPOWER on IntegriCloud