* [PATCH] pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH
@ 2022-08-08 2:51 João H. Spies
2022-08-22 9:03 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: João H. Spies @ 2022-08-08 2:51 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Heiko Stuebner, Jianqun Xu
Cc: Maya Matuszczyk, João H. Spies, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel
Switching between falling/rising edges for IRQ_TYPE_EDGE_BOTH on pins that
require debounce can cause the device to lose events due to a desync
between pin state and irq type.
This problem is resolved by switching between IRQ_TYPE_LEVEL_LOW and
IRQ_TYPE_LEVEL_HIGH instead.
Fixes: 936ee26 ("gpio/rockchip: add driver for rockchip gpio")
Signed-off-by: João H. Spies <jhlspies@gmail.com>
---
drivers/gpio/gpio-rockchip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 099e358d2491..48b948723077 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -417,11 +417,11 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
goto out;
} else {
bank->toggle_edge_mode |= mask;
- level |= mask;
+ level &= ~mask;
/*
* Determine gpio state. If 1 next interrupt should be
- * falling otherwise rising.
+ * low otherwise high.
*/
data = readl(bank->reg_base + bank->gpio_regs->ext_port);
if (data & mask)
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH
2022-08-08 2:51 [PATCH] pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH João H. Spies
@ 2022-08-22 9:03 ` Linus Walleij
2022-08-23 10:00 ` Heiko Stübner
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2022-08-22 9:03 UTC (permalink / raw)
To: João H. Spies
Cc: Bartosz Golaszewski, Heiko Stuebner, Jianqun Xu, Maya Matuszczyk,
linux-gpio, linux-arm-kernel, linux-rockchip, linux-kernel
On Mon, Aug 8, 2022 at 4:53 AM João H. Spies <jhlspies@gmail.com> wrote:
> Switching between falling/rising edges for IRQ_TYPE_EDGE_BOTH on pins that
> require debounce can cause the device to lose events due to a desync
> between pin state and irq type.
>
> This problem is resolved by switching between IRQ_TYPE_LEVEL_LOW and
> IRQ_TYPE_LEVEL_HIGH instead.
>
> Fixes: 936ee26 ("gpio/rockchip: add driver for rockchip gpio")
> Signed-off-by: João H. Spies <jhlspies@gmail.com>
No reaction from maintainers so I'm just gonna assume this fix is
correct and applied for fixes.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH
2022-08-22 9:03 ` Linus Walleij
@ 2022-08-23 10:00 ` Heiko Stübner
0 siblings, 0 replies; 3+ messages in thread
From: Heiko Stübner @ 2022-08-23 10:00 UTC (permalink / raw)
To: João H. Spies, Linus Walleij
Cc: Bartosz Golaszewski, Jianqun Xu, Maya Matuszczyk, linux-gpio,
linux-arm-kernel, linux-rockchip, linux-kernel
Am Montag, 22. August 2022, 11:03:08 CEST schrieb Linus Walleij:
> On Mon, Aug 8, 2022 at 4:53 AM João H. Spies <jhlspies@gmail.com> wrote:
>
> > Switching between falling/rising edges for IRQ_TYPE_EDGE_BOTH on pins that
> > require debounce can cause the device to lose events due to a desync
> > between pin state and irq type.
> >
> > This problem is resolved by switching between IRQ_TYPE_LEVEL_LOW and
> > IRQ_TYPE_LEVEL_HIGH instead.
> >
> > Fixes: 936ee26 ("gpio/rockchip: add driver for rockchip gpio")
> > Signed-off-by: João H. Spies <jhlspies@gmail.com>
>
> No reaction from maintainers so I'm just gonna assume this fix is
> correct and applied for fixes.
This plays with behavioral peculiarities of the gpio controller
(using the level setting to hopefully prevent missing edge irqs),
so doesn't follow
So I guess it really is more of a wait-and-see. And I guess as João
seems to have experienced that issue, that will hopefully work
for others too.
Heiko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-23 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-08 2:51 [PATCH] pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH João H. Spies
2022-08-22 9:03 ` Linus Walleij
2022-08-23 10:00 ` Heiko Stübner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).