sumo_dpm.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright 2012 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 __SUMO_DPM_H__
  24. #define __SUMO_DPM_H__
  25. #include "atom.h"
  26. #define SUMO_MAX_HARDWARE_POWERLEVELS 5
  27. #define SUMO_PM_NUMBER_OF_TC 15
  28. struct sumo_pl {
  29. u32 sclk;
  30. u32 vddc_index;
  31. u32 ds_divider_index;
  32. u32 ss_divider_index;
  33. u32 allow_gnb_slow;
  34. u32 sclk_dpm_tdp_limit;
  35. };
  36. /* used for the flags field */
  37. #define SUMO_POWERSTATE_FLAGS_FORCE_NBPS1_STATE (1 << 0)
  38. #define SUMO_POWERSTATE_FLAGS_BOOST_STATE (1 << 1)
  39. struct sumo_ps {
  40. struct sumo_pl levels[SUMO_MAX_HARDWARE_POWERLEVELS];
  41. u32 num_levels;
  42. /* flags */
  43. u32 flags;
  44. };
  45. #define NUMBER_OF_M3ARB_PARAM_SETS 10
  46. #define SUMO_MAX_NUMBER_VOLTAGES 4
  47. struct sumo_disp_clock_voltage_mapping_table {
  48. u32 num_max_voltage_levels;
  49. u32 display_clock_frequency[SUMO_MAX_NUMBER_VOLTAGES];
  50. };
  51. struct sumo_vid_mapping_entry {
  52. u16 vid_2bit;
  53. u16 vid_7bit;
  54. };
  55. struct sumo_vid_mapping_table {
  56. u32 num_entries;
  57. struct sumo_vid_mapping_entry entries[SUMO_MAX_NUMBER_VOLTAGES];
  58. };
  59. struct sumo_sclk_voltage_mapping_entry {
  60. u32 sclk_frequency;
  61. u16 vid_2bit;
  62. u16 rsv;
  63. };
  64. struct sumo_sclk_voltage_mapping_table {
  65. u32 num_max_dpm_entries;
  66. struct sumo_sclk_voltage_mapping_entry entries[SUMO_MAX_HARDWARE_POWERLEVELS];
  67. };
  68. struct sumo_sys_info {
  69. u32 bootup_sclk;
  70. u32 min_sclk;
  71. u32 bootup_uma_clk;
  72. u16 bootup_nb_voltage_index;
  73. u8 htc_tmp_lmt;
  74. u8 htc_hyst_lmt;
  75. struct sumo_sclk_voltage_mapping_table sclk_voltage_mapping_table;
  76. struct sumo_disp_clock_voltage_mapping_table disp_clk_voltage_mapping_table;
  77. struct sumo_vid_mapping_table vid_mapping_table;
  78. u32 csr_m3_arb_cntl_default[NUMBER_OF_M3ARB_PARAM_SETS];
  79. u32 csr_m3_arb_cntl_uvd[NUMBER_OF_M3ARB_PARAM_SETS];
  80. u32 csr_m3_arb_cntl_fs3d[NUMBER_OF_M3ARB_PARAM_SETS];
  81. u32 sclk_dpm_boost_margin;
  82. u32 sclk_dpm_throttle_margin;
  83. u32 sclk_dpm_tdp_limit_pg;
  84. u32 gnb_tdp_limit;
  85. u32 sclk_dpm_tdp_limit_boost;
  86. u32 boost_sclk;
  87. u32 boost_vid_2bit;
  88. bool enable_boost;
  89. };
  90. struct sumo_power_info {
  91. u32 asi;
  92. u32 pasi;
  93. u32 bsp;
  94. u32 bsu;
  95. u32 pbsp;
  96. u32 pbsu;
  97. u32 dsp;
  98. u32 psp;
  99. u32 thermal_auto_throttling;
  100. u32 uvd_m3_arbiter;
  101. u32 fw_version;
  102. struct sumo_sys_info sys_info;
  103. struct sumo_pl acpi_pl;
  104. struct sumo_pl boot_pl;
  105. struct sumo_pl boost_pl;
  106. bool disable_gfx_power_gating_in_uvd;
  107. bool driver_nbps_policy_disable;
  108. bool enable_alt_vddnb;
  109. bool enable_dynamic_m3_arbiter;
  110. bool enable_gfx_clock_gating;
  111. bool enable_gfx_power_gating;
  112. bool enable_mg_clock_gating;
  113. bool enable_sclk_ds;
  114. bool enable_auto_thermal_throttling;
  115. bool enable_dynamic_patch_ps;
  116. bool enable_dpm;
  117. bool enable_boost;
  118. struct radeon_ps current_rps;
  119. struct sumo_ps current_ps;
  120. struct radeon_ps requested_rps;
  121. struct sumo_ps requested_ps;
  122. };
  123. #define SUMO_UTC_DFLT_00 0x48
  124. #define SUMO_UTC_DFLT_01 0x44
  125. #define SUMO_UTC_DFLT_02 0x44
  126. #define SUMO_UTC_DFLT_03 0x44
  127. #define SUMO_UTC_DFLT_04 0x44
  128. #define SUMO_UTC_DFLT_05 0x44
  129. #define SUMO_UTC_DFLT_06 0x44
  130. #define SUMO_UTC_DFLT_07 0x44
  131. #define SUMO_UTC_DFLT_08 0x44
  132. #define SUMO_UTC_DFLT_09 0x44
  133. #define SUMO_UTC_DFLT_10 0x44
  134. #define SUMO_UTC_DFLT_11 0x44
  135. #define SUMO_UTC_DFLT_12 0x44
  136. #define SUMO_UTC_DFLT_13 0x44
  137. #define SUMO_UTC_DFLT_14 0x44
  138. #define SUMO_DTC_DFLT_00 0x48
  139. #define SUMO_DTC_DFLT_01 0x44
  140. #define SUMO_DTC_DFLT_02 0x44
  141. #define SUMO_DTC_DFLT_03 0x44
  142. #define SUMO_DTC_DFLT_04 0x44
  143. #define SUMO_DTC_DFLT_05 0x44
  144. #define SUMO_DTC_DFLT_06 0x44
  145. #define SUMO_DTC_DFLT_07 0x44
  146. #define SUMO_DTC_DFLT_08 0x44
  147. #define SUMO_DTC_DFLT_09 0x44
  148. #define SUMO_DTC_DFLT_10 0x44
  149. #define SUMO_DTC_DFLT_11 0x44
  150. #define SUMO_DTC_DFLT_12 0x44
  151. #define SUMO_DTC_DFLT_13 0x44
  152. #define SUMO_DTC_DFLT_14 0x44
  153. #define SUMO_AH_DFLT 5
  154. #define SUMO_R_DFLT0 70
  155. #define SUMO_R_DFLT1 70
  156. #define SUMO_R_DFLT2 70
  157. #define SUMO_R_DFLT3 70
  158. #define SUMO_R_DFLT4 100
  159. #define SUMO_L_DFLT0 0
  160. #define SUMO_L_DFLT1 20
  161. #define SUMO_L_DFLT2 20
  162. #define SUMO_L_DFLT3 20
  163. #define SUMO_L_DFLT4 20
  164. #define SUMO_VRC_DFLT 0x30033
  165. #define SUMO_MGCGTTLOCAL0_DFLT 0
  166. #define SUMO_MGCGTTLOCAL1_DFLT 0
  167. #define SUMO_GICST_DFLT 19
  168. #define SUMO_SST_DFLT 8
  169. #define SUMO_VOLTAGEDROPT_DFLT 1
  170. #define SUMO_GFXPOWERGATINGT_DFLT 100
  171. /* sumo_dpm.c */
  172. void sumo_gfx_clockgating_initialize(struct radeon_device *rdev);
  173. void sumo_program_vc(struct radeon_device *rdev, u32 vrc);
  174. void sumo_clear_vc(struct radeon_device *rdev);
  175. void sumo_program_sstp(struct radeon_device *rdev);
  176. void sumo_take_smu_control(struct radeon_device *rdev, bool enable);
  177. void sumo_construct_sclk_voltage_mapping_table(struct radeon_device *rdev,
  178. struct sumo_sclk_voltage_mapping_table *sclk_voltage_mapping_table,
  179. ATOM_AVAILABLE_SCLK_LIST *table);
  180. void sumo_construct_vid_mapping_table(struct radeon_device *rdev,
  181. struct sumo_vid_mapping_table *vid_mapping_table,
  182. ATOM_AVAILABLE_SCLK_LIST *table);
  183. u32 sumo_convert_vid2_to_vid7(struct radeon_device *rdev,
  184. struct sumo_vid_mapping_table *vid_mapping_table,
  185. u32 vid_2bit);
  186. u32 sumo_get_sleep_divider_from_id(u32 id);
  187. u32 sumo_get_sleep_divider_id_from_clock(struct radeon_device *rdev,
  188. u32 sclk,
  189. u32 min_sclk_in_sr);
  190. /* sumo_smc.c */
  191. void sumo_initialize_m3_arb(struct radeon_device *rdev);
  192. void sumo_smu_pg_init(struct radeon_device *rdev);
  193. void sumo_set_tdp_limit(struct radeon_device *rdev, u32 index, u32 tdp_limit);
  194. void sumo_smu_notify_alt_vddnb_change(struct radeon_device *rdev,
  195. bool powersaving, bool force_nbps1);
  196. void sumo_boost_state_enable(struct radeon_device *rdev, bool enable);
  197. void sumo_enable_boost_timer(struct radeon_device *rdev);
  198. u32 sumo_get_running_fw_version(struct radeon_device *rdev);
  199. #endif