Skip to content

Commit bb0bba7

Browse files
pcercueigregkh
authored andcommitted
pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ
commit 84e7a94 upstream. The PAT1 register contains information about the IRQ type (edge/level) for input GPIOs with IRQ enabled, and the direction for non-IRQ GPIOs. So it makes sense to read it only if the GPIO has no interrupt configured, otherwise input GPIOs configured for level IRQs are misdetected as output GPIOs. Fixes: ebd6651 ("pinctrl: ingenic: Implement .get_direction for GPIO chips") Reported-by: João Henrique <johnnyonflame@hotmail.com> Signed-off-by: Paul Cercueil <paul@crapouillou.net> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200622214548.265417-2-paul@crapouillou.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 974ca06 commit bb0bba7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/pinctrl/pinctrl-ingenic.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,8 @@ static int ingenic_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
16441644
unsigned int pin = gc->base + offset;
16451645

16461646
if (jzpc->version >= ID_JZ4760)
1647-
return ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1);
1647+
return ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_INT) ||
1648+
ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1);
16481649

16491650
if (ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_SELECT))
16501651
return true;

0 commit comments

Comments
 (0)