cypress_dpm.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 __CYPRESS_DPM_H__
  24. #define __CYPRESS_DPM_H__
  25. #include "rv770_dpm.h"
  26. #include "evergreen_smc.h"
  27. struct evergreen_mc_reg_entry {
  28. u32 mclk_max;
  29. u32 mc_data[SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE];
  30. };
  31. struct evergreen_mc_reg_table {
  32. u8 last;
  33. u8 num_entries;
  34. u16 valid_flag;
  35. struct evergreen_mc_reg_entry mc_reg_table_entry[MAX_AC_TIMING_ENTRIES];
  36. SMC_Evergreen_MCRegisterAddress mc_reg_address[SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE];
  37. };
  38. struct evergreen_ulv_param {
  39. bool supported;
  40. struct rv7xx_pl *pl;
  41. };
  42. struct evergreen_arb_registers {
  43. u32 mc_arb_dram_timing;
  44. u32 mc_arb_dram_timing2;
  45. u32 mc_arb_rfsh_rate;
  46. u32 mc_arb_burst_time;
  47. };
  48. struct at {
  49. u32 rlp;
  50. u32 rmp;
  51. u32 lhp;
  52. u32 lmp;
  53. };
  54. struct evergreen_power_info {
  55. /* must be first! */
  56. struct rv7xx_power_info rv7xx;
  57. /* flags */
  58. bool vddci_control;
  59. bool dynamic_ac_timing;
  60. bool abm;
  61. bool mcls;
  62. bool light_sleep;
  63. bool memory_transition;
  64. bool pcie_performance_request;
  65. bool pcie_performance_request_registered;
  66. bool sclk_deep_sleep;
  67. bool dll_default_on;
  68. bool ls_clock_gating;
  69. bool smu_uvd_hs;
  70. bool uvd_enabled;
  71. /* stored values */
  72. u16 acpi_vddci;
  73. u8 mvdd_high_index;
  74. u8 mvdd_low_index;
  75. u32 mclk_edc_wr_enable_threshold;
  76. struct evergreen_mc_reg_table mc_reg_table;
  77. struct atom_voltage_table vddc_voltage_table;
  78. struct atom_voltage_table vddci_voltage_table;
  79. struct evergreen_arb_registers bootup_arb_registers;
  80. struct evergreen_ulv_param ulv;
  81. struct at ats[2];
  82. /* smc offsets */
  83. u16 mc_reg_table_start;
  84. struct radeon_ps current_rps;
  85. struct rv7xx_ps current_ps;
  86. struct radeon_ps requested_rps;
  87. struct rv7xx_ps requested_ps;
  88. };
  89. #define CYPRESS_HASI_DFLT 400000
  90. #define CYPRESS_MGCGTTLOCAL0_DFLT 0x00000000
  91. #define CYPRESS_MGCGTTLOCAL1_DFLT 0x00000000
  92. #define CYPRESS_MGCGTTLOCAL2_DFLT 0x00000000
  93. #define CYPRESS_MGCGTTLOCAL3_DFLT 0x00000000
  94. #define CYPRESS_MGCGCGTSSMCTRL_DFLT 0x81944bc0
  95. #define REDWOOD_MGCGCGTSSMCTRL_DFLT 0x6e944040
  96. #define CEDAR_MGCGCGTSSMCTRL_DFLT 0x46944040
  97. #define CYPRESS_VRC_DFLT 0xC00033
  98. #define PCIE_PERF_REQ_REMOVE_REGISTRY 0
  99. #define PCIE_PERF_REQ_FORCE_LOWPOWER 1
  100. #define PCIE_PERF_REQ_PECI_GEN1 2
  101. #define PCIE_PERF_REQ_PECI_GEN2 3
  102. #define PCIE_PERF_REQ_PECI_GEN3 4
  103. int cypress_convert_power_level_to_smc(struct radeon_device *rdev,
  104. struct rv7xx_pl *pl,
  105. RV770_SMC_HW_PERFORMANCE_LEVEL *level,
  106. u8 watermark_level);
  107. int cypress_populate_smc_acpi_state(struct radeon_device *rdev,
  108. RV770_SMC_STATETABLE *table);
  109. int cypress_populate_smc_voltage_tables(struct radeon_device *rdev,
  110. RV770_SMC_STATETABLE *table);
  111. int cypress_populate_smc_initial_state(struct radeon_device *rdev,
  112. struct radeon_ps *radeon_initial_state,
  113. RV770_SMC_STATETABLE *table);
  114. u32 cypress_calculate_burst_time(struct radeon_device *rdev,
  115. u32 engine_clock, u32 memory_clock);
  116. void cypress_notify_link_speed_change_before_state_change(struct radeon_device *rdev,
  117. struct radeon_ps *radeon_new_state,
  118. struct radeon_ps *radeon_current_state);
  119. int cypress_upload_sw_state(struct radeon_device *rdev,
  120. struct radeon_ps *radeon_new_state);
  121. int cypress_upload_mc_reg_table(struct radeon_device *rdev,
  122. struct radeon_ps *radeon_new_state);
  123. void cypress_program_memory_timing_parameters(struct radeon_device *rdev,
  124. struct radeon_ps *radeon_new_state);
  125. void cypress_notify_link_speed_change_after_state_change(struct radeon_device *rdev,
  126. struct radeon_ps *radeon_new_state,
  127. struct radeon_ps *radeon_current_state);
  128. int cypress_construct_voltage_tables(struct radeon_device *rdev);
  129. int cypress_get_mvdd_configuration(struct radeon_device *rdev);
  130. void cypress_enable_spread_spectrum(struct radeon_device *rdev,
  131. bool enable);
  132. void cypress_enable_display_gap(struct radeon_device *rdev);
  133. int cypress_get_table_locations(struct radeon_device *rdev);
  134. int cypress_populate_mc_reg_table(struct radeon_device *rdev,
  135. struct radeon_ps *radeon_boot_state);
  136. void cypress_program_response_times(struct radeon_device *rdev);
  137. int cypress_notify_smc_display_change(struct radeon_device *rdev,
  138. bool has_display);
  139. void cypress_enable_sclk_control(struct radeon_device *rdev,
  140. bool enable);
  141. void cypress_enable_mclk_control(struct radeon_device *rdev,
  142. bool enable);
  143. void cypress_start_dpm(struct radeon_device *rdev);
  144. void cypress_advertise_gen2_capability(struct radeon_device *rdev);
  145. u32 cypress_map_clkf_to_ibias(struct radeon_device *rdev, u32 clkf);
  146. u8 cypress_get_mclk_frequency_ratio(struct radeon_device *rdev,
  147. u32 memory_clock, bool strobe_mode);
  148. u8 cypress_get_strobe_mode_settings(struct radeon_device *rdev, u32 mclk);
  149. #endif