linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] Input: gpio_keys - fall back to platform_get_irq() for interrupt-only keys
@ 2025-08-17 22:47 Dmitry Torokhov
  2025-08-17 22:47 ` [PATCH 2/3] mfd: rohm-bd71828: Use software nodes for gpio-keys Dmitry Torokhov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2025-08-17 22:47 UTC (permalink / raw)
  To: Matti Vaittinen, Lee Jones
  Cc: Andy Shevchenko, Arnd Bergmann, Bartosz Golaszewski,
	Linus Walleij, linux-input, linux-kernel

To allow transitioning away from gpio-keys platform data attempt to
retrieve IRQ for interrupt-only keys using platform_get_irq_optional()
if interrupt is not specified in platform data.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/gpio_keys.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index f9db86da0818..f56e92f7d631 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -616,12 +616,19 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 			break;
 		}
 	} else {
-		if (!button->irq) {
-			dev_err(dev, "Found button without gpio or irq\n");
-			return -EINVAL;
-		}
+		if (button->irq) {
+			bdata->irq = button->irq;
+		} else {
+			irq = platform_get_irq_optional(pdev, idx);
+			if (irq < 0) {
+				error = irq;
+				return dev_err_probe(dev, error,
+						     "Unable to determine IRQ# for button #%d",
+						     idx);
+			}
 
-		bdata->irq = button->irq;
+			bdata->irq = irq;
+		}
 
 		if (button->type && button->type != EV_KEY) {
 			dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n");
-- 
2.51.0.rc1.163.g2494970778-goog


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

end of thread, other threads:[~2025-08-20 13:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-17 22:47 [PATCH 1/3] Input: gpio_keys - fall back to platform_get_irq() for interrupt-only keys Dmitry Torokhov
2025-08-17 22:47 ` [PATCH 2/3] mfd: rohm-bd71828: Use software nodes for gpio-keys Dmitry Torokhov
2025-08-18  6:54   ` Matti Vaittinen
2025-08-18  6:56     ` Matti Vaittinen
2025-08-18 17:11       ` Dmitry Torokhov
2025-08-19 10:49         ` Matti Vaittinen
2025-08-17 22:47 ` [PATCH 3/3] mfd: rohm-bd718x7: " Dmitry Torokhov
2025-08-18  6:57   ` Matti Vaittinen
2025-08-20 13:37 ` [PATCH 1/3] Input: gpio_keys - fall back to platform_get_irq() for interrupt-only keys Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).