pm.c 16 KB

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