add support for target 3c24xx (more known as Openmoko GTA02 "Freerunner") and merge...
[openwrt/svn-archive/archive.git] / target / linux / s3c24xx / patches / 0098-Fix-the-FIXME-store-the-GPIO-value-for-now.patch
1 From 4b1af3131a97c004c8cdc74b61fbdd00d3ab22e4 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] Fix the FIXME, store the GPIO value for now
5
6 Signed-Off-by: Holger Freyther <zecke@openmoko.org>
7 ---
8 drivers/input/keyboard/neo1973kbd.c | 23 +++++++++++++----------
9 1 files changed, 13 insertions(+), 10 deletions(-)
10
11 diff --git a/drivers/input/keyboard/neo1973kbd.c b/drivers/input/keyboard/neo1973kbd.c
12 index 30f324d..a77d8c0 100644
13 --- a/drivers/input/keyboard/neo1973kbd.c
14 +++ b/drivers/input/keyboard/neo1973kbd.c
15 @@ -23,20 +23,21 @@
16 #include <linux/slab.h>
17
18 #include <asm/hardware.h>
19 -#include <asm/arch/gta01.h>
20 #include <asm/mach-types.h>
21
22 struct neo1973kbd {
23 struct input_dev *input;
24 unsigned int suspended;
25 + int gpio_aux;
26 + int gpio_hold;
27 + int gpio_jack;
28 };
29
30 static irqreturn_t neo1973kbd_aux_irq(int irq, void *dev_id)
31 {
32 struct neo1973kbd *neo1973kbd_data = dev_id;
33
34 - /* FIXME: use GPIO from platform_dev resources */
35 - int key_pressed = !s3c2410_gpio_getpin(GTA01_GPIO_AUX_KEY);
36 + int key_pressed = !s3c2410_gpio_getpin(neo1973kbd_data->gpio_aux);
37 input_report_key(neo1973kbd_data->input, KEY_PHONE, key_pressed);
38 input_sync(neo1973kbd_data->input);
39
40 @@ -47,8 +48,7 @@ static irqreturn_t neo1973kbd_hold_irq(int irq, void *dev_id)
41 {
42 struct neo1973kbd *neo1973kbd_data = dev_id;
43
44 - /* FIXME: use GPIO from platform_dev resources */
45 - int key_pressed = 3c2410_gpio_getpin(GTA01_GPIO_HOLD_KEY);
46 + int key_pressed = s3c2410_gpio_getpin(neo1973kbd_data->gpio_hold);
47 input_report_key(neo1973kbd_data->input, KEY_PAUSE, key_pressed);
48 input_sync(neo1973kbd_data->input);
49
50 @@ -59,8 +59,7 @@ static irqreturn_t neo1973kbd_headphone_irq(int irq, void *dev_id)
51 {
52 struct neo1973kbd *neo1973kbd_data = dev_id;
53
54 - /* FIXME: use GPIO from platform_dev resources */
55 - int key_pressed = s3c2410_gpio_getpin(GTA01_GPIO_JACK_INSERT);
56 + int key_pressed = s3c2410_gpio_getpin(neo1973kbd_data->gpio_jack);
57 input_report_switch(neo1973kbd_data->input,
58 SW_HEADPHONE_INSERT, key_pressed);
59 input_sync(neo1973kbd_data->input);
60 @@ -108,15 +107,19 @@ static int neo1973kbd_probe(struct platform_device *pdev)
61 if (pdev->resource[0].flags != 0)
62 return -EINVAL;
63
64 - irq_aux = s3c2410_gpio_getirq(pdev->resource[0].start);
65 + neo1973kbd->gpio_aux = pdev->resource[0].start;
66 + neo1973kbd->gpio_hold = pdev->resource[1].start;
67 + neo1973kbd->gpio_jack = pdev->resource[2].start;
68 +
69 + irq_aux = s3c2410_gpio_getirq(neo1973kbd->gpio_aux);
70 if (irq_aux < 0)
71 return -EINVAL;
72
73 - irq_hold = s3c2410_gpio_getirq(pdev->resource[1].start);
74 + irq_hold = s3c2410_gpio_getirq(neo1973kbd->gpio_hold);
75 if (irq_hold < 0)
76 return -EINVAL;
77
78 - irq_jack = s3c2410_gpio_getirq(pdev->resource[2].start);
79 + irq_jack = s3c2410_gpio_getirq(neo1973kbd->gpio_jack);
80 if (irq_jack < 0)
81 return -EINVAL;
82
83 --
84 1.5.6.3
85