amdgpu_dpm.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /*
  2. * Copyright 2014 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 __AMDGPU_DPM_H__
  24. #define __AMDGPU_DPM_H__
  25. enum amdgpu_int_thermal_type {
  26. THERMAL_TYPE_NONE,
  27. THERMAL_TYPE_EXTERNAL,
  28. THERMAL_TYPE_EXTERNAL_GPIO,
  29. THERMAL_TYPE_RV6XX,
  30. THERMAL_TYPE_RV770,
  31. THERMAL_TYPE_ADT7473_WITH_INTERNAL,
  32. THERMAL_TYPE_EVERGREEN,
  33. THERMAL_TYPE_SUMO,
  34. THERMAL_TYPE_NI,
  35. THERMAL_TYPE_SI,
  36. THERMAL_TYPE_EMC2103_WITH_INTERNAL,
  37. THERMAL_TYPE_CI,
  38. THERMAL_TYPE_KV,
  39. };
  40. enum amdgpu_dpm_auto_throttle_src {
  41. AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL,
  42. AMDGPU_DPM_AUTO_THROTTLE_SRC_EXTERNAL
  43. };
  44. enum amdgpu_dpm_event_src {
  45. AMDGPU_DPM_EVENT_SRC_ANALOG = 0,
  46. AMDGPU_DPM_EVENT_SRC_EXTERNAL = 1,
  47. AMDGPU_DPM_EVENT_SRC_DIGITAL = 2,
  48. AMDGPU_DPM_EVENT_SRC_ANALOG_OR_EXTERNAL = 3,
  49. AMDGPU_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL = 4
  50. };
  51. #define SCLK_DEEP_SLEEP_MASK 0x8
  52. struct amdgpu_ps {
  53. u32 caps; /* vbios flags */
  54. u32 class; /* vbios flags */
  55. u32 class2; /* vbios flags */
  56. /* UVD clocks */
  57. u32 vclk;
  58. u32 dclk;
  59. /* VCE clocks */
  60. u32 evclk;
  61. u32 ecclk;
  62. bool vce_active;
  63. enum amd_vce_level vce_level;
  64. /* asic priv */
  65. void *ps_priv;
  66. };
  67. struct amdgpu_dpm_thermal {
  68. /* thermal interrupt work */
  69. struct work_struct work;
  70. /* low temperature threshold */
  71. int min_temp;
  72. /* high temperature threshold */
  73. int max_temp;
  74. /* was last interrupt low to high or high to low */
  75. bool high_to_low;
  76. /* interrupt source */
  77. struct amdgpu_irq_src irq;
  78. };
  79. enum amdgpu_clk_action
  80. {
  81. AMDGPU_SCLK_UP = 1,
  82. AMDGPU_SCLK_DOWN
  83. };
  84. struct amdgpu_blacklist_clocks
  85. {
  86. u32 sclk;
  87. u32 mclk;
  88. enum amdgpu_clk_action action;
  89. };
  90. struct amdgpu_clock_and_voltage_limits {
  91. u32 sclk;
  92. u32 mclk;
  93. u16 vddc;
  94. u16 vddci;
  95. };
  96. struct amdgpu_clock_array {
  97. u32 count;
  98. u32 *values;
  99. };
  100. struct amdgpu_clock_voltage_dependency_entry {
  101. u32 clk;
  102. u16 v;
  103. };
  104. struct amdgpu_clock_voltage_dependency_table {
  105. u32 count;
  106. struct amdgpu_clock_voltage_dependency_entry *entries;
  107. };
  108. union amdgpu_cac_leakage_entry {
  109. struct {
  110. u16 vddc;
  111. u32 leakage;
  112. };
  113. struct {
  114. u16 vddc1;
  115. u16 vddc2;
  116. u16 vddc3;
  117. };
  118. };
  119. struct amdgpu_cac_leakage_table {
  120. u32 count;
  121. union amdgpu_cac_leakage_entry *entries;
  122. };
  123. struct amdgpu_phase_shedding_limits_entry {
  124. u16 voltage;
  125. u32 sclk;
  126. u32 mclk;
  127. };
  128. struct amdgpu_phase_shedding_limits_table {
  129. u32 count;
  130. struct amdgpu_phase_shedding_limits_entry *entries;
  131. };
  132. struct amdgpu_uvd_clock_voltage_dependency_entry {
  133. u32 vclk;
  134. u32 dclk;
  135. u16 v;
  136. };
  137. struct amdgpu_uvd_clock_voltage_dependency_table {
  138. u8 count;
  139. struct amdgpu_uvd_clock_voltage_dependency_entry *entries;
  140. };
  141. struct amdgpu_vce_clock_voltage_dependency_entry {
  142. u32 ecclk;
  143. u32 evclk;
  144. u16 v;
  145. };
  146. struct amdgpu_vce_clock_voltage_dependency_table {
  147. u8 count;
  148. struct amdgpu_vce_clock_voltage_dependency_entry *entries;
  149. };
  150. struct amdgpu_ppm_table {
  151. u8 ppm_design;
  152. u16 cpu_core_number;
  153. u32 platform_tdp;
  154. u32 small_ac_platform_tdp;
  155. u32 platform_tdc;
  156. u32 small_ac_platform_tdc;
  157. u32 apu_tdp;
  158. u32 dgpu_tdp;
  159. u32 dgpu_ulv_power;
  160. u32 tj_max;
  161. };
  162. struct amdgpu_cac_tdp_table {
  163. u16 tdp;
  164. u16 configurable_tdp;
  165. u16 tdc;
  166. u16 battery_power_limit;
  167. u16 small_power_limit;
  168. u16 low_cac_leakage;
  169. u16 high_cac_leakage;
  170. u16 maximum_power_delivery_limit;
  171. };
  172. struct amdgpu_dpm_dynamic_state {
  173. struct amdgpu_clock_voltage_dependency_table vddc_dependency_on_sclk;
  174. struct amdgpu_clock_voltage_dependency_table vddci_dependency_on_mclk;
  175. struct amdgpu_clock_voltage_dependency_table vddc_dependency_on_mclk;
  176. struct amdgpu_clock_voltage_dependency_table mvdd_dependency_on_mclk;
  177. struct amdgpu_clock_voltage_dependency_table vddc_dependency_on_dispclk;
  178. struct amdgpu_uvd_clock_voltage_dependency_table uvd_clock_voltage_dependency_table;
  179. struct amdgpu_vce_clock_voltage_dependency_table vce_clock_voltage_dependency_table;
  180. struct amdgpu_clock_voltage_dependency_table samu_clock_voltage_dependency_table;
  181. struct amdgpu_clock_voltage_dependency_table acp_clock_voltage_dependency_table;
  182. struct amdgpu_clock_voltage_dependency_table vddgfx_dependency_on_sclk;
  183. struct amdgpu_clock_array valid_sclk_values;
  184. struct amdgpu_clock_array valid_mclk_values;
  185. struct amdgpu_clock_and_voltage_limits max_clock_voltage_on_dc;
  186. struct amdgpu_clock_and_voltage_limits max_clock_voltage_on_ac;
  187. u32 mclk_sclk_ratio;
  188. u32 sclk_mclk_delta;
  189. u16 vddc_vddci_delta;
  190. u16 min_vddc_for_pcie_gen2;
  191. struct amdgpu_cac_leakage_table cac_leakage_table;
  192. struct amdgpu_phase_shedding_limits_table phase_shedding_limits_table;
  193. struct amdgpu_ppm_table *ppm_table;
  194. struct amdgpu_cac_tdp_table *cac_tdp_table;
  195. };
  196. struct amdgpu_dpm_fan {
  197. u16 t_min;
  198. u16 t_med;
  199. u16 t_high;
  200. u16 pwm_min;
  201. u16 pwm_med;
  202. u16 pwm_high;
  203. u8 t_hyst;
  204. u32 cycle_delay;
  205. u16 t_max;
  206. u8 control_mode;
  207. u16 default_max_fan_pwm;
  208. u16 default_fan_output_sensitivity;
  209. u16 fan_output_sensitivity;
  210. bool ucode_fan_control;
  211. };
  212. enum amdgpu_pcie_gen {
  213. AMDGPU_PCIE_GEN1 = 0,
  214. AMDGPU_PCIE_GEN2 = 1,
  215. AMDGPU_PCIE_GEN3 = 2,
  216. AMDGPU_PCIE_GEN_INVALID = 0xffff
  217. };
  218. struct amdgpu_dpm_funcs {
  219. int (*get_temperature)(struct amdgpu_device *adev);
  220. int (*pre_set_power_state)(struct amdgpu_device *adev);
  221. int (*set_power_state)(struct amdgpu_device *adev);
  222. void (*post_set_power_state)(struct amdgpu_device *adev);
  223. void (*display_configuration_changed)(struct amdgpu_device *adev);
  224. u32 (*get_sclk)(struct amdgpu_device *adev, bool low);
  225. u32 (*get_mclk)(struct amdgpu_device *adev, bool low);
  226. void (*print_power_state)(struct amdgpu_device *adev, struct amdgpu_ps *ps);
  227. void (*debugfs_print_current_performance_level)(struct amdgpu_device *adev, struct seq_file *m);
  228. int (*force_performance_level)(struct amdgpu_device *adev, enum amd_dpm_forced_level level);
  229. bool (*vblank_too_short)(struct amdgpu_device *adev);
  230. void (*powergate_uvd)(struct amdgpu_device *adev, bool gate);
  231. void (*powergate_vce)(struct amdgpu_device *adev, bool gate);
  232. void (*enable_bapm)(struct amdgpu_device *adev, bool enable);
  233. void (*set_fan_control_mode)(struct amdgpu_device *adev, u32 mode);
  234. u32 (*get_fan_control_mode)(struct amdgpu_device *adev);
  235. int (*set_fan_speed_percent)(struct amdgpu_device *adev, u32 speed);
  236. int (*get_fan_speed_percent)(struct amdgpu_device *adev, u32 *speed);
  237. int (*force_clock_level)(struct amdgpu_device *adev, enum pp_clock_type type, uint32_t mask);
  238. int (*print_clock_levels)(struct amdgpu_device *adev, enum pp_clock_type type, char *buf);
  239. int (*get_sclk_od)(struct amdgpu_device *adev);
  240. int (*set_sclk_od)(struct amdgpu_device *adev, uint32_t value);
  241. int (*get_mclk_od)(struct amdgpu_device *adev);
  242. int (*set_mclk_od)(struct amdgpu_device *adev, uint32_t value);
  243. int (*check_state_equal)(struct amdgpu_device *adev,
  244. struct amdgpu_ps *cps,
  245. struct amdgpu_ps *rps,
  246. bool *equal);
  247. int (*read_sensor)(struct amdgpu_device *adev, int idx, void *value,
  248. int *size);
  249. struct amd_vce_state* (*get_vce_clock_state)(struct amdgpu_device *adev, unsigned idx);
  250. int (*reset_power_profile_state)(struct amdgpu_device *adev,
  251. struct amd_pp_profile *request);
  252. int (*get_power_profile_state)(struct amdgpu_device *adev,
  253. struct amd_pp_profile *query);
  254. int (*set_power_profile_state)(struct amdgpu_device *adev,
  255. struct amd_pp_profile *request);
  256. int (*switch_power_profile)(struct amdgpu_device *adev,
  257. enum amd_pp_profile_type type);
  258. };
  259. #define amdgpu_dpm_pre_set_power_state(adev) (adev)->pm.funcs->pre_set_power_state((adev))
  260. #define amdgpu_dpm_set_power_state(adev) (adev)->pm.funcs->set_power_state((adev))
  261. #define amdgpu_dpm_post_set_power_state(adev) (adev)->pm.funcs->post_set_power_state((adev))
  262. #define amdgpu_dpm_display_configuration_changed(adev) (adev)->pm.funcs->display_configuration_changed((adev))
  263. #define amdgpu_dpm_print_power_state(adev, ps) (adev)->pm.funcs->print_power_state((adev), (ps))
  264. #define amdgpu_dpm_vblank_too_short(adev) (adev)->pm.funcs->vblank_too_short((adev))
  265. #define amdgpu_dpm_enable_bapm(adev, e) (adev)->pm.funcs->enable_bapm((adev), (e))
  266. #define amdgpu_dpm_read_sensor(adev, idx, value, size) \
  267. ((adev)->pp_enabled ? \
  268. (adev)->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, (idx), (value), (size)) : \
  269. (adev)->pm.funcs->read_sensor((adev), (idx), (value), (size)))
  270. #define amdgpu_dpm_get_temperature(adev) \
  271. ((adev)->pp_enabled ? \
  272. (adev)->powerplay.pp_funcs->get_temperature((adev)->powerplay.pp_handle) : \
  273. (adev)->pm.funcs->get_temperature((adev)))
  274. #define amdgpu_dpm_set_fan_control_mode(adev, m) \
  275. ((adev)->pp_enabled ? \
  276. (adev)->powerplay.pp_funcs->set_fan_control_mode((adev)->powerplay.pp_handle, (m)) : \
  277. (adev)->pm.funcs->set_fan_control_mode((adev), (m)))
  278. #define amdgpu_dpm_get_fan_control_mode(adev) \
  279. ((adev)->pp_enabled ? \
  280. (adev)->powerplay.pp_funcs->get_fan_control_mode((adev)->powerplay.pp_handle) : \
  281. (adev)->pm.funcs->get_fan_control_mode((adev)))
  282. #define amdgpu_dpm_set_fan_speed_percent(adev, s) \
  283. ((adev)->pp_enabled ? \
  284. (adev)->powerplay.pp_funcs->set_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
  285. (adev)->pm.funcs->set_fan_speed_percent((adev), (s)))
  286. #define amdgpu_dpm_get_fan_speed_percent(adev, s) \
  287. ((adev)->pp_enabled ? \
  288. (adev)->powerplay.pp_funcs->get_fan_speed_percent((adev)->powerplay.pp_handle, (s)) : \
  289. (adev)->pm.funcs->get_fan_speed_percent((adev), (s)))
  290. #define amdgpu_dpm_get_fan_speed_rpm(adev, s) \
  291. ((adev)->pp_enabled ? \
  292. (adev)->powerplay.pp_funcs->get_fan_speed_rpm((adev)->powerplay.pp_handle, (s)) : \
  293. -EINVAL)
  294. #define amdgpu_dpm_get_sclk(adev, l) \
  295. ((adev)->pp_enabled ? \
  296. (adev)->powerplay.pp_funcs->get_sclk((adev)->powerplay.pp_handle, (l)) : \
  297. (adev)->pm.funcs->get_sclk((adev), (l)))
  298. #define amdgpu_dpm_get_mclk(adev, l) \
  299. ((adev)->pp_enabled ? \
  300. (adev)->powerplay.pp_funcs->get_mclk((adev)->powerplay.pp_handle, (l)) : \
  301. (adev)->pm.funcs->get_mclk((adev), (l)))
  302. #define amdgpu_dpm_force_performance_level(adev, l) \
  303. ((adev)->pp_enabled ? \
  304. (adev)->powerplay.pp_funcs->force_performance_level((adev)->powerplay.pp_handle, (l)) : \
  305. (adev)->pm.funcs->force_performance_level((adev), (l)))
  306. #define amdgpu_dpm_powergate_uvd(adev, g) \
  307. ((adev)->pp_enabled ? \
  308. (adev)->powerplay.pp_funcs->powergate_uvd((adev)->powerplay.pp_handle, (g)) : \
  309. (adev)->pm.funcs->powergate_uvd((adev), (g)))
  310. #define amdgpu_dpm_powergate_vce(adev, g) \
  311. ((adev)->pp_enabled ? \
  312. (adev)->powerplay.pp_funcs->powergate_vce((adev)->powerplay.pp_handle, (g)) : \
  313. (adev)->pm.funcs->powergate_vce((adev), (g)))
  314. #define amdgpu_dpm_get_current_power_state(adev) \
  315. (adev)->powerplay.pp_funcs->get_current_power_state((adev)->powerplay.pp_handle)
  316. #define amdgpu_dpm_get_pp_num_states(adev, data) \
  317. (adev)->powerplay.pp_funcs->get_pp_num_states((adev)->powerplay.pp_handle, data)
  318. #define amdgpu_dpm_get_pp_table(adev, table) \
  319. (adev)->powerplay.pp_funcs->get_pp_table((adev)->powerplay.pp_handle, table)
  320. #define amdgpu_dpm_set_pp_table(adev, buf, size) \
  321. (adev)->powerplay.pp_funcs->set_pp_table((adev)->powerplay.pp_handle, buf, size)
  322. #define amdgpu_dpm_print_clock_levels(adev, type, buf) \
  323. (adev)->powerplay.pp_funcs->print_clock_levels((adev)->powerplay.pp_handle, type, buf)
  324. #define amdgpu_dpm_force_clock_level(adev, type, level) \
  325. (adev)->powerplay.pp_funcs->force_clock_level((adev)->powerplay.pp_handle, type, level)
  326. #define amdgpu_dpm_get_sclk_od(adev) \
  327. (adev)->powerplay.pp_funcs->get_sclk_od((adev)->powerplay.pp_handle)
  328. #define amdgpu_dpm_set_sclk_od(adev, value) \
  329. (adev)->powerplay.pp_funcs->set_sclk_od((adev)->powerplay.pp_handle, value)
  330. #define amdgpu_dpm_get_mclk_od(adev) \
  331. ((adev)->powerplay.pp_funcs->get_mclk_od((adev)->powerplay.pp_handle))
  332. #define amdgpu_dpm_set_mclk_od(adev, value) \
  333. ((adev)->powerplay.pp_funcs->set_mclk_od((adev)->powerplay.pp_handle, value))
  334. #define amdgpu_dpm_dispatch_task(adev, event_id, input, output) \
  335. (adev)->powerplay.pp_funcs->dispatch_tasks((adev)->powerplay.pp_handle, (event_id), (input), (output))
  336. #define amgdpu_dpm_check_state_equal(adev, cps, rps, equal) (adev)->pm.funcs->check_state_equal((adev), (cps),(rps),(equal))
  337. #define amdgpu_dpm_get_vce_clock_state(adev, i) \
  338. ((adev)->pp_enabled ? \
  339. (adev)->powerplay.pp_funcs->get_vce_clock_state((adev)->powerplay.pp_handle, (i)) : \
  340. (adev)->pm.funcs->get_vce_clock_state((adev), (i)))
  341. #define amdgpu_dpm_get_performance_level(adev) \
  342. ((adev)->pp_enabled ? \
  343. (adev)->powerplay.pp_funcs->get_performance_level((adev)->powerplay.pp_handle) : \
  344. (adev)->pm.dpm.forced_level)
  345. #define amdgpu_dpm_reset_power_profile_state(adev, request) \
  346. ((adev)->powerplay.pp_funcs->reset_power_profile_state(\
  347. (adev)->powerplay.pp_handle, request))
  348. #define amdgpu_dpm_get_power_profile_state(adev, query) \
  349. ((adev)->powerplay.pp_funcs->get_power_profile_state(\
  350. (adev)->powerplay.pp_handle, query))
  351. #define amdgpu_dpm_set_power_profile_state(adev, request) \
  352. ((adev)->powerplay.pp_funcs->set_power_profile_state(\
  353. (adev)->powerplay.pp_handle, request))
  354. #define amdgpu_dpm_switch_power_profile(adev, type) \
  355. ((adev)->powerplay.pp_funcs->switch_power_profile(\
  356. (adev)->powerplay.pp_handle, type))
  357. struct amdgpu_dpm {
  358. struct amdgpu_ps *ps;
  359. /* number of valid power states */
  360. int num_ps;
  361. /* current power state that is active */
  362. struct amdgpu_ps *current_ps;
  363. /* requested power state */
  364. struct amdgpu_ps *requested_ps;
  365. /* boot up power state */
  366. struct amdgpu_ps *boot_ps;
  367. /* default uvd power state */
  368. struct amdgpu_ps *uvd_ps;
  369. /* vce requirements */
  370. u32 num_of_vce_states;
  371. struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS];
  372. enum amd_vce_level vce_level;
  373. enum amd_pm_state_type state;
  374. enum amd_pm_state_type user_state;
  375. enum amd_pm_state_type last_state;
  376. enum amd_pm_state_type last_user_state;
  377. u32 platform_caps;
  378. u32 voltage_response_time;
  379. u32 backbias_response_time;
  380. void *priv;
  381. u32 new_active_crtcs;
  382. int new_active_crtc_count;
  383. u32 current_active_crtcs;
  384. int current_active_crtc_count;
  385. struct amdgpu_dpm_dynamic_state dyn_state;
  386. struct amdgpu_dpm_fan fan;
  387. u32 tdp_limit;
  388. u32 near_tdp_limit;
  389. u32 near_tdp_limit_adjusted;
  390. u32 sq_ramping_threshold;
  391. u32 cac_leakage;
  392. u16 tdp_od_limit;
  393. u32 tdp_adjustment;
  394. u16 load_line_slope;
  395. bool power_control;
  396. bool ac_power;
  397. /* special states active */
  398. bool thermal_active;
  399. bool uvd_active;
  400. bool vce_active;
  401. /* thermal handling */
  402. struct amdgpu_dpm_thermal thermal;
  403. /* forced levels */
  404. enum amd_dpm_forced_level forced_level;
  405. };
  406. struct amdgpu_pm {
  407. struct mutex mutex;
  408. u32 current_sclk;
  409. u32 current_mclk;
  410. u32 default_sclk;
  411. u32 default_mclk;
  412. struct amdgpu_i2c_chan *i2c_bus;
  413. /* internal thermal controller on rv6xx+ */
  414. enum amdgpu_int_thermal_type int_thermal_type;
  415. struct device *int_hwmon_dev;
  416. /* fan control parameters */
  417. bool no_fan;
  418. u8 fan_pulses_per_revolution;
  419. u8 fan_min_rpm;
  420. u8 fan_max_rpm;
  421. /* dpm */
  422. bool dpm_enabled;
  423. bool sysfs_initialized;
  424. struct amdgpu_dpm dpm;
  425. const struct firmware *fw; /* SMC firmware */
  426. uint32_t fw_version;
  427. const struct amdgpu_dpm_funcs *funcs;
  428. uint32_t pcie_gen_mask;
  429. uint32_t pcie_mlw_mask;
  430. struct amd_pp_display_configuration pm_display_cfg;/* set by DAL */
  431. };
  432. #define R600_SSTU_DFLT 0
  433. #define R600_SST_DFLT 0x00C8
  434. /* XXX are these ok? */
  435. #define R600_TEMP_RANGE_MIN (90 * 1000)
  436. #define R600_TEMP_RANGE_MAX (120 * 1000)
  437. #define FDO_PWM_MODE_STATIC 1
  438. #define FDO_PWM_MODE_STATIC_RPM 5
  439. enum amdgpu_td {
  440. AMDGPU_TD_AUTO,
  441. AMDGPU_TD_UP,
  442. AMDGPU_TD_DOWN,
  443. };
  444. enum amdgpu_display_watermark {
  445. AMDGPU_DISPLAY_WATERMARK_LOW = 0,
  446. AMDGPU_DISPLAY_WATERMARK_HIGH = 1,
  447. };
  448. enum amdgpu_display_gap
  449. {
  450. AMDGPU_PM_DISPLAY_GAP_VBLANK_OR_WM = 0,
  451. AMDGPU_PM_DISPLAY_GAP_VBLANK = 1,
  452. AMDGPU_PM_DISPLAY_GAP_WATERMARK = 2,
  453. AMDGPU_PM_DISPLAY_GAP_IGNORE = 3,
  454. };
  455. void amdgpu_dpm_print_class_info(u32 class, u32 class2);
  456. void amdgpu_dpm_print_cap_info(u32 caps);
  457. void amdgpu_dpm_print_ps_status(struct amdgpu_device *adev,
  458. struct amdgpu_ps *rps);
  459. u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev);
  460. u32 amdgpu_dpm_get_vrefresh(struct amdgpu_device *adev);
  461. bool amdgpu_is_uvd_state(u32 class, u32 class2);
  462. void amdgpu_calculate_u_and_p(u32 i, u32 r_c, u32 p_b,
  463. u32 *p, u32 *u);
  464. int amdgpu_calculate_at(u32 t, u32 h, u32 fh, u32 fl, u32 *tl, u32 *th);
  465. bool amdgpu_is_internal_thermal_sensor(enum amdgpu_int_thermal_type sensor);
  466. int amdgpu_get_platform_caps(struct amdgpu_device *adev);
  467. int amdgpu_parse_extended_power_table(struct amdgpu_device *adev);
  468. void amdgpu_free_extended_power_table(struct amdgpu_device *adev);
  469. void amdgpu_add_thermal_controller(struct amdgpu_device *adev);
  470. enum amdgpu_pcie_gen amdgpu_get_pcie_gen_support(struct amdgpu_device *adev,
  471. u32 sys_mask,
  472. enum amdgpu_pcie_gen asic_gen,
  473. enum amdgpu_pcie_gen default_gen);
  474. u16 amdgpu_get_pcie_lane_support(struct amdgpu_device *adev,
  475. u16 asic_lanes,
  476. u16 default_lanes);
  477. u8 amdgpu_encode_pci_lane_width(u32 lanes);
  478. struct amd_vce_state*
  479. amdgpu_get_vce_clock_state(struct amdgpu_device *adev, unsigned idx);
  480. #endif