gpio: rockchip: Reset int_bothedge when changing trigger
authorSamuel Holland <samuel@sholland.org>
Sat, 12 Feb 2022 20:50:48 +0000 (14:50 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2022 10:48:01 +0000 (11:48 +0100)
commit43221f446c0237e6823bbb043b680b004bd24cb6
treeeddc4ad3e53d294c27435d280667b192d6ed60e3
parent3c32405d6474a21f7d742828e73c13e326dcae82
gpio: rockchip: Reset int_bothedge when changing trigger

[ Upstream commit 7920af5c826cb4a7ada1ae26fdd317642805adc2 ]

With v2 hardware, an IRQ can be configured to trigger on both edges via
a bit in the int_bothedge register. Currently, the driver sets this bit
when changing the trigger type to IRQ_TYPE_EDGE_BOTH, but fails to reset
this bit if the trigger type is later changed to something else. This
causes spurious IRQs, and when using gpio-keys with wakeup-event-action
set to EV_ACT_(DE)ASSERTED, those IRQs translate into spurious wakeups.

Fixes: 3bcbd1a85b68 ("gpio/rockchip: support next version gpio controller")
Reported-by: Guillaume Savaton <guillaume@baierouge.fr>
Tested-by: Guillaume Savaton <guillaume@baierouge.fr>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-rockchip.c