Skip to contentSkip to conversation

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

PATCH Applied Andreas Kemnade 2 participants 2 messages Nov 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: gpio-keys - do not rely on debouncing capabilities of dedicated irqs

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")
---
 drivers/input/keyboard/gpio_keys.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/input/keyboard/gpio_keys.c +9 -5
index f1c31c5366f0..5813a5c82026 100644
@@ -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
Signature · 1 line
2.47.3
maintainer Applied
#1 lore raw
Quoted 6 lines · Andreas Kemnade

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")

Applied, thank you.

Signature · 1 line
Dmitry