diff options
author | eric miao <eric.miao@marvell.com> | 2008-01-28 18:00:02 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-02-04 08:17:33 -0500 |
commit | c016550490687c6bdbcdf06c7b4d874b6c7c6e4e (patch) | |
tree | d2b31c1d89c72417d050343caa6a6a5161b6d02f /arch/arm/mach-pxa/irq.c | |
parent | cd5604d5618a802e4ed047eb8b1515edc5fc49b5 (diff) |
[ARM] pxa: introduce sysdev for IRQ register saving/restoring
Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/irq.c')
-rw-r--r-- | arch/arm/mach-pxa/irq.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index 07acb45b16ea..5a1d5eef10a4 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/sysdev.h> | ||
18 | 19 | ||
19 | #include <asm/hardware.h> | 20 | #include <asm/hardware.h> |
20 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
@@ -321,3 +322,64 @@ void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)) | |||
321 | pxa_low_gpio_chip.set_wake = set_wake; | 322 | pxa_low_gpio_chip.set_wake = set_wake; |
322 | pxa_muxed_gpio_chip.set_wake = set_wake; | 323 | pxa_muxed_gpio_chip.set_wake = set_wake; |
323 | } | 324 | } |
325 | |||
326 | #ifdef CONFIG_PM | ||
327 | static unsigned long saved_icmr[2]; | ||
328 | |||
329 | static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) | ||
330 | { | ||
331 | switch (dev->id) { | ||
332 | case 0: | ||
333 | saved_icmr[0] = ICMR; | ||
334 | ICMR = 0; | ||
335 | break; | ||
336 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | ||
337 | case 1: | ||
338 | saved_icmr[1] = ICMR2; | ||
339 | ICMR2 = 0; | ||
340 | break; | ||
341 | #endif | ||
342 | default: | ||
343 | return -EINVAL; | ||
344 | } | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static int pxa_irq_resume(struct sys_device *dev) | ||
350 | { | ||
351 | switch (dev->id) { | ||
352 | case 0: | ||
353 | ICMR = saved_icmr[0]; | ||
354 | ICLR = 0; | ||
355 | ICCR = 1; | ||
356 | break; | ||
357 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | ||
358 | case 1: | ||
359 | ICMR2 = saved_icmr[1]; | ||
360 | ICLR2 = 0; | ||
361 | break; | ||
362 | #endif | ||
363 | default: | ||
364 | return -EINVAL; | ||
365 | } | ||
366 | |||
367 | return 0; | ||
368 | } | ||
369 | #else | ||
370 | #define pxa_irq_suspend NULL | ||
371 | #define pxa_irq_resume NULL | ||
372 | #endif | ||
373 | |||
374 | struct sysdev_class pxa_irq_sysclass = { | ||
375 | .name = "irq", | ||
376 | .suspend = pxa_irq_suspend, | ||
377 | .resume = pxa_irq_resume, | ||
378 | }; | ||
379 | |||
380 | static int __init pxa_irq_init(void) | ||
381 | { | ||
382 | return sysdev_class_register(&pxa_irq_sysclass); | ||
383 | } | ||
384 | |||
385 | core_initcall(pxa_irq_init); | ||