diff options
Diffstat (limited to 'meta/recipes-kernel/linux/linux-rp-2.6.24/sharpsl-rc-r1.patch')
-rw-r--r-- | meta/recipes-kernel/linux/linux-rp-2.6.24/sharpsl-rc-r1.patch | 527 |
1 files changed, 527 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-rp-2.6.24/sharpsl-rc-r1.patch b/meta/recipes-kernel/linux/linux-rp-2.6.24/sharpsl-rc-r1.patch new file mode 100644 index 0000000000..bed41c55d5 --- /dev/null +++ b/meta/recipes-kernel/linux/linux-rp-2.6.24/sharpsl-rc-r1.patch | |||
@@ -0,0 +1,527 @@ | |||
1 | This patch adds support for Sharp CE-RH2 on Spitz. | ||
2 | |||
3 | It is not clean enough to be upstreamed: | ||
4 | - It is a bit syslog-noisy. | ||
5 | - Does not support other Zaurus models. | ||
6 | - Maybe split to more parts: | ||
7 | * MAX1111 driver | ||
8 | * linear input device | ||
9 | * virtual keyboard on top of linear input device | ||
10 | |||
11 | Index: linux-2.6.24/arch/arm/mach-pxa/spitz.c | ||
12 | =================================================================== | ||
13 | --- linux-2.6.24.orig/arch/arm/mach-pxa/spitz.c 2008-03-10 17:05:37.000000000 +0000 | ||
14 | +++ linux-2.6.24/arch/arm/mach-pxa/spitz.c 2008-03-10 17:05:55.000000000 +0000 | ||
15 | @@ -259,6 +259,13 @@ | ||
16 | .id = -1, | ||
17 | }; | ||
18 | |||
19 | +/* | ||
20 | + * Spitz Remote Control Device | ||
21 | + */ | ||
22 | +static struct platform_device sharpsl_rc_device = { | ||
23 | + .name = "sharpsl-remote-control", | ||
24 | + .id = -1, | ||
25 | +}; | ||
26 | |||
27 | /* | ||
28 | * Spitz LEDs | ||
29 | @@ -548,6 +555,7 @@ | ||
30 | &spitzscoop_device, | ||
31 | &spitzssp_device, | ||
32 | &spitzkbd_device, | ||
33 | + &sharpsl_rc_device, | ||
34 | &spitzts_device, | ||
35 | &spitzbl_device, | ||
36 | &spitzled_device, | ||
37 | Index: linux-2.6.24/drivers/input/keyboard/Kconfig | ||
38 | =================================================================== | ||
39 | --- linux-2.6.24.orig/drivers/input/keyboard/Kconfig 2008-03-10 17:05:40.000000000 +0000 | ||
40 | +++ linux-2.6.24/drivers/input/keyboard/Kconfig 2008-03-10 17:05:55.000000000 +0000 | ||
41 | @@ -154,6 +154,17 @@ | ||
42 | To compile this driver as a module, choose M here: the | ||
43 | module will be called spitzkbd. | ||
44 | |||
45 | +config SHARPSL_RC | ||
46 | + tristate "Sharp SL-Cxx00 Remote Control" | ||
47 | + depends on PXA_SHARPSL | ||
48 | + default y | ||
49 | + help | ||
50 | + Say Y here to enable the remote on the Sharp Zaurus SL-Cxx00, | ||
51 | + SL-C1000, SL-C3000 and Sl-C3100 series of PDAs. | ||
52 | + | ||
53 | + To compile this driver as a module, choose M here: the | ||
54 | + module will be called sharpsl_rc. | ||
55 | + | ||
56 | config KEYBOARD_AMIGA | ||
57 | tristate "Amiga keyboard" | ||
58 | depends on AMIGA | ||
59 | Index: linux-2.6.24/drivers/input/keyboard/Makefile | ||
60 | =================================================================== | ||
61 | --- linux-2.6.24.orig/drivers/input/keyboard/Makefile 2008-03-10 17:05:40.000000000 +0000 | ||
62 | +++ linux-2.6.24/drivers/input/keyboard/Makefile 2008-03-10 17:06:17.000000000 +0000 | ||
63 | @@ -26,3 +26,5 @@ | ||
64 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o | ||
65 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o | ||
66 | obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o | ||
67 | +obj-$(CONFIG_SHARPSL_RC) += sharpsl_rc.o | ||
68 | + | ||
69 | Index: linux-2.6.24/drivers/input/keyboard/sharpsl_rc.c | ||
70 | =================================================================== | ||
71 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
72 | +++ linux-2.6.24/drivers/input/keyboard/sharpsl_rc.c 2008-03-10 17:05:55.000000000 +0000 | ||
73 | @@ -0,0 +1,291 @@ | ||
74 | +/* | ||
75 | + * Keyboard driver for Sharp Clamshell Models (SL-Cxx00) | ||
76 | + * | ||
77 | + * Copyright (c) 2004-2005 Richard Purdie | ||
78 | + * | ||
79 | + * Based on corgikbd.c and Sharp's RC driver | ||
80 | + * | ||
81 | + * This program is free software; you can redistribute it and/or modify | ||
82 | + * it under the terms of the GNU General Public License version 2 as | ||
83 | + * published by the Free Software Foundation. | ||
84 | + * | ||
85 | + */ | ||
86 | + | ||
87 | +#define DEBUG 1 | ||
88 | +#include <linux/delay.h> | ||
89 | +#include <linux/platform_device.h> | ||
90 | +#include <linux/init.h> | ||
91 | +#include <linux/input.h> | ||
92 | +#include <linux/interrupt.h> | ||
93 | +#include <linux/jiffies.h> | ||
94 | +#include <linux/module.h> | ||
95 | +#include <linux/slab.h> | ||
96 | + | ||
97 | +#ifdef CONFIG_MACH_SPITZ | ||
98 | +#include <asm/arch/spitz.h> | ||
99 | +#endif | ||
100 | +#ifdef CONFIG_MACH_CORGI | ||
101 | +#include <asm/arch/corgi.h> | ||
102 | +#endif | ||
103 | + | ||
104 | +#include <asm/arch/hardware.h> | ||
105 | +#include <asm/arch/pxa-regs.h> | ||
106 | +#include <asm/hardware/scoop.h> | ||
107 | +#include <asm/arch/sharpsl.h> | ||
108 | +#include <asm/hardware/sharpsl_pm.h> | ||
109 | + | ||
110 | +#define DPRINTK(fmt, args...) dev_dbg(data->dev, fmt "\n", ##args) | ||
111 | + | ||
112 | +struct remote_control_key { | ||
113 | + unsigned char min; | ||
114 | + unsigned char max; | ||
115 | + unsigned char key; | ||
116 | +}; | ||
117 | + | ||
118 | +#ifdef CONFIG_MACH_SPITZ | ||
119 | +#define REMOTE_AKIN_PULLUP SPITZ_SCP2_AKIN_PULLUP | ||
120 | +#define REMOTE_SCOOP_DEVICE spitzscoop2_device | ||
121 | +#define REMOTE_GPIO_INT SPITZ_GPIO_AK_INT | ||
122 | +#define REMOTE_IRQ_INT SPITZ_IRQ_GPIO_AK_INT | ||
123 | +static struct remote_control_key remote_keys[] = { | ||
124 | + { 25, 35, KEY_STOPCD}, | ||
125 | + { 55, 65, KEY_PLAYPAUSE}, | ||
126 | + { 85, 95, KEY_NEXTSONG}, | ||
127 | + { 115, 125, KEY_VOLUMEUP}, | ||
128 | + { 145, 155, KEY_PREVIOUSSONG}, | ||
129 | + { 180, 190, KEY_MUTE}, | ||
130 | + { 215, 225, KEY_VOLUMEDOWN}, | ||
131 | +}; | ||
132 | +#endif | ||
133 | +#ifdef CONFIG_MACH_CORGI | ||
134 | +#define REMOTE_AKIN_PULLUP CORGI_SCP_AKIN_PULLUP | ||
135 | +#define REMOTE_SCOOP_DEVICE corgiscoop_device | ||
136 | +#define REMOTE_GPIO_INT CORGI_GPIO_AK_INT | ||
137 | +#define REMOTE_IRQ_INT CORGI_IRQ_GPIO_AK_INT | ||
138 | +static struct remote_control_key remote_keys[] = { | ||
139 | + //These need to be fixed for the CE-RH1's values | ||
140 | + { 25, 35, KEY_STOPCD}, | ||
141 | + { 55, 65, KEY_PLAYPAUSE}, | ||
142 | + { 85, 95, KEY_NEXTSONG}, | ||
143 | + { 115, 125, KEY_VOLUMEUP}, | ||
144 | + { 145, 155, KEY_PREVIOUSSONG}, | ||
145 | + { 180, 190, KEY_MUTE}, | ||
146 | + { 215, 225, KEY_VOLUMEDOWN}, | ||
147 | +}; | ||
148 | +#endif | ||
149 | + | ||
150 | +#define RELEASE_HI 230 | ||
151 | +#define MAX_EARPHONE 6 | ||
152 | +#define RC_POLL_MS 10 | ||
153 | +#define RC_FINISH_MS 500 | ||
154 | +#define WAIT_STATE 3 | ||
155 | +#define NOISE_THRESHOLD 100 | ||
156 | + | ||
157 | +struct sharpsl_rc { | ||
158 | + struct input_dev *input; | ||
159 | + struct device *dev; | ||
160 | + | ||
161 | + spinlock_t lock; | ||
162 | + struct timer_list rctimer; | ||
163 | + struct timer_list rctimer_finish; | ||
164 | + | ||
165 | + unsigned int handling_press; | ||
166 | + unsigned int noise; | ||
167 | + unsigned int state; | ||
168 | + unsigned int last_key; | ||
169 | +}; | ||
170 | + | ||
171 | +static int get_remocon_raw(void) | ||
172 | +{ | ||
173 | + int i, val; | ||
174 | + | ||
175 | + val = sharpsl_pm_pxa_read_max1111(MAX1111_REMCOM); | ||
176 | + for (i = 0; i < ARRAY_SIZE(remote_keys); ++i) { | ||
177 | + if (val >= remote_keys[i].min | ||
178 | + && val <= remote_keys[i].max) { | ||
179 | + printk("get_remocon_raw: VAL=%i, KEY=%i\n", val, remote_keys[i].key); | ||
180 | + return remote_keys[i].key; | ||
181 | + } | ||
182 | + } | ||
183 | + return 0; | ||
184 | +} | ||
185 | + | ||
186 | +static irqreturn_t sharpsl_rc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
187 | +{ | ||
188 | + struct sharpsl_rc *data = dev_id; | ||
189 | + DPRINTK("sharpsl_rc_interrupt %d\n", irq); | ||
190 | + if (!data->handling_press) { | ||
191 | + DPRINTK("handling interrupt"); | ||
192 | + data->handling_press = 1; | ||
193 | + data->noise = 0; | ||
194 | + data->state = 0; | ||
195 | + data->last_key = 0; | ||
196 | + | ||
197 | + reset_scoop_gpio(&REMOTE_SCOOP_DEVICE.dev, REMOTE_AKIN_PULLUP); | ||
198 | + | ||
199 | + mod_timer(&data->rctimer, jiffies + msecs_to_jiffies(RC_POLL_MS)); | ||
200 | + } | ||
201 | + return IRQ_HANDLED; | ||
202 | +} | ||
203 | + | ||
204 | +static void sharpsl_rc_timer_callback(unsigned long dataPtr) | ||
205 | +{ | ||
206 | + struct sharpsl_rc *data = (struct sharpsl_rc *) dataPtr; | ||
207 | + int timer = 1; | ||
208 | + int key = get_remocon_raw(); | ||
209 | + DPRINTK("timer callback, key: %d", key); | ||
210 | + | ||
211 | + //wait for value to stabilize | ||
212 | + if (data->state < WAIT_STATE) { | ||
213 | + if (data->last_key != key) { | ||
214 | + ++data->noise; | ||
215 | + if (data->noise > NOISE_THRESHOLD) { | ||
216 | + DPRINTK("too much noise, bailing"); | ||
217 | + timer = 0; | ||
218 | + } | ||
219 | + data->state = 0; | ||
220 | + } else { | ||
221 | + ++data->state; | ||
222 | + } | ||
223 | + data->last_key = key; | ||
224 | + | ||
225 | + //stable value, send event | ||
226 | + } else if (data->state == WAIT_STATE) { | ||
227 | + data->noise = 0; | ||
228 | + //non-key returned, skip the rest of the states and bail now | ||
229 | + if (data->last_key == 0) { | ||
230 | + DPRINTK("non-key detected %d, noise: %d", data->last_key, data->noise); | ||
231 | + timer = 0; | ||
232 | + //send button press | ||
233 | + } else { | ||
234 | + DPRINTK("key press detected %d, noise %d", data->last_key, data->noise); | ||
235 | + input_report_key(data->input, data->last_key, 1); | ||
236 | + } | ||
237 | + ++data->state; | ||
238 | + | ||
239 | + //wait until key is released | ||
240 | + } else if (data->state < WAIT_STATE * 2) { | ||
241 | + if (key == data->last_key | ||
242 | + && data->noise < NOISE_THRESHOLD) { | ||
243 | + data->state = WAIT_STATE + 1; | ||
244 | + ++data->noise; | ||
245 | + } else { | ||
246 | + ++data->state; | ||
247 | + } | ||
248 | + //key is released, send event | ||
249 | + } else { | ||
250 | + //send button release | ||
251 | + DPRINTK("release key %d", data->last_key); | ||
252 | + input_report_key(data->input, data->last_key, 0); | ||
253 | + timer = 0; | ||
254 | + } | ||
255 | + if (timer) { | ||
256 | + mod_timer(&data->rctimer, jiffies + msecs_to_jiffies(RC_POLL_MS)); | ||
257 | + } else { | ||
258 | + set_scoop_gpio(&REMOTE_SCOOP_DEVICE.dev, REMOTE_AKIN_PULLUP); | ||
259 | + data->handling_press = 0; | ||
260 | + } | ||
261 | +} | ||
262 | + | ||
263 | +static int __init sharpsl_rc_probe(struct platform_device *pdev) | ||
264 | +{ | ||
265 | + struct sharpsl_rc *sharpsl_rc; | ||
266 | + struct input_dev *input_dev; | ||
267 | + int i, ret; | ||
268 | + | ||
269 | + dev_dbg(&pdev->dev, "sharpsl_rc_probe\n"); | ||
270 | + | ||
271 | + sharpsl_rc = kzalloc(sizeof(struct sharpsl_rc), GFP_KERNEL); | ||
272 | + input_dev = input_allocate_device(); | ||
273 | + if (!sharpsl_rc || !input_dev) { | ||
274 | + kfree(sharpsl_rc); | ||
275 | + input_free_device(input_dev); | ||
276 | + return -ENOMEM; | ||
277 | + } | ||
278 | + | ||
279 | + platform_set_drvdata(pdev, sharpsl_rc); | ||
280 | + | ||
281 | + sharpsl_rc->dev = &pdev->dev; | ||
282 | + sharpsl_rc->input = input_dev; | ||
283 | + spin_lock_init(&sharpsl_rc->lock); | ||
284 | + | ||
285 | + /* Init Remote Control Timer */ | ||
286 | + init_timer(&sharpsl_rc->rctimer); | ||
287 | + sharpsl_rc->rctimer.function = sharpsl_rc_timer_callback; | ||
288 | + sharpsl_rc->rctimer.data = (unsigned long) sharpsl_rc; | ||
289 | + | ||
290 | + input_dev->name = "Sharp Remote Control CE-RHX"; | ||
291 | + input_dev->phys = "sharpsl_rc/input0"; | ||
292 | + input_dev->id.bustype = BUS_HOST; | ||
293 | + input_dev->id.vendor = 0x0001; | ||
294 | + input_dev->id.product = 0x0001; | ||
295 | + input_dev->id.version = 0x0100; | ||
296 | + input_dev->cdev.dev = &pdev->dev; | ||
297 | + input_dev->private = sharpsl_rc; | ||
298 | + | ||
299 | + input_dev->evbit[0] = BIT(EV_KEY); | ||
300 | + | ||
301 | + for (i = 0; i <= ARRAY_SIZE(remote_keys); i++) | ||
302 | + set_bit(remote_keys[i].key, input_dev->keybit); | ||
303 | + | ||
304 | + input_register_device(sharpsl_rc->input); | ||
305 | + | ||
306 | + pxa_gpio_mode(REMOTE_GPIO_INT | GPIO_IN); | ||
307 | + ret = request_irq(REMOTE_IRQ_INT, | ||
308 | + sharpsl_rc_interrupt, | ||
309 | + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_SHARED, | ||
310 | + "sharpsl_rc", | ||
311 | + sharpsl_rc); | ||
312 | + if (ret < 0) { | ||
313 | + dev_dbg(&pdev->dev, "Can't get IRQ: %d!\n", i); | ||
314 | + kfree(sharpsl_rc); | ||
315 | + input_free_device(input_dev); | ||
316 | + return ret; | ||
317 | + } | ||
318 | + | ||
319 | + return 0; | ||
320 | +} | ||
321 | + | ||
322 | +static int sharpsl_rc_remove(struct platform_device *pdev) | ||
323 | +{ | ||
324 | + struct sharpsl_rc *sharpsl_rc = platform_get_drvdata(pdev); | ||
325 | + | ||
326 | + dev_dbg(&pdev->dev, "sharpsl_rc_remove\n"); | ||
327 | + | ||
328 | + free_irq(REMOTE_IRQ_INT, sharpsl_rc); | ||
329 | + del_timer_sync(&sharpsl_rc->rctimer); | ||
330 | + input_unregister_device(sharpsl_rc->input); | ||
331 | + kfree(sharpsl_rc); | ||
332 | + | ||
333 | + return 0; | ||
334 | +} | ||
335 | + | ||
336 | +static struct platform_driver sharpsl_rc_driver = { | ||
337 | + .probe = sharpsl_rc_probe, | ||
338 | + .remove = sharpsl_rc_remove, | ||
339 | + .suspend = NULL, | ||
340 | + .resume = NULL, | ||
341 | + .driver = { | ||
342 | + .name = "sharpsl-remote-control", | ||
343 | + }, | ||
344 | +}; | ||
345 | + | ||
346 | +static int __devinit sharpsl_rc_init(void) | ||
347 | +{ | ||
348 | + printk("sharpsl_rc_init\n"); | ||
349 | + return platform_driver_register(&sharpsl_rc_driver); | ||
350 | +} | ||
351 | + | ||
352 | +static void __exit sharpsl_rc_exit(void) | ||
353 | +{ | ||
354 | + printk("sharpsl_rc_exit\n"); | ||
355 | + platform_driver_unregister(&sharpsl_rc_driver); | ||
356 | +} | ||
357 | + | ||
358 | +module_init(sharpsl_rc_init); | ||
359 | +module_exit(sharpsl_rc_exit); | ||
360 | + | ||
361 | +MODULE_AUTHOR("Justin Patrin <papercrane@reversefold.com>"); | ||
362 | +MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | ||
363 | +MODULE_DESCRIPTION("SharpSL Remote Control Driver"); | ||
364 | +MODULE_LICENSE("GPL"); | ||
365 | Index: linux-2.6.24/drivers/input/keyboard/spitzkbd.c | ||
366 | =================================================================== | ||
367 | --- linux-2.6.24.orig/drivers/input/keyboard/spitzkbd.c 2008-01-24 22:58:37.000000000 +0000 | ||
368 | +++ linux-2.6.24/drivers/input/keyboard/spitzkbd.c 2008-03-10 17:05:55.000000000 +0000 | ||
369 | @@ -19,6 +19,7 @@ | ||
370 | #include <linux/jiffies.h> | ||
371 | #include <linux/module.h> | ||
372 | #include <linux/slab.h> | ||
373 | +#include <linux/kmod.h> | ||
374 | |||
375 | #include <asm/arch/spitz.h> | ||
376 | #include <asm/arch/hardware.h> | ||
377 | @@ -279,13 +280,21 @@ | ||
378 | static int sharpsl_hinge_state; | ||
379 | static int hinge_count; | ||
380 | |||
381 | +void spitzkbd_handle_sharpsl_rc(void *arg) { | ||
382 | + request_module("sharpsl_rc"); | ||
383 | +} | ||
384 | + | ||
385 | +DECLARE_WORK(spitzkbd_work, spitzkbd_handle_sharpsl_rc); | ||
386 | + | ||
387 | static void spitzkbd_hinge_timer(unsigned long data) | ||
388 | { | ||
389 | struct spitzkbd *spitzkbd_data = (struct spitzkbd *) data; | ||
390 | unsigned long state; | ||
391 | unsigned long flags; | ||
392 | + unsigned int headphone, remote; | ||
393 | |||
394 | state = GPLR(SPITZ_GPIO_SWA) & (GPIO_bit(SPITZ_GPIO_SWA)|GPIO_bit(SPITZ_GPIO_SWB)); | ||
395 | + state |= (GPLR(SPITZ_GPIO_HP_IN) & GPIO_bit(SPITZ_GPIO_HP_IN)); | ||
396 | state |= (GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)); | ||
397 | if (state != sharpsl_hinge_state) { | ||
398 | hinge_count = 0; | ||
399 | @@ -299,9 +308,18 @@ | ||
400 | |||
401 | input_report_switch(spitzkbd_data->input, SW_LID, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); | ||
402 | input_report_switch(spitzkbd_data->input, SW_TABLET_MODE, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); | ||
403 | - input_report_switch(spitzkbd_data->input, SW_HEADPHONE_INSERT, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0)); | ||
404 | + | ||
405 | + headphone = ((GPLR(SPITZ_GPIO_HP_IN) & GPIO_bit(SPITZ_GPIO_HP_IN)) != 0); | ||
406 | + input_report_switch(spitzkbd_data->input, SW_HEADPHONE_INSERT, headphone); | ||
407 | + | ||
408 | + remote = headphone && ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) == 0); | ||
409 | + input_report_switch(spitzkbd_data->input, SW_REMOTE_INSERT, remote); | ||
410 | input_sync(spitzkbd_data->input); | ||
411 | |||
412 | + if (remote) { | ||
413 | + schedule_work(&spitzkbd_work); | ||
414 | + } | ||
415 | + | ||
416 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); | ||
417 | } else { | ||
418 | mod_timer(&spitzkbd_data->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL)); | ||
419 | @@ -395,6 +413,7 @@ | ||
420 | set_bit(SW_LID, input_dev->swbit); | ||
421 | set_bit(SW_TABLET_MODE, input_dev->swbit); | ||
422 | set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); | ||
423 | + set_bit(SW_REMOTE_INSERT, input_dev->swbit); | ||
424 | |||
425 | err = input_register_device(input_dev); | ||
426 | if (err) | ||
427 | @@ -432,9 +451,12 @@ | ||
428 | request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, | ||
429 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
430 | "Spitzkbd SWB", spitzkbd); | ||
431 | - request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr, | ||
432 | + request_irq(SPITZ_IRQ_GPIO_HP_IN, spitzkbd_hinge_isr, | ||
433 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
434 | "Spitzkbd HP", spitzkbd); | ||
435 | + request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr, | ||
436 | + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_SHARED, | ||
437 | + "Spitzkbd HP Type", spitzkbd); | ||
438 | |||
439 | return 0; | ||
440 | |||
441 | @@ -455,6 +477,7 @@ | ||
442 | free_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd); | ||
443 | free_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd); | ||
444 | free_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd); | ||
445 | + free_irq(SPITZ_IRQ_GPIO_HP_IN, spitzkbd); | ||
446 | free_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd); | ||
447 | |||
448 | del_timer_sync(&spitzkbd->htimer); | ||
449 | Index: linux-2.6.24/arch/arm/mach-pxa/sharpsl.h | ||
450 | =================================================================== | ||
451 | --- linux-2.6.24.orig/arch/arm/mach-pxa/sharpsl.h 2008-03-10 17:05:35.000000000 +0000 | ||
452 | +++ linux-2.6.24/arch/arm/mach-pxa/sharpsl.h 2008-03-10 17:05:55.000000000 +0000 | ||
453 | @@ -37,15 +37,10 @@ | ||
454 | */ | ||
455 | #define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x)) | ||
456 | |||
457 | -/* MAX1111 Channel Definitions */ | ||
458 | -#define MAX1111_BATT_VOLT 4u | ||
459 | -#define MAX1111_BATT_TEMP 2u | ||
460 | -#define MAX1111_ACIN_VOLT 6u | ||
461 | - | ||
462 | extern struct battery_thresh spitz_battery_levels_acin[]; | ||
463 | extern struct battery_thresh spitz_battery_levels_noac[]; | ||
464 | void sharpsl_pm_pxa_init(void); | ||
465 | void sharpsl_pm_pxa_remove(void); | ||
466 | -int sharpsl_pm_pxa_read_max1111(int channel); | ||
467 | + | ||
468 | |||
469 | |||
470 | Index: linux-2.6.24/arch/arm/mach-pxa/sharpsl_pm.c | ||
471 | =================================================================== | ||
472 | --- linux-2.6.24.orig/arch/arm/mach-pxa/sharpsl_pm.c 2008-01-24 22:58:37.000000000 +0000 | ||
473 | +++ linux-2.6.24/arch/arm/mach-pxa/sharpsl_pm.c 2008-03-10 17:05:55.000000000 +0000 | ||
474 | @@ -135,6 +135,8 @@ | ||
475 | | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR); | ||
476 | } | ||
477 | |||
478 | +EXPORT_SYMBOL(sharpsl_pm_pxa_read_max1111); | ||
479 | + | ||
480 | void sharpsl_pm_pxa_init(void) | ||
481 | { | ||
482 | pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN); | ||
483 | Index: linux-2.6.24/include/asm-arm/hardware/sharpsl_pm.h | ||
484 | =================================================================== | ||
485 | --- linux-2.6.24.orig/include/asm-arm/hardware/sharpsl_pm.h 2008-01-24 22:58:37.000000000 +0000 | ||
486 | +++ linux-2.6.24/include/asm-arm/hardware/sharpsl_pm.h 2008-03-10 17:05:55.000000000 +0000 | ||
487 | @@ -104,3 +104,10 @@ | ||
488 | irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id); | ||
489 | irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id); | ||
490 | |||
491 | +/* MAX1111 Channel Definitions */ | ||
492 | +#define MAX1111_REMCOM 0u | ||
493 | +#define MAX1111_BATT_VOLT 4u | ||
494 | +#define MAX1111_BATT_TEMP 2u | ||
495 | +#define MAX1111_ACIN_VOLT 6u | ||
496 | + | ||
497 | +int sharpsl_pm_pxa_read_max1111(int channel); | ||
498 | Index: linux-2.6.24/include/linux/input.h | ||
499 | =================================================================== | ||
500 | --- linux-2.6.24.orig/include/linux/input.h 2008-01-24 22:58:37.000000000 +0000 | ||
501 | +++ linux-2.6.24/include/linux/input.h 2008-03-10 17:05:55.000000000 +0000 | ||
502 | @@ -636,6 +636,7 @@ | ||
503 | #define SW_TABLET_MODE 0x01 /* set = tablet mode */ | ||
504 | #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ | ||
505 | #define SW_RADIO 0x03 /* set = radio enabled */ | ||
506 | +#define SW_REMOTE_INSERT 0x04 /* set = remote */ | ||
507 | #define SW_MAX 0x0f | ||
508 | #define SW_CNT (SW_MAX+1) | ||
509 | |||
510 | Index: linux-2.6.24/arch/arm/mach-pxa/spitz_pm.c | ||
511 | =================================================================== | ||
512 | --- linux-2.6.24.orig/arch/arm/mach-pxa/spitz_pm.c 2008-03-10 17:05:40.000000000 +0000 | ||
513 | +++ linux-2.6.24/arch/arm/mach-pxa/spitz_pm.c 2008-03-10 17:05:55.000000000 +0000 | ||
514 | @@ -162,6 +162,13 @@ | ||
515 | if (resume_on_alarm && (PEDR & PWER_RTC)) | ||
516 | is_resume |= PWER_RTC; | ||
517 | |||
518 | + printk("wakeup: PEDR: %x, PKSR: %x, HP_IN: %x, AK_INT: %x\n", PEDR, PKSR, GPIO_bit(SPITZ_GPIO_HP_IN), GPIO_bit(SPITZ_GPIO_AK_INT)); | ||
519 | + | ||
520 | + //remote/headphone interrupt, wakeup | ||
521 | + if (PEDR == 0 && (PKSR & 0xc0d01) != 0) { | ||
522 | + is_resume |= PWER_RTC; | ||
523 | + } | ||
524 | + | ||
525 | dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume); | ||
526 | return is_resume; | ||
527 | } | ||