power_state.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * Copyright 2015 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_POWERSTATE_H
  24. #define PP_POWERSTATE_H
  25. struct pp_hw_power_state {
  26. unsigned int magic;
  27. };
  28. struct pp_power_state;
  29. #define PP_INVALID_POWER_STATE_ID (0)
  30. /*
  31. * An item of a list containing Power States.
  32. */
  33. struct PP_StateLinkedList {
  34. struct pp_power_state *next;
  35. struct pp_power_state *prev;
  36. };
  37. enum PP_StateUILabel {
  38. PP_StateUILabel_None,
  39. PP_StateUILabel_Battery,
  40. PP_StateUILabel_MiddleLow,
  41. PP_StateUILabel_Balanced,
  42. PP_StateUILabel_MiddleHigh,
  43. PP_StateUILabel_Performance,
  44. PP_StateUILabel_BACO
  45. };
  46. enum PP_StateClassificationFlag {
  47. PP_StateClassificationFlag_Boot = 0x0001,
  48. PP_StateClassificationFlag_Thermal = 0x0002,
  49. PP_StateClassificationFlag_LimitedPowerSource = 0x0004,
  50. PP_StateClassificationFlag_Rest = 0x0008,
  51. PP_StateClassificationFlag_Forced = 0x0010,
  52. PP_StateClassificationFlag_User3DPerformance = 0x0020,
  53. PP_StateClassificationFlag_User2DPerformance = 0x0040,
  54. PP_StateClassificationFlag_3DPerformance = 0x0080,
  55. PP_StateClassificationFlag_ACOverdriveTemplate = 0x0100,
  56. PP_StateClassificationFlag_Uvd = 0x0200,
  57. PP_StateClassificationFlag_3DPerformanceLow = 0x0400,
  58. PP_StateClassificationFlag_ACPI = 0x0800,
  59. PP_StateClassificationFlag_HD2 = 0x1000,
  60. PP_StateClassificationFlag_UvdHD = 0x2000,
  61. PP_StateClassificationFlag_UvdSD = 0x4000,
  62. PP_StateClassificationFlag_UserDCPerformance = 0x8000,
  63. PP_StateClassificationFlag_DCOverdriveTemplate = 0x10000,
  64. PP_StateClassificationFlag_BACO = 0x20000,
  65. PP_StateClassificationFlag_LimitedPowerSource_2 = 0x40000,
  66. PP_StateClassificationFlag_ULV = 0x80000,
  67. PP_StateClassificationFlag_UvdMVC = 0x100000,
  68. };
  69. typedef unsigned int PP_StateClassificationFlags;
  70. struct PP_StateClassificationBlock {
  71. enum PP_StateUILabel ui_label;
  72. enum PP_StateClassificationFlag flags;
  73. int bios_index;
  74. bool temporary_state;
  75. bool to_be_deleted;
  76. };
  77. struct PP_StatePcieBlock {
  78. unsigned int lanes;
  79. };
  80. enum PP_RefreshrateSource {
  81. PP_RefreshrateSource_EDID,
  82. PP_RefreshrateSource_Explicit
  83. };
  84. struct PP_StateDisplayBlock {
  85. bool disableFrameModulation;
  86. bool limitRefreshrate;
  87. enum PP_RefreshrateSource refreshrateSource;
  88. int explicitRefreshrate;
  89. int edidRefreshrateIndex;
  90. bool enableVariBright;
  91. };
  92. struct PP_StateMemroyBlock {
  93. bool dllOff;
  94. uint8_t m3arb;
  95. uint8_t unused[3];
  96. };
  97. struct PP_StateSoftwareAlgorithmBlock {
  98. bool disableLoadBalancing;
  99. bool enableSleepForTimestamps;
  100. };
  101. #define PP_TEMPERATURE_UNITS_PER_CENTIGRADES 1000
  102. /**
  103. * Type to hold a temperature range.
  104. */
  105. struct PP_TemperatureRange {
  106. uint32_t min;
  107. uint32_t max;
  108. };
  109. struct PP_StateValidationBlock {
  110. bool singleDisplayOnly;
  111. bool disallowOnDC;
  112. uint8_t supportedPowerLevels;
  113. };
  114. struct PP_UVD_CLOCKS {
  115. uint32_t VCLK;
  116. uint32_t DCLK;
  117. };
  118. /**
  119. * Structure to hold a PowerPlay Power State.
  120. */
  121. struct pp_power_state {
  122. uint32_t id;
  123. struct PP_StateLinkedList orderedList;
  124. struct PP_StateLinkedList allStatesList;
  125. struct PP_StateClassificationBlock classification;
  126. struct PP_StateValidationBlock validation;
  127. struct PP_StatePcieBlock pcie;
  128. struct PP_StateDisplayBlock display;
  129. struct PP_StateMemroyBlock memory;
  130. struct PP_TemperatureRange temperatures;
  131. struct PP_StateSoftwareAlgorithmBlock software;
  132. struct PP_UVD_CLOCKS uvd_clocks;
  133. struct pp_hw_power_state hardware;
  134. };
  135. enum PP_MMProfilingState {
  136. PP_MMProfilingState_NA = 0,
  137. PP_MMProfilingState_Started,
  138. PP_MMProfilingState_Stopped
  139. };
  140. struct pp_clock_engine_request {
  141. unsigned long client_type;
  142. unsigned long ctx_id;
  143. uint64_t context_handle;
  144. unsigned long sclk;
  145. unsigned long sclk_hard_min;
  146. unsigned long mclk;
  147. unsigned long iclk;
  148. unsigned long evclk;
  149. unsigned long ecclk;
  150. unsigned long ecclk_hard_min;
  151. unsigned long vclk;
  152. unsigned long dclk;
  153. unsigned long sclk_over_drive;
  154. unsigned long mclk_over_drive;
  155. unsigned long sclk_threshold;
  156. unsigned long flag;
  157. unsigned long vclk_ceiling;
  158. unsigned long dclk_ceiling;
  159. unsigned long num_cus;
  160. unsigned long pm_flag;
  161. enum PP_MMProfilingState mm_profiling_state;
  162. };
  163. #endif