dm_pp_smu.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. struct pp_smu {
  31. struct dc_context *ctx;
  32. };
  33. enum wm_set_id {
  34. WM_A,
  35. WM_B,
  36. WM_C,
  37. WM_D,
  38. WM_COUNT,
  39. };
  40. struct pp_smu_wm_set_range {
  41. enum wm_set_id wm_inst;
  42. uint32_t min_fill_clk_khz;
  43. uint32_t max_fill_clk_khz;
  44. uint32_t min_drain_clk_khz;
  45. uint32_t max_drain_clk_khz;
  46. };
  47. struct pp_smu_wm_range_sets {
  48. uint32_t num_reader_wm_sets;
  49. struct pp_smu_wm_set_range reader_wm_sets[WM_COUNT];
  50. uint32_t num_writer_wm_sets;
  51. struct pp_smu_wm_set_range writer_wm_sets[WM_COUNT];
  52. };
  53. struct pp_smu_display_requirement_rv {
  54. /* PPSMC_MSG_SetDisplayCount: count
  55. * 0 triggers S0i2 optimization
  56. */
  57. unsigned int display_count;
  58. /* PPSMC_MSG_SetHardMinFclkByFreq: khz
  59. * FCLK will vary with DPM, but never below requested hard min
  60. */
  61. unsigned int hard_min_fclk_khz;
  62. /* PPSMC_MSG_SetHardMinDcefclkByFreq: khz
  63. * fixed clock at requested freq, either from FCH bypass or DFS
  64. */
  65. unsigned int hard_min_dcefclk_khz;
  66. /* PPSMC_MSG_SetMinDeepSleepDcefclk: mhz
  67. * when DF is in cstate, dcf clock is further divided down
  68. * to just above given frequency
  69. */
  70. unsigned int min_deep_sleep_dcefclk_mhz;
  71. };
  72. struct pp_smu_funcs_rv {
  73. struct pp_smu pp_smu;
  74. void (*set_display_requirement)(struct pp_smu *pp,
  75. struct pp_smu_display_requirement_rv *req);
  76. /* which SMU message? are reader and writer WM separate SMU msg? */
  77. void (*set_wm_ranges)(struct pp_smu *pp,
  78. struct pp_smu_wm_range_sets *ranges);
  79. /* PME w/a */
  80. void (*set_pme_wa_enable)(struct pp_smu *pp);
  81. };
  82. #if 0
  83. struct pp_smu_funcs_rv {
  84. /* PPSMC_MSG_SetDisplayCount
  85. * 0 triggers S0i2 optimization
  86. */
  87. void (*set_display_count)(struct pp_smu *pp, int count);
  88. /* PPSMC_MSG_SetHardMinFclkByFreq
  89. * FCLK will vary with DPM, but never below requested hard min
  90. */
  91. void (*set_hard_min_fclk_by_freq)(struct pp_smu *pp, int khz);
  92. /* PPSMC_MSG_SetHardMinDcefclkByFreq
  93. * fixed clock at requested freq, either from FCH bypass or DFS
  94. */
  95. void (*set_hard_min_dcefclk_by_freq)(struct pp_smu *pp, int khz);
  96. /* PPSMC_MSG_SetMinDeepSleepDcefclk
  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_dcefclk)(struct pp_smu *pp, int mhz);
  101. /* todo: aesthetic
  102. * watermark range table
  103. */
  104. /* todo: functional/feature
  105. * PPSMC_MSG_SetHardMinSocclkByFreq: required to support DWB
  106. */
  107. };
  108. #endif
  109. #endif /* DM_PP_SMU_IF__H */