[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231204203357.2897008-3-ben.wolsieffer@hefring.com>
Date: Mon, 4 Dec 2023 15:33:57 -0500
From: Ben Wolsieffer <ben.wolsieffer@...ring.com>
To: linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-gpio@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Linus Walleij <linus.walleij@...aro.org>,
Ben Wolsieffer <ben.wolsieffer@...ring.com>
Subject: [PATCH 2/2] pinctrl: stm32: fix GPIO level interrupts
The STM32 doesn't support GPIO level interrupts in hardware, so the
driver tries to emulate them using edge interrupts, by retriggering the
interrupt if necessary based on the pin state after the handler
finishes.
Currently, this functionality does not work because the irqchip uses
handle_edge_irq(), which doesn't run the irq_eoi() or irq_unmask()
callbacks after handling the interrupt. This patch fixes this by using
handle_level_irq() for level interrupts, which causes irq_unmask() to be
called to retrigger the interrupt.
Signed-off-by: Ben Wolsieffer <ben.wolsieffer@...ring.com>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 603f900e88c1..fb9532601cbb 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -348,12 +348,15 @@ static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
case IRQ_TYPE_EDGE_RISING:
case IRQ_TYPE_EDGE_FALLING:
case IRQ_TYPE_EDGE_BOTH:
+ irq_set_handler_locked(d, handle_edge_irq);
parent_type = type;
break;
case IRQ_TYPE_LEVEL_HIGH:
+ irq_set_handler_locked(d, handle_level_irq);
parent_type = IRQ_TYPE_EDGE_RISING;
break;
case IRQ_TYPE_LEVEL_LOW:
+ irq_set_handler_locked(d, handle_level_irq);
parent_type = IRQ_TYPE_EDGE_FALLING;
break;
default:
--
2.42.1
Powered by blists - more mailing lists