pinctrl: sun4i: GPIOs configured as irq must be set to input before reading
authorHans de Goede <hdegoede@redhat.com>
Sun, 8 Mar 2015 21:13:57 +0000 (22:13 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 18 Mar 2015 09:56:46 +0000 (10:56 +0100)
commitef6d24cc7f5b2b5c4184eddb039e2add6231a122
treee32481835c8e61ef2dc01c7e1ea797c9c8206c00
parentbd8733738c5af6114dd15d340b3f8713e9b624c2
pinctrl: sun4i: GPIOs configured as irq must be set to input before reading

On sun4i-a10, when GPIOs are configured as external interrupt the value for
them in the data register does not seem to get updated, so set their mux to
input (and restore afterwards) when reading the pin.

Missed edges seem to be buffered, so this does not introduce a race
condition.

I've also tested this on sun5i-a13 and sun7i-a20 and those do not seem to
be affected, the input value representation in the data register does seem
to correctly get updated to the actual pin value while in irq mode there.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
drivers/pinctrl/sunxi/pinctrl-sunxi.c
drivers/pinctrl/sunxi/pinctrl-sunxi.h