[OpenWrt-Devel] [PATCH] gpio-button-hotplug: gpio-keys: read initial state

Linus Walleij linus.walleij at linaro.org
Sat Jun 15 04:26:54 EDT 2019

On Fri, Jun 14, 2019 at 9:28 PM Christian Lamparter <chunkeey at gmail.com> wrote:

> Maybe he can point to a specifc reason why the interrupt gets triggered
> when the module is loaded and how to handle it. Because this behavior
> seems to be common between different platforms now and the upstream
> gpio-keys (which does work differently!) seems to handle it just fine.
> @Linus: Do you have any inside knowledge about the issue? That when
> gpio-keys is loaded (in OpenWrt it's a module due to kernel size
> constraint on various routers) the associated interrupt fires and
> this results in a ghost key event.

Without any detailed knowledge I'd say the most common cause
is the underlying GPIO chip implementation. There are often transient
line events when the system is powered up and initialized and it
is often necessary for the gpio_chip driver to clear any interrupt
flags in hardware before setting up the gpio chip, especially the
irqchip portions of it.

I tried to half-guess what gpio chip this is using and since it
is WiFi pro 1200e I guess ths gpio driver is
drivers/gpio-ath79.c which does indeed initialize an
irqchip without clearing the interrupts first.

Can you try this patch, if this solves the problem I will commit
it upstream as well:

More information about the openwrt-devel mailing list