aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-rcar.c
diff options
context:
space:
mode:
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 6ec82f76f019..e8198dd68615 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -232,7 +232,14 @@ static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
232 232
233static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset) 233static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset)
234{ 234{
235 return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & BIT(offset)); 235 u32 bit = BIT(offset);
236
237 /* testing on r8a7790 shows that INDT does not show correct pin state
238 * when configured as output, so use OUTDT in case of output pins */
239 if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit)
240 return (int)(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit);
241 else
242 return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit);
236} 243}
237 244
238static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value) 245static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)