openwrt/package
David Bauer 6d59f4eeb4 gpio-button-hotplug: unify polled and interrupt code
This patch unifies the polled and interrupt-driven gpio_keys code
paths as well implements consistent handling of the debounce
interval set for the GPIO buttons and switches.

Hotplug events will only be fired if

1. The input changes its state and remains stable for the duration
   of the debounce interval (default is 5 ms).

2. In the initial stable (no state-change for duration of the
   debounce interval) state once the driver module gets loaded.

   Switch type inputs will always report their stable state.
   Unpressed buttons will not trigger an event for the initial
   stable state. Whereas pressed buttons will trigger an event.
   This is consistent with upstream's gpio-key driver that uses
   the input subsystem (and dont use autorepeat).

Prior to this patch, this was handled inconsistently for interrupt-based
an polled gpio-keys. Hence this patch unifies the shared logic into the
gpio_keys_handle_button() function and modify both implementations to
handle the initial state properly.

The changes described in 2. ) . can have an impact on the
failsafe trigger. Up until now, the script checked for button
state changes. On the down side, this allowed to trigger the
failsafe by releasing a held button at the right time. On the
plus side, the button's polarity setting didn't matter.

Now, the failsafe will only engage when a button was pressed
at the right moment (same as before), but now it can
theoretically also trigger when the button was pressed the
whole time the kernel booted and well into the fast-blinking
preinit phase. However, the chances that this can happen are
really small. This is because the gpio-button module is usually
up and ready even before the preinit state is entered. So, the
initial pressed button event gets lost and most devices behave
as before.

Bisectors: If this patch causes a device to permanently go into
failsafe or experience weird behavior due to inputs, please
check the following:
 - the GPIO polarity setting for the button
 - the software-debounce value

Run-tested for 'gpio-keys' and 'gpio-keys-polled' on

 - devolo WiFi pro 1200e
 - devolo WiFi pro 1750c
 - devolo WiFi pro 1750x
 - Netgear WNDR4700
 - Meraki MR24
 - RT-AC58U

Signed-off-by: David Bauer <mail@david-bauer.net>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [further
cleanups, simplification and unification]
(cherry picked from commit 27f3f493de)
2019-07-19 17:04:30 +02:00
..
base-files base-files: Fix path check in get_mac_binary 2019-07-09 23:08:10 +02:00
boot mvebu: fix regression for non-generic ESPRESSObin versions 2019-06-28 21:52:57 +02:00
devel valgrind: Add support for ARM64 architecture 2019-05-14 20:28:41 +02:00
firmware layerscape: drop ppa package 2019-06-06 15:40:09 +02:00
kernel gpio-button-hotplug: unify polled and interrupt code 2019-07-19 17:04:30 +02:00
libs libroxml: bump to the 3.0.2 version 2019-07-16 14:13:07 +02:00
network openvpn: fix handling of list options 2019-07-17 20:11:41 +02:00
system fstools: add direct dependencies on libblobmsg-json and libjson-c 2019-07-15 00:48:13 +02:00
utils busybox: strip off ALTERNATIVES spec 2019-07-12 09:17:34 +00:00
Makefile build: add ABI_VERSION to binary package names 2019-01-19 14:32:12 +01:00