Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pm.h
Go to the documentation of this file.
1 /* arch/arm/plat-samsung/include/plat/pm.h
2  *
3  * Copyright (c) 2004 Simtec Electronics
4  * http://armlinux.simtec.co.uk/
5  * Written by Ben Dooks, <[email protected]>
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 #include <linux/irq.h>
19 
20 struct device;
21 
22 #ifdef CONFIG_PM
23 
24 extern __init int s3c_pm_init(void);
25 extern __init int s3c64xx_pm_init(void);
26 
27 #else
28 
29 static inline int s3c_pm_init(void)
30 {
31  return 0;
32 }
33 
34 static inline int s3c64xx_pm_init(void)
35 {
36  return 0;
37 }
38 #endif
39 
40 /* configuration for the IRQ mask over sleep */
41 extern unsigned long s3c_irqwake_intmask;
42 extern unsigned long s3c_irqwake_eintmask;
43 
44 /* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
45 extern unsigned long s3c_irqwake_intallow;
46 extern unsigned long s3c_irqwake_eintallow;
47 
48 /* per-cpu sleep functions */
49 
50 extern void (*pm_cpu_prep)(void);
51 extern int (*pm_cpu_sleep)(unsigned long);
52 
53 /* Flags for PM Control */
54 
55 extern unsigned long s3c_pm_flags;
56 
57 extern unsigned char pm_uart_udivslot; /* true to save UART UDIVSLOT */
58 
59 /* from sleep.S */
60 
61 extern void s3c_cpu_resume(void);
62 
63 extern int s3c2410_cpu_suspend(unsigned long);
64 
65 /* sleep save info */
66 
75 struct sleep_save {
76  void __iomem *reg;
77  unsigned long val;
78 };
79 
80 #define SAVE_ITEM(x) \
81  { .reg = (x) }
82 
94 struct pm_uart_save {
101 };
102 
103 /* helper functions to save/restore lists of registers. */
104 
105 extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
106 extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
107 extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
108 
109 #ifdef CONFIG_PM
110 extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
111 extern int s3c24xx_irq_suspend(void);
112 extern void s3c24xx_irq_resume(void);
113 #else
114 #define s3c_irqext_wake NULL
115 #define s3c24xx_irq_suspend NULL
116 #define s3c24xx_irq_resume NULL
117 #endif
118 
120 
121 /* PM debug functions */
122 
123 #ifdef CONFIG_SAMSUNG_PM_DEBUG
124 
132 extern void s3c_pm_dbg(const char *msg, ...);
133 
134 #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
135 #else
136 #define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt)
137 #endif
138 
139 #ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
140 
145 extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
146 
147 #else
148 static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
149 #endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
150 
151 /* suspend memory checking */
152 
153 #ifdef CONFIG_SAMSUNG_PM_CHECK
154 extern void s3c_pm_check_prepare(void);
155 extern void s3c_pm_check_restore(void);
156 extern void s3c_pm_check_cleanup(void);
157 extern void s3c_pm_check_store(void);
158 #else
159 #define s3c_pm_check_prepare() do { } while(0)
160 #define s3c_pm_check_restore() do { } while(0)
161 #define s3c_pm_check_cleanup() do { } while(0)
162 #define s3c_pm_check_store() do { } while(0)
163 #endif
164 
171 extern void s3c_pm_configure_extint(void);
172 
180 extern void samsung_pm_restore_gpios(void);
181 
187 extern void samsung_pm_save_gpios(void);
188 
189 extern void s3c_pm_save_core(void);
190 extern void s3c_pm_restore_core(void);