1 From d0342f6cc0388862a8e62b4b77f1c4c011385e9a Mon Sep 17 00:00:00 2001
2 From: Holger Freyther <zecke@openmoko.org>
3 Date: Fri, 25 Jul 2008 23:06:03 +0100
4 Subject: [PATCH] Add GPIO -> IRQ for the s3c2410 and add irq_to_gpio to the gpio.h of the Samsung SoC
6 Use this irq_to_gpio in the neo1973 keyboard driver
8 drivers/input/keyboard/neo1973kbd.c | 19 ++++++-------------
9 include/asm-arm/arch-s3c2410/gpio.h | 5 ++---
10 2 files changed, 8 insertions(+), 16 deletions(-)
12 diff --git a/drivers/input/keyboard/neo1973kbd.c b/drivers/input/keyboard/neo1973kbd.c
13 index b413bc8..06fa8e0 100644
14 --- a/drivers/input/keyboard/neo1973kbd.c
15 +++ b/drivers/input/keyboard/neo1973kbd.c
18 struct input_dev *input;
19 unsigned int suspended;
25 static irqreturn_t neo1973kbd_aux_irq(int irq, void *dev_id)
27 struct neo1973kbd *neo1973kbd_data = dev_id;
29 - int key_pressed = !gpio_get_value(neo1973kbd_data->gpio_aux);
30 + int key_pressed = !gpio_get_value(irq_to_gpio(irq));
31 input_report_key(neo1973kbd_data->input, KEY_PHONE, key_pressed);
32 input_sync(neo1973kbd_data->input);
34 @@ -48,7 +45,7 @@ static irqreturn_t neo1973kbd_hold_irq(int irq, void *dev_id)
36 struct neo1973kbd *neo1973kbd_data = dev_id;
38 - int key_pressed = gpio_get_value(neo1973kbd_data->gpio_hold);
39 + int key_pressed = gpio_get_value(irq_to_gpio(irq));
40 input_report_key(neo1973kbd_data->input, KEY_PAUSE, key_pressed);
41 input_sync(neo1973kbd_data->input);
43 @@ -59,7 +56,7 @@ static irqreturn_t neo1973kbd_headphone_irq(int irq, void *dev_id)
45 struct neo1973kbd *neo1973kbd_data = dev_id;
47 - int key_pressed = gpio_get_value(neo1973kbd_data->gpio_jack);
48 + int key_pressed = gpio_get_value(irq_to_gpio(irq));
49 input_report_switch(neo1973kbd_data->input,
50 SW_HEADPHONE_INSERT, key_pressed);
51 input_sync(neo1973kbd_data->input);
52 @@ -107,19 +104,15 @@ static int neo1973kbd_probe(struct platform_device *pdev)
53 if (pdev->resource[0].flags != 0)
56 - neo1973kbd->gpio_aux = pdev->resource[0].start;
57 - neo1973kbd->gpio_hold = pdev->resource[1].start;
58 - neo1973kbd->gpio_jack = pdev->resource[2].start;
60 - irq_aux = gpio_to_irq(neo1973kbd->gpio_aux);
61 + irq_aux = gpio_to_irq(pdev->resource[0].start);
65 - irq_hold = gpio_to_irq(neo1973kbd->gpio_hold);
66 + irq_hold = gpio_to_irq(pdev->resource[1].start);
70 - irq_jack = gpio_to_irq(neo1973kbd->gpio_jack);
71 + irq_jack = gpio_to_irq(pdev->resource[2].start);
75 diff --git a/include/asm-arm/arch-s3c2410/gpio.h b/include/asm-arm/arch-s3c2410/gpio.h
76 index 7583895..1b96c4e 100644
77 --- a/include/asm-arm/arch-s3c2410/gpio.h
78 +++ b/include/asm-arm/arch-s3c2410/gpio.h
79 @@ -61,8 +61,7 @@ static inline int gpio_direction_output(unsigned gpio, int value)
80 #define gpio_to_irq(gpio) s3c2400_gpio_getirq(gpio)
82 #define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio)
83 +#define irq_to_gpio(irq) s3c2410_irq_to_gpio(irq)
86 -/* FIXME implement irq_to_gpio() */
89 +#include <asm-generic/gpio.h>