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