[PATCH] Input: gpio-keys - do not rely on debouncing capabilities of dedicated irqs

From: Andreas Kemnade

Date: Wed Nov 04 2026 - 14:31:08 EST


If no GPIO interrupts are used, these IRQs are unlikely subject to the same
debouncing mechanisms as a GPIO interrupt would be, so stick to software
debouncing. Experienced on OMAP4 using pinctrl IRQs.

Fixes: 3717194f2492 ("Input: gpio-keys - add system suspend support for dedicated wakeirqs")
Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
---
drivers/input/keyboard/gpio_keys.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index f1c31c5366f0..5813a5c82026 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -554,12 +554,16 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
bool active_low = gpiod_is_active_low(bdata->gpiod);

if (button->debounce_interval) {
- error = gpiod_set_debounce(bdata->gpiod,
+ /* do not rely on non-gpio irqs being subject to debouncing measures */
+ if ((button->irq || button->wakeirq)) {
+ bdata->software_debounce = button->debounce_interval;
+ } else {
+ error = gpiod_set_debounce(bdata->gpiod,
button->debounce_interval * 1000);
- /* use timer if gpiolib doesn't provide debounce */
- if (error < 0)
- bdata->software_debounce =
- button->debounce_interval;
+ /* use timer if gpiolib doesn't provide debounce */
+ if (error < 0)
+ bdata->software_debounce = button->debounce_interval;
+ }

/*
* If reading the GPIO won't sleep, we can use a
--
2.47.3