On 2019-12-12 2:09 p.m., Hamish Martin 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@xxxxxxxxxxxxxxxxxxx>
---
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index 831a9318c384..c79e91eb1a47 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -288,6 +288,11 @@ static int iproc_gpio_irq_set_type(struct irq_data *d, unsigned int type)
rising_or_high);
raw_spin_unlock_irqrestore(&chip->lock, flags);
+ if (type & IRQ_TYPE_EDGE_BOTH)
+ irq_set_handler_locked(d, handle_edge_irq);
+ else
+ irq_set_handler_locked(d, handle_level_irq);
+
I think it would make more sense to put them under the above spinlock
protection, right?
In addition, with this, can the default assignment in 'iproc_gpio_probe'
be removed?
girq->handler = handle_simple_irq;
Thanks,
Ray
dev_dbg(chip->dev,
"gpio:%u level_triggered:%d dual_edge:%d rising_or_high:%d\n",
gpio, level_triggered, dual_edge, rising_or_high);