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

33 #include <linux/hwmon-sysfs.h>
104 * - battery
106 * - balanced
108 * - performance
110 * battery
112 * On older GPUs, the vbios provided a special power state for battery
113 * operation. Selecting battery switched to this state. This is no
140 return -EPERM; in amdgpu_get_power_dpm_state()
141 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_power_dpm_state()
142 return -EPERM; in amdgpu_get_power_dpm_state()
144 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_power_dpm_state()
146 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_state()
152 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_power_dpm_state()
153 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_state()
156 (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : in amdgpu_get_power_dpm_state()
171 return -EPERM; in amdgpu_set_power_dpm_state()
172 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_power_dpm_state()
173 return -EPERM; in amdgpu_set_power_dpm_state()
175 if (strncmp("battery", buf, strlen("battery")) == 0) in amdgpu_set_power_dpm_state()
182 return -EINVAL; in amdgpu_set_power_dpm_state()
184 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_power_dpm_state()
186 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_state()
192 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_state()
193 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_state()
206 * - auto
208 * - low
210 * - high
212 * - manual
214 * - profile_standard
216 * - profile_min_sclk
218 * - profile_min_mclk
220 * - profile_peak
225 * the optimal power profile for current conditions in the driver.
268 return -EPERM; in amdgpu_get_power_dpm_force_performance_level()
269 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_power_dpm_force_performance_level()
270 return -EPERM; in amdgpu_get_power_dpm_force_performance_level()
272 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
274 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
280 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
281 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
307 return -EPERM; in amdgpu_set_power_dpm_force_performance_level()
308 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_power_dpm_force_performance_level()
309 return -EPERM; in amdgpu_set_power_dpm_force_performance_level()
332 return -EINVAL; in amdgpu_set_power_dpm_force_performance_level()
335 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
337 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
341 mutex_lock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
343 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
344 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
345 mutex_unlock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
346 return -EINVAL; in amdgpu_set_power_dpm_force_performance_level()
349 adev->pm.stable_pstate_ctx = NULL; in amdgpu_set_power_dpm_force_performance_level()
350 mutex_unlock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
352 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
353 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
369 return -EPERM; in amdgpu_get_pp_num_states()
370 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_num_states()
371 return -EPERM; in amdgpu_get_pp_num_states()
373 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_num_states()
375 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_num_states()
382 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_num_states()
383 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_num_states()
389 (data.states[i] == POWER_STATE_TYPE_BATTERY) ? "battery" : in amdgpu_get_pp_num_states()
407 return -EPERM; in amdgpu_get_pp_cur_state()
408 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_cur_state()
409 return -EPERM; in amdgpu_get_pp_cur_state()
411 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_cur_state()
413 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_cur_state()
421 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_cur_state()
422 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_cur_state()
433 i = -EINVAL; in amdgpu_get_pp_cur_state()
446 return -EPERM; in amdgpu_get_pp_force_state()
447 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_force_state()
448 return -EPERM; in amdgpu_get_pp_force_state()
450 if (adev->pm.pp_force_state_enabled) in amdgpu_get_pp_force_state()
469 return -EPERM; in amdgpu_set_pp_force_state()
470 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_force_state()
471 return -EPERM; in amdgpu_set_pp_force_state()
473 adev->pm.pp_force_state_enabled = false; in amdgpu_set_pp_force_state()
480 return -EINVAL; in amdgpu_set_pp_force_state()
484 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_force_state()
486 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
504 adev->pm.pp_force_state_enabled = true; in amdgpu_set_pp_force_state()
507 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_force_state()
508 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
513 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_force_state()
514 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
524 * will attempt to upload a new powerplay table and re-initialize
539 return -EPERM; in amdgpu_get_pp_table()
540 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_table()
541 return -EPERM; in amdgpu_get_pp_table()
543 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_table()
545 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_table()
551 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_table()
552 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_table()
558 size = PAGE_SIZE - 1; in amdgpu_get_pp_table()
575 return -EPERM; in amdgpu_set_pp_table()
576 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_table()
577 return -EPERM; in amdgpu_set_pp_table()
579 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_table()
581 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_table()
587 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_table()
588 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_table()
653 * - a list of engine clock levels and voltages labeled OD_SCLK
655 * - a list of memory clock levels and voltages labeled OD_MCLK
657 * - a list of valid ranges for sclk, mclk, and voltage labeled OD_RANGE
673 * - minimum and maximum engine clock labeled OD_SCLK
675 * - minimum(not available for Vega20 and Navi1x) and maximum memory
678 * - three <frequency, voltage> points labeled OD_VDDC_CURVE.
681 * - voltage offset(in mV) applied on target voltage calculation.
687 * - a list of valid ranges for sclk, mclk, and voltage curve points
694 * - minimum and maximum engine clock labeled OD_SCLK
696 * - a list of valid ranges for sclk labeled OD_RANGE
702 * - minimum and maximum engine clock labeled OD_SCLK
703 * - minimum and maximum core clocks labeled OD_CCLK
705 * - a list of valid ranges for sclk and cclk labeled OD_RANGE
709 * - First select manual using power_dpm_force_performance_level
711 * - For clock frequency setting, enter a new value by writing a
732 * - When you have edited all of the states as needed, write "c" (commit)
735 * - If you want to reset to the default power levels, write "r" (reset)
757 return -EPERM; in amdgpu_set_pp_od_clk_voltage()
758 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_od_clk_voltage()
759 return -EPERM; in amdgpu_set_pp_od_clk_voltage()
762 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
779 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
795 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
802 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
804 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
825 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
826 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
831 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
832 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
833 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
855 return -EPERM; in amdgpu_get_pp_od_clk_voltage()
856 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_od_clk_voltage()
857 return -EPERM; in amdgpu_get_pp_od_clk_voltage()
859 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
861 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
870 if (ret == -ENOENT) { in amdgpu_get_pp_od_clk_voltage()
884 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
885 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
898 * - Current ppfeature masks
899 * - List of the all supported powerplay features with their naming,
917 return -EPERM; in amdgpu_set_pp_features()
918 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_features()
919 return -EPERM; in amdgpu_set_pp_features()
923 return -EINVAL; in amdgpu_set_pp_features()
925 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_features()
927 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_features()
933 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_features()
934 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_features()
937 return -EINVAL; in amdgpu_set_pp_features()
952 return -EPERM; in amdgpu_get_pp_features()
953 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_features()
954 return -EPERM; in amdgpu_get_pp_features()
956 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_features()
958 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_features()
966 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_features()
967 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_features()
993 * .. code-block:: bash
1012 return -EPERM; in amdgpu_get_pp_dpm_clock()
1013 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_dpm_clock()
1014 return -EPERM; in amdgpu_get_pp_dpm_clock()
1016 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_dpm_clock()
1018 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_dpm_clock()
1023 if (ret == -ENOENT) in amdgpu_get_pp_dpm_clock()
1029 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_dpm_clock()
1030 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_dpm_clock()
1053 bytes = min(count, sizeof(buf_cpy) - 1); in amdgpu_read_mask()
1061 return -EINVAL; in amdgpu_read_mask()
1081 return -EPERM; in amdgpu_set_pp_dpm_clock()
1082 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_dpm_clock()
1083 return -EPERM; in amdgpu_set_pp_dpm_clock()
1089 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_dpm_clock()
1091 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_dpm_clock()
1097 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_dpm_clock()
1098 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_dpm_clock()
1101 return -EINVAL; in amdgpu_set_pp_dpm_clock()
1236 return -EPERM; in amdgpu_get_pp_sclk_od()
1237 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_sclk_od()
1238 return -EPERM; in amdgpu_get_pp_sclk_od()
1240 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_sclk_od()
1242 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_sclk_od()
1248 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_sclk_od()
1249 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_sclk_od()
1265 return -EPERM; in amdgpu_set_pp_sclk_od()
1266 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_sclk_od()
1267 return -EPERM; in amdgpu_set_pp_sclk_od()
1272 return -EINVAL; in amdgpu_set_pp_sclk_od()
1274 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_sclk_od()
1276 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_sclk_od()
1282 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_sclk_od()
1283 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_sclk_od()
1298 return -EPERM; in amdgpu_get_pp_mclk_od()
1299 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_mclk_od()
1300 return -EPERM; in amdgpu_get_pp_mclk_od()
1302 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_mclk_od()
1304 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_mclk_od()
1310 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_mclk_od()
1311 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_mclk_od()
1327 return -EPERM; in amdgpu_set_pp_mclk_od()
1328 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_mclk_od()
1329 return -EPERM; in amdgpu_set_pp_mclk_od()
1334 return -EINVAL; in amdgpu_set_pp_mclk_od()
1336 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_mclk_od()
1338 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_mclk_od()
1344 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_mclk_od()
1345 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_mclk_od()
1358 * and the relevant heuristics settings for that profile.
1360 * To select a profile or create a custom profile, first select manual using
1362 * profile to pp_power_profile_mode will enable those heuristics. To
1364 * starting with the number of the custom profile along with a setting
1380 return -EPERM; in amdgpu_get_pp_power_profile_mode()
1381 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_power_profile_mode()
1382 return -EPERM; in amdgpu_get_pp_power_profile_mode()
1384 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1386 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1394 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1395 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1419 return -EPERM; in amdgpu_set_pp_power_profile_mode()
1420 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_power_profile_mode()
1421 return -EPERM; in amdgpu_set_pp_power_profile_mode()
1427 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1431 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1434 memcpy(buf_cpy, buf, count-i); in amdgpu_set_pp_power_profile_mode()
1441 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1449 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1451 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1457 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1458 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1463 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1483 return -EPERM; in amdgpu_get_gpu_busy_percent()
1484 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_gpu_busy_percent()
1485 return -EPERM; in amdgpu_get_gpu_busy_percent()
1487 r = pm_runtime_get_sync(ddev->dev); in amdgpu_get_gpu_busy_percent()
1489 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_busy_percent()
1497 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_gpu_busy_percent()
1498 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_busy_percent()
1523 return -EPERM; in amdgpu_get_mem_busy_percent()
1524 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_mem_busy_percent()
1525 return -EPERM; in amdgpu_get_mem_busy_percent()
1527 r = pm_runtime_get_sync(ddev->dev); in amdgpu_get_mem_busy_percent()
1529 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_mem_busy_percent()
1537 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_mem_busy_percent()
1538 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_mem_busy_percent()
1568 return -EPERM; in amdgpu_get_pcie_bw()
1569 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pcie_bw()
1570 return -EPERM; in amdgpu_get_pcie_bw()
1572 if (adev->flags & AMD_IS_APU) in amdgpu_get_pcie_bw()
1573 return -ENODATA; in amdgpu_get_pcie_bw()
1575 if (!adev->asic_funcs->get_pcie_usage) in amdgpu_get_pcie_bw()
1576 return -ENODATA; in amdgpu_get_pcie_bw()
1578 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_pcie_bw()
1580 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pcie_bw()
1586 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_pcie_bw()
1587 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pcie_bw()
1590 count0, count1, pcie_get_mps(adev->pdev)); in amdgpu_get_pcie_bw()
1611 return -EPERM; in amdgpu_get_unique_id()
1612 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_unique_id()
1613 return -EPERM; in amdgpu_get_unique_id()
1615 if (adev->unique_id) in amdgpu_get_unique_id()
1616 return sysfs_emit(buf, "%016llx\n", adev->unique_id); in amdgpu_get_unique_id()
1644 adev_to_drm(adev)->unique, in amdgpu_get_thermal_throttling_logging()
1645 atomic_read(&adev->throttling_logging_enabled) ? "enabled" : "disabled", in amdgpu_get_thermal_throttling_logging()
1646 adev->throttling_logging_rs.interval / HZ + 1); in amdgpu_get_thermal_throttling_logging()
1665 return -EINVAL; in amdgpu_set_thermal_throttling_logging()
1668 raw_spin_lock_irqsave(&adev->throttling_logging_rs.lock, flags); in amdgpu_set_thermal_throttling_logging()
1673 adev->throttling_logging_rs.interval = in amdgpu_set_thermal_throttling_logging()
1674 (throttling_logging_interval - 1) * HZ; in amdgpu_set_thermal_throttling_logging()
1675 adev->throttling_logging_rs.begin = 0; in amdgpu_set_thermal_throttling_logging()
1676 adev->throttling_logging_rs.printed = 0; in amdgpu_set_thermal_throttling_logging()
1677 adev->throttling_logging_rs.missed = 0; in amdgpu_set_thermal_throttling_logging()
1678 raw_spin_unlock_irqrestore(&adev->throttling_logging_rs.lock, flags); in amdgpu_set_thermal_throttling_logging()
1680 atomic_set(&adev->throttling_logging_enabled, 1); in amdgpu_set_thermal_throttling_logging()
1682 atomic_set(&adev->throttling_logging_enabled, 0); in amdgpu_set_thermal_throttling_logging()
1711 return -EPERM; in amdgpu_get_gpu_metrics()
1712 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_gpu_metrics()
1713 return -EPERM; in amdgpu_get_gpu_metrics()
1715 ret = pm_runtime_get_sync(ddev->dev); in amdgpu_get_gpu_metrics()
1717 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_metrics()
1726 size = PAGE_SIZE - 1; in amdgpu_get_gpu_metrics()
1731 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_get_gpu_metrics()
1732 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_metrics()
1745 return -EPERM; in amdgpu_device_read_powershift()
1746 if (adev->in_suspend && !adev->in_runpm) in amdgpu_device_read_powershift()
1747 return -EPERM; in amdgpu_device_read_powershift()
1749 r = pm_runtime_get_sync(ddev->dev); in amdgpu_device_read_powershift()
1751 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_device_read_powershift()
1762 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_device_read_powershift()
1763 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_device_read_powershift()
1776 if (r == -EOPNOTSUPP) { in amdgpu_show_powershift_percent()
1781 if (mgpu_info.gpu_ins[i].adev->flags & AMD_IS_APU) { in amdgpu_show_powershift_percent()
1801 * there is no powershift and values between [1-100] means that the power
1817 * there is no powershift and values between [1-100] means that the power is
1832 * smartshift(SS2.0) bias level. The value ranges from -100 to 100
1833 * and the default is 0. -100 sets maximum preference to APU
1858 return -EPERM; in amdgpu_set_smartshift_bias()
1859 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_smartshift_bias()
1860 return -EPERM; in amdgpu_set_smartshift_bias()
1862 r = pm_runtime_get_sync(ddev->dev); in amdgpu_set_smartshift_bias()
1864 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_smartshift_bias()
1883 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_smartshift_bias()
1884 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_smartshift_bias()
1952 struct device_attribute *dev_attr = &attr->dev_attr; in default_attr_update()
1953 uint32_t mp1_ver = adev->ip_versions[MP1_HWIP][0]; in default_attr_update()
1954 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in default_attr_update()
1955 const char *attr_name = dev_attr->attr.name; in default_attr_update()
1957 if (!(attr->flags & mask)) { in default_attr_update()
1980 if (adev->flags & AMD_IS_APU || gc_ver == IP_VERSION(9, 0, 1)) in default_attr_update()
1984 if (adev->flags & AMD_IS_APU) in default_attr_update()
2000 if (adev->flags & AMD_IS_APU || gc_ver < IP_VERSION(9, 0, 0)) in default_attr_update()
2020 if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP) in default_attr_update()
2033 dev_attr->attr.mode &= ~S_IWUGO; in default_attr_update()
2034 dev_attr->store = NULL; in default_attr_update()
2040 dev_attr->attr.mode &= ~0222; in default_attr_update()
2041 dev_attr->store = NULL; in default_attr_update()
2051 dev_attr->attr.mode &= ~S_IWUGO; in default_attr_update()
2052 dev_attr->store = NULL; in default_attr_update()
2058 dev_attr->attr.mode &= ~S_IWUGO; in default_attr_update()
2059 dev_attr->store = NULL; in default_attr_update()
2073 struct device_attribute *dev_attr = &attr->dev_attr; in amdgpu_device_attr_create()
2074 const char *name = dev_attr->attr.name; in amdgpu_device_attr_create()
2083 attr_update = attr->attr_update ? attr->attr_update : default_attr_update; in amdgpu_device_attr_create()
2087 dev_err(adev->dev, "failed to update device file %s, ret = %d\n", in amdgpu_device_attr_create()
2095 ret = device_create_file(adev->dev, dev_attr); in amdgpu_device_attr_create()
2097 dev_err(adev->dev, "failed to create device file %s, ret = %d\n", in amdgpu_device_attr_create()
2103 return -ENOMEM; in amdgpu_device_attr_create()
2105 attr_entry->attr = attr; in amdgpu_device_attr_create()
2106 INIT_LIST_HEAD(&attr_entry->entry); in amdgpu_device_attr_create()
2108 list_add_tail(&attr_entry->entry, attr_list); in amdgpu_device_attr_create()
2115 struct device_attribute *dev_attr = &attr->dev_attr; in amdgpu_device_attr_remove()
2117 device_remove_file(adev->dev, dev_attr); in amdgpu_device_attr_remove()
2155 amdgpu_device_attr_remove(adev, entry->attr); in amdgpu_device_attr_remove_groups()
2156 list_del(&entry->entry); in amdgpu_device_attr_remove_groups()
2166 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp()
2170 return -EPERM; in amdgpu_hwmon_show_temp()
2171 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_temp()
2172 return -EPERM; in amdgpu_hwmon_show_temp()
2175 return -EINVAL; in amdgpu_hwmon_show_temp()
2177 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_temp()
2179 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_temp()
2200 r = -EINVAL; in amdgpu_hwmon_show_temp()
2204 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_temp()
2205 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_temp()
2218 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_thresh()
2222 temp = adev->pm.dpm.thermal.min_temp; in amdgpu_hwmon_show_temp_thresh()
2224 temp = adev->pm.dpm.thermal.max_temp; in amdgpu_hwmon_show_temp_thresh()
2234 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_hotspot_temp_thresh()
2238 temp = adev->pm.dpm.thermal.min_hotspot_temp; in amdgpu_hwmon_show_hotspot_temp_thresh()
2240 temp = adev->pm.dpm.thermal.max_hotspot_crit_temp; in amdgpu_hwmon_show_hotspot_temp_thresh()
2250 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_mem_temp_thresh()
2254 temp = adev->pm.dpm.thermal.min_mem_temp; in amdgpu_hwmon_show_mem_temp_thresh()
2256 temp = adev->pm.dpm.thermal.max_mem_crit_temp; in amdgpu_hwmon_show_mem_temp_thresh()
2265 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_label()
2268 return -EINVAL; in amdgpu_hwmon_show_temp_label()
2278 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_emergency()
2282 return -EINVAL; in amdgpu_hwmon_show_temp_emergency()
2286 temp = adev->pm.dpm.thermal.max_hotspot_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2289 temp = adev->pm.dpm.thermal.max_edge_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2292 temp = adev->pm.dpm.thermal.max_mem_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2308 return -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2309 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_pwm1_enable()
2310 return -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2312 ret = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2314 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2320 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2321 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2324 return -EINVAL; in amdgpu_hwmon_get_pwm1_enable()
2339 return -EPERM; in amdgpu_hwmon_set_pwm1_enable()
2340 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_pwm1_enable()
2341 return -EPERM; in amdgpu_hwmon_set_pwm1_enable()
2347 ret = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2349 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2355 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2356 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2359 return -EINVAL; in amdgpu_hwmon_set_pwm1_enable()
2388 return -EPERM; in amdgpu_hwmon_set_pwm1()
2389 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_pwm1()
2390 return -EPERM; in amdgpu_hwmon_set_pwm1()
2396 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2398 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2408 err = -EINVAL; in amdgpu_hwmon_set_pwm1()
2415 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2416 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2433 return -EPERM; in amdgpu_hwmon_get_pwm1()
2434 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_pwm1()
2435 return -EPERM; in amdgpu_hwmon_get_pwm1()
2437 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2439 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2445 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2446 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2463 return -EPERM; in amdgpu_hwmon_get_fan1_input()
2464 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_input()
2465 return -EPERM; in amdgpu_hwmon_get_fan1_input()
2467 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2469 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2475 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2476 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2494 return -EPERM; in amdgpu_hwmon_get_fan1_min()
2495 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_min()
2496 return -EPERM; in amdgpu_hwmon_get_fan1_min()
2498 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_min()
2500 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_min()
2507 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_min()
2508 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_min()
2526 return -EPERM; in amdgpu_hwmon_get_fan1_max()
2527 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_max()
2528 return -EPERM; in amdgpu_hwmon_get_fan1_max()
2530 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_max()
2532 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_max()
2539 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_max()
2540 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_max()
2557 return -EPERM; in amdgpu_hwmon_get_fan1_target()
2558 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_target()
2559 return -EPERM; in amdgpu_hwmon_get_fan1_target()
2561 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2563 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2569 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2570 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2588 return -EPERM; in amdgpu_hwmon_set_fan1_target()
2589 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_fan1_target()
2590 return -EPERM; in amdgpu_hwmon_set_fan1_target()
2596 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2598 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2607 err = -ENODATA; in amdgpu_hwmon_set_fan1_target()
2614 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2615 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2632 return -EPERM; in amdgpu_hwmon_get_fan1_enable()
2633 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_enable()
2634 return -EPERM; in amdgpu_hwmon_get_fan1_enable()
2636 ret = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2638 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2644 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2645 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
2648 return -EINVAL; in amdgpu_hwmon_get_fan1_enable()
2664 return -EPERM; in amdgpu_hwmon_set_fan1_enable()
2665 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_fan1_enable()
2666 return -EPERM; in amdgpu_hwmon_set_fan1_enable()
2677 return -EINVAL; in amdgpu_hwmon_set_fan1_enable()
2679 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2681 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2687 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2688 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
2691 return -EINVAL; in amdgpu_hwmon_set_fan1_enable()
2705 return -EPERM; in amdgpu_hwmon_show_vddgfx()
2706 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_vddgfx()
2707 return -EPERM; in amdgpu_hwmon_show_vddgfx()
2709 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddgfx()
2711 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddgfx()
2719 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddgfx()
2720 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddgfx()
2744 return -EPERM; in amdgpu_hwmon_show_vddnb()
2745 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_vddnb()
2746 return -EPERM; in amdgpu_hwmon_show_vddnb()
2749 if (!(adev->flags & AMD_IS_APU)) in amdgpu_hwmon_show_vddnb()
2750 return -EINVAL; in amdgpu_hwmon_show_vddnb()
2752 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddnb()
2754 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddnb()
2762 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddnb()
2763 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_vddnb()
2788 return -EPERM; in amdgpu_hwmon_show_power_avg()
2789 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_power_avg()
2790 return -EPERM; in amdgpu_hwmon_show_power_avg()
2792 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_avg()
2794 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_avg()
2802 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_avg()
2803 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_avg()
2828 enum pp_power_type power_type = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_power_cap_generic()
2834 return -EPERM; in amdgpu_hwmon_show_power_cap_generic()
2835 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_power_cap_generic()
2836 return -EPERM; in amdgpu_hwmon_show_power_cap_generic()
2838 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2840 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2852 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2853 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
2888 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in amdgpu_hwmon_show_power_label()
2892 to_sensor_dev_attr(attr)->index == PP_PWR_TYPE_FAST ? in amdgpu_hwmon_show_power_label()
2904 int limit_type = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_set_power_cap()
2909 return -EPERM; in amdgpu_hwmon_set_power_cap()
2910 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_power_cap()
2911 return -EPERM; in amdgpu_hwmon_set_power_cap()
2914 return -EINVAL; in amdgpu_hwmon_set_power_cap()
2923 err = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2925 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2931 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2932 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
2949 return -EPERM; in amdgpu_hwmon_show_sclk()
2950 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_sclk()
2951 return -EPERM; in amdgpu_hwmon_show_sclk()
2953 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_sclk()
2955 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_sclk()
2963 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_sclk()
2964 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_sclk()
2988 return -EPERM; in amdgpu_hwmon_show_mclk()
2989 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_mclk()
2990 return -EPERM; in amdgpu_hwmon_show_mclk()
2992 r = pm_runtime_get_sync(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_mclk()
2994 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_mclk()
3002 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_mclk()
3003 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_mclk()
3023 * - GPU temperature (via the on-die sensor)
3025 * - GPU voltage
3027 * - Northbridge voltage (APUs only)
3029 * - GPU power
3031 * - GPU fan
3033 * - GPU gfx/compute engine clock
3035 * - GPU memory clock (dGPU only)
3039 * - temp[1-3]_input: the on die GPU temperature in millidegrees Celsius
3040 * - temp2_input and temp3_input are supported on SOC15 dGPUs only
3042 * - temp[1-3]_label: temperature channel label
3043 * - temp2_label and temp3_label are supported on SOC15 dGPUs only
3045 * - temp[1-3]_crit: temperature critical max value in millidegrees Celsius
3046 * - temp2_crit and temp3_crit are supported on SOC15 dGPUs only
3048 * - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius
3049 * - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only
3051 * - temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius
3052 * - these are supported on SOC15 dGPUs only
3056 * - in0_input: the voltage on the GPU in millivolts
3058 * - in1_input: the voltage on the Northbridge in millivolts
3062 * - power1_average: average power used by the GPU in microWatts
3064 * - power1_cap_min: minimum cap supported in microWatts
3066 * - power1_cap_max: maximum cap supported in microWatts
3068 * - power1_cap: selected power cap in microWatts
3072 * - pwm1: pulse width modulation fan level (0-255)
3074 …* - pwm1_enable: pulse width modulation fan control method (0: no fan speed control, 1: manual fan…
3076 * - pwm1_min: pulse width modulation fan control minimum level (0)
3078 * - pwm1_max: pulse width modulation fan control maximum level (255)
3080 * - fan1_min: a minimum value Unit: revolution/min (RPM)
3082 * - fan1_max: a maximum value Unit: revolution/max (RPM)
3084 * - fan1_input: fan speed in RPM
3086 * - fan[1-\*]_target: Desired fan speed Unit: revolution/min (RPM)
3088 * - fan[1-\*]_enable: Enable or disable the sensors.1: Enable 0: Disable
3090 * NOTE: DO NOT set the fan speed via "pwm1" and "fan[1-\*]_target" interfaces at the same time.
3095 * - freq1_input: the gfx/compute clock in hertz
3097 * - freq2_input: the memory clock in hertz
3201 umode_t effective_mode = attr->mode; in hwmon_attributes_visible()
3202 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in hwmon_attributes_visible()
3204 /* under multi-vf mode, the hwmon attributes are all not supported */ in hwmon_attributes_visible()
3213 if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr || in hwmon_attributes_visible()
3225 if ((adev->flags & AMD_IS_APU) && in hwmon_attributes_visible()
3238 if ((adev->flags & AMD_IS_APU) && (adev->family >= AMDGPU_FAMILY_CZ) && in hwmon_attributes_visible()
3244 if (!adev->pm.dpm_enabled && in hwmon_attributes_visible()
3259 if (((amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3261 ((amdgpu_dpm_get_fan_control_mode(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3265 if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3267 ((amdgpu_dpm_set_fan_control_mode(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3272 if (((adev->family == AMDGPU_FAMILY_SI) || in hwmon_attributes_visible()
3273 ((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(10, 3, 1)))) && in hwmon_attributes_visible()
3281 if (((adev->family == AMDGPU_FAMILY_SI) || in hwmon_attributes_visible()
3282 ((adev->flags & AMD_IS_APU) && (gc_ver < IP_VERSION(9, 3, 0)))) && in hwmon_attributes_visible()
3287 if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3288 (amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3289 (amdgpu_dpm_set_fan_speed_rpm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3290 (amdgpu_dpm_get_fan_speed_rpm(adev, NULL) == -EOPNOTSUPP)) && in hwmon_attributes_visible()
3295 if ((amdgpu_dpm_set_fan_speed_rpm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3296 (amdgpu_dpm_get_fan_speed_rpm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3301 if ((adev->family == AMDGPU_FAMILY_SI || /* not implemented yet */ in hwmon_attributes_visible()
3302 adev->family == AMDGPU_FAMILY_KV) && /* not implemented yet */ in hwmon_attributes_visible()
3308 if (!(adev->flags & AMD_IS_APU) && in hwmon_attributes_visible()
3314 if ((adev->flags & AMD_IS_APU) && in hwmon_attributes_visible()
3320 if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0)) && in hwmon_attributes_visible()
3362 if (adev->pm.sysfs_initialized) in amdgpu_pm_sysfs_init()
3365 INIT_LIST_HEAD(&adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
3367 if (adev->pm.dpm_enabled == 0) in amdgpu_pm_sysfs_init()
3370 adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev, in amdgpu_pm_sysfs_init()
3373 if (IS_ERR(adev->pm.int_hwmon_dev)) { in amdgpu_pm_sysfs_init()
3374 ret = PTR_ERR(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_init()
3375 dev_err(adev->dev, in amdgpu_pm_sysfs_init()
3397 &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
3401 adev->pm.sysfs_initialized = true; in amdgpu_pm_sysfs_init()
3408 if (adev->pm.int_hwmon_dev) in amdgpu_pm_sysfs_fini()
3409 hwmon_device_unregister(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_fini()
3411 amdgpu_device_attr_remove_groups(adev, &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_fini()
3443 uint32_t mp1_ver = adev->ip_versions[MP1_HWIP][0]; in amdgpu_debugfs_pm_info_pp()
3444 uint32_t gc_ver = adev->ip_versions[GC_HWIP][0]; in amdgpu_debugfs_pm_info_pp()
3547 struct amdgpu_device *adev = (struct amdgpu_device *)m->private; in amdgpu_debugfs_pm_info_show()
3553 return -EPERM; in amdgpu_debugfs_pm_info_show()
3554 if (adev->in_suspend && !adev->in_runpm) in amdgpu_debugfs_pm_info_show()
3555 return -EPERM; in amdgpu_debugfs_pm_info_show()
3557 r = pm_runtime_get_sync(dev->dev); in amdgpu_debugfs_pm_info_show()
3559 pm_runtime_put_autosuspend(dev->dev); in amdgpu_debugfs_pm_info_show()
3576 pm_runtime_mark_last_busy(dev->dev); in amdgpu_debugfs_pm_info_show()
3577 pm_runtime_put_autosuspend(dev->dev); in amdgpu_debugfs_pm_info_show()
3585 * amdgpu_pm_priv_buffer_read - Read memory region allocated to FW
3592 struct amdgpu_device *adev = file_inode(f)->i_private; in amdgpu_pm_prv_buffer_read()
3598 return -EPERM; in amdgpu_pm_prv_buffer_read()
3599 if (adev->in_suspend && !adev->in_runpm) in amdgpu_pm_prv_buffer_read()
3600 return -EPERM; in amdgpu_pm_prv_buffer_read()
3607 return -EINVAL; in amdgpu_pm_prv_buffer_read()
3625 struct drm_minor *minor = adev_to_drm(adev)->primary; in amdgpu_debugfs_pm_init()
3626 struct dentry *root = minor->debugfs_root; in amdgpu_debugfs_pm_init()
3628 if (!adev->pm.dpm_enabled) in amdgpu_debugfs_pm_init()
3634 if (adev->pm.smu_prv_buffer_size > 0) in amdgpu_debugfs_pm_init()
3638 adev->pm.smu_prv_buffer_size); in amdgpu_debugfs_pm_init()