* [PATCH v2 0/1] pinctrl: iproc: Fix level interrupt handling
@ 2019-12-15 21:05 Hamish Martin
2019-12-15 21:05 ` [PATCH v2 1/1] pinctrl: iproc: Set irq handler based on trig type Hamish Martin
0 siblings, 1 reply; 3+ messages in thread
From: Hamish Martin @ 2019-12-15 21:05 UTC (permalink / raw)
To: linus.walleij, rjui, sbranden; +Cc: linux-gpio, linux-arm-kernel, Hamish Martin
An issue is seen on the BCM56060 SoC using the pinctrl-iproc-gpio.c driver
for one of its GPIO blocks.
When a GPIO on this block is used as a level sensitive interrupt the
downstream handler is not invoked until the level returns to its previous
(non-interrupting) state. This makes the level sensitive interrupts
unusable. Edge sensitive interrupts are not affected.
The fix is to simply ensure that we use a more appropriate handler
(handle_level_irq) for the interrupt based on what trigger type has been
configured.
Similar setting of the handler is done in numerous other drivers.
v2: Fixes for Ray Jui's review comments.
Hamish Martin (1):
pinctrl: iproc: Set irq handler based on trig type
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--
2.24.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] pinctrl: iproc: Set irq handler based on trig type
2019-12-15 21:05 [PATCH v2 0/1] pinctrl: iproc: Fix level interrupt handling Hamish Martin
@ 2019-12-15 21:05 ` Hamish Martin
2019-12-16 9:43 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Hamish Martin @ 2019-12-15 21:05 UTC (permalink / raw)
To: linus.walleij, rjui, sbranden; +Cc: linux-gpio, linux-arm-kernel, Hamish Martin
Rather than always using handle_simple_irq() as the gpio_irq_chip
handler, set a more appropriate handler based on the IRQ trigger type
requested.
This is important for level triggered interrupts which need to be
masked during handling.
Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
---
v2: Alterations based on Ray Jui's review comments
- shift setting of handler type inside spinlocked region
- install handle_bad_irq as default handler for uninitialised interrupts
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index 831a9318c384..aa9b5ba1bf38 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -286,6 +286,12 @@ static int iproc_gpio_irq_set_type(struct irq_data *d, unsigned int type)
iproc_set_bit(chip, IPROC_GPIO_INT_DE_OFFSET, gpio, dual_edge);
iproc_set_bit(chip, IPROC_GPIO_INT_EDGE_OFFSET, gpio,
rising_or_high);
+
+ if (type & IRQ_TYPE_EDGE_BOTH)
+ irq_set_handler_locked(d, handle_edge_irq);
+ else
+ irq_set_handler_locked(d, handle_level_irq);
+
raw_spin_unlock_irqrestore(&chip->lock, flags);
dev_dbg(chip->dev,
@@ -868,7 +874,7 @@ static int iproc_gpio_probe(struct platform_device *pdev)
return -ENOMEM;
girq->parents[0] = irq;
girq->default_type = IRQ_TYPE_NONE;
- girq->handler = handle_simple_irq;
+ girq->handler = handle_bad_irq;
}
ret = gpiochip_add_data(gc, chip);
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] pinctrl: iproc: Set irq handler based on trig type
2019-12-15 21:05 ` [PATCH v2 1/1] pinctrl: iproc: Set irq handler based on trig type Hamish Martin
@ 2019-12-16 9:43 ` Linus Walleij
0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2019-12-16 9:43 UTC (permalink / raw)
To: Hamish Martin; +Cc: Ray Jui, Scott Branden, open list:GPIO SUBSYSTEM, Linux ARM
On Sun, Dec 15, 2019 at 10:05 PM Hamish Martin
<hamish.martin@alliedtelesis.co.nz> wrote:
> Rather than always using handle_simple_irq() as the gpio_irq_chip
> handler, set a more appropriate handler based on the IRQ trigger type
> requested.
> This is important for level triggered interrupts which need to be
> masked during handling.
>
> Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
> ---
> v2: Alterations based on Ray Jui's review comments
> - shift setting of handler type inside spinlocked region
> - install handle_bad_irq as default handler for uninitialised interrupts
Patch applied. It just looks very good.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-16 9:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 21:05 [PATCH v2 0/1] pinctrl: iproc: Fix level interrupt handling Hamish Martin
2019-12-15 21:05 ` [PATCH v2 1/1] pinctrl: iproc: Set irq handler based on trig type Hamish Martin
2019-12-16 9:43 ` Linus Walleij
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).