pm.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2004 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Written by Ben Dooks, <ben@simtec.co.uk>
  6. */
  7. /* s3c_pm_init
  8. *
  9. * called from board at initialisation time to setup the power
  10. * management
  11. */
  12. #include <plat/pm-common.h>
  13. struct device;
  14. #ifdef CONFIG_SAMSUNG_PM
  15. extern __init int s3c_pm_init(void);
  16. extern __init int s3c64xx_pm_init(void);
  17. #else
  18. static inline int s3c_pm_init(void)
  19. {
  20. return 0;
  21. }
  22. static inline int s3c64xx_pm_init(void)
  23. {
  24. return 0;
  25. }
  26. #endif
  27. /* configuration for the IRQ mask over sleep */
  28. extern unsigned long s3c_irqwake_intmask;
  29. extern unsigned long s3c_irqwake_eintmask;
  30. /* per-cpu sleep functions */
  31. extern void (*pm_cpu_prep)(void);
  32. extern int (*pm_cpu_sleep)(unsigned long);
  33. /* Flags for PM Control */
  34. extern unsigned long s3c_pm_flags;
  35. /* from sleep.S */
  36. extern int s3c2410_cpu_suspend(unsigned long);
  37. #ifdef CONFIG_PM_SLEEP
  38. extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
  39. extern void s3c_cpu_resume(void);
  40. #else
  41. #define s3c_irq_wake NULL
  42. #define s3c_cpu_resume NULL
  43. #endif
  44. #ifdef CONFIG_SAMSUNG_PM
  45. extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
  46. #else
  47. #define s3c_irqext_wake NULL
  48. #endif
  49. #ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
  50. /**
  51. * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
  52. * @set: set bits for the state of the LEDs
  53. * @clear: clear bits for the state of the LEDs.
  54. */
  55. extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
  56. #else
  57. static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
  58. #endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
  59. /**
  60. * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
  61. *
  62. * Setup all the necessary GPIO pins for waking the system on external
  63. * interrupt.
  64. */
  65. extern void s3c_pm_configure_extint(void);
  66. #ifdef CONFIG_GPIO_SAMSUNG
  67. /**
  68. * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
  69. *
  70. * Restore the state of the GPIO pins after sleep, which may involve ensuring
  71. * that we do not glitch the state of the pins from that the bootloader's
  72. * resume code has done.
  73. */
  74. extern void samsung_pm_restore_gpios(void);
  75. /**
  76. * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
  77. *
  78. * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
  79. */
  80. extern void samsung_pm_save_gpios(void);
  81. #else
  82. static inline void samsung_pm_restore_gpios(void) {}
  83. static inline void samsung_pm_save_gpios(void) {}
  84. #endif
  85. extern void s3c_pm_save_core(void);
  86. extern void s3c_pm_restore_core(void);