pm.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * OMAP2/3 Power Management Routines
  3. *
  4. * Copyright (C) 2008 Nokia Corporation
  5. * Jouni Hogander
  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. #ifndef __ARCH_ARM_MACH_OMAP2_PM_H
  12. #define __ARCH_ARM_MACH_OMAP2_PM_H
  13. #include <linux/err.h>
  14. #include "powerdomain.h"
  15. #ifdef CONFIG_CPU_IDLE
  16. extern int __init omap3_idle_init(void);
  17. extern int __init omap4_idle_init(void);
  18. #else
  19. static inline int omap3_idle_init(void)
  20. {
  21. return 0;
  22. }
  23. static inline int omap4_idle_init(void)
  24. {
  25. return 0;
  26. }
  27. #endif
  28. extern void *omap3_secure_ram_storage;
  29. extern void omap3_pm_off_mode_enable(int);
  30. extern void omap_sram_idle(void);
  31. extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
  32. #if defined(CONFIG_PM_OPP)
  33. extern int omap3_opp_init(void);
  34. extern int omap4_opp_init(void);
  35. #else
  36. static inline int omap3_opp_init(void)
  37. {
  38. return -EINVAL;
  39. }
  40. static inline int omap4_opp_init(void)
  41. {
  42. return -EINVAL;
  43. }
  44. #endif
  45. extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
  46. extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
  47. #ifdef CONFIG_PM_DEBUG
  48. extern u32 enable_off_mode;
  49. #else
  50. #define enable_off_mode 0
  51. #endif
  52. #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
  53. extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
  54. #else
  55. #define pm_dbg_update_time(pwrdm, prev) do {} while (0);
  56. #endif /* CONFIG_PM_DEBUG */
  57. /* 24xx */
  58. extern void omap24xx_idle_loop_suspend(void);
  59. extern unsigned int omap24xx_idle_loop_suspend_sz;
  60. extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl,
  61. void __iomem *sdrc_power);
  62. extern unsigned int omap24xx_cpu_suspend_sz;
  63. /* 3xxx */
  64. extern void omap34xx_cpu_suspend(int save_state);
  65. /* omap3_do_wfi function pointer and size, for copy to SRAM */
  66. extern void omap3_do_wfi(void);
  67. extern unsigned int omap3_do_wfi_sz;
  68. /* ... and its pointer from SRAM after copy */
  69. extern void (*omap3_do_wfi_sram)(void);
  70. extern void omap3_save_scratchpad_contents(void);
  71. #define PM_RTA_ERRATUM_i608 (1 << 0)
  72. #define PM_SDRC_WAKEUP_ERRATUM_i583 (1 << 1)
  73. #define PM_PER_MEMORIES_ERRATUM_i582 (1 << 2)
  74. #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
  75. extern u16 pm34xx_errata;
  76. #define IS_PM34XX_ERRATUM(id) (pm34xx_errata & (id))
  77. extern void enable_omap3630_toggle_l2_on_restore(void);
  78. #else
  79. #define IS_PM34XX_ERRATUM(id) 0
  80. static inline void enable_omap3630_toggle_l2_on_restore(void) { }
  81. #endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
  82. #define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0)
  83. #define PM_OMAP4_CPU_OSWR_DISABLE (1 << 1)
  84. #if defined(CONFIG_PM) && (defined(CONFIG_ARCH_OMAP4) ||\
  85. defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX))
  86. extern u16 pm44xx_errata;
  87. #define IS_PM44XX_ERRATUM(id) (pm44xx_errata & (id))
  88. #else
  89. #define IS_PM44XX_ERRATUM(id) 0
  90. #endif
  91. #ifdef CONFIG_POWER_AVS_OMAP
  92. extern int omap_devinit_smartreflex(void);
  93. extern void omap_enable_smartreflex_on_init(void);
  94. #else
  95. static inline int omap_devinit_smartreflex(void)
  96. {
  97. return -EINVAL;
  98. }
  99. static inline void omap_enable_smartreflex_on_init(void) {}
  100. #endif
  101. #ifdef CONFIG_TWL4030_CORE
  102. extern int omap3_twl_init(void);
  103. extern int omap4_twl_init(void);
  104. extern int omap3_twl_set_sr_bit(bool enable);
  105. #else
  106. static inline int omap3_twl_init(void)
  107. {
  108. return -EINVAL;
  109. }
  110. static inline int omap4_twl_init(void)
  111. {
  112. return -EINVAL;
  113. }
  114. #endif
  115. #ifdef CONFIG_PM
  116. extern void omap_pm_setup_oscillator(u32 tstart, u32 tshut);
  117. extern void omap_pm_get_oscillator(u32 *tstart, u32 *tshut);
  118. extern void omap_pm_setup_sr_i2c_pcb_length(u32 mm);
  119. #else
  120. static inline void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { }
  121. static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { *tstart = *tshut = 0; }
  122. static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { }
  123. #endif
  124. #ifdef CONFIG_SUSPEND
  125. void omap_common_suspend_init(void *pm_suspend);
  126. #else
  127. static inline void omap_common_suspend_init(void *pm_suspend)
  128. {
  129. }
  130. #endif /* CONFIG_SUSPEND */
  131. #endif