pm.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* arch/arm/plat-samsung/include/plat/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. #include <plat/pm-common.h>
  17. struct device;
  18. #ifdef CONFIG_SAMSUNG_PM
  19. extern __init int s3c_pm_init(void);
  20. extern __init int s3c64xx_pm_init(void);
  21. #else
  22. static inline int s3c_pm_init(void)
  23. {
  24. return 0;
  25. }
  26. static inline int s3c64xx_pm_init(void)
  27. {
  28. return 0;
  29. }
  30. #endif
  31. /* configuration for the IRQ mask over sleep */
  32. extern unsigned long s3c_irqwake_intmask;
  33. extern unsigned long s3c_irqwake_eintmask;
  34. /* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
  35. extern unsigned long s3c_irqwake_intallow;
  36. extern unsigned long s3c_irqwake_eintallow;
  37. /* per-cpu sleep functions */
  38. extern void (*pm_cpu_prep)(void);
  39. extern int (*pm_cpu_sleep)(unsigned long);
  40. /* Flags for PM Control */
  41. extern unsigned long s3c_pm_flags;
  42. /* from sleep.S */
  43. extern int s3c2410_cpu_suspend(unsigned long);
  44. #ifdef CONFIG_SAMSUNG_PM
  45. extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
  46. extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
  47. extern void s3c_cpu_resume(void);
  48. #else
  49. #define s3c_irq_wake NULL
  50. #define s3c_irqext_wake NULL
  51. #define s3c_cpu_resume NULL
  52. #endif
  53. #ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
  54. /**
  55. * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
  56. * @set: set bits for the state of the LEDs
  57. * @clear: clear bits for the state of the LEDs.
  58. */
  59. extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
  60. #else
  61. static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
  62. #endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
  63. /**
  64. * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
  65. *
  66. * Setup all the necessary GPIO pins for waking the system on external
  67. * interrupt.
  68. */
  69. extern void s3c_pm_configure_extint(void);
  70. #ifdef CONFIG_GPIO_SAMSUNG
  71. /**
  72. * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
  73. *
  74. * Restore the state of the GPIO pins after sleep, which may involve ensuring
  75. * that we do not glitch the state of the pins from that the bootloader's
  76. * resume code has done.
  77. */
  78. extern void samsung_pm_restore_gpios(void);
  79. /**
  80. * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
  81. *
  82. * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
  83. */
  84. extern void samsung_pm_save_gpios(void);
  85. #else
  86. static inline void samsung_pm_restore_gpios(void) {}
  87. static inline void samsung_pm_save_gpios(void) {}
  88. #endif
  89. extern void s3c_pm_save_core(void);
  90. extern void s3c_pm_restore_core(void);