linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <philipp.zabel@gmail.com>
To: linux-input@atrey.karlin.mff.cuni.cz
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Paul Sokolovsky <pmiscml@gmail.com>
Subject: [PATCH] gpio-keys
Date: Thu, 15 Feb 2007 12:06:59 +0100	[thread overview]
Message-ID: <1171537620.27151.5.camel@localhost.localdomain> (raw)

Now that the common GPIO API is in mainline, gpio-keys should use it.
This adds support for at least SA1100 and S3C24xx CPUs.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>

Index: linux-2.6/drivers/input/keyboard/Kconfig
===================================================================
--- linux-2.6.orig/drivers/input/keyboard/Kconfig	2007-02-15 10:18:58.000000000 +0100
+++ linux-2.6/drivers/input/keyboard/Kconfig	2007-02-15 10:20:03.000000000 +0100
@@ -216,10 +216,10 @@
 
 config KEYBOARD_GPIO
         tristate "Buttons on CPU GPIOs (PXA)"
-        depends on ARCH_PXA
+	depends on (ARCH_SA1100 || ARCH_PXA || ARCH_S3C2410)
 	help
 	  This driver implements support for buttons connected
-	  directly to GPIO pins of PXA CPUs.
+	  directly to GPIO pins of SA1100, PXA or S3C24xx CPUs.
 
 	  Say Y here if your device has buttons connected
 	  directly to GPIO pins of the CPU.
Index: linux-2.6/drivers/input/keyboard/gpio_keys.c
===================================================================
--- linux-2.6.orig/drivers/input/keyboard/gpio_keys.c	2007-02-15 10:17:05.000000000 +0100
+++ linux-2.6/drivers/input/keyboard/gpio_keys.c	2007-02-15 10:18:18.000000000 +0100
@@ -24,7 +24,7 @@
 #include <linux/input.h>
 #include <linux/irq.h>
 
-#include <asm/arch/pxa-regs.h>
+#include <asm/gpio.h>
 #include <asm/arch/hardware.h>
 
 #include <asm/hardware/gpio_keys.h>
@@ -38,8 +38,8 @@
 
 	for (i = 0; i < pdata->nbuttons; i++) {
 		int gpio = pdata->buttons[i].gpio;
-		if (irq == IRQ_GPIO(gpio)) {
-			int state = ((GPLR(gpio) & GPIO_bit(gpio)) ? 1 : 0) ^ (pdata->buttons[i].active_low);
+		if (irq == gpio_to_irq(gpio)) {
+			int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low);
 
 			input_report_key(input, pdata->buttons[i].keycode, state);
 			input_sync(input);
@@ -75,7 +75,7 @@
 
 	for (i = 0; i < pdata->nbuttons; i++) {
 		int code = pdata->buttons[i].keycode;
-		int irq = IRQ_GPIO(pdata->buttons[i].gpio);
+		int irq = gpio_to_irq(pdata->buttons[i].gpio);
 
 		set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
 		error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
@@ -98,7 +98,7 @@
 
  fail:
 	for (i = i - 1; i >= 0; i--)
-		free_irq(IRQ_GPIO(pdata->buttons[i].gpio), pdev);
+		free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev);
 
 	input_free_device(input);
 
@@ -112,7 +112,7 @@
 	int i;
 
 	for (i = 0; i < pdata->nbuttons; i++) {
-		int irq = IRQ_GPIO(pdata->buttons[i].gpio);
+		int irq = gpio_to_irq(pdata->buttons[i].gpio);
 		free_irq(irq, pdev);
 	}
 

             reply	other threads:[~2007-02-15 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-15 11:06 Philipp Zabel [this message]
2007-02-15 12:19 ` [PATCH] gpio-keys Philipp Zabel
2007-02-15 20:03 ` 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=1171537620.27151.5.camel@localhost.localdomain \
    --to=philipp.zabel@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=pmiscml@gmail.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;
as well as URLs for NNTP newsgroup(s).