amd_powerplay.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231
  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. #include "pp_debug.h"
  24. #include <linux/types.h>
  25. #include <linux/kernel.h>
  26. #include <linux/gfp.h>
  27. #include <linux/slab.h>
  28. #include <linux/firmware.h>
  29. #include "amd_shared.h"
  30. #include "amd_powerplay.h"
  31. #include "power_state.h"
  32. #include "amdgpu.h"
  33. #include "hwmgr.h"
  34. static const struct amd_pm_funcs pp_dpm_funcs;
  35. static int amd_powerplay_create(struct amdgpu_device *adev)
  36. {
  37. struct pp_hwmgr *hwmgr;
  38. if (adev == NULL)
  39. return -EINVAL;
  40. hwmgr = kzalloc(sizeof(struct pp_hwmgr), GFP_KERNEL);
  41. if (hwmgr == NULL)
  42. return -ENOMEM;
  43. hwmgr->adev = adev;
  44. hwmgr->not_vf = !amdgpu_sriov_vf(adev);
  45. hwmgr->pm_en = (amdgpu_dpm && hwmgr->not_vf) ? true : false;
  46. hwmgr->device = amdgpu_cgs_create_device(adev);
  47. mutex_init(&hwmgr->smu_lock);
  48. hwmgr->chip_family = adev->family;
  49. hwmgr->chip_id = adev->asic_type;
  50. hwmgr->feature_mask = adev->powerplay.pp_feature;
  51. hwmgr->display_config = &adev->pm.pm_display_cfg;
  52. adev->powerplay.pp_handle = hwmgr;
  53. adev->powerplay.pp_funcs = &pp_dpm_funcs;
  54. return 0;
  55. }
  56. static void amd_powerplay_destroy(struct amdgpu_device *adev)
  57. {
  58. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  59. kfree(hwmgr->hardcode_pp_table);
  60. hwmgr->hardcode_pp_table = NULL;
  61. kfree(hwmgr);
  62. hwmgr = NULL;
  63. }
  64. static int pp_early_init(void *handle)
  65. {
  66. int ret;
  67. struct amdgpu_device *adev = handle;
  68. ret = amd_powerplay_create(adev);
  69. if (ret != 0)
  70. return ret;
  71. ret = hwmgr_early_init(adev->powerplay.pp_handle);
  72. if (ret)
  73. return -EINVAL;
  74. return 0;
  75. }
  76. static int pp_sw_init(void *handle)
  77. {
  78. struct amdgpu_device *adev = handle;
  79. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  80. int ret = 0;
  81. ret = hwmgr_sw_init(hwmgr);
  82. pr_debug("powerplay sw init %s\n", ret ? "failed" : "successfully");
  83. return ret;
  84. }
  85. static int pp_sw_fini(void *handle)
  86. {
  87. struct amdgpu_device *adev = handle;
  88. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  89. hwmgr_sw_fini(hwmgr);
  90. if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) {
  91. release_firmware(adev->pm.fw);
  92. adev->pm.fw = NULL;
  93. amdgpu_ucode_fini_bo(adev);
  94. }
  95. return 0;
  96. }
  97. static int pp_hw_init(void *handle)
  98. {
  99. int ret = 0;
  100. struct amdgpu_device *adev = handle;
  101. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  102. if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
  103. amdgpu_ucode_init_bo(adev);
  104. ret = hwmgr_hw_init(hwmgr);
  105. if (ret)
  106. pr_err("powerplay hw init failed\n");
  107. return ret;
  108. }
  109. static int pp_hw_fini(void *handle)
  110. {
  111. struct amdgpu_device *adev = handle;
  112. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  113. hwmgr_hw_fini(hwmgr);
  114. return 0;
  115. }
  116. static void pp_reserve_vram_for_smu(struct amdgpu_device *adev)
  117. {
  118. int r = -EINVAL;
  119. void *cpu_ptr = NULL;
  120. uint64_t gpu_addr;
  121. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  122. if (amdgpu_bo_create_kernel(adev, adev->pm.smu_prv_buffer_size,
  123. PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
  124. &adev->pm.smu_prv_buffer,
  125. &gpu_addr,
  126. &cpu_ptr)) {
  127. DRM_ERROR("amdgpu: failed to create smu prv buffer\n");
  128. return;
  129. }
  130. if (hwmgr->hwmgr_func->notify_cac_buffer_info)
  131. r = hwmgr->hwmgr_func->notify_cac_buffer_info(hwmgr,
  132. lower_32_bits((unsigned long)cpu_ptr),
  133. upper_32_bits((unsigned long)cpu_ptr),
  134. lower_32_bits(gpu_addr),
  135. upper_32_bits(gpu_addr),
  136. adev->pm.smu_prv_buffer_size);
  137. if (r) {
  138. amdgpu_bo_free_kernel(&adev->pm.smu_prv_buffer, NULL, NULL);
  139. adev->pm.smu_prv_buffer = NULL;
  140. DRM_ERROR("amdgpu: failed to notify SMU buffer address\n");
  141. }
  142. }
  143. static int pp_late_init(void *handle)
  144. {
  145. struct amdgpu_device *adev = handle;
  146. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  147. if (hwmgr && hwmgr->pm_en) {
  148. mutex_lock(&hwmgr->smu_lock);
  149. hwmgr_handle_task(hwmgr,
  150. AMD_PP_TASK_COMPLETE_INIT, NULL);
  151. mutex_unlock(&hwmgr->smu_lock);
  152. }
  153. if (adev->pm.smu_prv_buffer_size != 0)
  154. pp_reserve_vram_for_smu(adev);
  155. return 0;
  156. }
  157. static void pp_late_fini(void *handle)
  158. {
  159. struct amdgpu_device *adev = handle;
  160. if (adev->pm.smu_prv_buffer)
  161. amdgpu_bo_free_kernel(&adev->pm.smu_prv_buffer, NULL, NULL);
  162. amd_powerplay_destroy(adev);
  163. }
  164. static bool pp_is_idle(void *handle)
  165. {
  166. return false;
  167. }
  168. static int pp_wait_for_idle(void *handle)
  169. {
  170. return 0;
  171. }
  172. static int pp_sw_reset(void *handle)
  173. {
  174. return 0;
  175. }
  176. static int pp_set_powergating_state(void *handle,
  177. enum amd_powergating_state state)
  178. {
  179. struct amdgpu_device *adev = handle;
  180. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  181. int ret;
  182. if (!hwmgr || !hwmgr->pm_en)
  183. return 0;
  184. if (hwmgr->hwmgr_func->gfx_off_control) {
  185. /* Enable/disable GFX off through SMU */
  186. ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr,
  187. state == AMD_PG_STATE_GATE);
  188. if (ret)
  189. pr_err("gfx off control failed!\n");
  190. }
  191. if (hwmgr->hwmgr_func->enable_per_cu_power_gating == NULL) {
  192. pr_debug("%s was not implemented.\n", __func__);
  193. return 0;
  194. }
  195. /* Enable/disable GFX per cu powergating through SMU */
  196. return hwmgr->hwmgr_func->enable_per_cu_power_gating(hwmgr,
  197. state == AMD_PG_STATE_GATE);
  198. }
  199. static int pp_suspend(void *handle)
  200. {
  201. struct amdgpu_device *adev = handle;
  202. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  203. return hwmgr_suspend(hwmgr);
  204. }
  205. static int pp_resume(void *handle)
  206. {
  207. struct amdgpu_device *adev = handle;
  208. struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
  209. return hwmgr_resume(hwmgr);
  210. }
  211. static int pp_set_clockgating_state(void *handle,
  212. enum amd_clockgating_state state)
  213. {
  214. return 0;
  215. }
  216. static const struct amd_ip_funcs pp_ip_funcs = {
  217. .name = "powerplay",
  218. .early_init = pp_early_init,
  219. .late_init = pp_late_init,
  220. .sw_init = pp_sw_init,
  221. .sw_fini = pp_sw_fini,
  222. .hw_init = pp_hw_init,
  223. .hw_fini = pp_hw_fini,
  224. .late_fini = pp_late_fini,
  225. .suspend = pp_suspend,
  226. .resume = pp_resume,
  227. .is_idle = pp_is_idle,
  228. .wait_for_idle = pp_wait_for_idle,
  229. .soft_reset = pp_sw_reset,
  230. .set_clockgating_state = pp_set_clockgating_state,
  231. .set_powergating_state = pp_set_powergating_state,
  232. };
  233. const struct amdgpu_ip_block_version pp_smu_ip_block =
  234. {
  235. .type = AMD_IP_BLOCK_TYPE_SMC,
  236. .major = 1,
  237. .minor = 0,
  238. .rev = 0,
  239. .funcs = &pp_ip_funcs,
  240. };
  241. static int pp_dpm_load_fw(void *handle)
  242. {
  243. return 0;
  244. }
  245. static int pp_dpm_fw_loading_complete(void *handle)
  246. {
  247. return 0;
  248. }
  249. static int pp_set_clockgating_by_smu(void *handle, uint32_t msg_id)
  250. {
  251. struct pp_hwmgr *hwmgr = handle;
  252. if (!hwmgr || !hwmgr->pm_en)
  253. return -EINVAL;
  254. if (hwmgr->hwmgr_func->update_clock_gatings == NULL) {
  255. pr_info("%s was not implemented.\n", __func__);
  256. return 0;
  257. }
  258. return hwmgr->hwmgr_func->update_clock_gatings(hwmgr, &msg_id);
  259. }
  260. static void pp_dpm_en_umd_pstate(struct pp_hwmgr *hwmgr,
  261. enum amd_dpm_forced_level *level)
  262. {
  263. uint32_t profile_mode_mask = AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD |
  264. AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
  265. AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK |
  266. AMD_DPM_FORCED_LEVEL_PROFILE_PEAK;
  267. if (!(hwmgr->dpm_level & profile_mode_mask)) {
  268. /* enter umd pstate, save current level, disable gfx cg*/
  269. if (*level & profile_mode_mask) {
  270. hwmgr->saved_dpm_level = hwmgr->dpm_level;
  271. hwmgr->en_umd_pstate = true;
  272. amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
  273. AMD_IP_BLOCK_TYPE_GFX,
  274. AMD_CG_STATE_UNGATE);
  275. amdgpu_device_ip_set_powergating_state(hwmgr->adev,
  276. AMD_IP_BLOCK_TYPE_GFX,
  277. AMD_PG_STATE_UNGATE);
  278. }
  279. } else {
  280. /* exit umd pstate, restore level, enable gfx cg*/
  281. if (!(*level & profile_mode_mask)) {
  282. if (*level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)
  283. *level = hwmgr->saved_dpm_level;
  284. hwmgr->en_umd_pstate = false;
  285. amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
  286. AMD_IP_BLOCK_TYPE_GFX,
  287. AMD_CG_STATE_GATE);
  288. amdgpu_device_ip_set_powergating_state(hwmgr->adev,
  289. AMD_IP_BLOCK_TYPE_GFX,
  290. AMD_PG_STATE_GATE);
  291. }
  292. }
  293. }
  294. static int pp_dpm_force_performance_level(void *handle,
  295. enum amd_dpm_forced_level level)
  296. {
  297. struct pp_hwmgr *hwmgr = handle;
  298. if (!hwmgr || !hwmgr->pm_en)
  299. return -EINVAL;
  300. if (level == hwmgr->dpm_level)
  301. return 0;
  302. mutex_lock(&hwmgr->smu_lock);
  303. pp_dpm_en_umd_pstate(hwmgr, &level);
  304. hwmgr->request_dpm_level = level;
  305. hwmgr_handle_task(hwmgr, AMD_PP_TASK_READJUST_POWER_STATE, NULL);
  306. mutex_unlock(&hwmgr->smu_lock);
  307. return 0;
  308. }
  309. static enum amd_dpm_forced_level pp_dpm_get_performance_level(
  310. void *handle)
  311. {
  312. struct pp_hwmgr *hwmgr = handle;
  313. enum amd_dpm_forced_level level;
  314. if (!hwmgr || !hwmgr->pm_en)
  315. return -EINVAL;
  316. mutex_lock(&hwmgr->smu_lock);
  317. level = hwmgr->dpm_level;
  318. mutex_unlock(&hwmgr->smu_lock);
  319. return level;
  320. }
  321. static uint32_t pp_dpm_get_sclk(void *handle, bool low)
  322. {
  323. struct pp_hwmgr *hwmgr = handle;
  324. uint32_t clk = 0;
  325. if (!hwmgr || !hwmgr->pm_en)
  326. return 0;
  327. if (hwmgr->hwmgr_func->get_sclk == NULL) {
  328. pr_info("%s was not implemented.\n", __func__);
  329. return 0;
  330. }
  331. mutex_lock(&hwmgr->smu_lock);
  332. clk = hwmgr->hwmgr_func->get_sclk(hwmgr, low);
  333. mutex_unlock(&hwmgr->smu_lock);
  334. return clk;
  335. }
  336. static uint32_t pp_dpm_get_mclk(void *handle, bool low)
  337. {
  338. struct pp_hwmgr *hwmgr = handle;
  339. uint32_t clk = 0;
  340. if (!hwmgr || !hwmgr->pm_en)
  341. return 0;
  342. if (hwmgr->hwmgr_func->get_mclk == NULL) {
  343. pr_info("%s was not implemented.\n", __func__);
  344. return 0;
  345. }
  346. mutex_lock(&hwmgr->smu_lock);
  347. clk = hwmgr->hwmgr_func->get_mclk(hwmgr, low);
  348. mutex_unlock(&hwmgr->smu_lock);
  349. return clk;
  350. }
  351. static void pp_dpm_powergate_vce(void *handle, bool gate)
  352. {
  353. struct pp_hwmgr *hwmgr = handle;
  354. if (!hwmgr || !hwmgr->pm_en)
  355. return;
  356. if (hwmgr->hwmgr_func->powergate_vce == NULL) {
  357. pr_info("%s was not implemented.\n", __func__);
  358. return;
  359. }
  360. mutex_lock(&hwmgr->smu_lock);
  361. hwmgr->hwmgr_func->powergate_vce(hwmgr, gate);
  362. mutex_unlock(&hwmgr->smu_lock);
  363. }
  364. static void pp_dpm_powergate_uvd(void *handle, bool gate)
  365. {
  366. struct pp_hwmgr *hwmgr = handle;
  367. if (!hwmgr || !hwmgr->pm_en)
  368. return;
  369. if (hwmgr->hwmgr_func->powergate_uvd == NULL) {
  370. pr_info("%s was not implemented.\n", __func__);
  371. return;
  372. }
  373. mutex_lock(&hwmgr->smu_lock);
  374. hwmgr->hwmgr_func->powergate_uvd(hwmgr, gate);
  375. mutex_unlock(&hwmgr->smu_lock);
  376. }
  377. static int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_task task_id,
  378. enum amd_pm_state_type *user_state)
  379. {
  380. int ret = 0;
  381. struct pp_hwmgr *hwmgr = handle;
  382. if (!hwmgr || !hwmgr->pm_en)
  383. return -EINVAL;
  384. mutex_lock(&hwmgr->smu_lock);
  385. ret = hwmgr_handle_task(hwmgr, task_id, user_state);
  386. mutex_unlock(&hwmgr->smu_lock);
  387. return ret;
  388. }
  389. static enum amd_pm_state_type pp_dpm_get_current_power_state(void *handle)
  390. {
  391. struct pp_hwmgr *hwmgr = handle;
  392. struct pp_power_state *state;
  393. enum amd_pm_state_type pm_type;
  394. if (!hwmgr || !hwmgr->pm_en || !hwmgr->current_ps)
  395. return -EINVAL;
  396. mutex_lock(&hwmgr->smu_lock);
  397. state = hwmgr->current_ps;
  398. switch (state->classification.ui_label) {
  399. case PP_StateUILabel_Battery:
  400. pm_type = POWER_STATE_TYPE_BATTERY;
  401. break;
  402. case PP_StateUILabel_Balanced:
  403. pm_type = POWER_STATE_TYPE_BALANCED;
  404. break;
  405. case PP_StateUILabel_Performance:
  406. pm_type = POWER_STATE_TYPE_PERFORMANCE;
  407. break;
  408. default:
  409. if (state->classification.flags & PP_StateClassificationFlag_Boot)
  410. pm_type = POWER_STATE_TYPE_INTERNAL_BOOT;
  411. else
  412. pm_type = POWER_STATE_TYPE_DEFAULT;
  413. break;
  414. }
  415. mutex_unlock(&hwmgr->smu_lock);
  416. return pm_type;
  417. }
  418. static void pp_dpm_set_fan_control_mode(void *handle, uint32_t mode)
  419. {
  420. struct pp_hwmgr *hwmgr = handle;
  421. if (!hwmgr || !hwmgr->pm_en)
  422. return;
  423. if (hwmgr->hwmgr_func->set_fan_control_mode == NULL) {
  424. pr_info("%s was not implemented.\n", __func__);
  425. return;
  426. }
  427. mutex_lock(&hwmgr->smu_lock);
  428. hwmgr->hwmgr_func->set_fan_control_mode(hwmgr, mode);
  429. mutex_unlock(&hwmgr->smu_lock);
  430. }
  431. static uint32_t pp_dpm_get_fan_control_mode(void *handle)
  432. {
  433. struct pp_hwmgr *hwmgr = handle;
  434. uint32_t mode = 0;
  435. if (!hwmgr || !hwmgr->pm_en)
  436. return 0;
  437. if (hwmgr->hwmgr_func->get_fan_control_mode == NULL) {
  438. pr_info("%s was not implemented.\n", __func__);
  439. return 0;
  440. }
  441. mutex_lock(&hwmgr->smu_lock);
  442. mode = hwmgr->hwmgr_func->get_fan_control_mode(hwmgr);
  443. mutex_unlock(&hwmgr->smu_lock);
  444. return mode;
  445. }
  446. static int pp_dpm_set_fan_speed_percent(void *handle, uint32_t percent)
  447. {
  448. struct pp_hwmgr *hwmgr = handle;
  449. int ret = 0;
  450. if (!hwmgr || !hwmgr->pm_en)
  451. return -EINVAL;
  452. if (hwmgr->hwmgr_func->set_fan_speed_percent == NULL) {
  453. pr_info("%s was not implemented.\n", __func__);
  454. return 0;
  455. }
  456. mutex_lock(&hwmgr->smu_lock);
  457. ret = hwmgr->hwmgr_func->set_fan_speed_percent(hwmgr, percent);
  458. mutex_unlock(&hwmgr->smu_lock);
  459. return ret;
  460. }
  461. static int pp_dpm_get_fan_speed_percent(void *handle, uint32_t *speed)
  462. {
  463. struct pp_hwmgr *hwmgr = handle;
  464. int ret = 0;
  465. if (!hwmgr || !hwmgr->pm_en)
  466. return -EINVAL;
  467. if (hwmgr->hwmgr_func->get_fan_speed_percent == NULL) {
  468. pr_info("%s was not implemented.\n", __func__);
  469. return 0;
  470. }
  471. mutex_lock(&hwmgr->smu_lock);
  472. ret = hwmgr->hwmgr_func->get_fan_speed_percent(hwmgr, speed);
  473. mutex_unlock(&hwmgr->smu_lock);
  474. return ret;
  475. }
  476. static int pp_dpm_get_fan_speed_rpm(void *handle, uint32_t *rpm)
  477. {
  478. struct pp_hwmgr *hwmgr = handle;
  479. int ret = 0;
  480. if (!hwmgr || !hwmgr->pm_en)
  481. return -EINVAL;
  482. if (hwmgr->hwmgr_func->get_fan_speed_rpm == NULL)
  483. return -EINVAL;
  484. mutex_lock(&hwmgr->smu_lock);
  485. ret = hwmgr->hwmgr_func->get_fan_speed_rpm(hwmgr, rpm);
  486. mutex_unlock(&hwmgr->smu_lock);
  487. return ret;
  488. }
  489. static int pp_dpm_get_pp_num_states(void *handle,
  490. struct pp_states_info *data)
  491. {
  492. struct pp_hwmgr *hwmgr = handle;
  493. int i;
  494. memset(data, 0, sizeof(*data));
  495. if (!hwmgr || !hwmgr->pm_en ||!hwmgr->ps)
  496. return -EINVAL;
  497. mutex_lock(&hwmgr->smu_lock);
  498. data->nums = hwmgr->num_ps;
  499. for (i = 0; i < hwmgr->num_ps; i++) {
  500. struct pp_power_state *state = (struct pp_power_state *)
  501. ((unsigned long)hwmgr->ps + i * hwmgr->ps_size);
  502. switch (state->classification.ui_label) {
  503. case PP_StateUILabel_Battery:
  504. data->states[i] = POWER_STATE_TYPE_BATTERY;
  505. break;
  506. case PP_StateUILabel_Balanced:
  507. data->states[i] = POWER_STATE_TYPE_BALANCED;
  508. break;
  509. case PP_StateUILabel_Performance:
  510. data->states[i] = POWER_STATE_TYPE_PERFORMANCE;
  511. break;
  512. default:
  513. if (state->classification.flags & PP_StateClassificationFlag_Boot)
  514. data->states[i] = POWER_STATE_TYPE_INTERNAL_BOOT;
  515. else
  516. data->states[i] = POWER_STATE_TYPE_DEFAULT;
  517. }
  518. }
  519. mutex_unlock(&hwmgr->smu_lock);
  520. return 0;
  521. }
  522. static int pp_dpm_get_pp_table(void *handle, char **table)
  523. {
  524. struct pp_hwmgr *hwmgr = handle;
  525. int size = 0;
  526. if (!hwmgr || !hwmgr->pm_en ||!hwmgr->soft_pp_table)
  527. return -EINVAL;
  528. mutex_lock(&hwmgr->smu_lock);
  529. *table = (char *)hwmgr->soft_pp_table;
  530. size = hwmgr->soft_pp_table_size;
  531. mutex_unlock(&hwmgr->smu_lock);
  532. return size;
  533. }
  534. static int amd_powerplay_reset(void *handle)
  535. {
  536. struct pp_hwmgr *hwmgr = handle;
  537. int ret;
  538. ret = hwmgr_hw_fini(hwmgr);
  539. if (ret)
  540. return ret;
  541. ret = hwmgr_hw_init(hwmgr);
  542. if (ret)
  543. return ret;
  544. return hwmgr_handle_task(hwmgr, AMD_PP_TASK_COMPLETE_INIT, NULL);
  545. }
  546. static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)
  547. {
  548. struct pp_hwmgr *hwmgr = handle;
  549. int ret = -ENOMEM;
  550. if (!hwmgr || !hwmgr->pm_en)
  551. return -EINVAL;
  552. mutex_lock(&hwmgr->smu_lock);
  553. if (!hwmgr->hardcode_pp_table) {
  554. hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table,
  555. hwmgr->soft_pp_table_size,
  556. GFP_KERNEL);
  557. if (!hwmgr->hardcode_pp_table)
  558. goto err;
  559. }
  560. memcpy(hwmgr->hardcode_pp_table, buf, size);
  561. hwmgr->soft_pp_table = hwmgr->hardcode_pp_table;
  562. ret = amd_powerplay_reset(handle);
  563. if (ret)
  564. goto err;
  565. if (hwmgr->hwmgr_func->avfs_control) {
  566. ret = hwmgr->hwmgr_func->avfs_control(hwmgr, false);
  567. if (ret)
  568. goto err;
  569. }
  570. mutex_unlock(&hwmgr->smu_lock);
  571. return 0;
  572. err:
  573. mutex_unlock(&hwmgr->smu_lock);
  574. return ret;
  575. }
  576. static int pp_dpm_force_clock_level(void *handle,
  577. enum pp_clock_type type, uint32_t mask)
  578. {
  579. struct pp_hwmgr *hwmgr = handle;
  580. int ret = 0;
  581. if (!hwmgr || !hwmgr->pm_en)
  582. return -EINVAL;
  583. if (hwmgr->hwmgr_func->force_clock_level == NULL) {
  584. pr_info("%s was not implemented.\n", __func__);
  585. return 0;
  586. }
  587. mutex_lock(&hwmgr->smu_lock);
  588. if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
  589. ret = hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);
  590. else
  591. ret = -EINVAL;
  592. mutex_unlock(&hwmgr->smu_lock);
  593. return ret;
  594. }
  595. static int pp_dpm_print_clock_levels(void *handle,
  596. enum pp_clock_type type, char *buf)
  597. {
  598. struct pp_hwmgr *hwmgr = handle;
  599. int ret = 0;
  600. if (!hwmgr || !hwmgr->pm_en)
  601. return -EINVAL;
  602. if (hwmgr->hwmgr_func->print_clock_levels == NULL) {
  603. pr_info("%s was not implemented.\n", __func__);
  604. return 0;
  605. }
  606. mutex_lock(&hwmgr->smu_lock);
  607. ret = hwmgr->hwmgr_func->print_clock_levels(hwmgr, type, buf);
  608. mutex_unlock(&hwmgr->smu_lock);
  609. return ret;
  610. }
  611. static int pp_dpm_get_sclk_od(void *handle)
  612. {
  613. struct pp_hwmgr *hwmgr = handle;
  614. int ret = 0;
  615. if (!hwmgr || !hwmgr->pm_en)
  616. return -EINVAL;
  617. if (hwmgr->hwmgr_func->get_sclk_od == NULL) {
  618. pr_info("%s was not implemented.\n", __func__);
  619. return 0;
  620. }
  621. mutex_lock(&hwmgr->smu_lock);
  622. ret = hwmgr->hwmgr_func->get_sclk_od(hwmgr);
  623. mutex_unlock(&hwmgr->smu_lock);
  624. return ret;
  625. }
  626. static int pp_dpm_set_sclk_od(void *handle, uint32_t value)
  627. {
  628. struct pp_hwmgr *hwmgr = handle;
  629. int ret = 0;
  630. if (!hwmgr || !hwmgr->pm_en)
  631. return -EINVAL;
  632. if (hwmgr->hwmgr_func->set_sclk_od == NULL) {
  633. pr_info("%s was not implemented.\n", __func__);
  634. return 0;
  635. }
  636. mutex_lock(&hwmgr->smu_lock);
  637. ret = hwmgr->hwmgr_func->set_sclk_od(hwmgr, value);
  638. mutex_unlock(&hwmgr->smu_lock);
  639. return ret;
  640. }
  641. static int pp_dpm_get_mclk_od(void *handle)
  642. {
  643. struct pp_hwmgr *hwmgr = handle;
  644. int ret = 0;
  645. if (!hwmgr || !hwmgr->pm_en)
  646. return -EINVAL;
  647. if (hwmgr->hwmgr_func->get_mclk_od == NULL) {
  648. pr_info("%s was not implemented.\n", __func__);
  649. return 0;
  650. }
  651. mutex_lock(&hwmgr->smu_lock);
  652. ret = hwmgr->hwmgr_func->get_mclk_od(hwmgr);
  653. mutex_unlock(&hwmgr->smu_lock);
  654. return ret;
  655. }
  656. static int pp_dpm_set_mclk_od(void *handle, uint32_t value)
  657. {
  658. struct pp_hwmgr *hwmgr = handle;
  659. int ret = 0;
  660. if (!hwmgr || !hwmgr->pm_en)
  661. return -EINVAL;
  662. if (hwmgr->hwmgr_func->set_mclk_od == NULL) {
  663. pr_info("%s was not implemented.\n", __func__);
  664. return 0;
  665. }
  666. mutex_lock(&hwmgr->smu_lock);
  667. ret = hwmgr->hwmgr_func->set_mclk_od(hwmgr, value);
  668. mutex_unlock(&hwmgr->smu_lock);
  669. return ret;
  670. }
  671. static int pp_dpm_read_sensor(void *handle, int idx,
  672. void *value, int *size)
  673. {
  674. struct pp_hwmgr *hwmgr = handle;
  675. int ret = 0;
  676. if (!hwmgr || !hwmgr->pm_en || !value)
  677. return -EINVAL;
  678. switch (idx) {
  679. case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK:
  680. *((uint32_t *)value) = hwmgr->pstate_sclk;
  681. return 0;
  682. case AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK:
  683. *((uint32_t *)value) = hwmgr->pstate_mclk;
  684. return 0;
  685. default:
  686. mutex_lock(&hwmgr->smu_lock);
  687. ret = hwmgr->hwmgr_func->read_sensor(hwmgr, idx, value, size);
  688. mutex_unlock(&hwmgr->smu_lock);
  689. return ret;
  690. }
  691. }
  692. static struct amd_vce_state*
  693. pp_dpm_get_vce_clock_state(void *handle, unsigned idx)
  694. {
  695. struct pp_hwmgr *hwmgr = handle;
  696. if (!hwmgr || !hwmgr->pm_en)
  697. return NULL;
  698. if (idx < hwmgr->num_vce_state_tables)
  699. return &hwmgr->vce_states[idx];
  700. return NULL;
  701. }
  702. static int pp_get_power_profile_mode(void *handle, char *buf)
  703. {
  704. struct pp_hwmgr *hwmgr = handle;
  705. if (!hwmgr || !hwmgr->pm_en || !buf)
  706. return -EINVAL;
  707. if (hwmgr->hwmgr_func->get_power_profile_mode == NULL) {
  708. pr_info("%s was not implemented.\n", __func__);
  709. return snprintf(buf, PAGE_SIZE, "\n");
  710. }
  711. return hwmgr->hwmgr_func->get_power_profile_mode(hwmgr, buf);
  712. }
  713. static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
  714. {
  715. struct pp_hwmgr *hwmgr = handle;
  716. int ret = -EINVAL;
  717. if (!hwmgr || !hwmgr->pm_en)
  718. return ret;
  719. if (hwmgr->hwmgr_func->set_power_profile_mode == NULL) {
  720. pr_info("%s was not implemented.\n", __func__);
  721. return ret;
  722. }
  723. mutex_lock(&hwmgr->smu_lock);
  724. if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
  725. ret = hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, input, size);
  726. mutex_unlock(&hwmgr->smu_lock);
  727. return ret;
  728. }
  729. static int pp_odn_edit_dpm_table(void *handle, uint32_t type, long *input, uint32_t size)
  730. {
  731. struct pp_hwmgr *hwmgr = handle;
  732. if (!hwmgr || !hwmgr->pm_en)
  733. return -EINVAL;
  734. if (hwmgr->hwmgr_func->odn_edit_dpm_table == NULL) {
  735. pr_info("%s was not implemented.\n", __func__);
  736. return -EINVAL;
  737. }
  738. return hwmgr->hwmgr_func->odn_edit_dpm_table(hwmgr, type, input, size);
  739. }
  740. static int pp_dpm_switch_power_profile(void *handle,
  741. enum PP_SMC_POWER_PROFILE type, bool en)
  742. {
  743. struct pp_hwmgr *hwmgr = handle;
  744. long workload;
  745. uint32_t index;
  746. if (!hwmgr || !hwmgr->pm_en)
  747. return -EINVAL;
  748. if (hwmgr->hwmgr_func->set_power_profile_mode == NULL) {
  749. pr_info("%s was not implemented.\n", __func__);
  750. return -EINVAL;
  751. }
  752. if (!(type < PP_SMC_POWER_PROFILE_CUSTOM))
  753. return -EINVAL;
  754. mutex_lock(&hwmgr->smu_lock);
  755. if (!en) {
  756. hwmgr->workload_mask &= ~(1 << hwmgr->workload_prority[type]);
  757. index = fls(hwmgr->workload_mask);
  758. index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0;
  759. workload = hwmgr->workload_setting[index];
  760. } else {
  761. hwmgr->workload_mask |= (1 << hwmgr->workload_prority[type]);
  762. index = fls(hwmgr->workload_mask);
  763. index = index <= Workload_Policy_Max ? index - 1 : 0;
  764. workload = hwmgr->workload_setting[index];
  765. }
  766. if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
  767. hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0);
  768. mutex_unlock(&hwmgr->smu_lock);
  769. return 0;
  770. }
  771. static int pp_set_power_limit(void *handle, uint32_t limit)
  772. {
  773. struct pp_hwmgr *hwmgr = handle;
  774. if (!hwmgr || !hwmgr->pm_en)
  775. return -EINVAL;
  776. if (hwmgr->hwmgr_func->set_power_limit == NULL) {
  777. pr_info("%s was not implemented.\n", __func__);
  778. return -EINVAL;
  779. }
  780. if (limit == 0)
  781. limit = hwmgr->default_power_limit;
  782. if (limit > hwmgr->default_power_limit)
  783. return -EINVAL;
  784. mutex_lock(&hwmgr->smu_lock);
  785. hwmgr->hwmgr_func->set_power_limit(hwmgr, limit);
  786. hwmgr->power_limit = limit;
  787. mutex_unlock(&hwmgr->smu_lock);
  788. return 0;
  789. }
  790. static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
  791. {
  792. struct pp_hwmgr *hwmgr = handle;
  793. if (!hwmgr || !hwmgr->pm_en ||!limit)
  794. return -EINVAL;
  795. mutex_lock(&hwmgr->smu_lock);
  796. if (default_limit)
  797. *limit = hwmgr->default_power_limit;
  798. else
  799. *limit = hwmgr->power_limit;
  800. mutex_unlock(&hwmgr->smu_lock);
  801. return 0;
  802. }
  803. static int pp_display_configuration_change(void *handle,
  804. const struct amd_pp_display_configuration *display_config)
  805. {
  806. struct pp_hwmgr *hwmgr = handle;
  807. if (!hwmgr || !hwmgr->pm_en)
  808. return -EINVAL;
  809. mutex_lock(&hwmgr->smu_lock);
  810. phm_store_dal_configuration_data(hwmgr, display_config);
  811. mutex_unlock(&hwmgr->smu_lock);
  812. return 0;
  813. }
  814. static int pp_get_display_power_level(void *handle,
  815. struct amd_pp_simple_clock_info *output)
  816. {
  817. struct pp_hwmgr *hwmgr = handle;
  818. int ret = 0;
  819. if (!hwmgr || !hwmgr->pm_en ||!output)
  820. return -EINVAL;
  821. mutex_lock(&hwmgr->smu_lock);
  822. ret = phm_get_dal_power_level(hwmgr, output);
  823. mutex_unlock(&hwmgr->smu_lock);
  824. return ret;
  825. }
  826. static int pp_get_current_clocks(void *handle,
  827. struct amd_pp_clock_info *clocks)
  828. {
  829. struct amd_pp_simple_clock_info simple_clocks;
  830. struct pp_clock_info hw_clocks;
  831. struct pp_hwmgr *hwmgr = handle;
  832. int ret = 0;
  833. if (!hwmgr || !hwmgr->pm_en)
  834. return -EINVAL;
  835. mutex_lock(&hwmgr->smu_lock);
  836. phm_get_dal_power_level(hwmgr, &simple_clocks);
  837. if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
  838. PHM_PlatformCaps_PowerContainment))
  839. ret = phm_get_clock_info(hwmgr, &hwmgr->current_ps->hardware,
  840. &hw_clocks, PHM_PerformanceLevelDesignation_PowerContainment);
  841. else
  842. ret = phm_get_clock_info(hwmgr, &hwmgr->current_ps->hardware,
  843. &hw_clocks, PHM_PerformanceLevelDesignation_Activity);
  844. if (ret) {
  845. pr_info("Error in phm_get_clock_info \n");
  846. mutex_unlock(&hwmgr->smu_lock);
  847. return -EINVAL;
  848. }
  849. clocks->min_engine_clock = hw_clocks.min_eng_clk;
  850. clocks->max_engine_clock = hw_clocks.max_eng_clk;
  851. clocks->min_memory_clock = hw_clocks.min_mem_clk;
  852. clocks->max_memory_clock = hw_clocks.max_mem_clk;
  853. clocks->min_bus_bandwidth = hw_clocks.min_bus_bandwidth;
  854. clocks->max_bus_bandwidth = hw_clocks.max_bus_bandwidth;
  855. clocks->max_engine_clock_in_sr = hw_clocks.max_eng_clk;
  856. clocks->min_engine_clock_in_sr = hw_clocks.min_eng_clk;
  857. clocks->max_clocks_state = simple_clocks.level;
  858. if (0 == phm_get_current_shallow_sleep_clocks(hwmgr, &hwmgr->current_ps->hardware, &hw_clocks)) {
  859. clocks->max_engine_clock_in_sr = hw_clocks.max_eng_clk;
  860. clocks->min_engine_clock_in_sr = hw_clocks.min_eng_clk;
  861. }
  862. mutex_unlock(&hwmgr->smu_lock);
  863. return 0;
  864. }
  865. static int pp_get_clock_by_type(void *handle, enum amd_pp_clock_type type, struct amd_pp_clocks *clocks)
  866. {
  867. struct pp_hwmgr *hwmgr = handle;
  868. int ret = 0;
  869. if (!hwmgr || !hwmgr->pm_en)
  870. return -EINVAL;
  871. if (clocks == NULL)
  872. return -EINVAL;
  873. mutex_lock(&hwmgr->smu_lock);
  874. ret = phm_get_clock_by_type(hwmgr, type, clocks);
  875. mutex_unlock(&hwmgr->smu_lock);
  876. return ret;
  877. }
  878. static int pp_get_clock_by_type_with_latency(void *handle,
  879. enum amd_pp_clock_type type,
  880. struct pp_clock_levels_with_latency *clocks)
  881. {
  882. struct pp_hwmgr *hwmgr = handle;
  883. int ret = 0;
  884. if (!hwmgr || !hwmgr->pm_en ||!clocks)
  885. return -EINVAL;
  886. mutex_lock(&hwmgr->smu_lock);
  887. ret = phm_get_clock_by_type_with_latency(hwmgr, type, clocks);
  888. mutex_unlock(&hwmgr->smu_lock);
  889. return ret;
  890. }
  891. static int pp_get_clock_by_type_with_voltage(void *handle,
  892. enum amd_pp_clock_type type,
  893. struct pp_clock_levels_with_voltage *clocks)
  894. {
  895. struct pp_hwmgr *hwmgr = handle;
  896. int ret = 0;
  897. if (!hwmgr || !hwmgr->pm_en ||!clocks)
  898. return -EINVAL;
  899. mutex_lock(&hwmgr->smu_lock);
  900. ret = phm_get_clock_by_type_with_voltage(hwmgr, type, clocks);
  901. mutex_unlock(&hwmgr->smu_lock);
  902. return ret;
  903. }
  904. static int pp_set_watermarks_for_clocks_ranges(void *handle,
  905. struct pp_wm_sets_with_clock_ranges_soc15 *wm_with_clock_ranges)
  906. {
  907. struct pp_hwmgr *hwmgr = handle;
  908. int ret = 0;
  909. if (!hwmgr || !hwmgr->pm_en ||!wm_with_clock_ranges)
  910. return -EINVAL;
  911. mutex_lock(&hwmgr->smu_lock);
  912. ret = phm_set_watermarks_for_clocks_ranges(hwmgr,
  913. wm_with_clock_ranges);
  914. mutex_unlock(&hwmgr->smu_lock);
  915. return ret;
  916. }
  917. static int pp_display_clock_voltage_request(void *handle,
  918. struct pp_display_clock_request *clock)
  919. {
  920. struct pp_hwmgr *hwmgr = handle;
  921. int ret = 0;
  922. if (!hwmgr || !hwmgr->pm_en ||!clock)
  923. return -EINVAL;
  924. mutex_lock(&hwmgr->smu_lock);
  925. ret = phm_display_clock_voltage_request(hwmgr, clock);
  926. mutex_unlock(&hwmgr->smu_lock);
  927. return ret;
  928. }
  929. static int pp_get_display_mode_validation_clocks(void *handle,
  930. struct amd_pp_simple_clock_info *clocks)
  931. {
  932. struct pp_hwmgr *hwmgr = handle;
  933. int ret = 0;
  934. if (!hwmgr || !hwmgr->pm_en ||!clocks)
  935. return -EINVAL;
  936. mutex_lock(&hwmgr->smu_lock);
  937. if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_DynamicPatchPowerState))
  938. ret = phm_get_max_high_clocks(hwmgr, clocks);
  939. mutex_unlock(&hwmgr->smu_lock);
  940. return ret;
  941. }
  942. static int pp_set_mmhub_powergating_by_smu(void *handle)
  943. {
  944. struct pp_hwmgr *hwmgr = handle;
  945. if (!hwmgr || !hwmgr->pm_en)
  946. return -EINVAL;
  947. if (hwmgr->hwmgr_func->set_mmhub_powergating_by_smu == NULL) {
  948. pr_info("%s was not implemented.\n", __func__);
  949. return 0;
  950. }
  951. return hwmgr->hwmgr_func->set_mmhub_powergating_by_smu(hwmgr);
  952. }
  953. static const struct amd_pm_funcs pp_dpm_funcs = {
  954. .load_firmware = pp_dpm_load_fw,
  955. .wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
  956. .force_performance_level = pp_dpm_force_performance_level,
  957. .get_performance_level = pp_dpm_get_performance_level,
  958. .get_current_power_state = pp_dpm_get_current_power_state,
  959. .powergate_vce = pp_dpm_powergate_vce,
  960. .powergate_uvd = pp_dpm_powergate_uvd,
  961. .dispatch_tasks = pp_dpm_dispatch_tasks,
  962. .set_fan_control_mode = pp_dpm_set_fan_control_mode,
  963. .get_fan_control_mode = pp_dpm_get_fan_control_mode,
  964. .set_fan_speed_percent = pp_dpm_set_fan_speed_percent,
  965. .get_fan_speed_percent = pp_dpm_get_fan_speed_percent,
  966. .get_fan_speed_rpm = pp_dpm_get_fan_speed_rpm,
  967. .get_pp_num_states = pp_dpm_get_pp_num_states,
  968. .get_pp_table = pp_dpm_get_pp_table,
  969. .set_pp_table = pp_dpm_set_pp_table,
  970. .force_clock_level = pp_dpm_force_clock_level,
  971. .print_clock_levels = pp_dpm_print_clock_levels,
  972. .get_sclk_od = pp_dpm_get_sclk_od,
  973. .set_sclk_od = pp_dpm_set_sclk_od,
  974. .get_mclk_od = pp_dpm_get_mclk_od,
  975. .set_mclk_od = pp_dpm_set_mclk_od,
  976. .read_sensor = pp_dpm_read_sensor,
  977. .get_vce_clock_state = pp_dpm_get_vce_clock_state,
  978. .switch_power_profile = pp_dpm_switch_power_profile,
  979. .set_clockgating_by_smu = pp_set_clockgating_by_smu,
  980. .get_power_profile_mode = pp_get_power_profile_mode,
  981. .set_power_profile_mode = pp_set_power_profile_mode,
  982. .odn_edit_dpm_table = pp_odn_edit_dpm_table,
  983. .set_power_limit = pp_set_power_limit,
  984. .get_power_limit = pp_get_power_limit,
  985. /* export to DC */
  986. .get_sclk = pp_dpm_get_sclk,
  987. .get_mclk = pp_dpm_get_mclk,
  988. .display_configuration_change = pp_display_configuration_change,
  989. .get_display_power_level = pp_get_display_power_level,
  990. .get_current_clocks = pp_get_current_clocks,
  991. .get_clock_by_type = pp_get_clock_by_type,
  992. .get_clock_by_type_with_latency = pp_get_clock_by_type_with_latency,
  993. .get_clock_by_type_with_voltage = pp_get_clock_by_type_with_voltage,
  994. .set_watermarks_for_clocks_ranges = pp_set_watermarks_for_clocks_ranges,
  995. .display_clock_voltage_request = pp_display_clock_voltage_request,
  996. .get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks,
  997. .set_mmhub_powergating_by_smu = pp_set_mmhub_powergating_by_smu,
  998. };