trinity_dpm.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 __TRINITY_DPM_H__
  24. #define __TRINITY_DPM_H__
  25. #include "sumo_dpm.h"
  26. #define TRINITY_SIZEOF_DPM_STATE_TABLE (SMU_SCLK_DPM_STATE_1_CNTL_0 - SMU_SCLK_DPM_STATE_0_CNTL_0)
  27. struct trinity_pl {
  28. u32 sclk;
  29. u8 vddc_index;
  30. u8 ds_divider_index;
  31. u8 ss_divider_index;
  32. u8 allow_gnb_slow;
  33. u8 force_nbp_state;
  34. u8 display_wm;
  35. u8 vce_wm;
  36. };
  37. #define TRINITY_POWERSTATE_FLAGS_NBPS_FORCEHIGH (1 << 0)
  38. #define TRINITY_POWERSTATE_FLAGS_NBPS_LOCKTOHIGH (1 << 1)
  39. #define TRINITY_POWERSTATE_FLAGS_NBPS_LOCKTOLOW (1 << 2)
  40. #define TRINITY_POWERSTATE_FLAGS_BAPM_DISABLE (1 << 0)
  41. struct trinity_ps {
  42. u32 num_levels;
  43. struct trinity_pl levels[SUMO_MAX_HARDWARE_POWERLEVELS];
  44. u32 nbps_flags;
  45. u32 bapm_flags;
  46. u8 Dpm0PgNbPsLo;
  47. u8 Dpm0PgNbPsHi;
  48. u8 DpmXNbPsLo;
  49. u8 DpmXNbPsHi;
  50. u32 vclk_low_divider;
  51. u32 vclk_high_divider;
  52. u32 dclk_low_divider;
  53. u32 dclk_high_divider;
  54. };
  55. #define TRINITY_NUM_NBPSTATES 4
  56. struct trinity_uvd_clock_table_entry
  57. {
  58. u32 vclk;
  59. u32 dclk;
  60. u8 vclk_did;
  61. u8 dclk_did;
  62. u8 rsv[2];
  63. };
  64. struct trinity_sys_info {
  65. u32 bootup_uma_clk;
  66. u32 bootup_sclk;
  67. u32 min_sclk;
  68. u32 dentist_vco_freq;
  69. u32 nb_dpm_enable;
  70. u32 nbp_mclk[TRINITY_NUM_NBPSTATES];
  71. u32 nbp_nclk[TRINITY_NUM_NBPSTATES];
  72. u16 nbp_voltage_index[TRINITY_NUM_NBPSTATES];
  73. u16 bootup_nb_voltage_index;
  74. u8 htc_tmp_lmt;
  75. u8 htc_hyst_lmt;
  76. struct sumo_sclk_voltage_mapping_table sclk_voltage_mapping_table;
  77. struct sumo_vid_mapping_table vid_mapping_table;
  78. u32 uma_channel_number;
  79. struct trinity_uvd_clock_table_entry uvd_clock_table_entries[4];
  80. };
  81. struct trinity_power_info {
  82. u32 at[SUMO_MAX_HARDWARE_POWERLEVELS];
  83. u32 dpm_interval;
  84. u32 thermal_auto_throttling;
  85. struct trinity_sys_info sys_info;
  86. struct trinity_pl boot_pl;
  87. u32 min_sclk_did;
  88. bool enable_nbps_policy;
  89. bool voltage_drop_in_dce;
  90. bool override_dynamic_mgpg;
  91. bool enable_gfx_clock_gating;
  92. bool enable_gfx_power_gating;
  93. bool enable_mg_clock_gating;
  94. bool enable_gfx_dynamic_mgpg;
  95. bool enable_auto_thermal_throttling;
  96. bool enable_dpm;
  97. bool enable_sclk_ds;
  98. bool enable_bapm;
  99. bool uvd_dpm;
  100. struct radeon_ps current_rps;
  101. struct trinity_ps current_ps;
  102. struct radeon_ps requested_rps;
  103. struct trinity_ps requested_ps;
  104. };
  105. #define TRINITY_AT_DFLT 30
  106. /* trinity_smc.c */
  107. int trinity_dpm_bapm_enable(struct radeon_device *rdev, bool enable);
  108. int trinity_dpm_config(struct radeon_device *rdev, bool enable);
  109. int trinity_uvd_dpm_config(struct radeon_device *rdev);
  110. int trinity_dpm_force_state(struct radeon_device *rdev, u32 n);
  111. int trinity_dpm_n_levels_disabled(struct radeon_device *rdev, u32 n);
  112. int trinity_dpm_no_forced_level(struct radeon_device *rdev);
  113. int trinity_dce_enable_voltage_adjustment(struct radeon_device *rdev,
  114. bool enable);
  115. int trinity_gfx_dynamic_mgpg_config(struct radeon_device *rdev);
  116. void trinity_acquire_mutex(struct radeon_device *rdev);
  117. void trinity_release_mutex(struct radeon_device *rdev);
  118. #endif