pm.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* linux/include/asm-arm/plat-s3c24xx/pm.h
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  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. /* s3c_pm_init
  12. *
  13. * called from board at initialisation time to setup the power
  14. * management
  15. */
  16. #ifdef CONFIG_PM
  17. extern __init int s3c_pm_init(void);
  18. #else
  19. static inline int s3c_pm_init(void)
  20. {
  21. return 0;
  22. }
  23. #endif
  24. /* configuration for the IRQ mask over sleep */
  25. extern unsigned long s3c_irqwake_intmask;
  26. extern unsigned long s3c_irqwake_eintmask;
  27. /* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
  28. extern unsigned long s3c_irqwake_intallow;
  29. extern unsigned long s3c_irqwake_eintallow;
  30. /* per-cpu sleep functions */
  31. extern void (*pm_cpu_prep)(void);
  32. extern void (*pm_cpu_sleep)(void);
  33. /* Flags for PM Control */
  34. extern unsigned long s3c_pm_flags;
  35. /* from sleep.S */
  36. extern int s3c_cpu_save(unsigned long *saveblk);
  37. extern void s3c_cpu_resume(void);
  38. extern void s3c2410_cpu_suspend(void);
  39. extern unsigned long s3c_sleep_save_phys;
  40. /* sleep save info */
  41. /**
  42. * struct sleep_save - save information for shared peripherals.
  43. * @reg: Pointer to the register to save.
  44. * @val: Holder for the value saved from reg.
  45. *
  46. * This describes a list of registers which is used by the pm core and
  47. * other subsystem to save and restore register values over suspend.
  48. */
  49. struct sleep_save {
  50. void __iomem *reg;
  51. unsigned long val;
  52. };
  53. #define SAVE_ITEM(x) \
  54. { .reg = (x) }
  55. /**
  56. * struct pm_uart_save - save block for core UART
  57. * @ulcon: Save value for S3C2410_ULCON
  58. * @ucon: Save value for S3C2410_UCON
  59. * @ufcon: Save value for S3C2410_UFCON
  60. * @umcon: Save value for S3C2410_UMCON
  61. * @ubrdiv: Save value for S3C2410_UBRDIV
  62. *
  63. * Save block for UART registers to be held over sleep and restored if they
  64. * are needed (say by debug).
  65. */
  66. struct pm_uart_save {
  67. u32 ulcon;
  68. u32 ucon;
  69. u32 ufcon;
  70. u32 umcon;
  71. u32 ubrdiv;
  72. };
  73. /* helper functions to save/restore lists of registers. */
  74. extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
  75. extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
  76. extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
  77. #ifdef CONFIG_PM
  78. extern int s3c_irqext_wake(unsigned int irqno, unsigned int state);
  79. extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
  80. extern int s3c24xx_irq_resume(struct sys_device *dev);
  81. #else
  82. #define s3c_irqext_wake NULL
  83. #define s3c24xx_irq_suspend NULL
  84. #define s3c24xx_irq_resume NULL
  85. #endif
  86. /* PM debug functions */
  87. #ifdef CONFIG_S3C2410_PM_DEBUG
  88. /**
  89. * s3c_pm_dbg() - low level debug function for use in suspend/resume.
  90. * @msg: The message to print.
  91. *
  92. * This function is used mainly to debug the resume process before the system
  93. * can rely on printk/console output. It uses the low-level debugging output
  94. * routine printascii() to do its work.
  95. */
  96. extern void s3c_pm_dbg(const char *msg, ...);
  97. #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
  98. #else
  99. #define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt)
  100. #endif
  101. /* suspend memory checking */
  102. #ifdef CONFIG_S3C2410_PM_CHECK
  103. extern void s3c_pm_check_prepare(void);
  104. extern void s3c_pm_check_restore(void);
  105. extern void s3c_pm_check_cleanup(void);
  106. extern void s3c_pm_check_store(void);
  107. #else
  108. #define s3c_pm_check_prepare() do { } while(0)
  109. #define s3c_pm_check_restore() do { } while(0)
  110. #define s3c_pm_check_cleanup() do { } while(0)
  111. #define s3c_pm_check_store() do { } while(0)
  112. #endif
  113. /**
  114. * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
  115. *
  116. * Setup all the necessary GPIO pins for waking the system on external
  117. * interrupt.
  118. */
  119. extern void s3c_pm_configure_extint(void);
  120. /**
  121. * s3c_pm_restore_gpios() - restore the state of the gpios after sleep.
  122. *
  123. * Restore the state of the GPIO pins after sleep, which may involve ensuring
  124. * that we do not glitch the state of the pins from that the bootloader's
  125. * resume code has done.
  126. */
  127. extern void s3c_pm_restore_gpios(void);
  128. /**
  129. * s3c_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
  130. *
  131. * Save the GPIO states for resotration on resume. See s3c_pm_restore_gpios().
  132. */
  133. extern void s3c_pm_save_gpios(void);
  134. /**
  135. * s3c_pm_cb_flushcache - callback for assembly code
  136. *
  137. * Callback to issue flush_cache_all() as this call is
  138. * not a directly callable object.
  139. */
  140. extern void s3c_pm_cb_flushcache(void);
  141. extern void s3c_pm_save_core(void);
  142. extern void s3c_pm_restore_core(void);