linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-04  7:25 Y Vo
       [not found] ` <1433402712-21399-1-git-send-email-yvo-qTEPVZfXA3Y@public.gmane.org>
  2015-06-05 12:50 ` Arnd Bergmann
  0 siblings, 2 replies; 8+ messages in thread
From: Y Vo @ 2015-06-04  7:25 UTC (permalink / raw)
  To: linux-input, Dmitry Torokhov, linus.walleij, linux-gpio,
	devicetree, linux-arm-kernel
  Cc: Y Vo, Phong Vo, Toan Le, Loc Ho, Feng Kan, patches

GIC is designed to support two of trigger mechanisms - active level
high or edge rising. But in the gpio_keys driver, it tries to use both
edge rising and edge falling trigger. This patch fixes the gpio_keys
driver to request only the edge rising event when failed to configure the
interrupt.

Signed-off-by: Y Vo <yvo@apm.com>
---
 drivers/input/keyboard/gpio_keys.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ddf4045..7c3da2c 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -532,9 +532,23 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
 					     isr, irqflags, desc, bdata);
 	if (error < 0) {
-		dev_err(dev, "Unable to claim irq %d; error %d\n",
-			bdata->irq, error);
-		return error;
+		/*
+		 * Attempt to request again with only rising edge trigger
+		 */
+		if ((irqflags & (IRQ_TYPE_EDGE_RISING | IRQF_TRIGGER_FALLING))) {
+			irqflags = IRQ_TYPE_EDGE_RISING;
+			error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
+							     isr, irqflags, desc, bdata);
+			if (error < 0) {
+				dev_err(dev, "Unable to claim irq %d; error %d\n",
+					bdata->irq, error);
+				return error;
+			}
+		} else {
+			dev_err(dev, "Unable to claim irq %d; error %d\n",
+				bdata->irq, error);
+			return error;
+		}
 	}
 
 	return 0;
-- 
1.7.1


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

end of thread, other threads:[~2015-06-10 23:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-04  7:25 [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt Y Vo
     [not found] ` <1433402712-21399-1-git-send-email-yvo-qTEPVZfXA3Y@public.gmane.org>
2015-06-04 17:23   ` Dmitry Torokhov
2015-06-05  3:37     ` Feng Kan
2015-06-05  4:36       ` Dmitry Torokhov
2015-06-08  6:30   ` Uwe Kleine-König
2015-06-05 12:50 ` Arnd Bergmann
2015-06-08  2:48   ` Y Vo
2015-06-10 23:08     ` Arnd Bergmann

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