openwrt/package/kernel
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
..
acx-mac80211 adm5120: Remove unmaintained target 2019-05-03 21:27:12 +02:00
ar7-atm ar7-atm: fix function signatures with expected ones 2017-10-29 23:41:00 +01:00
ath10k-ct ath10k-ct: adjust tx power reduction for US regulatory domain 2019-06-15 00:40:25 +02:00
avila-wdt build: use KERNEL_MAKE_FLAGS for kernel file compilations 2017-10-29 16:17:05 +01:00
brcm2708-gpu-fw brcm2708-gpu-fw: add fw required for camera module 2018-12-05 00:39:53 +02:00
broadcom-wl broadcom-wl: fix compilation with 4.14 2018-02-11 23:15:05 +01:00
button-hotplug button-hotplug: add KEY_POWER2 handling 2019-05-30 11:55:50 +02:00
cryptodev-linux cryptodev-linux: Update to 1.10 2019-01-12 19:09:43 +01:00
dtc/patches package: kernel: dtc: Add DTO support 2017-11-06 16:39:41 +01:00
gpio-button-hotplug gpio-button-hotplug: unify polled and interrupt code 2019-07-19 17:04:30 +02:00
gpio-nct5104d kernel: gpio-nct5104d remove boardname check 2018-07-12 08:51:27 +02:00
hwmon-gsc build: use KERNEL_MAKE_FLAGS for kernel file compilations 2017-10-29 16:17:05 +01:00
i2c-gpio-custom i2c-gpio-custom: Adapt to moved include file 2018-12-15 14:28:48 +01:00
kmod-sched-cake kernel: Remove support for kernel 3.18 2019-05-03 22:41:38 +02:00
lantiq ltq-atm/ltq-ptm: re-enable/fix reset_ppe() functionality for VR9 2019-03-10 16:49:31 +01:00
leds-apu2 kernel: leds-apu2 remove boardname check 2018-07-16 15:12:17 +02:00
linux netsupport: move out mqprio from kmod-sched 2019-07-08 16:28:27 +02:00
mac80211 mac80211: Do not build b43legacy on BRCM47xx mips74 subtarget 2019-07-12 01:27:16 +02:00
mt76 kernel: Remove support for kernel 3.18 2019-05-03 22:41:38 +02:00
mwlwifi mwlwifi: Fix pcie timeout issue 2019-04-01 10:05:49 +02:00
nat46 nat46: Fix mirror hash 2019-02-07 11:15:11 +01:00
om-watchdog treewide: use the generic board_name function 2017-07-15 23:13:34 +02:00
rtc-rv5c386a build: use KERNEL_MAKE_FLAGS for kernel file compilations 2017-10-29 16:17:05 +01:00
rtl8812au-ct kernel: Remove support for kernel 3.18 2019-05-03 22:41:38 +02:00
spi-gpio-custom kernel: Deactivate *-gpio-custom drivers for 4.19 2018-12-15 14:28:48 +01:00
trelay trelay: Install hotplug and config files as 600 2018-09-19 09:41:28 +01:00
w1-gpio-custom kernel: Deactivate *-gpio-custom drivers for 4.19 2018-12-15 14:28:48 +01:00