[ARM] S3C: Rename sleep.S functions to be non-cpu specific
[safe/jmp/linux-2.6] / arch / arm / plat-s3c / include / plat / pm.h
1 /* linux/include/asm-arm/plat-s3c24xx/pm.h
2  *
3  * Copyright (c) 2004 Simtec Electronics
4  *      http://armlinux.simtec.co.uk/
5  *      Written by Ben Dooks, <ben@simtec.co.uk>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10 */
11
12 /* s3c_pm_init
13  *
14  * called from board at initialisation time to setup the power
15  * management
16 */
17
18 #ifdef CONFIG_PM
19
20 extern __init int s3c_pm_init(void);
21
22 #else
23
24 static inline int s3c_pm_init(void)
25 {
26         return 0;
27 }
28 #endif
29
30 /* configuration for the IRQ mask over sleep */
31 extern unsigned long s3c_irqwake_intmask;
32 extern unsigned long s3c_irqwake_eintmask;
33
34 /* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
35 extern unsigned long s3c_irqwake_intallow;
36 extern unsigned long s3c_irqwake_eintallow;
37
38 /* per-cpu sleep functions */
39
40 extern void (*pm_cpu_prep)(void);
41 extern void (*pm_cpu_sleep)(void);
42
43 /* Flags for PM Control */
44
45 extern unsigned long s3c_pm_flags;
46
47 /* from sleep.S */
48
49 extern int  s3c_cpu_save(unsigned long *saveblk);
50 extern void s3c_cpu_resume(void);
51
52 extern void s3c2410_cpu_suspend(void);
53
54 extern unsigned long s3c_sleep_save_phys;
55
56 /* sleep save info */
57
58 /**
59  * struct sleep_save - save information for shared peripherals.
60  * @reg: Pointer to the register to save.
61  * @val: Holder for the value saved from reg.
62  *
63  * This describes a list of registers which is used by the pm core and
64  * other subsystem to save and restore register values over suspend.
65  */
66 struct sleep_save {
67         void __iomem    *reg;
68         unsigned long   val;
69 };
70
71 #define SAVE_ITEM(x) \
72         { .reg = (x) }
73
74 /* helper functions to save/restore lists of registers. */
75
76 extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
77 extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
78 extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
79
80 #ifdef CONFIG_PM
81 extern int s3c_irqext_wake(unsigned int irqno, unsigned int state);
82 extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
83 extern int s3c24xx_irq_resume(struct sys_device *dev);
84 #else
85 #define s3c_irqext_wake NULL
86 #define s3c24xx_irq_suspend NULL
87 #define s3c24xx_irq_resume  NULL
88 #endif
89
90 /* PM debug functions */
91
92 #ifdef CONFIG_S3C2410_PM_DEBUG
93 /**
94  * s3c_pm_dbg() - low level debug function for use in suspend/resume.
95  * @msg: The message to print.
96  *
97  * This function is used mainly to debug the resume process before the system
98  * can rely on printk/console output. It uses the low-level debugging output
99  * routine printascii() to do its work.
100  */
101 extern void s3c_pm_dbg(const char *msg, ...);
102
103 #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
104 #else
105 #define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt)
106 #endif
107
108 /* suspend memory checking */
109
110 #ifdef CONFIG_S3C2410_PM_CHECK
111 extern void s3c_pm_check_prepare(void);
112 extern void s3c_pm_check_restore(void);
113 extern void s3c_pm_check_store(void);
114 #else
115 #define s3c_pm_check_prepare() do { } while(0)
116 #define s3c_pm_check_restore() do { } while(0)
117 #define s3c_pm_check_store()   do { } while(0)
118 #endif
119
120 /**
121  * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
122  *
123  * Setup all the necessary GPIO pins for waking the system on external
124  * interrupt.
125  */
126 extern void s3c_pm_configure_extint(void);
127
128 /**
129  * s3c_pm_restore_gpios() - restore the state of the gpios after sleep.
130  *
131  * Restore the state of the GPIO pins after sleep, which may involve ensuring
132  * that we do not glitch the state of the pins from that the bootloader's
133  * resume code has done.
134 */
135 extern void s3c_pm_restore_gpios(void);
136
137 /**
138  * s3c_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
139  *
140  * Save the GPIO states for resotration on resume. See s3c_pm_restore_gpios().
141  */
142 extern void s3c_pm_save_gpios(void);
143
144 extern void s3c_pm_save_core(void);
145 extern void s3c_pm_restore_core(void);