pm.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /* linux/arch/arm/mach-s3c2410/pm.c
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 Power Manager (Suspend-To-RAM) support
  7. *
  8. * See Documentation/arm/Samsung-S3C24XX/Suspend.txt for more information
  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 as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * Parts based on arch/arm/mach-pxa/pm.c
  25. *
  26. * Thanks to Dimitry Andric for debugging
  27. *
  28. * Modifications:
  29. * 10-Mar-2005 LCVR Changed S3C2410_VA_UART to S3C24XX_VA_UART
  30. */
  31. #include <linux/init.h>
  32. #include <linux/suspend.h>
  33. #include <linux/errno.h>
  34. #include <linux/time.h>
  35. #include <linux/interrupt.h>
  36. #include <linux/crc32.h>
  37. #include <linux/ioport.h>
  38. #include <linux/delay.h>
  39. #include <asm/hardware.h>
  40. #include <asm/io.h>
  41. #include <asm/arch/regs-serial.h>
  42. #include <asm/arch/regs-clock.h>
  43. #include <asm/arch/regs-gpio.h>
  44. #include <asm/arch/regs-mem.h>
  45. #include <asm/arch/regs-irq.h>
  46. #include <asm/mach/time.h>
  47. #include "pm.h"
  48. /* for external use */
  49. unsigned long s3c_pm_flags;
  50. /* cache functions from arch/arm/mm/proc-arm920.S */
  51. #ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
  52. extern void arm920_flush_kern_cache_all(void);
  53. #else
  54. static void arm920_flush_kern_cache_all(void) { }
  55. #endif
  56. #define PFX "s3c24xx-pm: "
  57. static struct sleep_save core_save[] = {
  58. SAVE_ITEM(S3C2410_LOCKTIME),
  59. SAVE_ITEM(S3C2410_CLKCON),
  60. /* we restore the timings here, with the proviso that the board
  61. * brings the system up in an slower, or equal frequency setting
  62. * to the original system.
  63. *
  64. * if we cannot guarantee this, then things are going to go very
  65. * wrong here, as we modify the refresh and both pll settings.
  66. */
  67. SAVE_ITEM(S3C2410_BWSCON),
  68. SAVE_ITEM(S3C2410_BANKCON0),
  69. SAVE_ITEM(S3C2410_BANKCON1),
  70. SAVE_ITEM(S3C2410_BANKCON2),
  71. SAVE_ITEM(S3C2410_BANKCON3),
  72. SAVE_ITEM(S3C2410_BANKCON4),
  73. SAVE_ITEM(S3C2410_BANKCON5),
  74. SAVE_ITEM(S3C2410_CLKDIVN),
  75. SAVE_ITEM(S3C2410_MPLLCON),
  76. SAVE_ITEM(S3C2410_UPLLCON),
  77. SAVE_ITEM(S3C2410_CLKSLOW),
  78. SAVE_ITEM(S3C2410_REFRESH),
  79. };
  80. /* this lot should be really saved by the IRQ code */
  81. static struct sleep_save irq_save[] = {
  82. SAVE_ITEM(S3C2410_EXTINT0),
  83. SAVE_ITEM(S3C2410_EXTINT1),
  84. SAVE_ITEM(S3C2410_EXTINT2),
  85. SAVE_ITEM(S3C2410_EINFLT0),
  86. SAVE_ITEM(S3C2410_EINFLT1),
  87. SAVE_ITEM(S3C2410_EINFLT2),
  88. SAVE_ITEM(S3C2410_EINFLT3),
  89. SAVE_ITEM(S3C2410_EINTMASK),
  90. SAVE_ITEM(S3C2410_INTMSK)
  91. };
  92. static struct sleep_save gpio_save[] = {
  93. SAVE_ITEM(S3C2410_GPACON),
  94. SAVE_ITEM(S3C2410_GPADAT),
  95. SAVE_ITEM(S3C2410_GPBCON),
  96. SAVE_ITEM(S3C2410_GPBDAT),
  97. SAVE_ITEM(S3C2410_GPBUP),
  98. SAVE_ITEM(S3C2410_GPCCON),
  99. SAVE_ITEM(S3C2410_GPCDAT),
  100. SAVE_ITEM(S3C2410_GPCUP),
  101. SAVE_ITEM(S3C2410_GPDCON),
  102. SAVE_ITEM(S3C2410_GPDDAT),
  103. SAVE_ITEM(S3C2410_GPDUP),
  104. SAVE_ITEM(S3C2410_GPECON),
  105. SAVE_ITEM(S3C2410_GPEDAT),
  106. SAVE_ITEM(S3C2410_GPEUP),
  107. SAVE_ITEM(S3C2410_GPFCON),
  108. SAVE_ITEM(S3C2410_GPFDAT),
  109. SAVE_ITEM(S3C2410_GPFUP),
  110. SAVE_ITEM(S3C2410_GPGCON),
  111. SAVE_ITEM(S3C2410_GPGDAT),
  112. SAVE_ITEM(S3C2410_GPGUP),
  113. SAVE_ITEM(S3C2410_GPHCON),
  114. SAVE_ITEM(S3C2410_GPHDAT),
  115. SAVE_ITEM(S3C2410_GPHUP),
  116. SAVE_ITEM(S3C2410_DCLKCON),
  117. };
  118. #ifdef CONFIG_S3C2410_PM_DEBUG
  119. #define SAVE_UART(va) \
  120. SAVE_ITEM((va) + S3C2410_ULCON), \
  121. SAVE_ITEM((va) + S3C2410_UCON), \
  122. SAVE_ITEM((va) + S3C2410_UFCON), \
  123. SAVE_ITEM((va) + S3C2410_UMCON), \
  124. SAVE_ITEM((va) + S3C2410_UBRDIV)
  125. static struct sleep_save uart_save[] = {
  126. SAVE_UART(S3C24XX_VA_UART0),
  127. SAVE_UART(S3C24XX_VA_UART1),
  128. #ifndef CONFIG_CPU_S3C2400
  129. SAVE_UART(S3C24XX_VA_UART2),
  130. #endif
  131. };
  132. /* debug
  133. *
  134. * we send the debug to printascii() to allow it to be seen if the
  135. * system never wakes up from the sleep
  136. */
  137. extern void printascii(const char *);
  138. static void pm_dbg(const char *fmt, ...)
  139. {
  140. va_list va;
  141. char buff[256];
  142. va_start(va, fmt);
  143. vsprintf(buff, fmt, va);
  144. va_end(va);
  145. printascii(buff);
  146. }
  147. static void s3c2410_pm_debug_init(void)
  148. {
  149. unsigned long tmp = __raw_readl(S3C2410_CLKCON);
  150. /* re-start uart clocks */
  151. tmp |= S3C2410_CLKCON_UART0;
  152. tmp |= S3C2410_CLKCON_UART1;
  153. tmp |= S3C2410_CLKCON_UART2;
  154. __raw_writel(tmp, S3C2410_CLKCON);
  155. udelay(10);
  156. }
  157. #define DBG(fmt...) pm_dbg(fmt)
  158. #else
  159. #define DBG(fmt...) printk(KERN_DEBUG fmt)
  160. #define s3c2410_pm_debug_init() do { } while(0)
  161. static struct sleep_save uart_save[] = {};
  162. #endif
  163. #if defined(CONFIG_S3C2410_PM_CHECK) && CONFIG_S3C2410_PM_CHECK_CHUNKSIZE != 0
  164. /* suspend checking code...
  165. *
  166. * this next area does a set of crc checks over all the installed
  167. * memory, so the system can verify if the resume was ok.
  168. *
  169. * CONFIG_S3C2410_PM_CHECK_CHUNKSIZE defines the block-size for the CRC,
  170. * increasing it will mean that the area corrupted will be less easy to spot,
  171. * and reducing the size will cause the CRC save area to grow
  172. */
  173. #define CHECK_CHUNKSIZE (CONFIG_S3C2410_PM_CHECK_CHUNKSIZE * 1024)
  174. static u32 crc_size; /* size needed for the crc block */
  175. static u32 *crcs; /* allocated over suspend/resume */
  176. typedef u32 *(run_fn_t)(struct resource *ptr, u32 *arg);
  177. /* s3c2410_pm_run_res
  178. *
  179. * go thorugh the given resource list, and look for system ram
  180. */
  181. static void s3c2410_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
  182. {
  183. while (ptr != NULL) {
  184. if (ptr->child != NULL)
  185. s3c2410_pm_run_res(ptr->child, fn, arg);
  186. if ((ptr->flags & IORESOURCE_MEM) &&
  187. strcmp(ptr->name, "System RAM") == 0) {
  188. DBG("Found system RAM at %08lx..%08lx\n",
  189. ptr->start, ptr->end);
  190. arg = (fn)(ptr, arg);
  191. }
  192. ptr = ptr->sibling;
  193. }
  194. }
  195. static void s3c2410_pm_run_sysram(run_fn_t fn, u32 *arg)
  196. {
  197. s3c2410_pm_run_res(&iomem_resource, fn, arg);
  198. }
  199. static u32 *s3c2410_pm_countram(struct resource *res, u32 *val)
  200. {
  201. u32 size = (u32)(res->end - res->start)+1;
  202. size += CHECK_CHUNKSIZE-1;
  203. size /= CHECK_CHUNKSIZE;
  204. DBG("Area %08lx..%08lx, %d blocks\n", res->start, res->end, size);
  205. *val += size * sizeof(u32);
  206. return val;
  207. }
  208. /* s3c2410_pm_prepare_check
  209. *
  210. * prepare the necessary information for creating the CRCs. This
  211. * must be done before the final save, as it will require memory
  212. * allocating, and thus touching bits of the kernel we do not
  213. * know about.
  214. */
  215. static void s3c2410_pm_check_prepare(void)
  216. {
  217. crc_size = 0;
  218. s3c2410_pm_run_sysram(s3c2410_pm_countram, &crc_size);
  219. DBG("s3c2410_pm_prepare_check: %u checks needed\n", crc_size);
  220. crcs = kmalloc(crc_size+4, GFP_KERNEL);
  221. if (crcs == NULL)
  222. printk(KERN_ERR "Cannot allocated CRC save area\n");
  223. }
  224. static u32 *s3c2410_pm_makecheck(struct resource *res, u32 *val)
  225. {
  226. unsigned long addr, left;
  227. for (addr = res->start; addr < res->end;
  228. addr += CHECK_CHUNKSIZE) {
  229. left = res->end - addr;
  230. if (left > CHECK_CHUNKSIZE)
  231. left = CHECK_CHUNKSIZE;
  232. *val = crc32_le(~0, phys_to_virt(addr), left);
  233. val++;
  234. }
  235. return val;
  236. }
  237. /* s3c2410_pm_check_store
  238. *
  239. * compute the CRC values for the memory blocks before the final
  240. * sleep.
  241. */
  242. static void s3c2410_pm_check_store(void)
  243. {
  244. if (crcs != NULL)
  245. s3c2410_pm_run_sysram(s3c2410_pm_makecheck, crcs);
  246. }
  247. /* in_region
  248. *
  249. * return TRUE if the area defined by ptr..ptr+size contatins the
  250. * what..what+whatsz
  251. */
  252. static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
  253. {
  254. if ((what+whatsz) < ptr)
  255. return 0;
  256. if (what > (ptr+size))
  257. return 0;
  258. return 1;
  259. }
  260. static u32 *s3c2410_pm_runcheck(struct resource *res, u32 *val)
  261. {
  262. void *save_at = phys_to_virt(s3c2410_sleep_save_phys);
  263. unsigned long addr;
  264. unsigned long left;
  265. void *ptr;
  266. u32 calc;
  267. for (addr = res->start; addr < res->end;
  268. addr += CHECK_CHUNKSIZE) {
  269. left = res->end - addr;
  270. if (left > CHECK_CHUNKSIZE)
  271. left = CHECK_CHUNKSIZE;
  272. ptr = phys_to_virt(addr);
  273. if (in_region(ptr, left, crcs, crc_size)) {
  274. DBG("skipping %08lx, has crc block in\n", addr);
  275. goto skip_check;
  276. }
  277. if (in_region(ptr, left, save_at, 32*4 )) {
  278. DBG("skipping %08lx, has save block in\n", addr);
  279. goto skip_check;
  280. }
  281. /* calculate and check the checksum */
  282. calc = crc32_le(~0, ptr, left);
  283. if (calc != *val) {
  284. printk(KERN_ERR PFX "Restore CRC error at "
  285. "%08lx (%08x vs %08x)\n", addr, calc, *val);
  286. DBG("Restore CRC error at %08lx (%08x vs %08x)\n",
  287. addr, calc, *val);
  288. }
  289. skip_check:
  290. val++;
  291. }
  292. return val;
  293. }
  294. /* s3c2410_pm_check_restore
  295. *
  296. * check the CRCs after the restore event and free the memory used
  297. * to hold them
  298. */
  299. static void s3c2410_pm_check_restore(void)
  300. {
  301. if (crcs != NULL) {
  302. s3c2410_pm_run_sysram(s3c2410_pm_runcheck, crcs);
  303. kfree(crcs);
  304. crcs = NULL;
  305. }
  306. }
  307. #else
  308. #define s3c2410_pm_check_prepare() do { } while(0)
  309. #define s3c2410_pm_check_restore() do { } while(0)
  310. #define s3c2410_pm_check_store() do { } while(0)
  311. #endif
  312. /* helper functions to save and restore register state */
  313. void s3c2410_pm_do_save(struct sleep_save *ptr, int count)
  314. {
  315. for (; count > 0; count--, ptr++) {
  316. ptr->val = __raw_readl(ptr->reg);
  317. DBG("saved %p value %08lx\n", ptr->reg, ptr->val);
  318. }
  319. }
  320. /* s3c2410_pm_do_restore
  321. *
  322. * restore the system from the given list of saved registers
  323. *
  324. * Note, we do not use DBG() in here, as the system may not have
  325. * restore the UARTs state yet
  326. */
  327. void s3c2410_pm_do_restore(struct sleep_save *ptr, int count)
  328. {
  329. for (; count > 0; count--, ptr++) {
  330. printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n",
  331. ptr->reg, ptr->val, __raw_readl(ptr->reg));
  332. __raw_writel(ptr->val, ptr->reg);
  333. }
  334. }
  335. /* s3c2410_pm_do_restore_core
  336. *
  337. * similar to s3c2410_pm_do_restore_core
  338. *
  339. * WARNING: Do not put any debug in here that may effect memory or use
  340. * peripherals, as things may be changing!
  341. */
  342. static void s3c2410_pm_do_restore_core(struct sleep_save *ptr, int count)
  343. {
  344. for (; count > 0; count--, ptr++) {
  345. __raw_writel(ptr->val, ptr->reg);
  346. }
  347. }
  348. /* s3c2410_pm_show_resume_irqs
  349. *
  350. * print any IRQs asserted at resume time (ie, we woke from)
  351. */
  352. static void s3c2410_pm_show_resume_irqs(int start, unsigned long which,
  353. unsigned long mask)
  354. {
  355. int i;
  356. which &= ~mask;
  357. for (i = 0; i <= 31; i++) {
  358. if ((which) & (1L<<i)) {
  359. DBG("IRQ %d asserted at resume\n", start+i);
  360. }
  361. }
  362. }
  363. /* s3c2410_pm_check_resume_pin
  364. *
  365. * check to see if the pin is configured correctly for sleep mode, and
  366. * make any necessary adjustments if it is not
  367. */
  368. static void s3c2410_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
  369. {
  370. unsigned long irqstate;
  371. unsigned long pinstate;
  372. int irq = s3c2410_gpio_getirq(pin);
  373. if (irqoffs < 4)
  374. irqstate = s3c_irqwake_intmask & (1L<<irqoffs);
  375. else
  376. irqstate = s3c_irqwake_eintmask & (1L<<irqoffs);
  377. pinstate = s3c2410_gpio_getcfg(pin);
  378. pinstate >>= S3C2410_GPIO_OFFSET(pin)*2;
  379. if (!irqstate) {
  380. if (pinstate == 0x02)
  381. DBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin);
  382. } else {
  383. if (pinstate == 0x02) {
  384. DBG("Disabling IRQ %d (pin %d)\n", irq, pin);
  385. s3c2410_gpio_cfgpin(pin, 0x00);
  386. }
  387. }
  388. }
  389. /* s3c2410_pm_configure_extint
  390. *
  391. * configure all external interrupt pins
  392. */
  393. static void s3c2410_pm_configure_extint(void)
  394. {
  395. int pin;
  396. /* for each of the external interrupts (EINT0..EINT15) we
  397. * need to check wether it is an external interrupt source,
  398. * and then configure it as an input if it is not
  399. */
  400. for (pin = S3C2410_GPF0; pin <= S3C2410_GPF7; pin++) {
  401. s3c2410_pm_check_resume_pin(pin, pin - S3C2410_GPF0);
  402. }
  403. for (pin = S3C2410_GPG0; pin <= S3C2410_GPG7; pin++) {
  404. s3c2410_pm_check_resume_pin(pin, (pin - S3C2410_GPG0)+8);
  405. }
  406. }
  407. #define any_allowed(mask, allow) (((mask) & (allow)) != (allow))
  408. /* s3c2410_pm_enter
  409. *
  410. * central control for sleep/resume process
  411. */
  412. static int s3c2410_pm_enter(suspend_state_t state)
  413. {
  414. unsigned long regs_save[16];
  415. unsigned long tmp;
  416. /* ensure the debug is initialised (if enabled) */
  417. s3c2410_pm_debug_init();
  418. DBG("s3c2410_pm_enter(%d)\n", state);
  419. if (state != PM_SUSPEND_MEM) {
  420. printk(KERN_ERR PFX "error: only PM_SUSPEND_MEM supported\n");
  421. return -EINVAL;
  422. }
  423. /* check if we have anything to wake-up with... bad things seem
  424. * to happen if you suspend with no wakeup (system will often
  425. * require a full power-cycle)
  426. */
  427. if (!any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) &&
  428. !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) {
  429. printk(KERN_ERR PFX "No sources enabled for wake-up!\n");
  430. printk(KERN_ERR PFX "Aborting sleep\n");
  431. return -EINVAL;
  432. }
  433. /* prepare check area if configured */
  434. s3c2410_pm_check_prepare();
  435. /* store the physical address of the register recovery block */
  436. s3c2410_sleep_save_phys = virt_to_phys(regs_save);
  437. DBG("s3c2410_sleep_save_phys=0x%08lx\n", s3c2410_sleep_save_phys);
  438. /* ensure at least GESTATUS3 has the resume address */
  439. __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3);
  440. DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
  441. DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
  442. /* save all necessary core registers not covered by the drivers */
  443. s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save));
  444. s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
  445. s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save));
  446. s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
  447. /* set the irq configuration for wake */
  448. s3c2410_pm_configure_extint();
  449. DBG("sleep: irq wakeup masks: %08lx,%08lx\n",
  450. s3c_irqwake_intmask, s3c_irqwake_eintmask);
  451. __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
  452. __raw_writel(s3c_irqwake_eintmask, S3C2410_EINTMASK);
  453. /* ack any outstanding external interrupts before we go to sleep */
  454. __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
  455. /* flush cache back to ram */
  456. arm920_flush_kern_cache_all();
  457. s3c2410_pm_check_store();
  458. /* send the cpu to sleep... */
  459. __raw_writel(0x00, S3C2410_CLKCON); /* turn off clocks over sleep */
  460. s3c2410_cpu_suspend(regs_save);
  461. /* restore the cpu state */
  462. cpu_init();
  463. /* unset the return-from-sleep flag, to ensure reset */
  464. tmp = __raw_readl(S3C2410_GSTATUS2);
  465. tmp &= S3C2410_GSTATUS2_OFFRESET;
  466. __raw_writel(tmp, S3C2410_GSTATUS2);
  467. /* restore the system state */
  468. s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
  469. s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save));
  470. s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
  471. s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
  472. s3c2410_pm_debug_init();
  473. /* check what irq (if any) restored the system */
  474. DBG("post sleep: IRQs 0x%08x, 0x%08x\n",
  475. __raw_readl(S3C2410_SRCPND),
  476. __raw_readl(S3C2410_EINTPEND));
  477. s3c2410_pm_show_resume_irqs(IRQ_EINT0, __raw_readl(S3C2410_SRCPND),
  478. s3c_irqwake_intmask);
  479. s3c2410_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
  480. s3c_irqwake_eintmask);
  481. DBG("post sleep, preparing to return\n");
  482. s3c2410_pm_check_restore();
  483. /* ok, let's return from sleep */
  484. DBG("S3C2410 PM Resume (post-restore)\n");
  485. return 0;
  486. }
  487. /*
  488. * Called after processes are frozen, but before we shut down devices.
  489. */
  490. static int s3c2410_pm_prepare(suspend_state_t state)
  491. {
  492. return 0;
  493. }
  494. /*
  495. * Called after devices are re-setup, but before processes are thawed.
  496. */
  497. static int s3c2410_pm_finish(suspend_state_t state)
  498. {
  499. return 0;
  500. }
  501. /*
  502. * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
  503. */
  504. static struct pm_ops s3c2410_pm_ops = {
  505. .pm_disk_mode = PM_DISK_FIRMWARE,
  506. .prepare = s3c2410_pm_prepare,
  507. .enter = s3c2410_pm_enter,
  508. .finish = s3c2410_pm_finish,
  509. };
  510. /* s3c2410_pm_init
  511. *
  512. * Attach the power management functions. This should be called
  513. * from the board specific initialisation if the board supports
  514. * it.
  515. */
  516. int __init s3c2410_pm_init(void)
  517. {
  518. printk("S3C2410 Power Management, (c) 2004 Simtec Electronics\n");
  519. pm_set_ops(&s3c2410_pm_ops);
  520. return 0;
  521. }