dm_pp_smu.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright 2017 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. * Authors: AMD
  23. *
  24. */
  25. #ifndef DM_PP_SMU_IF__H
  26. #define DM_PP_SMU_IF__H
  27. /*
  28. * interface to PPLIB/SMU to setup clocks and pstate requirements on SoC
  29. */
  30. enum pp_smu_ver {
  31. /*
  32. * PP_SMU_INTERFACE_X should be interpreted as the interface defined
  33. * starting from X, where X is some family of ASICs. This is as
  34. * opposed to interfaces used only for X. There will be some degree
  35. * of interface sharing between families of ASIcs.
  36. */
  37. PP_SMU_UNSUPPORTED,
  38. PP_SMU_VER_RV
  39. };
  40. struct pp_smu {
  41. enum pp_smu_ver ver;
  42. const void *pp;
  43. /*
  44. * interim extra handle for backwards compatibility
  45. * as some existing functionality not yet implemented
  46. * by ppsmu
  47. */
  48. const void *dm;
  49. };
  50. struct pp_smu_wm_set_range {
  51. unsigned int wm_inst;
  52. uint32_t min_fill_clk_khz;
  53. uint32_t max_fill_clk_khz;
  54. uint32_t min_drain_clk_khz;
  55. uint32_t max_drain_clk_khz;
  56. };
  57. #define MAX_WATERMARK_SETS 4
  58. struct pp_smu_wm_range_sets {
  59. unsigned int num_reader_wm_sets;
  60. struct pp_smu_wm_set_range reader_wm_sets[MAX_WATERMARK_SETS];
  61. unsigned int num_writer_wm_sets;
  62. struct pp_smu_wm_set_range writer_wm_sets[MAX_WATERMARK_SETS];
  63. };
  64. struct pp_smu_display_requirement_rv {
  65. /* PPSMC_MSG_SetDisplayCount: count
  66. * 0 triggers S0i2 optimization
  67. */
  68. unsigned int display_count;
  69. /* PPSMC_MSG_SetHardMinFclkByFreq: khz
  70. * FCLK will vary with DPM, but never below requested hard min
  71. */
  72. unsigned int hard_min_fclk_khz;
  73. /* PPSMC_MSG_SetHardMinDcefclkByFreq: khz
  74. * fixed clock at requested freq, either from FCH bypass or DFS
  75. */
  76. unsigned int hard_min_dcefclk_khz;
  77. /* PPSMC_MSG_SetMinDeepSleepDcefclk: mhz
  78. * when DF is in cstate, dcf clock is further divided down
  79. * to just above given frequency
  80. */
  81. unsigned int min_deep_sleep_dcefclk_mhz;
  82. };
  83. struct pp_smu_funcs_rv {
  84. struct pp_smu pp_smu;
  85. /* PPSMC_MSG_SetDisplayCount
  86. * 0 triggers S0i2 optimization
  87. */
  88. void (*set_display_count)(struct pp_smu *pp, int count);
  89. /* which SMU message? are reader and writer WM separate SMU msg? */
  90. void (*set_wm_ranges)(struct pp_smu *pp,
  91. struct pp_smu_wm_range_sets *ranges);
  92. /* PPSMC_MSG_SetHardMinDcfclkByFreq
  93. * fixed clock at requested freq, either from FCH bypass or DFS
  94. */
  95. void (*set_hard_min_dcfclk_by_freq)(struct pp_smu *pp, int khz);
  96. /* PPSMC_MSG_SetMinDeepSleepDcfclk
  97. * when DF is in cstate, dcf clock is further divided down
  98. * to just above given frequency
  99. */
  100. void (*set_min_deep_sleep_dcfclk)(struct pp_smu *pp, int mhz);
  101. /* PPSMC_MSG_SetHardMinFclkByFreq
  102. * FCLK will vary with DPM, but never below requested hard min
  103. */
  104. void (*set_hard_min_fclk_by_freq)(struct pp_smu *pp, int khz);
  105. /* PPSMC_MSG_SetHardMinSocclkByFreq
  106. * Needed for DWB support
  107. */
  108. void (*set_hard_min_socclk_by_freq)(struct pp_smu *pp, int khz);
  109. /* PME w/a */
  110. void (*set_pme_wa_enable)(struct pp_smu *pp);
  111. /*
  112. * Legacy functions. Used for backwards comp. with existing
  113. * PPlib code.
  114. */
  115. void (*set_display_requirement)(struct pp_smu *pp,
  116. struct pp_smu_display_requirement_rv *req);
  117. };
  118. struct pp_smu_funcs {
  119. struct pp_smu ctx;
  120. union {
  121. struct pp_smu_funcs_rv rv_funcs;
  122. };
  123. };
  124. #endif /* DM_PP_SMU_IF__H */