mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: gpio-keys - do not rely on debouncing capabilities of dedicated irqs
@ 2026-11-04 18:50 Andreas Kemnade
  2026-11-04 23:43 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Kemnade @ 2026-11-04 18:50 UTC (permalink / raw)
  To: dmitry.torokhov, andreas, arnd, marco.crivellari,
	bartosz.golaszewski, tony, linux-input, linux-kernel, brgl,
	linux-omap

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@kemnade.info>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-04 23:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 18:50 [PATCH] Input: gpio-keys - do not rely on debouncing capabilities of dedicated irqs Andreas Kemnade
2026-11-04 23:43 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®