immortalwrt/package/kernel
David Bauer 9cf12ba1d3 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]
2021-08-27 12:29:23 +08:00
..
acx-mac80211 acx-mac80211: replace dead URLs with OpenWrt CDN 2021-02-08 12:12:02 +08:00
ar7-atm fix permission 2019-09-30 14:27:46 +08:00
ath10k-ct ath10k-ct: add security fixes 2021-07-03 17:26:16 +08:00
avila-wdt fix permission 2019-09-30 13:42:16 +08:00
bcm27xx-gpu-fw bcm27xx-gpu-fw: update to latest version 2021-05-05 01:18:01 +08:00
broadcom-wl treewide: unify OpenWrt hosted source via @OPENWRT 2021-02-08 12:11:32 +08:00
button-hotplug fix permission 2019-09-30 14:27:46 +08:00
cryptodev-linux cryptodev-linux: bump to 1.11 2020-10-05 23:37:17 +08:00
dtc/patches fix & merge 2019-09-30 13:21:19 +08:00
exfat Revert "exfat: update to 5.12.3" 2021-06-15 18:20:54 +08:00
fast-classifier package lean: move to LuCI feeds 2021-05-14 23:12:28 +08:00
fullconenat package lean: move to LuCI feeds 2021-05-14 23:12:28 +08:00
gpio-button-hotplug gpio-button-hotplug: unify polled and interrupt code 2021-08-27 12:29:23 +08:00
gpio-nct5104d kernel: drop outdated kernel version switches for local code 2020-05-24 11:28:11 +08:00
gpio-nxp-74hc153 packages: kernel: add gpio-nxp-74hc153 2021-03-23 11:26:20 +08:00
hwmon-gsc fix permission 2019-09-30 13:42:16 +08:00
i2c-gpio-custom fix permission 2019-09-30 14:27:46 +08:00
kmod-sched-cake-oot sched-cake-oot: add missing constraints for kernel 4.9 2020-11-01 11:35:46 +08:00
lantiq treewide: unify OpenWrt hosted source via @OPENWRT 2021-02-08 12:11:32 +08:00
linux kmod-qlcnic: add missing deps 2021-08-18 22:13:40 +08:00
mac80211 mac80211: distance config: allow "auto" as a value 2021-06-26 02:47:40 +08:00
mt76 package: fix cmake packages build with ninja 2021-06-13 12:01:10 +08:00
mt7601u-ap treewide: move kernel pacakges from ctcgfw to kernel 2021-03-23 17:46:58 +08:00
mt-drivers package lean: move to LuCI feeds 2021-05-14 23:12:28 +08:00
mwlwifi mwlwifi: add PKG_FLAGS:=nonshared 2021-03-25 23:28:47 +08:00
nat46 nat46: fix translation of ICMP protocols parameter problem and unreachable 2021-08-02 12:02:17 +08:00
om-watchdog package: drop PKG_VERSION for purely local packages 2020-07-16 20:15:59 +08:00
qntfs-driver treewide: move kernel pacakges from ctcgfw to kernel 2021-03-23 17:46:58 +08:00
r8125 r8125: bump to 9.005.06 2021-06-12 01:06:24 +08:00
r8152 r8152: Update to 2.15 2021-05-29 01:00:30 +08:00
r8168 r8168: update to 8.049.01 2021-08-08 20:24:21 +08:00
rtc-rv5c386a kernel: drop outdated kernel version switches for local code 2020-05-24 11:28:11 +08:00
rtl88x2bu treewide: move kernel pacakges from ctcgfw to kernel 2021-03-23 17:46:58 +08:00
rtl8188eu treewide: move kernel pacakges from ctcgfw to kernel 2021-03-23 17:46:58 +08:00
rtl8189es rtl8189es: update to latest git HEAD 2021-04-28 23:50:30 +08:00
rtl8192du ntlf9t: move packages to packages feed 2021-03-29 23:13:57 +08:00
rtl8812au-ac rtl8812au-ac: update to latest git HEAD 2021-06-19 18:10:31 +08:00
rtl8812au-ct Merge Lean's source 2020-02-01 00:36:16 +08:00
rtl8821cu treewide: move kernel pacakges from ctcgfw to kernel 2021-03-23 17:46:58 +08:00
shortcut-fe package lean: move to LuCI feeds 2021-05-14 23:12:28 +08:00
spi-gpio-custom fix permission 2019-09-30 14:27:46 +08:00
trelay package: drop PKG_VERSION for purely local packages 2020-07-16 20:15:59 +08:00
w1-gpio-custom fix permission 2019-09-30 14:27:46 +08:00