Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 1 | /* linux/arch/arm/plat-s3c/pm.c |
| 2 | * |
| 3 | * Copyright 2008 Openmoko, Inc. |
Ben Dooks | ccae941 | 2009-11-13 22:54:14 +0000 | [diff] [blame] | 4 | * Copyright 2004-2008 Simtec Electronics |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 5 | * Ben Dooks <ben@simtec.co.uk> |
| 6 | * http://armlinux.simtec.co.uk/ |
| 7 | * |
| 8 | * S3C common power management (suspend to ram) support. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/suspend.h> |
| 17 | #include <linux/errno.h> |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 18 | #include <linux/delay.h> |
Tomasz Figa | cd3fc1b | 2013-05-17 18:24:29 +0200 | [diff] [blame] | 19 | #include <linux/of.h> |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 20 | #include <linux/serial_core.h> |
Tushar Behera | 334a1c7 | 2014-02-14 10:32:45 +0900 | [diff] [blame^] | 21 | #include <linux/serial_s3c.h> |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 22 | #include <linux/io.h> |
| 23 | |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 24 | #include <asm/cacheflush.h> |
Russell King | 2c74a0c | 2011-06-22 17:41:48 +0100 | [diff] [blame] | 25 | #include <asm/suspend.h> |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 26 | |
Tomasz Figa | d6280ff | 2013-06-15 09:17:33 +0900 | [diff] [blame] | 27 | #ifdef CONFIG_SAMSUNG_ATAGS |
| 28 | #include <mach/hardware.h> |
| 29 | #include <mach/map.h> |
Kukjin Kim | 05a6380 | 2013-12-19 04:07:32 +0900 | [diff] [blame] | 30 | #ifndef CONFIG_ARCH_EXYNOS |
Kukjin Kim | 2857f65 | 2013-12-19 04:22:40 +0900 | [diff] [blame] | 31 | #include <mach/regs-clock.h> |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 32 | #include <mach/regs-irq.h> |
Kukjin Kim | 05a6380 | 2013-12-19 04:07:32 +0900 | [diff] [blame] | 33 | #endif |
Arnd Bergmann | 7ba8022 | 2013-03-05 11:28:29 +0100 | [diff] [blame] | 34 | #include <mach/irqs.h> |
Tomasz Figa | d6280ff | 2013-06-15 09:17:33 +0900 | [diff] [blame] | 35 | #endif |
| 36 | |
Ben Dooks | 56b3442 | 2008-12-12 00:24:12 +0000 | [diff] [blame] | 37 | #include <asm/irq.h> |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 38 | |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 39 | #include <plat/pm.h> |
Ben Dooks | 431fb7d | 2010-02-05 13:52:53 +0100 | [diff] [blame] | 40 | #include <mach/pm-core.h> |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 41 | |
| 42 | /* for external use */ |
| 43 | |
| 44 | unsigned long s3c_pm_flags; |
| 45 | |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 46 | /* Debug code: |
| 47 | * |
| 48 | * This code supports debug output to the low level UARTs for use on |
| 49 | * resume before the console layer is available. |
| 50 | */ |
| 51 | |
Ben Dooks | 8005745 | 2010-01-20 12:29:25 +0900 | [diff] [blame] | 52 | #ifdef CONFIG_SAMSUNG_PM_DEBUG |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 53 | extern void printascii(const char *); |
| 54 | |
| 55 | void s3c_pm_dbg(const char *fmt, ...) |
| 56 | { |
| 57 | va_list va; |
| 58 | char buff[256]; |
| 59 | |
| 60 | va_start(va, fmt); |
Chen Gang | 8baaa26 | 2013-01-25 10:29:01 -0800 | [diff] [blame] | 61 | vsnprintf(buff, sizeof(buff), fmt, va); |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 62 | va_end(va); |
| 63 | |
| 64 | printascii(buff); |
| 65 | } |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 66 | |
| 67 | static inline void s3c_pm_debug_init(void) |
| 68 | { |
| 69 | /* restart uart clocks so we can use them to output */ |
| 70 | s3c_pm_debug_init_uart(); |
| 71 | } |
| 72 | |
| 73 | #else |
| 74 | #define s3c_pm_debug_init() do { } while(0) |
| 75 | |
Ben Dooks | 8005745 | 2010-01-20 12:29:25 +0900 | [diff] [blame] | 76 | #endif /* CONFIG_SAMSUNG_PM_DEBUG */ |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 77 | |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 78 | /* Save the UART configurations if we are configured for debug. */ |
| 79 | |
Ben Dooks | 4b637dc | 2008-12-12 00:24:24 +0000 | [diff] [blame] | 80 | unsigned char pm_uart_udivslot; |
| 81 | |
Ben Dooks | 8005745 | 2010-01-20 12:29:25 +0900 | [diff] [blame] | 82 | #ifdef CONFIG_SAMSUNG_PM_DEBUG |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 83 | |
Yadwinder Singh Brar | 7bdc84f | 2013-07-24 17:05:07 +0900 | [diff] [blame] | 84 | static struct pm_uart_save uart_save; |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 85 | |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 86 | static void s3c_pm_save_uart(unsigned int uart, struct pm_uart_save *save) |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 87 | { |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 88 | void __iomem *regs = S3C_VA_UARTx(uart); |
| 89 | |
| 90 | save->ulcon = __raw_readl(regs + S3C2410_ULCON); |
| 91 | save->ucon = __raw_readl(regs + S3C2410_UCON); |
| 92 | save->ufcon = __raw_readl(regs + S3C2410_UFCON); |
| 93 | save->umcon = __raw_readl(regs + S3C2410_UMCON); |
| 94 | save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV); |
Ben Dooks | 57699e9 | 2008-12-12 00:24:23 +0000 | [diff] [blame] | 95 | |
Ben Dooks | 4b637dc | 2008-12-12 00:24:24 +0000 | [diff] [blame] | 96 | if (pm_uart_udivslot) |
| 97 | save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT); |
| 98 | |
Ben Dooks | 57699e9 | 2008-12-12 00:24:23 +0000 | [diff] [blame] | 99 | S3C_PMDBG("UART[%d]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n", |
| 100 | uart, save->ulcon, save->ucon, save->ufcon, save->ubrdiv); |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 101 | } |
| 102 | |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 103 | static void s3c_pm_save_uarts(void) |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 104 | { |
Yadwinder Singh Brar | 7bdc84f | 2013-07-24 17:05:07 +0900 | [diff] [blame] | 105 | s3c_pm_save_uart(CONFIG_DEBUG_S3C_UART, &uart_save); |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | static void s3c_pm_restore_uart(unsigned int uart, struct pm_uart_save *save) |
| 109 | { |
| 110 | void __iomem *regs = S3C_VA_UARTx(uart); |
| 111 | |
Ben Dooks | 57699e9 | 2008-12-12 00:24:23 +0000 | [diff] [blame] | 112 | s3c_pm_arch_update_uart(regs, save); |
| 113 | |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 114 | __raw_writel(save->ulcon, regs + S3C2410_ULCON); |
| 115 | __raw_writel(save->ucon, regs + S3C2410_UCON); |
| 116 | __raw_writel(save->ufcon, regs + S3C2410_UFCON); |
| 117 | __raw_writel(save->umcon, regs + S3C2410_UMCON); |
| 118 | __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV); |
Ben Dooks | 4b637dc | 2008-12-12 00:24:24 +0000 | [diff] [blame] | 119 | |
| 120 | if (pm_uart_udivslot) |
| 121 | __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT); |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | static void s3c_pm_restore_uarts(void) |
| 125 | { |
Yadwinder Singh Brar | 7bdc84f | 2013-07-24 17:05:07 +0900 | [diff] [blame] | 126 | s3c_pm_restore_uart(CONFIG_DEBUG_S3C_UART, &uart_save); |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 127 | } |
| 128 | #else |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 129 | static void s3c_pm_save_uarts(void) { } |
| 130 | static void s3c_pm_restore_uarts(void) { } |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 131 | #endif |
| 132 | |
Ben Dooks | 56b3442 | 2008-12-12 00:24:12 +0000 | [diff] [blame] | 133 | /* The IRQ ext-int code goes here, it is too small to currently bother |
| 134 | * with its own file. */ |
| 135 | |
| 136 | unsigned long s3c_irqwake_intmask = 0xffffffffL; |
| 137 | unsigned long s3c_irqwake_eintmask = 0xffffffffL; |
| 138 | |
Mark Brown | f5aeffb | 2010-12-02 14:35:38 +0900 | [diff] [blame] | 139 | int s3c_irqext_wake(struct irq_data *data, unsigned int state) |
Ben Dooks | 56b3442 | 2008-12-12 00:24:12 +0000 | [diff] [blame] | 140 | { |
Mark Brown | f5aeffb | 2010-12-02 14:35:38 +0900 | [diff] [blame] | 141 | unsigned long bit = 1L << IRQ_EINT_BIT(data->irq); |
Ben Dooks | 56b3442 | 2008-12-12 00:24:12 +0000 | [diff] [blame] | 142 | |
| 143 | if (!(s3c_irqwake_eintallow & bit)) |
| 144 | return -ENOENT; |
| 145 | |
| 146 | printk(KERN_INFO "wake %s for irq %d\n", |
Mark Brown | f5aeffb | 2010-12-02 14:35:38 +0900 | [diff] [blame] | 147 | state ? "enabled" : "disabled", data->irq); |
Ben Dooks | 56b3442 | 2008-12-12 00:24:12 +0000 | [diff] [blame] | 148 | |
| 149 | if (!state) |
| 150 | s3c_irqwake_eintmask |= bit; |
| 151 | else |
| 152 | s3c_irqwake_eintmask &= ~bit; |
| 153 | |
| 154 | return 0; |
| 155 | } |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 156 | |
| 157 | /* helper functions to save and restore register state */ |
| 158 | |
| 159 | /** |
| 160 | * s3c_pm_do_save() - save a set of registers for restoration on resume. |
| 161 | * @ptr: Pointer to an array of registers. |
| 162 | * @count: Size of the ptr array. |
| 163 | * |
| 164 | * Run through the list of registers given, saving their contents in the |
| 165 | * array for later restoration when we wakeup. |
| 166 | */ |
| 167 | void s3c_pm_do_save(struct sleep_save *ptr, int count) |
| 168 | { |
| 169 | for (; count > 0; count--, ptr++) { |
| 170 | ptr->val = __raw_readl(ptr->reg); |
| 171 | S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * s3c_pm_do_restore() - restore register values from the save list. |
| 177 | * @ptr: Pointer to an array of registers. |
| 178 | * @count: Size of the ptr array. |
| 179 | * |
| 180 | * Restore the register values saved from s3c_pm_do_save(). |
| 181 | * |
| 182 | * Note, we do not use S3C_PMDBG() in here, as the system may not have |
| 183 | * restore the UARTs state yet |
| 184 | */ |
| 185 | |
Daniel Kurtz | c143751 | 2013-12-12 07:08:27 +0900 | [diff] [blame] | 186 | void s3c_pm_do_restore(const struct sleep_save *ptr, int count) |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 187 | { |
| 188 | for (; count > 0; count--, ptr++) { |
| 189 | printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n", |
| 190 | ptr->reg, ptr->val, __raw_readl(ptr->reg)); |
| 191 | |
| 192 | __raw_writel(ptr->val, ptr->reg); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * s3c_pm_do_restore_core() - early restore register values from save list. |
| 198 | * |
| 199 | * This is similar to s3c_pm_do_restore() except we try and minimise the |
| 200 | * side effects of the function in case registers that hardware might need |
| 201 | * to work has been restored. |
| 202 | * |
| 203 | * WARNING: Do not put any debug in here that may effect memory or use |
| 204 | * peripherals, as things may be changing! |
| 205 | */ |
| 206 | |
Daniel Kurtz | c143751 | 2013-12-12 07:08:27 +0900 | [diff] [blame] | 207 | void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count) |
Ben Dooks | 6419711 | 2008-12-12 00:24:06 +0000 | [diff] [blame] | 208 | { |
| 209 | for (; count > 0; count--, ptr++) |
| 210 | __raw_writel(ptr->val, ptr->reg); |
| 211 | } |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 212 | |
| 213 | /* s3c2410_pm_show_resume_irqs |
| 214 | * |
| 215 | * print any IRQs asserted at resume time (ie, we woke from) |
| 216 | */ |
Maurus Cuelenaere | baab730 | 2011-04-02 10:50:22 +0900 | [diff] [blame] | 217 | static void __maybe_unused s3c_pm_show_resume_irqs(int start, |
| 218 | unsigned long which, |
| 219 | unsigned long mask) |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 220 | { |
| 221 | int i; |
| 222 | |
| 223 | which &= ~mask; |
| 224 | |
| 225 | for (i = 0; i <= 31; i++) { |
| 226 | if (which & (1L<<i)) { |
| 227 | S3C_PMDBG("IRQ %d asserted at resume\n", start+i); |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | |
| 233 | void (*pm_cpu_prep)(void); |
Russell King | 29cb3cd | 2011-07-02 09:54:01 +0100 | [diff] [blame] | 234 | int (*pm_cpu_sleep)(unsigned long); |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 235 | |
| 236 | #define any_allowed(mask, allow) (((mask) & (allow)) != (allow)) |
| 237 | |
| 238 | /* s3c_pm_enter |
| 239 | * |
| 240 | * central control for sleep/resume process |
| 241 | */ |
| 242 | |
| 243 | static int s3c_pm_enter(suspend_state_t state) |
| 244 | { |
Abhilash Kesavan | d3fcacf | 2013-01-25 10:40:19 -0800 | [diff] [blame] | 245 | int ret; |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 246 | /* ensure the debug is initialised (if enabled) */ |
| 247 | |
| 248 | s3c_pm_debug_init(); |
| 249 | |
| 250 | S3C_PMDBG("%s(%d)\n", __func__, state); |
| 251 | |
| 252 | if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) { |
| 253 | printk(KERN_ERR "%s: error: no cpu sleep function\n", __func__); |
| 254 | return -EINVAL; |
| 255 | } |
| 256 | |
| 257 | /* check if we have anything to wake-up with... bad things seem |
| 258 | * to happen if you suspend with no wakeup (system will often |
| 259 | * require a full power-cycle) |
| 260 | */ |
| 261 | |
Tomasz Figa | cd3fc1b | 2013-05-17 18:24:29 +0200 | [diff] [blame] | 262 | if (!of_have_populated_dt() && |
| 263 | !any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) && |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 264 | !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) { |
| 265 | printk(KERN_ERR "%s: No wake-up sources!\n", __func__); |
| 266 | printk(KERN_ERR "%s: Aborting sleep\n", __func__); |
| 267 | return -EINVAL; |
| 268 | } |
| 269 | |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 270 | /* save all necessary core registers not covered by the drivers */ |
| 271 | |
Tomasz Figa | cd3fc1b | 2013-05-17 18:24:29 +0200 | [diff] [blame] | 272 | if (!of_have_populated_dt()) { |
| 273 | samsung_pm_save_gpios(); |
| 274 | samsung_pm_saved_gpios(); |
| 275 | } |
| 276 | |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 277 | s3c_pm_save_uarts(); |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 278 | s3c_pm_save_core(); |
| 279 | |
| 280 | /* set the irq configuration for wake */ |
| 281 | |
| 282 | s3c_pm_configure_extint(); |
| 283 | |
| 284 | S3C_PMDBG("sleep: irq wakeup masks: %08lx,%08lx\n", |
| 285 | s3c_irqwake_intmask, s3c_irqwake_eintmask); |
| 286 | |
| 287 | s3c_pm_arch_prepare_irqs(); |
| 288 | |
| 289 | /* call cpu specific preparation */ |
| 290 | |
| 291 | pm_cpu_prep(); |
| 292 | |
| 293 | /* flush cache back to ram */ |
| 294 | |
| 295 | flush_cache_all(); |
| 296 | |
| 297 | s3c_pm_check_store(); |
| 298 | |
| 299 | /* send the cpu to sleep... */ |
| 300 | |
| 301 | s3c_pm_arch_stop_clocks(); |
| 302 | |
Russell King | e7089da | 2011-06-21 19:29:26 +0100 | [diff] [blame] | 303 | /* this will also act as our return point from when |
Ben Dooks | fff94cd | 2009-03-10 11:48:07 +0000 | [diff] [blame] | 304 | * we resume as it saves its own register state and restores it |
| 305 | * during the resume. */ |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 306 | |
Abhilash Kesavan | d3fcacf | 2013-01-25 10:40:19 -0800 | [diff] [blame] | 307 | ret = cpu_suspend(0, pm_cpu_sleep); |
| 308 | if (ret) |
| 309 | return ret; |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 310 | |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 311 | /* restore the system state */ |
| 312 | |
| 313 | s3c_pm_restore_core(); |
Ben Dooks | d2b07fe | 2008-12-12 00:24:20 +0000 | [diff] [blame] | 314 | s3c_pm_restore_uarts(); |
Tomasz Figa | cd3fc1b | 2013-05-17 18:24:29 +0200 | [diff] [blame] | 315 | |
| 316 | if (!of_have_populated_dt()) { |
| 317 | samsung_pm_restore_gpios(); |
| 318 | s3c_pm_restored_gpios(); |
| 319 | } |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 320 | |
| 321 | s3c_pm_debug_init(); |
| 322 | |
| 323 | /* check what irq (if any) restored the system */ |
| 324 | |
| 325 | s3c_pm_arch_show_resume_irqs(); |
| 326 | |
| 327 | S3C_PMDBG("%s: post sleep, preparing to return\n", __func__); |
| 328 | |
Ben Dooks | bd117bd | 2009-03-10 18:19:35 +0000 | [diff] [blame] | 329 | /* LEDs should now be 1110 */ |
| 330 | s3c_pm_debug_smdkled(1 << 1, 0); |
| 331 | |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 332 | s3c_pm_check_restore(); |
| 333 | |
| 334 | /* ok, let's return from sleep */ |
| 335 | |
| 336 | S3C_PMDBG("S3C PM Resume (post-restore)\n"); |
| 337 | return 0; |
| 338 | } |
| 339 | |
Ben Dooks | aa8aba6 | 2008-12-12 00:24:34 +0000 | [diff] [blame] | 340 | static int s3c_pm_prepare(void) |
| 341 | { |
| 342 | /* prepare check area if configured */ |
| 343 | |
| 344 | s3c_pm_check_prepare(); |
| 345 | return 0; |
| 346 | } |
| 347 | |
| 348 | static void s3c_pm_finish(void) |
| 349 | { |
| 350 | s3c_pm_check_cleanup(); |
| 351 | } |
| 352 | |
Lionel Debroux | 2f55ac0 | 2010-11-16 14:14:02 +0100 | [diff] [blame] | 353 | static const struct platform_suspend_ops s3c_pm_ops = { |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 354 | .enter = s3c_pm_enter, |
Ben Dooks | aa8aba6 | 2008-12-12 00:24:34 +0000 | [diff] [blame] | 355 | .prepare = s3c_pm_prepare, |
| 356 | .finish = s3c_pm_finish, |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 357 | .valid = suspend_valid_only_mem, |
| 358 | }; |
| 359 | |
Ben Dooks | 4e59c25 | 2008-12-12 00:24:18 +0000 | [diff] [blame] | 360 | /* s3c_pm_init |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 361 | * |
| 362 | * Attach the power management functions. This should be called |
| 363 | * from the board specific initialisation if the board supports |
| 364 | * it. |
| 365 | */ |
| 366 | |
Ben Dooks | 4e59c25 | 2008-12-12 00:24:18 +0000 | [diff] [blame] | 367 | int __init s3c_pm_init(void) |
Ben Dooks | 2261e0e | 2008-12-12 00:24:08 +0000 | [diff] [blame] | 368 | { |
| 369 | printk("S3C Power Management, Copyright 2004 Simtec Electronics\n"); |
| 370 | |
| 371 | suspend_set_ops(&s3c_pm_ops); |
| 372 | return 0; |
| 373 | } |