cypress_dpm.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 evergreen_power_info {
  49. /* must be first! */
  50. struct rv7xx_power_info rv7xx;
  51. /* flags */
  52. bool vddci_control;
  53. bool dynamic_ac_timing;
  54. bool abm;
  55. bool mcls;
  56. bool light_sleep;
  57. bool memory_transition;
  58. bool pcie_performance_request;
  59. bool pcie_performance_request_registered;
  60. bool sclk_deep_sleep;
  61. bool dll_default_on;
  62. bool ls_clock_gating;
  63. /* stored values */
  64. u16 acpi_vddci;
  65. u8 mvdd_high_index;
  66. u8 mvdd_low_index;
  67. u32 mclk_edc_wr_enable_threshold;
  68. struct evergreen_mc_reg_table mc_reg_table;
  69. struct atom_voltage_table vddc_voltage_table;
  70. struct atom_voltage_table vddci_voltage_table;
  71. struct evergreen_arb_registers bootup_arb_registers;
  72. struct evergreen_ulv_param ulv;
  73. /* smc offsets */
  74. u16 mc_reg_table_start;
  75. };
  76. #define CYPRESS_HASI_DFLT 400000
  77. #define CYPRESS_MGCGTTLOCAL0_DFLT 0x00000000
  78. #define CYPRESS_MGCGTTLOCAL1_DFLT 0x00000000
  79. #define CYPRESS_MGCGTTLOCAL2_DFLT 0x00000000
  80. #define CYPRESS_MGCGTTLOCAL3_DFLT 0x00000000
  81. #define CYPRESS_MGCGCGTSSMCTRL_DFLT 0x81944bc0
  82. #define REDWOOD_MGCGCGTSSMCTRL_DFLT 0x6e944040
  83. #define CEDAR_MGCGCGTSSMCTRL_DFLT 0x46944040
  84. #define CYPRESS_VRC_DFLT 0xC00033
  85. #define PCIE_PERF_REQ_REMOVE_REGISTRY 0
  86. #define PCIE_PERF_REQ_FORCE_LOWPOWER 1
  87. #define PCIE_PERF_REQ_PECI_GEN1 2
  88. #define PCIE_PERF_REQ_PECI_GEN2 3
  89. #define PCIE_PERF_REQ_PECI_GEN3 4
  90. int cypress_convert_power_level_to_smc(struct radeon_device *rdev,
  91. struct rv7xx_pl *pl,
  92. RV770_SMC_HW_PERFORMANCE_LEVEL *level,
  93. u8 watermark_level);
  94. int cypress_populate_smc_acpi_state(struct radeon_device *rdev,
  95. RV770_SMC_STATETABLE *table);
  96. int cypress_populate_smc_voltage_tables(struct radeon_device *rdev,
  97. RV770_SMC_STATETABLE *table);
  98. int cypress_populate_smc_initial_state(struct radeon_device *rdev,
  99. struct radeon_ps *radeon_initial_state,
  100. RV770_SMC_STATETABLE *table);
  101. u32 cypress_calculate_burst_time(struct radeon_device *rdev,
  102. u32 engine_clock, u32 memory_clock);
  103. void cypress_notify_link_speed_change_before_state_change(struct radeon_device *rdev);
  104. int cypress_upload_sw_state(struct radeon_device *rdev);
  105. int cypress_upload_mc_reg_table(struct radeon_device *rdev);
  106. void cypress_program_memory_timing_parameters(struct radeon_device *rdev);
  107. void cypress_notify_link_speed_change_after_state_change(struct radeon_device *rdev);
  108. int cypress_construct_voltage_tables(struct radeon_device *rdev);
  109. int cypress_get_mvdd_configuration(struct radeon_device *rdev);
  110. void cypress_enable_spread_spectrum(struct radeon_device *rdev,
  111. bool enable);
  112. void cypress_enable_display_gap(struct radeon_device *rdev);
  113. int cypress_get_table_locations(struct radeon_device *rdev);
  114. int cypress_populate_mc_reg_table(struct radeon_device *rdev);
  115. void cypress_program_response_times(struct radeon_device *rdev);
  116. int cypress_notify_smc_display_change(struct radeon_device *rdev,
  117. bool has_display);
  118. void cypress_enable_sclk_control(struct radeon_device *rdev,
  119. bool enable);
  120. void cypress_enable_mclk_control(struct radeon_device *rdev,
  121. bool enable);
  122. void cypress_start_dpm(struct radeon_device *rdev);
  123. void cypress_advertise_gen2_capability(struct radeon_device *rdev);
  124. #endif