r600_dpm.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. /*
  2. * Copyright 2011 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. */
  23. #ifndef __R600_DPM_H__
  24. #define __R600_DPM_H__
  25. #define R600_ASI_DFLT 10000
  26. #define R600_BSP_DFLT 0x41EB
  27. #define R600_BSU_DFLT 0x2
  28. #define R600_AH_DFLT 5
  29. #define R600_RLP_DFLT 25
  30. #define R600_RMP_DFLT 65
  31. #define R600_LHP_DFLT 40
  32. #define R600_LMP_DFLT 15
  33. #define R600_TD_DFLT 0
  34. #define R600_UTC_DFLT_00 0x24
  35. #define R600_UTC_DFLT_01 0x22
  36. #define R600_UTC_DFLT_02 0x22
  37. #define R600_UTC_DFLT_03 0x22
  38. #define R600_UTC_DFLT_04 0x22
  39. #define R600_UTC_DFLT_05 0x22
  40. #define R600_UTC_DFLT_06 0x22
  41. #define R600_UTC_DFLT_07 0x22
  42. #define R600_UTC_DFLT_08 0x22
  43. #define R600_UTC_DFLT_09 0x22
  44. #define R600_UTC_DFLT_10 0x22
  45. #define R600_UTC_DFLT_11 0x22
  46. #define R600_UTC_DFLT_12 0x22
  47. #define R600_UTC_DFLT_13 0x22
  48. #define R600_UTC_DFLT_14 0x22
  49. #define R600_DTC_DFLT_00 0x24
  50. #define R600_DTC_DFLT_01 0x22
  51. #define R600_DTC_DFLT_02 0x22
  52. #define R600_DTC_DFLT_03 0x22
  53. #define R600_DTC_DFLT_04 0x22
  54. #define R600_DTC_DFLT_05 0x22
  55. #define R600_DTC_DFLT_06 0x22
  56. #define R600_DTC_DFLT_07 0x22
  57. #define R600_DTC_DFLT_08 0x22
  58. #define R600_DTC_DFLT_09 0x22
  59. #define R600_DTC_DFLT_10 0x22
  60. #define R600_DTC_DFLT_11 0x22
  61. #define R600_DTC_DFLT_12 0x22
  62. #define R600_DTC_DFLT_13 0x22
  63. #define R600_DTC_DFLT_14 0x22
  64. #define R600_VRC_DFLT 0x0000C003
  65. #define R600_VOLTAGERESPONSETIME_DFLT 1000
  66. #define R600_BACKBIASRESPONSETIME_DFLT 1000
  67. #define R600_VRU_DFLT 0x3
  68. #define R600_SPLLSTEPTIME_DFLT 0x1000
  69. #define R600_SPLLSTEPUNIT_DFLT 0x3
  70. #define R600_TPU_DFLT 0
  71. #define R600_TPC_DFLT 0x200
  72. #define R600_SSTU_DFLT 0
  73. #define R600_SST_DFLT 0x00C8
  74. #define R600_GICST_DFLT 0x200
  75. #define R600_FCT_DFLT 0x0400
  76. #define R600_FCTU_DFLT 0
  77. #define R600_CTXCGTT3DRPHC_DFLT 0x20
  78. #define R600_CTXCGTT3DRSDC_DFLT 0x40
  79. #define R600_VDDC3DOORPHC_DFLT 0x100
  80. #define R600_VDDC3DOORSDC_DFLT 0x7
  81. #define R600_VDDC3DOORSU_DFLT 0
  82. #define R600_MPLLLOCKTIME_DFLT 100
  83. #define R600_MPLLRESETTIME_DFLT 150
  84. #define R600_VCOSTEPPCT_DFLT 20
  85. #define R600_ENDINGVCOSTEPPCT_DFLT 5
  86. #define R600_REFERENCEDIVIDER_DFLT 4
  87. #define R600_PM_NUMBER_OF_TC 15
  88. #define R600_PM_NUMBER_OF_SCLKS 20
  89. #define R600_PM_NUMBER_OF_MCLKS 4
  90. #define R600_PM_NUMBER_OF_VOLTAGE_LEVELS 4
  91. #define R600_PM_NUMBER_OF_ACTIVITY_LEVELS 3
  92. /* XXX are these ok? */
  93. #define R600_TEMP_RANGE_MIN (90 * 1000)
  94. #define R600_TEMP_RANGE_MAX (120 * 1000)
  95. #define FDO_PWM_MODE_STATIC 1
  96. #define FDO_PWM_MODE_STATIC_RPM 5
  97. enum r600_power_level {
  98. R600_POWER_LEVEL_LOW = 0,
  99. R600_POWER_LEVEL_MEDIUM = 1,
  100. R600_POWER_LEVEL_HIGH = 2,
  101. R600_POWER_LEVEL_CTXSW = 3,
  102. };
  103. enum r600_td {
  104. R600_TD_AUTO,
  105. R600_TD_UP,
  106. R600_TD_DOWN,
  107. };
  108. enum r600_display_watermark {
  109. R600_DISPLAY_WATERMARK_LOW = 0,
  110. R600_DISPLAY_WATERMARK_HIGH = 1,
  111. };
  112. enum r600_display_gap
  113. {
  114. R600_PM_DISPLAY_GAP_VBLANK_OR_WM = 0,
  115. R600_PM_DISPLAY_GAP_VBLANK = 1,
  116. R600_PM_DISPLAY_GAP_WATERMARK = 2,
  117. R600_PM_DISPLAY_GAP_IGNORE = 3,
  118. };
  119. extern const u32 r600_utc[R600_PM_NUMBER_OF_TC];
  120. extern const u32 r600_dtc[R600_PM_NUMBER_OF_TC];
  121. void r600_dpm_print_class_info(u32 class, u32 class2);
  122. void r600_dpm_print_cap_info(u32 caps);
  123. void r600_dpm_print_ps_status(struct radeon_device *rdev,
  124. struct radeon_ps *rps);
  125. u32 r600_dpm_get_vblank_time(struct radeon_device *rdev);
  126. u32 r600_dpm_get_vrefresh(struct radeon_device *rdev);
  127. bool r600_is_uvd_state(u32 class, u32 class2);
  128. void r600_calculate_u_and_p(u32 i, u32 r_c, u32 p_b,
  129. u32 *p, u32 *u);
  130. int r600_calculate_at(u32 t, u32 h, u32 fh, u32 fl, u32 *tl, u32 *th);
  131. void r600_gfx_clockgating_enable(struct radeon_device *rdev, bool enable);
  132. void r600_dynamicpm_enable(struct radeon_device *rdev, bool enable);
  133. void r600_enable_thermal_protection(struct radeon_device *rdev, bool enable);
  134. void r600_enable_acpi_pm(struct radeon_device *rdev);
  135. void r600_enable_dynamic_pcie_gen2(struct radeon_device *rdev, bool enable);
  136. bool r600_dynamicpm_enabled(struct radeon_device *rdev);
  137. void r600_enable_sclk_control(struct radeon_device *rdev, bool enable);
  138. void r600_enable_mclk_control(struct radeon_device *rdev, bool enable);
  139. void r600_enable_spll_bypass(struct radeon_device *rdev, bool enable);
  140. void r600_wait_for_spll_change(struct radeon_device *rdev);
  141. void r600_set_bsp(struct radeon_device *rdev, u32 u, u32 p);
  142. void r600_set_at(struct radeon_device *rdev,
  143. u32 l_to_m, u32 m_to_h,
  144. u32 h_to_m, u32 m_to_l);
  145. void r600_set_tc(struct radeon_device *rdev, u32 index, u32 u_t, u32 d_t);
  146. void r600_select_td(struct radeon_device *rdev, enum r600_td td);
  147. void r600_set_vrc(struct radeon_device *rdev, u32 vrv);
  148. void r600_set_tpu(struct radeon_device *rdev, u32 u);
  149. void r600_set_tpc(struct radeon_device *rdev, u32 c);
  150. void r600_set_sstu(struct radeon_device *rdev, u32 u);
  151. void r600_set_sst(struct radeon_device *rdev, u32 t);
  152. void r600_set_git(struct radeon_device *rdev, u32 t);
  153. void r600_set_fctu(struct radeon_device *rdev, u32 u);
  154. void r600_set_fct(struct radeon_device *rdev, u32 t);
  155. void r600_set_ctxcgtt3d_rphc(struct radeon_device *rdev, u32 p);
  156. void r600_set_ctxcgtt3d_rsdc(struct radeon_device *rdev, u32 s);
  157. void r600_set_vddc3d_oorsu(struct radeon_device *rdev, u32 u);
  158. void r600_set_vddc3d_oorphc(struct radeon_device *rdev, u32 p);
  159. void r600_set_vddc3d_oorsdc(struct radeon_device *rdev, u32 s);
  160. void r600_set_mpll_lock_time(struct radeon_device *rdev, u32 lock_time);
  161. void r600_set_mpll_reset_time(struct radeon_device *rdev, u32 reset_time);
  162. void r600_engine_clock_entry_enable(struct radeon_device *rdev,
  163. u32 index, bool enable);
  164. void r600_engine_clock_entry_enable_pulse_skipping(struct radeon_device *rdev,
  165. u32 index, bool enable);
  166. void r600_engine_clock_entry_enable_post_divider(struct radeon_device *rdev,
  167. u32 index, bool enable);
  168. void r600_engine_clock_entry_set_post_divider(struct radeon_device *rdev,
  169. u32 index, u32 divider);
  170. void r600_engine_clock_entry_set_reference_divider(struct radeon_device *rdev,
  171. u32 index, u32 divider);
  172. void r600_engine_clock_entry_set_feedback_divider(struct radeon_device *rdev,
  173. u32 index, u32 divider);
  174. void r600_engine_clock_entry_set_step_time(struct radeon_device *rdev,
  175. u32 index, u32 step_time);
  176. void r600_vid_rt_set_ssu(struct radeon_device *rdev, u32 u);
  177. void r600_vid_rt_set_vru(struct radeon_device *rdev, u32 u);
  178. void r600_vid_rt_set_vrt(struct radeon_device *rdev, u32 rt);
  179. void r600_voltage_control_enable_pins(struct radeon_device *rdev,
  180. u64 mask);
  181. void r600_voltage_control_program_voltages(struct radeon_device *rdev,
  182. enum r600_power_level index, u64 pins);
  183. void r600_voltage_control_deactivate_static_control(struct radeon_device *rdev,
  184. u64 mask);
  185. void r600_power_level_enable(struct radeon_device *rdev,
  186. enum r600_power_level index, bool enable);
  187. void r600_power_level_set_voltage_index(struct radeon_device *rdev,
  188. enum r600_power_level index, u32 voltage_index);
  189. void r600_power_level_set_mem_clock_index(struct radeon_device *rdev,
  190. enum r600_power_level index, u32 mem_clock_index);
  191. void r600_power_level_set_eng_clock_index(struct radeon_device *rdev,
  192. enum r600_power_level index, u32 eng_clock_index);
  193. void r600_power_level_set_watermark_id(struct radeon_device *rdev,
  194. enum r600_power_level index,
  195. enum r600_display_watermark watermark_id);
  196. void r600_power_level_set_pcie_gen2(struct radeon_device *rdev,
  197. enum r600_power_level index, bool compatible);
  198. enum r600_power_level r600_power_level_get_current_index(struct radeon_device *rdev);
  199. enum r600_power_level r600_power_level_get_target_index(struct radeon_device *rdev);
  200. void r600_power_level_set_enter_index(struct radeon_device *rdev,
  201. enum r600_power_level index);
  202. void r600_wait_for_power_level_unequal(struct radeon_device *rdev,
  203. enum r600_power_level index);
  204. void r600_wait_for_power_level(struct radeon_device *rdev,
  205. enum r600_power_level index);
  206. void r600_start_dpm(struct radeon_device *rdev);
  207. void r600_stop_dpm(struct radeon_device *rdev);
  208. bool r600_is_internal_thermal_sensor(enum radeon_int_thermal_type sensor);
  209. int r600_get_platform_caps(struct radeon_device *rdev);
  210. int r600_parse_extended_power_table(struct radeon_device *rdev);
  211. void r600_free_extended_power_table(struct radeon_device *rdev);
  212. enum radeon_pcie_gen r600_get_pcie_gen_support(struct radeon_device *rdev,
  213. u32 sys_mask,
  214. enum radeon_pcie_gen asic_gen,
  215. enum radeon_pcie_gen default_gen);
  216. u16 r600_get_pcie_lane_support(struct radeon_device *rdev,
  217. u16 asic_lanes,
  218. u16 default_lanes);
  219. u8 r600_encode_pci_lane_width(u32 lanes);
  220. #endif