mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: dmitry.torokhov@gmail.com, andreas@kemnade.info, arnd@arndb.de,
	marco.crivellari@suse.com, bartosz.golaszewski@oss.qualcomm.com,
	tony@atomide.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, brgl@kernel.org,
	linux-omap@vger.kernel.org
Subject: [PATCH] Input: gpio-keys - do not rely on debouncing capabilities of dedicated irqs
Date: Wed,  4 Nov 2026 19:50:44 +0100	[thread overview]
Message-ID: <20261104185044.2551808-1-andreas@kemnade.info> (raw)

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


             reply	other threads:[~2026-11-04 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 18:50 Andreas Kemnade [this message]
2026-11-04 23:43 ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261104185044.2551808-1-andreas@kemnade.info \
    --to=andreas@kemnade.info \
    --cc=arnd@arndb.de \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=marco.crivellari@suse.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®