[PATCH] gpio: ath79: Clear pending IRQs

Linus Walleij linus.walleij at linaro.org
Sat Jun 15 04:18:48 EDT 2019


The ath79 gpio driver may emit "ghost interrupts" because
pending IRQs are sitting in the latches when we probe the
driver. It appears this GPIO block clears interrupts by
reading the status register, so read that and toss the
result before adding the gpio irqchip.

Reported-by: David Bauer <mail at david-bauer.net>
Reported-by: Christian Lamparter <chunkeey at gmail.com>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
 drivers/gpio/gpio-ath79.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
index 0a553d676042..39ccb48c03d5 100644
--- a/drivers/gpio/gpio-ath79.c
+++ b/drivers/gpio/gpio-ath79.c
@@ -290,6 +290,8 @@ static int ath79_gpio_probe(struct platform_device *pdev)
     if (np && !of_property_read_bool(np, "interrupt-controller"))
         return 0;

+    /* Clear any pending IRQs so we have a clean slate */
+    ath79_gpio_read(ctrl, AR71XX_GPIO_REG_INT_PENDING);
     err = gpiochip_irqchip_add(&ctrl->gc, &ath79_gpio_irqchip, 0,
                 handle_simple_irq, IRQ_TYPE_NONE);
     if (err) {
-- 
2.21.0

> I have to add that OpenWrt's
> gpio-button-hotplug.c (which registers the gpio-keys and
> gpio-keys-polled) is a special, out-of-tree module that sends broadcast
> events (netlink) rather than using the input-subsystem (again due
> to space issues).

This seems like a valid usecase. I guess it may be hard to drive
that solution home upstream but at some point it should at least
be discussed with Dmitry (the input maintainer) so he can give
his view on how resource constrained systems should handle
this.

I suspect the root cause is the "footprint problem" that hits IOT
devices like OpenWrt and I know Nicolas Pitre tried to drive
a few approaches upstream to get footprint down, but the
experience was somewhat discouraging.

I think it's a worthy cause though! Small memory systems
should be able to run Linux proper IMO, we just lack the
manpower to make it happen.

Yours,
Linus Walleij

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list