pm-data.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include "pm.h"
  13. struct msm_pm_platform_data msm_pm_sleep_modes[] __refdata = {
  14. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
  15. .idle_supported = 1,
  16. .suspend_supported = 1,
  17. .idle_enabled = 0,
  18. .suspend_enabled = 0,
  19. },
  20. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
  21. .idle_supported = 1,
  22. .suspend_supported = 1,
  23. .idle_enabled = 0,
  24. .suspend_enabled = 0,
  25. },
  26. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RETENTION)] = {
  27. .idle_supported = 1,
  28. .suspend_supported = 0,
  29. .idle_enabled = 0,
  30. .suspend_enabled = 0,
  31. },
  32. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
  33. .idle_supported = 1,
  34. .suspend_supported = 1,
  35. .idle_enabled = 1,
  36. .suspend_enabled = 1,
  37. },
  38. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
  39. .idle_supported = 1,
  40. .suspend_supported = 1,
  41. .idle_enabled = 0,
  42. .suspend_enabled = 1,
  43. },
  44. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
  45. .idle_supported = 1,
  46. .suspend_supported = 1,
  47. .idle_enabled = 0,
  48. .suspend_enabled = 0,
  49. },
  50. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_RETENTION)] = {
  51. .idle_supported = 1,
  52. .suspend_supported = 1,
  53. .idle_enabled = 0,
  54. .suspend_enabled = 0,
  55. },
  56. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
  57. .idle_supported = 1,
  58. .suspend_supported = 0,
  59. .idle_enabled = 1,
  60. .suspend_enabled = 0,
  61. },
  62. [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
  63. .idle_supported = 1,
  64. .suspend_supported = 1,
  65. .idle_enabled = 0,
  66. .suspend_enabled = 1,
  67. },
  68. [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
  69. .idle_supported = 1,
  70. .suspend_supported = 1,
  71. .idle_enabled = 0,
  72. .suspend_enabled = 0,
  73. },
  74. [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_RETENTION)] = {
  75. .idle_supported = 1,
  76. .suspend_supported = 1,
  77. .idle_enabled = 0,
  78. .suspend_enabled = 0,
  79. },
  80. [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
  81. .idle_supported = 1,
  82. .suspend_supported = 0,
  83. .idle_enabled = 1,
  84. .suspend_enabled = 0,
  85. },
  86. [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
  87. .idle_supported = 1,
  88. .suspend_supported = 1,
  89. .idle_enabled = 0,
  90. .suspend_enabled = 1,
  91. },
  92. [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
  93. .idle_supported = 1,
  94. .suspend_supported = 1,
  95. .idle_enabled = 0,
  96. .suspend_enabled = 0,
  97. },
  98. [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_RETENTION)] = {
  99. .idle_supported = 1,
  100. .suspend_supported = 1,
  101. .idle_enabled = 0,
  102. .suspend_enabled = 0,
  103. },
  104. [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
  105. .idle_supported = 1,
  106. .suspend_supported = 0,
  107. .idle_enabled = 1,
  108. .suspend_enabled = 0,
  109. },
  110. [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_NR)] = {
  111. .idle_supported = 0,
  112. .suspend_supported = 0,
  113. .idle_enabled = 0,
  114. .suspend_enabled = 0,
  115. },
  116. };
  117. // add enable/disable sleep mode
  118. // mode : msm_pm_sleep_mode @ /android/kernel/arch/arm/mach-msm/pm.h
  119. // Usage>>>
  120. // enter_mode : msm_pm_sleep_mode_enable(MSM_PM_SLEEP_MODE_RETENTION, 0);
  121. // exit_mode : msm_pm_sleep_mode_enable(MSM_PM_SLEEP_MODE_RETENTION, 1);
  122. void msm_pm_sleep_mode_enable(unsigned int mode, bool enable)
  123. {
  124. unsigned int cpu;
  125. int idx;
  126. for_each_possible_cpu(cpu) {
  127. idx = MSM_PM_MODE(cpu, mode);
  128. msm_pm_sleep_modes[idx].idle_enabled = enable;
  129. }
  130. }
  131. // add MSM_PM_SLEEP_MODE_RETENTION enable/disable sleep mode
  132. // mode : msm_pm_sleep_mode @ /android/kernel/arch/arm/mach-msm/pm.h
  133. // Usage>>>
  134. // enter_mode : msm_pm_sleep_mode_enable(0);
  135. // exit_mode : msm_pm_sleep_mode_enable(1);
  136. void msm_pm_retention_mode_enable(bool enable)
  137. {
  138. msm_pm_sleep_mode_enable(MSM_PM_SLEEP_MODE_RETENTION, enable);
  139. }