aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2007-02-18 01:40:46 -0500
committerDmitry Torokhov <dtor@insightbb.com>2007-02-18 01:40:46 -0500
commit0d98f6bbd8d62c2c7a9924e0b3e5068cc28173b0 (patch)
treee5a5b9560acd4454f1a1b34e2a5cfcd9c5d31c9e /drivers/input
parent1efa770f8ef0bfe12cd004f2e1f75eefcd8699d3 (diff)
Input: gpio-keys - switch to common GPIO API
This adds support for at least SA1100 and S3C24xx CPUs. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/Kconfig6
-rw-r--r--drivers/input/keyboard/gpio_keys.c15
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1b81a72e19d9..64509689fa65 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -215,11 +215,11 @@ config KEYBOARD_AAED2000
215 module will be called aaed2000_kbd. 215 module will be called aaed2000_kbd.
216 216
217config KEYBOARD_GPIO 217config KEYBOARD_GPIO
218 tristate "Buttons on CPU GPIOs (PXA)" 218 tristate "Buttons on CPU GPIOs (PXA)"
219 depends on ARCH_PXA 219 depends on (ARCH_SA1100 || ARCH_PXA || ARCH_S3C2410)
220 help 220 help
221 This driver implements support for buttons connected 221 This driver implements support for buttons connected
222 directly to GPIO pins of PXA CPUs. 222 directly to GPIO pins of SA1100, PXA or S3C24xx CPUs.
223 223
224 Say Y here if your device has buttons connected 224 Say Y here if your device has buttons connected
225 directly to GPIO pins of the CPU. 225 directly to GPIO pins of the CPU.
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 7ad479e4e3b3..fa03a00b4c6d 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -24,7 +24,7 @@
24#include <linux/input.h> 24#include <linux/input.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26 26
27#include <asm/arch/pxa-regs.h> 27#include <asm/gpio.h>
28#include <asm/arch/hardware.h> 28#include <asm/arch/hardware.h>
29 29
30#include <asm/hardware/gpio_keys.h> 30#include <asm/hardware/gpio_keys.h>
@@ -38,8 +38,8 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
38 38
39 for (i = 0; i < pdata->nbuttons; i++) { 39 for (i = 0; i < pdata->nbuttons; i++) {
40 int gpio = pdata->buttons[i].gpio; 40 int gpio = pdata->buttons[i].gpio;
41 if (irq == IRQ_GPIO(gpio)) { 41 if (irq == gpio_to_irq(gpio)) {
42 int state = ((GPLR(gpio) & GPIO_bit(gpio)) ? 1 : 0) ^ (pdata->buttons[i].active_low); 42 int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low);
43 43
44 input_report_key(input, pdata->buttons[i].keycode, state); 44 input_report_key(input, pdata->buttons[i].keycode, state);
45 input_sync(input); 45 input_sync(input);
@@ -75,14 +75,15 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
75 75
76 for (i = 0; i < pdata->nbuttons; i++) { 76 for (i = 0; i < pdata->nbuttons; i++) {
77 int code = pdata->buttons[i].keycode; 77 int code = pdata->buttons[i].keycode;
78 int irq = IRQ_GPIO(pdata->buttons[i].gpio); 78 int irq = gpio_to_irq(pdata->buttons[i].gpio);
79 79
80 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); 80 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
81 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, 81 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
82 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys", 82 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys",
83 pdev); 83 pdev);
84 if (error) { 84 if (error) {
85 printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", irq, ret); 85 printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n",
86 irq, error);
86 goto fail; 87 goto fail;
87 } 88 }
88 set_bit(code, input->keybit); 89 set_bit(code, input->keybit);
@@ -98,7 +99,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
98 99
99 fail: 100 fail:
100 for (i = i - 1; i >= 0; i--) 101 for (i = i - 1; i >= 0; i--)
101 free_irq(IRQ_GPIO(pdata->buttons[i].gpio), pdev); 102 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev);
102 103
103 input_free_device(input); 104 input_free_device(input);
104 105
@@ -112,7 +113,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
112 int i; 113 int i;
113 114
114 for (i = 0; i < pdata->nbuttons; i++) { 115 for (i = 0; i < pdata->nbuttons; i++) {
115 int irq = IRQ_GPIO(pdata->buttons[i].gpio); 116 int irq = gpio_to_irq(pdata->buttons[i].gpio);
116 free_irq(irq, pdev); 117 free_irq(irq, pdev);
117 } 118 }
118 119