mali_kbase_hwaccess_pm.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. *
  3. * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * A copy of the licence is included with the program, and can also be obtained
  11. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. * Boston, MA 02110-1301, USA.
  13. *
  14. */
  15. /**
  16. * @file mali_kbase_hwaccess_pm.h
  17. * HW access power manager common APIs
  18. */
  19. #ifndef _KBASE_HWACCESS_PM_H_
  20. #define _KBASE_HWACCESS_PM_H_
  21. #include <mali_midg_regmap.h>
  22. #include <linux/atomic.h>
  23. #include <mali_kbase_pm_defs.h>
  24. /* Forward definition - see mali_kbase.h */
  25. struct kbase_device;
  26. /* Functions common to all HW access backends */
  27. /**
  28. * Initialize the power management framework.
  29. *
  30. * Must be called before any other power management function
  31. *
  32. * @param kbdev The kbase device structure for the device (must be a valid
  33. * pointer)
  34. *
  35. * @return 0 if the power management framework was successfully
  36. * initialized.
  37. */
  38. int kbase_hwaccess_pm_init(struct kbase_device *kbdev);
  39. /**
  40. * Terminate the power management framework.
  41. *
  42. * No power management functions may be called after this (except
  43. * @ref kbase_pm_init)
  44. *
  45. * @param kbdev The kbase device structure for the device (must be a valid
  46. * pointer)
  47. */
  48. void kbase_hwaccess_pm_term(struct kbase_device *kbdev);
  49. /**
  50. * kbase_hwaccess_pm_powerup - Power up the GPU.
  51. * @kbdev: The kbase device structure for the device (must be a valid pointer)
  52. * @flags: Flags to pass on to kbase_pm_init_hw
  53. *
  54. * Power up GPU after all modules have been initialized and interrupt handlers
  55. * installed.
  56. *
  57. * Return: 0 if powerup was successful.
  58. */
  59. int kbase_hwaccess_pm_powerup(struct kbase_device *kbdev,
  60. unsigned int flags);
  61. /**
  62. * Halt the power management framework.
  63. *
  64. * Should ensure that no new interrupts are generated, but allow any currently
  65. * running interrupt handlers to complete successfully. The GPU is forced off by
  66. * the time this function returns, regardless of whether or not the active power
  67. * policy asks for the GPU to be powered off.
  68. *
  69. * @param kbdev The kbase device structure for the device (must be a valid
  70. * pointer)
  71. */
  72. void kbase_hwaccess_pm_halt(struct kbase_device *kbdev);
  73. /**
  74. * Perform any backend-specific actions to suspend the GPU
  75. *
  76. * @param kbdev The kbase device structure for the device (must be a valid
  77. * pointer)
  78. */
  79. void kbase_hwaccess_pm_suspend(struct kbase_device *kbdev);
  80. /**
  81. * Perform any backend-specific actions to resume the GPU from a suspend
  82. *
  83. * @param kbdev The kbase device structure for the device (must be a valid
  84. * pointer)
  85. */
  86. void kbase_hwaccess_pm_resume(struct kbase_device *kbdev);
  87. /**
  88. * Perform any required actions for activating the GPU. Called when the first
  89. * context goes active.
  90. *
  91. * @param kbdev The kbase device structure for the device (must be a valid
  92. * pointer)
  93. */
  94. void kbase_hwaccess_pm_gpu_active(struct kbase_device *kbdev);
  95. /**
  96. * Perform any required actions for idling the GPU. Called when the last
  97. * context goes idle.
  98. *
  99. * @param kbdev The kbase device structure for the device (must be a valid
  100. * pointer)
  101. */
  102. void kbase_hwaccess_pm_gpu_idle(struct kbase_device *kbdev);
  103. /**
  104. * Set the debug core mask.
  105. *
  106. * This determines which cores the power manager is allowed to use.
  107. *
  108. * @param kbdev The kbase device structure for the device (must be a
  109. * valid pointer)
  110. * @param new_core_mask_js0 The core mask to use for job slot 0
  111. * @param new_core_mask_js0 The core mask to use for job slot 1
  112. * @param new_core_mask_js0 The core mask to use for job slot 2
  113. */
  114. void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev,
  115. u64 new_core_mask_js0, u64 new_core_mask_js1,
  116. u64 new_core_mask_js2);
  117. /**
  118. * Get the current policy.
  119. *
  120. * Returns the policy that is currently active.
  121. *
  122. * @param kbdev The kbase device structure for the device (must be a valid
  123. * pointer)
  124. *
  125. * @return The current policy
  126. */
  127. const struct kbase_pm_ca_policy
  128. *kbase_pm_ca_get_policy(struct kbase_device *kbdev);
  129. /**
  130. * Change the policy to the one specified.
  131. *
  132. * @param kbdev The kbase device structure for the device (must be a valid
  133. * pointer)
  134. * @param policy The policy to change to (valid pointer returned from
  135. * @ref kbase_pm_ca_list_policies)
  136. */
  137. void kbase_pm_ca_set_policy(struct kbase_device *kbdev,
  138. const struct kbase_pm_ca_policy *policy);
  139. /**
  140. * Retrieve a static list of the available policies.
  141. *
  142. * @param[out] policies An array pointer to take the list of policies. This may
  143. * be NULL. The contents of this array must not be
  144. * modified.
  145. *
  146. * @return The number of policies
  147. */
  148. int
  149. kbase_pm_ca_list_policies(const struct kbase_pm_ca_policy * const **policies);
  150. /**
  151. * Get the current policy.
  152. *
  153. * Returns the policy that is currently active.
  154. *
  155. * @param kbdev The kbase device structure for the device (must be a valid
  156. * pointer)
  157. *
  158. * @return The current policy
  159. */
  160. const struct kbase_pm_policy *kbase_pm_get_policy(struct kbase_device *kbdev);
  161. /**
  162. * Change the policy to the one specified.
  163. *
  164. * @param kbdev The kbase device structure for the device (must be a valid
  165. * pointer)
  166. * @param policy The policy to change to (valid pointer returned from
  167. * @ref kbase_pm_list_policies)
  168. */
  169. void kbase_pm_set_policy(struct kbase_device *kbdev,
  170. const struct kbase_pm_policy *policy);
  171. /**
  172. * Retrieve a static list of the available policies.
  173. *
  174. * @param[out] policies An array pointer to take the list of policies. This may
  175. * be NULL. The contents of this array must not be
  176. * modified.
  177. *
  178. * @return The number of policies
  179. */
  180. int kbase_pm_list_policies(const struct kbase_pm_policy * const **policies);
  181. #endif // ifndef _KBASE_HWACCESS_PM_H_