Merge 2.6.38-rc5 into staging-next
[deliverable/linux.git] / arch / arm / plat-samsung / include / plat / pm.h
CommitLineData
c116c1d7 1/* arch/arm/plat-samsung/include/plat/pm.h
1da177e4
LT
2 *
3 * Copyright (c) 2004 Simtec Electronics
6419711a 4 * http://armlinux.simtec.co.uk/
1da177e4
LT
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
4e59c25d 12/* s3c_pm_init
1da177e4
LT
13 *
14 * called from board at initialisation time to setup the power
15 * management
16*/
17
f5aeffb7
MB
18#include <linux/irq.h>
19
a09e2b21
MB
20struct sys_device;
21
1da177e4
LT
22#ifdef CONFIG_PM
23
4e59c25d 24extern __init int s3c_pm_init(void);
1da177e4
LT
25
26#else
27
4e59c25d 28static inline int s3c_pm_init(void)
1da177e4
LT
29{
30 return 0;
31}
32#endif
33
34/* configuration for the IRQ mask over sleep */
35extern unsigned long s3c_irqwake_intmask;
36extern unsigned long s3c_irqwake_eintmask;
37
38/* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
39extern unsigned long s3c_irqwake_intallow;
40extern unsigned long s3c_irqwake_eintallow;
41
0033a2f0
BD
42/* per-cpu sleep functions */
43
44extern void (*pm_cpu_prep)(void);
45extern void (*pm_cpu_sleep)(void);
46
1da177e4
LT
47/* Flags for PM Control */
48
49extern unsigned long s3c_pm_flags;
50
4b637dc2
BD
51extern unsigned char pm_uart_udivslot; /* true to save UART UDIVSLOT */
52
1da177e4
LT
53/* from sleep.S */
54
ef30e144
BD
55extern int s3c_cpu_save(unsigned long *saveblk);
56extern void s3c_cpu_resume(void);
57
58095d7f 58extern void s3c2410_cpu_suspend(void);
1da177e4 59
6419711a 60extern unsigned long s3c_sleep_save_phys;
1da177e4
LT
61
62/* sleep save info */
63
6419711a
BD
64/**
65 * struct sleep_save - save information for shared peripherals.
66 * @reg: Pointer to the register to save.
67 * @val: Holder for the value saved from reg.
68 *
69 * This describes a list of registers which is used by the pm core and
70 * other subsystem to save and restore register values over suspend.
71 */
1da177e4
LT
72struct sleep_save {
73 void __iomem *reg;
74 unsigned long val;
75};
76
77#define SAVE_ITEM(x) \
78 { .reg = (x) }
79
d2b07fe2
BD
80/**
81 * struct pm_uart_save - save block for core UART
82 * @ulcon: Save value for S3C2410_ULCON
83 * @ucon: Save value for S3C2410_UCON
84 * @ufcon: Save value for S3C2410_UFCON
85 * @umcon: Save value for S3C2410_UMCON
86 * @ubrdiv: Save value for S3C2410_UBRDIV
87 *
88 * Save block for UART registers to be held over sleep and restored if they
89 * are needed (say by debug).
90*/
91struct pm_uart_save {
92 u32 ulcon;
93 u32 ucon;
94 u32 ufcon;
95 u32 umcon;
96 u32 ubrdiv;
4b637dc2 97 u32 udivslot;
d2b07fe2
BD
98};
99
6419711a
BD
100/* helper functions to save/restore lists of registers. */
101
102extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
103extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
104extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
1e582fc7
BD
105
106#ifdef CONFIG_PM
f5aeffb7 107extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
1e582fc7
BD
108extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
109extern int s3c24xx_irq_resume(struct sys_device *dev);
110#else
56b34426 111#define s3c_irqext_wake NULL
1e582fc7
BD
112#define s3c24xx_irq_suspend NULL
113#define s3c24xx_irq_resume NULL
114#endif
6419711a
BD
115
116/* PM debug functions */
117
8005745d 118#ifdef CONFIG_SAMSUNG_PM_DEBUG
6419711a
BD
119/**
120 * s3c_pm_dbg() - low level debug function for use in suspend/resume.
121 * @msg: The message to print.
122 *
123 * This function is used mainly to debug the resume process before the system
124 * can rely on printk/console output. It uses the low-level debugging output
125 * routine printascii() to do its work.
126 */
127extern void s3c_pm_dbg(const char *msg, ...);
128
129#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
130#else
131#define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt)
132#endif
549c7e33 133
bd117bd1
BD
134#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
135/**
136 * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
137 * @set: set bits for the state of the LEDs
138 * @clear: clear bits for the state of the LEDs.
139 */
140extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
141
142#else
143static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
144#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
145
549c7e33
BD
146/* suspend memory checking */
147
8005745d 148#ifdef CONFIG_SAMSUNG_PM_CHECK
549c7e33
BD
149extern void s3c_pm_check_prepare(void);
150extern void s3c_pm_check_restore(void);
aa8aba69 151extern void s3c_pm_check_cleanup(void);
549c7e33
BD
152extern void s3c_pm_check_store(void);
153#else
154#define s3c_pm_check_prepare() do { } while(0)
155#define s3c_pm_check_restore() do { } while(0)
aa8aba69 156#define s3c_pm_check_cleanup() do { } while(0)
549c7e33
BD
157#define s3c_pm_check_store() do { } while(0)
158#endif
2261e0e6
BD
159
160/**
161 * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
162 *
163 * Setup all the necessary GPIO pins for waking the system on external
164 * interrupt.
165 */
166extern void s3c_pm_configure_extint(void);
167
168/**
169 * s3c_pm_restore_gpios() - restore the state of the gpios after sleep.
170 *
171 * Restore the state of the GPIO pins after sleep, which may involve ensuring
172 * that we do not glitch the state of the pins from that the bootloader's
173 * resume code has done.
174*/
175extern void s3c_pm_restore_gpios(void);
176
177/**
178 * s3c_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
179 *
180 * Save the GPIO states for resotration on resume. See s3c_pm_restore_gpios().
181 */
182extern void s3c_pm_save_gpios(void);
183
fff94cd9
BD
184/**
185 * s3c_pm_cb_flushcache - callback for assembly code
186 *
187 * Callback to issue flush_cache_all() as this call is
188 * not a directly callable object.
189 */
190extern void s3c_pm_cb_flushcache(void);
191
2261e0e6
BD
192extern void s3c_pm_save_core(void);
193extern void s3c_pm_restore_core(void);
This page took 1.39605 seconds and 5 git commands to generate.