aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/gpio_keys.c
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/keyboard/gpio_keys.c
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/keyboard/gpio_keys.c')
-rw-r--r--drivers/input/keyboard/gpio_keys.c15
1 files changed, 8 insertions, 7 deletions
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