Skip to content

Commit

Permalink
gpio-rcar: Use OUTDT when reading GPIOs configured as output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Magnus Damm authored and Linus Walleij committed Jun 17, 2013
1 parent cd73891 commit ae9550f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/gpio/gpio-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ae9550f

Please sign in to comment.