Lines Matching +full:battery +full:- +full:profile

33 #include <linux/hwmon-sysfs.h>
68 * - battery
70 * - balanced
72 * - performance
74 * battery
76 * On older GPUs, the vbios provided a special power state for battery
77 * operation. Selecting battery switched to this state. This is no
104 return -EPERM; in amdgpu_get_power_dpm_state()
105 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_power_dpm_state()
106 return -EPERM; in amdgpu_get_power_dpm_state()
108 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_power_dpm_state()
110 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_state()
116 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_power_dpm_state()
117 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_state()
120 (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : in amdgpu_get_power_dpm_state()
135 return -EPERM; in amdgpu_set_power_dpm_state()
136 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_power_dpm_state()
137 return -EPERM; in amdgpu_set_power_dpm_state()
139 if (strncmp("battery", buf, strlen("battery")) == 0) in amdgpu_set_power_dpm_state()
146 return -EINVAL; in amdgpu_set_power_dpm_state()
148 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_power_dpm_state()
150 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_state()
156 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_state()
157 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_state()
170 * - auto
172 * - low
174 * - high
176 * - manual
178 * - profile_standard
180 * - profile_min_sclk
182 * - profile_min_mclk
184 * - profile_peak
189 * the optimal power profile for current conditions in the driver.
232 return -EPERM; in amdgpu_get_power_dpm_force_performance_level()
233 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_power_dpm_force_performance_level()
234 return -EPERM; in amdgpu_get_power_dpm_force_performance_level()
236 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
238 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
244 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
245 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
271 return -EPERM; in amdgpu_set_power_dpm_force_performance_level()
272 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_power_dpm_force_performance_level()
273 return -EPERM; in amdgpu_set_power_dpm_force_performance_level()
296 return -EINVAL; in amdgpu_set_power_dpm_force_performance_level()
299 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
301 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
305 mutex_lock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
307 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
308 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
309 mutex_unlock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
310 return -EINVAL; in amdgpu_set_power_dpm_force_performance_level()
313 adev->pm.stable_pstate_ctx = NULL; in amdgpu_set_power_dpm_force_performance_level()
314 mutex_unlock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
316 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
317 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
333 return -EPERM; in amdgpu_get_pp_num_states()
334 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_num_states()
335 return -EPERM; in amdgpu_get_pp_num_states()
337 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_num_states()
339 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_num_states()
346 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_num_states()
347 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_num_states()
353 (data.states[i] == POWER_STATE_TYPE_BATTERY) ? "battery" : in amdgpu_get_pp_num_states()
371 return -EPERM; in amdgpu_get_pp_cur_state()
372 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_cur_state()
373 return -EPERM; in amdgpu_get_pp_cur_state()
375 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_cur_state()
377 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_cur_state()
385 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_cur_state()
386 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_cur_state()
397 i = -EINVAL; in amdgpu_get_pp_cur_state()
410 return -EPERM; in amdgpu_get_pp_force_state()
411 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_force_state()
412 return -EPERM; in amdgpu_get_pp_force_state()
414 if (adev->pm.pp_force_state_enabled) in amdgpu_get_pp_force_state()
433 return -EPERM; in amdgpu_set_pp_force_state()
434 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_force_state()
435 return -EPERM; in amdgpu_set_pp_force_state()
437 adev->pm.pp_force_state_enabled = false; in amdgpu_set_pp_force_state()
444 return -EINVAL; in amdgpu_set_pp_force_state()
448 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_force_state()
450 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
468 adev->pm.pp_force_state_enabled = true; in amdgpu_set_pp_force_state()
471 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_force_state()
472 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
477 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_force_state()
478 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
488 * will attempt to upload a new powerplay table and re-initialize
503 return -EPERM; in amdgpu_get_pp_table()
504 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_table()
505 return -EPERM; in amdgpu_get_pp_table()
507 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_table()
509 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_table()
515 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_table()
516 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_table()
522 size = PAGE_SIZE - 1; in amdgpu_get_pp_table()
539 return -EPERM; in amdgpu_set_pp_table()
540 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_table()
541 return -EPERM; in amdgpu_set_pp_table()
543 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_table()
545 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_table()
551 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_table()
552 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_table()
617 * - a list of engine clock levels and voltages labeled OD_SCLK
619 * - a list of memory clock levels and voltages labeled OD_MCLK
621 * - a list of valid ranges for sclk, mclk, and voltage labeled OD_RANGE
637 * - minimum and maximum engine clock labeled OD_SCLK
639 * - minimum(not available for Vega20 and Navi1x) and maximum memory
642 * - three <frequency, voltage> points labeled OD_VDDC_CURVE.
646 * - voltage offset for the six anchor points of the v/f curve labeled
650 * - voltage offset(in mV) applied on target voltage calculation.
656 * - a list of valid ranges for sclk, mclk, and voltage curve points
663 * - minimum and maximum engine clock labeled OD_SCLK
665 * - a list of valid ranges for sclk labeled OD_RANGE
671 * - minimum and maximum engine clock labeled OD_SCLK
672 * - minimum and maximum core clocks labeled OD_CCLK
674 * - a list of valid ranges for sclk and cclk labeled OD_RANGE
678 * - First select manual using power_dpm_force_performance_level
680 * - For clock frequency setting, enter a new value by writing a
690 * - For NV1X, enter the new values by writing a string that
696 * - For SMU13 ASICs, enter the new values by writing a string that
699 * index as 0 - 5.
700 * - "vc 0 10" will update the voltage offset for point1 as 10mv.
701 * - "vc 5 -10" will update the voltage offset for point6 as -10mv.
708 * - When you have edited all of the states as needed, write "c" (commit)
711 * - If you want to reset to the default power levels, write "r" (reset)
733 return -EPERM; in amdgpu_set_pp_od_clk_voltage()
734 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_od_clk_voltage()
735 return -EPERM; in amdgpu_set_pp_od_clk_voltage()
738 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
755 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
771 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
778 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
780 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
801 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
802 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
807 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
808 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
809 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
831 return -EPERM; in amdgpu_get_pp_od_clk_voltage()
832 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_od_clk_voltage()
833 return -EPERM; in amdgpu_get_pp_od_clk_voltage()
835 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
837 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
846 if (ret == -ENOENT) { in amdgpu_get_pp_od_clk_voltage()
858 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
859 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
872 * - Current ppfeature masks
873 * - List of the all supported powerplay features with their naming,
891 return -EPERM; in amdgpu_set_pp_features()
892 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_features()
893 return -EPERM; in amdgpu_set_pp_features()
897 return -EINVAL; in amdgpu_set_pp_features()
899 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_features()
901 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_features()
907 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_features()
908 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_features()
911 return -EINVAL; in amdgpu_set_pp_features()
926 return -EPERM; in amdgpu_get_pp_features()
927 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_features()
928 return -EPERM; in amdgpu_get_pp_features()
930 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_features()
932 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_features()
940 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_features()
941 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_features()
967 * .. code-block:: bash
986 return -EPERM; in amdgpu_get_pp_dpm_clock()
987 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_dpm_clock()
988 return -EPERM; in amdgpu_get_pp_dpm_clock()
990 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_dpm_clock()
992 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_dpm_clock()
997 if (ret == -ENOENT) in amdgpu_get_pp_dpm_clock()
1003 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_dpm_clock()
1004 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_dpm_clock()
1027 bytes = min(count, sizeof(buf_cpy) - 1); in amdgpu_read_mask()
1035 return -EINVAL; in amdgpu_read_mask()
1055 return -EPERM; in amdgpu_set_pp_dpm_clock()
1056 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_dpm_clock()
1057 return -EPERM; in amdgpu_set_pp_dpm_clock()
1063 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_dpm_clock()
1065 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_dpm_clock()
1071 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_dpm_clock()
1072 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_dpm_clock()
1075 return -EINVAL; in amdgpu_set_pp_dpm_clock()
1240 return -EPERM; in amdgpu_get_pp_sclk_od()
1241 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_sclk_od()
1242 return -EPERM; in amdgpu_get_pp_sclk_od()
1244 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_sclk_od()
1246 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_sclk_od()
1252 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_sclk_od()
1253 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_sclk_od()
1269 return -EPERM; in amdgpu_set_pp_sclk_od()
1270 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_sclk_od()
1271 return -EPERM; in amdgpu_set_pp_sclk_od()
1276 return -EINVAL; in amdgpu_set_pp_sclk_od()
1278 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_sclk_od()
1280 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_sclk_od()
1286 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_sclk_od()
1287 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_sclk_od()
1302 return -EPERM; in amdgpu_get_pp_mclk_od()
1303 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_mclk_od()
1304 return -EPERM; in amdgpu_get_pp_mclk_od()
1306 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_mclk_od()
1308 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_mclk_od()
1314 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_mclk_od()
1315 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_mclk_od()
1331 return -EPERM; in amdgpu_set_pp_mclk_od()
1332 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_mclk_od()
1333 return -EPERM; in amdgpu_set_pp_mclk_od()
1338 return -EINVAL; in amdgpu_set_pp_mclk_od()
1340 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_mclk_od()
1342 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_mclk_od()
1348 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_mclk_od()
1349 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_mclk_od()
1362 * and the relevant heuristics settings for that profile.
1364 * To select a profile or create a custom profile, first select manual using
1366 * profile to pp_power_profile_mode will enable those heuristics. To
1368 * starting with the number of the custom profile along with a setting
1384 return -EPERM; in amdgpu_get_pp_power_profile_mode()
1385 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_power_profile_mode()
1386 return -EPERM; in amdgpu_get_pp_power_profile_mode()
1388 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1390 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1398 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1399 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1423 return -EPERM; in amdgpu_set_pp_power_profile_mode()
1424 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_power_profile_mode()
1425 return -EPERM; in amdgpu_set_pp_power_profile_mode()
1431 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1435 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1438 memcpy(buf_cpy, buf, count-i); in amdgpu_set_pp_power_profile_mode()
1445 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1453 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1455 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1461 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1462 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1467 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1477 return -EPERM; in amdgpu_hwmon_get_sensor_generic()
1478 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_sensor_generic()
1479 return -EPERM; in amdgpu_hwmon_get_sensor_generic()
1481 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_sensor_generic()
1483 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_sensor_generic()
1490 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_sensor_generic()
1491 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_sensor_generic()
1566 return -EPERM; in amdgpu_get_pcie_bw()
1567 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pcie_bw()
1568 return -EPERM; in amdgpu_get_pcie_bw()
1570 if (adev->flags & AMD_IS_APU) in amdgpu_get_pcie_bw()
1571 return -ENODATA; in amdgpu_get_pcie_bw()
1573 if (!adev->asic_funcs->get_pcie_usage) in amdgpu_get_pcie_bw()
1574 return -ENODATA; in amdgpu_get_pcie_bw()
1576 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pcie_bw()
1578 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pcie_bw()
1584 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pcie_bw()
1585 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pcie_bw()
1588 count0, count1, pcie_get_mps(adev->pdev)); in amdgpu_get_pcie_bw()
1609 return -EPERM; in amdgpu_get_unique_id()
1610 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_unique_id()
1611 return -EPERM; in amdgpu_get_unique_id()
1613 if (adev->unique_id) in amdgpu_get_unique_id()
1614 return sysfs_emit(buf, "%016llx\n", adev->unique_id); in amdgpu_get_unique_id()
1642 adev_to_drm(adev)->unique, in amdgpu_get_thermal_throttling_logging()
1643 atomic_read(&adev->throttling_logging_enabled) ? "enabled" : "disabled", in amdgpu_get_thermal_throttling_logging()
1644 adev->throttling_logging_rs.interval / HZ + 1); in amdgpu_get_thermal_throttling_logging()
1663 return -EINVAL; in amdgpu_set_thermal_throttling_logging()
1666 raw_spin_lock_irqsave(&adev->throttling_logging_rs.lock, flags); in amdgpu_set_thermal_throttling_logging()
1671 adev->throttling_logging_rs.interval = in amdgpu_set_thermal_throttling_logging()
1672 (throttling_logging_interval - 1) * HZ; in amdgpu_set_thermal_throttling_logging()
1673 adev->throttling_logging_rs.begin = 0; in amdgpu_set_thermal_throttling_logging()
1674 adev->throttling_logging_rs.printed = 0; in amdgpu_set_thermal_throttling_logging()
1675 adev->throttling_logging_rs.missed = 0; in amdgpu_set_thermal_throttling_logging()
1676 raw_spin_unlock_irqrestore(&adev->throttling_logging_rs.lock, flags); in amdgpu_set_thermal_throttling_logging()
1678 atomic_set(&adev->throttling_logging_enabled, 1); in amdgpu_set_thermal_throttling_logging()
1680 atomic_set(&adev->throttling_logging_enabled, 0); in amdgpu_set_thermal_throttling_logging()
1707 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_apu_thermal_cap()
1709 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_apu_thermal_cap()
1719 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_apu_thermal_cap()
1720 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_apu_thermal_cap()
1741 return -EINVAL; in amdgpu_set_apu_thermal_cap()
1744 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_apu_thermal_cap()
1746 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_apu_thermal_cap()
1756 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_apu_thermal_cap()
1757 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_apu_thermal_cap()
1785 return -EPERM; in amdgpu_get_gpu_metrics()
1786 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_gpu_metrics()
1787 return -EPERM; in amdgpu_get_gpu_metrics()
1789 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_gpu_metrics()
1791 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_metrics()
1800 size = PAGE_SIZE - 1; in amdgpu_get_gpu_metrics()
1805 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_gpu_metrics()
1806 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_metrics()
1820 if (r == -EOPNOTSUPP) { in amdgpu_show_powershift_percent()
1825 if (mgpu_info.gpu_ins[i].adev->flags & AMD_IS_APU) { in amdgpu_show_powershift_percent()
1846 * there is no powershift and values between [1-100] means that the power
1862 * there is no powershift and values between [1-100] means that the power is
1877 * smartshift(SS2.0) bias level. The value ranges from -100 to 100
1878 * and the default is 0. -100 sets maximum preference to APU
1903 return -EPERM; in amdgpu_set_smartshift_bias()
1904 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_smartshift_bias()
1905 return -EPERM; in amdgpu_set_smartshift_bias()
1907 r = pm_runtime_get_sync(ddev->dev); in amdgpu_set_smartshift_bias()
1909 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_smartshift_bias()
1928 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_smartshift_bias()
1929 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_smartshift_bias()
1999 struct device_attribute *dev_attr = &attr->dev_attr; in default_attr_update()
2000 uint32_t mp1_ver = adev->ip_versions[MP1_HWIP][0]; in default_attr_update()
2001 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in default_attr_update()
2002 const char *attr_name = dev_attr->attr.name; in default_attr_update()
2004 if (!(attr->flags & mask)) { in default_attr_update()
2026 if (adev->flags & AMD_IS_APU || gc_ver == IP_VERSION(9, 0, 1)) in default_attr_update()
2030 if (adev->flags & AMD_IS_APU) in default_attr_update()
2050 if ((adev->flags & AMD_IS_APU && in default_attr_update()
2070 gc_ver == IP_VERSION(11, 0, 3)) && adev->vcn.num_vcn_inst >= 2)) in default_attr_update()
2085 gc_ver == IP_VERSION(11, 0, 3)) && adev->vcn.num_vcn_inst >= 2)) in default_attr_update()
2088 if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP) in default_attr_update()
2101 dev_attr->attr.mode &= ~S_IWUGO; in default_attr_update()
2102 dev_attr->store = NULL; in default_attr_update()
2108 dev_attr->attr.mode &= ~0222; in default_attr_update()
2109 dev_attr->store = NULL; in default_attr_update()
2119 dev_attr->attr.mode &= ~S_IWUGO; in default_attr_update()
2120 dev_attr->store = NULL; in default_attr_update()
2126 dev_attr->attr.mode &= ~S_IWUGO; in default_attr_update()
2127 dev_attr->store = NULL; in default_attr_update()
2150 return -EINVAL; in amdgpu_device_attr_create()
2152 dev_attr = &attr->dev_attr; in amdgpu_device_attr_create()
2153 name = dev_attr->attr.name; in amdgpu_device_attr_create()
2155 attr_update = attr->attr_update ? attr->attr_update : default_attr_update; in amdgpu_device_attr_create()
2159 dev_err(adev->dev, "failed to update device file %s, ret = %d\n", in amdgpu_device_attr_create()
2167 ret = device_create_file(adev->dev, dev_attr); in amdgpu_device_attr_create()
2169 dev_err(adev->dev, "failed to create device file %s, ret = %d\n", in amdgpu_device_attr_create()
2175 return -ENOMEM; in amdgpu_device_attr_create()
2177 attr_entry->attr = attr; in amdgpu_device_attr_create()
2178 INIT_LIST_HEAD(&attr_entry->entry); in amdgpu_device_attr_create()
2180 list_add_tail(&attr_entry->entry, attr_list); in amdgpu_device_attr_create()
2187 struct device_attribute *dev_attr = &attr->dev_attr; in amdgpu_device_attr_remove()
2189 device_remove_file(adev->dev, dev_attr); in amdgpu_device_attr_remove()
2227 amdgpu_device_attr_remove(adev, entry->attr); in amdgpu_device_attr_remove_groups()
2228 list_del(&entry->entry); in amdgpu_device_attr_remove_groups()
2238 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp()
2242 return -EINVAL; in amdgpu_hwmon_show_temp()
2261 r = -EINVAL; in amdgpu_hwmon_show_temp()
2276 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_thresh()
2280 temp = adev->pm.dpm.thermal.min_temp; in amdgpu_hwmon_show_temp_thresh()
2282 temp = adev->pm.dpm.thermal.max_temp; in amdgpu_hwmon_show_temp_thresh()
2292 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_hotspot_temp_thresh()
2296 temp = adev->pm.dpm.thermal.min_hotspot_temp; in amdgpu_hwmon_show_hotspot_temp_thresh()
2298 temp = adev->pm.dpm.thermal.max_hotspot_crit_temp; in amdgpu_hwmon_show_hotspot_temp_thresh()
2308 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_mem_temp_thresh()
2312 temp = adev->pm.dpm.thermal.min_mem_temp; in amdgpu_hwmon_show_mem_temp_thresh()
2314 temp = adev->pm.dpm.thermal.max_mem_crit_temp; in amdgpu_hwmon_show_mem_temp_thresh()
2323 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_label()
2326 return -EINVAL; in amdgpu_hwmon_show_temp_label()
2336 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_emergency()
2340 return -EINVAL; in amdgpu_hwmon_show_temp_emergency()
2344 temp = adev->pm.dpm.thermal.max_hotspot_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2347 temp = adev->pm.dpm.thermal.max_edge_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2350 temp = adev->pm.dpm.thermal.max_mem_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2366 return -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2367 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_pwm1_enable()
2368 return -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2370 ret = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2372 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2378 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2379 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2382 return -EINVAL; in amdgpu_hwmon_get_pwm1_enable()
2397 return -EPERM; in amdgpu_hwmon_set_pwm1_enable()
2398 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_pwm1_enable()
2399 return -EPERM; in amdgpu_hwmon_set_pwm1_enable()
2405 ret = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2407 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2413 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2414 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2417 return -EINVAL; in amdgpu_hwmon_set_pwm1_enable()
2446 return -EPERM; in amdgpu_hwmon_set_pwm1()
2447 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_pwm1()
2448 return -EPERM; in amdgpu_hwmon_set_pwm1()
2454 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2456 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2466 err = -EINVAL; in amdgpu_hwmon_set_pwm1()
2473 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2474 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2491 return -EPERM; in amdgpu_hwmon_get_pwm1()
2492 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_pwm1()
2493 return -EPERM; in amdgpu_hwmon_get_pwm1()
2495 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2497 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2503 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2504 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2521 return -EPERM; in amdgpu_hwmon_get_fan1_input()
2522 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_input()
2523 return -EPERM; in amdgpu_hwmon_get_fan1_input()
2525 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2527 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2533 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2534 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2585 return -EPERM; in amdgpu_hwmon_get_fan1_target()
2586 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_target()
2587 return -EPERM; in amdgpu_hwmon_get_fan1_target()
2589 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2591 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2597 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2598 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2616 return -EPERM; in amdgpu_hwmon_set_fan1_target()
2617 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_fan1_target()
2618 return -EPERM; in amdgpu_hwmon_set_fan1_target()
2624 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2626 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2635 err = -ENODATA; in amdgpu_hwmon_set_fan1_target()
2642 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2643 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2660 return -EPERM; in amdgpu_hwmon_get_fan1_enable()
2661 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_enable()
2662 return -EPERM; in amdgpu_hwmon_get_fan1_enable()
2664 ret = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2666 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2672 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2673 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2676 return -EINVAL; in amdgpu_hwmon_get_fan1_enable()
2692 return -EPERM; in amdgpu_hwmon_set_fan1_enable()
2693 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_fan1_enable()
2694 return -EPERM; in amdgpu_hwmon_set_fan1_enable()
2705 return -EINVAL; in amdgpu_hwmon_set_fan1_enable()
2707 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2709 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2715 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2716 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2719 return -EINVAL; in amdgpu_hwmon_set_fan1_enable()
2757 if (!(adev->flags & AMD_IS_APU)) in amdgpu_hwmon_show_vddnb()
2758 return -EINVAL; in amdgpu_hwmon_show_vddnb()
2834 enum pp_power_type power_type = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_power_cap_generic()
2840 return -EPERM; in amdgpu_hwmon_show_power_cap_generic()
2841 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_power_cap_generic()
2842 return -EPERM; in amdgpu_hwmon_show_power_cap_generic()
2844 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2846 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2858 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2859 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2894 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in amdgpu_hwmon_show_power_label()
2898 to_sensor_dev_attr(attr)->index == PP_PWR_TYPE_FAST ? in amdgpu_hwmon_show_power_label()
2910 int limit_type = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_set_power_cap()
2915 return -EPERM; in amdgpu_hwmon_set_power_cap()
2916 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_power_cap()
2917 return -EPERM; in amdgpu_hwmon_set_power_cap()
2920 return -EINVAL; in amdgpu_hwmon_set_power_cap()
2929 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2931 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2937 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2938 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2999 * - GPU temperature (via the on-die sensor)
3001 * - GPU voltage
3003 * - Northbridge voltage (APUs only)
3005 * - GPU power
3007 * - GPU fan
3009 * - GPU gfx/compute engine clock
3011 * - GPU memory clock (dGPU only)
3015 * - temp[1-3]_input: the on die GPU temperature in millidegrees Celsius
3016 * - temp2_input and temp3_input are supported on SOC15 dGPUs only
3018 * - temp[1-3]_label: temperature channel label
3019 * - temp2_label and temp3_label are supported on SOC15 dGPUs only
3021 * - temp[1-3]_crit: temperature critical max value in millidegrees Celsius
3022 * - temp2_crit and temp3_crit are supported on SOC15 dGPUs only
3024 * - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius
3025 * - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only
3027 * - temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius
3028 * - these are supported on SOC15 dGPUs only
3032 * - in0_input: the voltage on the GPU in millivolts
3034 * - in1_input: the voltage on the Northbridge in millivolts
3038 * - power1_average: average power used by the SoC in microWatts. On APUs this includes the CPU.
3040 …* - power1_input: instantaneous power used by the SoC in microWatts. On APUs this includes the CP…
3042 * - power1_cap_min: minimum cap supported in microWatts
3044 * - power1_cap_max: maximum cap supported in microWatts
3046 * - power1_cap: selected power cap in microWatts
3050 * - pwm1: pulse width modulation fan level (0-255)
3052 …* - pwm1_enable: pulse width modulation fan control method (0: no fan speed control, 1: manual fan…
3054 * - pwm1_min: pulse width modulation fan control minimum level (0)
3056 * - pwm1_max: pulse width modulation fan control maximum level (255)
3058 * - fan1_min: a minimum value Unit: revolution/min (RPM)
3060 * - fan1_max: a maximum value Unit: revolution/max (RPM)
3062 * - fan1_input: fan speed in RPM
3064 * - fan[1-\*]_target: Desired fan speed Unit: revolution/min (RPM)
3066 * - fan[1-\*]_enable: Enable or disable the sensors.1: Enable 0: Disable
3068 * NOTE: DO NOT set the fan speed via "pwm1" and "fan[1-\*]_target" interfaces at the same time.
3073 * - freq1_input: the gfx/compute clock in hertz
3075 * - freq2_input: the memory clock in hertz
3181 umode_t effective_mode = attr->mode; in hwmon_attributes_visible()
3182 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in hwmon_attributes_visible()
3185 /* under multi-vf mode, the hwmon attributes are all not supported */ in hwmon_attributes_visible()
3194 if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr || in hwmon_attributes_visible()
3206 if ((adev->flags & AMD_IS_APU) && in hwmon_attributes_visible()
3219 if ((((adev->flags & AMD_IS_APU) && (adev->family >= AMDGPU_FAMILY_CZ)) || in hwmon_attributes_visible()
3226 if (!adev->pm.dpm_enabled && in hwmon_attributes_visible()
3241 if (((amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3243 ((amdgpu_dpm_get_fan_control_mode(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3247 if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3249 ((amdgpu_dpm_set_fan_control_mode(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3254 if (((adev->family == AMDGPU_FAMILY_SI) || in hwmon_attributes_visible()
3255 ((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(10, 3, 1)) && in hwmon_attributes_visible()
3264 if (((adev->family == AMDGPU_FAMILY_SI) || in hwmon_attributes_visible()
3265 ((adev->flags & AMD_IS_APU) && (gc_ver < IP_VERSION(9, 3, 0)))) && in hwmon_attributes_visible()
3271 …amdgpu_hwmon_get_sensor_generic(adev, AMDGPU_PP_SENSOR_GPU_AVG_POWER, (void *)&tmp) == -EOPNOTSUPP) in hwmon_attributes_visible()
3274 …amdgpu_hwmon_get_sensor_generic(adev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER, (void *)&tmp) == -EOPNOTSU… in hwmon_attributes_visible()
3278 if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3279 (amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3280 (amdgpu_dpm_set_fan_speed_rpm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3281 (amdgpu_dpm_get_fan_speed_rpm(adev, NULL) == -EOPNOTSUPP)) && in hwmon_attributes_visible()
3286 if ((amdgpu_dpm_set_fan_speed_rpm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3287 (amdgpu_dpm_get_fan_speed_rpm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3292 if ((adev->family == AMDGPU_FAMILY_SI || /* not implemented yet */ in hwmon_attributes_visible()
3293 adev->family == AMDGPU_FAMILY_KV || /* not implemented yet */ in hwmon_attributes_visible()
3300 if ((!(adev->flags & AMD_IS_APU) || (gc_ver == IP_VERSION(9, 4, 3))) && in hwmon_attributes_visible()
3306 if (((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(9, 4, 3))) && in hwmon_attributes_visible()
3311 if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0)) && in hwmon_attributes_visible()
3328 if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0) || in hwmon_attributes_visible()
3365 if (adev->pm.sysfs_initialized) in amdgpu_pm_sysfs_init()
3368 INIT_LIST_HEAD(&adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
3370 if (adev->pm.dpm_enabled == 0) in amdgpu_pm_sysfs_init()
3373 adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev, in amdgpu_pm_sysfs_init()
3376 if (IS_ERR(adev->pm.int_hwmon_dev)) { in amdgpu_pm_sysfs_init()
3377 ret = PTR_ERR(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_init()
3378 dev_err(adev->dev, in amdgpu_pm_sysfs_init()
3400 &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
3404 adev->pm.sysfs_initialized = true; in amdgpu_pm_sysfs_init()
3411 if (adev->pm.int_hwmon_dev) in amdgpu_pm_sysfs_fini()
3412 hwmon_device_unregister(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_fini()
3414 amdgpu_device_attr_remove_groups(adev, &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_fini()
3447 uint32_t mp1_ver = adev->ip_versions[MP1_HWIP][0]; in amdgpu_debugfs_pm_info_pp()
3448 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in amdgpu_debugfs_pm_info_pp()
3592 struct amdgpu_device *adev = (struct amdgpu_device *)m->private; in amdgpu_debugfs_pm_info_show()
3598 return -EPERM; in amdgpu_debugfs_pm_info_show()
3599 if (adev->in_suspend && !adev->in_runpm) in amdgpu_debugfs_pm_info_show()
3600 return -EPERM; in amdgpu_debugfs_pm_info_show()
3602 r = pm_runtime_get_sync(dev->dev); in amdgpu_debugfs_pm_info_show()
3604 pm_runtime_put_autosuspend(dev->dev); in amdgpu_debugfs_pm_info_show()
3621 pm_runtime_mark_last_busy(dev->dev); in amdgpu_debugfs_pm_info_show()
3622 pm_runtime_put_autosuspend(dev->dev); in amdgpu_debugfs_pm_info_show()
3630 * amdgpu_pm_priv_buffer_read - Read memory region allocated to FW
3637 struct amdgpu_device *adev = file_inode(f)->i_private; in amdgpu_pm_prv_buffer_read()
3643 return -EPERM; in amdgpu_pm_prv_buffer_read()
3644 if (adev->in_suspend && !adev->in_runpm) in amdgpu_pm_prv_buffer_read()
3645 return -EPERM; in amdgpu_pm_prv_buffer_read()
3652 return -EINVAL; in amdgpu_pm_prv_buffer_read()
3670 struct drm_minor *minor = adev_to_drm(adev)->primary; in amdgpu_debugfs_pm_init()
3671 struct dentry *root = minor->debugfs_root; in amdgpu_debugfs_pm_init()
3673 if (!adev->pm.dpm_enabled) in amdgpu_debugfs_pm_init()
3679 if (adev->pm.smu_prv_buffer_size > 0) in amdgpu_debugfs_pm_init()
3683 adev->pm.smu_prv_buffer_size); in amdgpu_debugfs_pm_init()