ppatomfwctrl.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright 2016 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 PP_ATOMFWCTRL_H
  24. #define PP_ATOMFWCTRL_H
  25. #include "hwmgr.h"
  26. #define GetIndexIntoMasterCmdTable(FieldName) \
  27. (((char*)(&((struct atom_master_list_of_command_functions_v2_1*)0)->FieldName)-(char*)0)/sizeof(uint16_t))
  28. #define GetIndexIntoMasterDataTable(FieldName) \
  29. (((char*)(&((struct atom_master_list_of_data_tables_v2_1*)0)->FieldName)-(char*)0)/sizeof(uint16_t))
  30. #define PP_ATOMFWCTRL_MAX_VOLTAGE_ENTRIES 32
  31. struct pp_atomfwctrl_voltage_table_entry {
  32. uint16_t value;
  33. uint32_t smio_low;
  34. };
  35. struct pp_atomfwctrl_voltage_table {
  36. uint32_t count;
  37. uint32_t mask_low;
  38. uint32_t phase_delay;
  39. uint8_t psi0_enable;
  40. uint8_t psi1_enable;
  41. uint8_t max_vid_step;
  42. uint8_t telemetry_offset;
  43. uint8_t telemetry_slope;
  44. struct pp_atomfwctrl_voltage_table_entry entries[PP_ATOMFWCTRL_MAX_VOLTAGE_ENTRIES];
  45. };
  46. struct pp_atomfwctrl_gpio_pin_assignment {
  47. uint16_t us_gpio_pin_aindex;
  48. uint8_t uc_gpio_pin_bit_shift;
  49. };
  50. struct pp_atomfwctrl_clock_dividers_soc15 {
  51. uint32_t ulClock; /* the actual clock */
  52. uint32_t ulDid; /* DFS divider */
  53. uint32_t ulPll_fb_mult; /* Feedback Multiplier: bit 8:0 int, bit 15:12 post_div, bit 31:16 frac */
  54. uint32_t ulPll_ss_fbsmult; /* Spread FB Multiplier: bit 8:0 int, bit 31:16 frac */
  55. uint16_t usPll_ss_slew_frac;
  56. uint8_t ucPll_ss_enable;
  57. uint8_t ucReserve;
  58. uint32_t ulReserve[2];
  59. };
  60. struct pp_atomfwctrl_avfs_parameters {
  61. uint32_t ulMaxVddc;
  62. uint32_t ulMinVddc;
  63. uint32_t ulMeanNsigmaAcontant0;
  64. uint32_t ulMeanNsigmaAcontant1;
  65. uint32_t ulMeanNsigmaAcontant2;
  66. uint16_t usMeanNsigmaDcTolSigma;
  67. uint16_t usMeanNsigmaPlatformMean;
  68. uint16_t usMeanNsigmaPlatformSigma;
  69. uint32_t ulGbVdroopTableCksoffA0;
  70. uint32_t ulGbVdroopTableCksoffA1;
  71. uint32_t ulGbVdroopTableCksoffA2;
  72. uint32_t ulGbVdroopTableCksonA0;
  73. uint32_t ulGbVdroopTableCksonA1;
  74. uint32_t ulGbVdroopTableCksonA2;
  75. uint32_t ulGbFuseTableCksoffM1;
  76. uint32_t ulGbFuseTableCksoffM2;
  77. uint32_t ulGbFuseTableCksoffB;
  78. uint32_t ulGbFuseTableCksonM1;
  79. uint32_t ulGbFuseTableCksonM2;
  80. uint32_t ulGbFuseTableCksonB;
  81. uint8_t ucEnableGbVdroopTableCkson;
  82. uint8_t ucEnableGbFuseTableCkson;
  83. uint16_t usPsmAgeComfactor;
  84. uint32_t ulDispclk2GfxclkM1;
  85. uint32_t ulDispclk2GfxclkM2;
  86. uint32_t ulDispclk2GfxclkB;
  87. uint32_t ulDcefclk2GfxclkM1;
  88. uint32_t ulDcefclk2GfxclkM2;
  89. uint32_t ulDcefclk2GfxclkB;
  90. uint32_t ulPixelclk2GfxclkM1;
  91. uint32_t ulPixelclk2GfxclkM2;
  92. uint32_t ulPixelclk2GfxclkB;
  93. uint32_t ulPhyclk2GfxclkM1;
  94. uint32_t ulPhyclk2GfxclkM2;
  95. uint32_t ulPhyclk2GfxclkB;
  96. };
  97. struct pp_atomfwctrl_gpio_parameters {
  98. uint8_t ucAcDcGpio;
  99. uint8_t ucAcDcPolarity;
  100. uint8_t ucVR0HotGpio;
  101. uint8_t ucVR0HotPolarity;
  102. uint8_t ucVR1HotGpio;
  103. uint8_t ucVR1HotPolarity;
  104. uint8_t ucFwCtfGpio;
  105. uint8_t ucFwCtfPolarity;
  106. };
  107. struct pp_atomfwctrl_bios_boot_up_values {
  108. uint32_t ulRevision;
  109. uint32_t ulGfxClk;
  110. uint32_t ulUClk;
  111. uint32_t ulSocClk;
  112. uint16_t usVddc;
  113. uint16_t usVddci;
  114. uint16_t usMvddc;
  115. uint16_t usVddGfx;
  116. };
  117. int pp_atomfwctrl_get_gpu_pll_dividers_vega10(struct pp_hwmgr *hwmgr,
  118. uint32_t clock_type, uint32_t clock_value,
  119. struct pp_atomfwctrl_clock_dividers_soc15 *dividers);
  120. int pp_atomfwctrl_enter_self_refresh(struct pp_hwmgr *hwmgr);
  121. bool pp_atomfwctrl_get_pp_assign_pin(struct pp_hwmgr *hwmgr, const uint32_t pin_id,
  122. struct pp_atomfwctrl_gpio_pin_assignment *gpio_pin_assignment);
  123. int pp_atomfwctrl_get_voltage_table_v4(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
  124. uint8_t voltage_mode, struct pp_atomfwctrl_voltage_table *voltage_table);
  125. bool pp_atomfwctrl_is_voltage_controlled_by_gpio_v4(struct pp_hwmgr *hwmgr,
  126. uint8_t voltage_type, uint8_t voltage_mode);
  127. int pp_atomfwctrl_get_avfs_information(struct pp_hwmgr *hwmgr,
  128. struct pp_atomfwctrl_avfs_parameters *param);
  129. int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr *hwmgr,
  130. struct pp_atomfwctrl_gpio_parameters *param);
  131. int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr *hwmgr,
  132. struct pp_atomfwctrl_bios_boot_up_values *boot_values);
  133. #endif