Lines Matching +full:custom +full:- +full:temp

33 #include <linux/hwmon-sysfs.h>
94 "CUSTOM",
108 * - battery
110 * - balanced
112 * - performance
144 return -EPERM; in amdgpu_get_power_dpm_state()
145 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_power_dpm_state()
146 return -EPERM; in amdgpu_get_power_dpm_state()
148 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_power_dpm_state()
150 return ret ?: -EPERM; in amdgpu_get_power_dpm_state()
154 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_state()
172 return -EPERM; in amdgpu_set_power_dpm_state()
173 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_power_dpm_state()
174 return -EPERM; in amdgpu_set_power_dpm_state()
183 return -EINVAL; in amdgpu_set_power_dpm_state()
185 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_power_dpm_state()
191 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_state()
192 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_state()
205 * - auto
207 * - low
209 * - high
211 * - manual
213 * - profile_standard
215 * - profile_min_sclk
217 * - profile_min_mclk
219 * - profile_peak
267 return -EPERM; in amdgpu_get_power_dpm_force_performance_level()
268 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_power_dpm_force_performance_level()
269 return -EPERM; in amdgpu_get_power_dpm_force_performance_level()
271 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
273 return ret ?: -EPERM; in amdgpu_get_power_dpm_force_performance_level()
277 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_power_dpm_force_performance_level()
303 return -EPERM; in amdgpu_set_power_dpm_force_performance_level()
304 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_power_dpm_force_performance_level()
305 return -EPERM; in amdgpu_set_power_dpm_force_performance_level()
328 return -EINVAL; in amdgpu_set_power_dpm_force_performance_level()
331 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
335 mutex_lock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
337 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
338 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
339 mutex_unlock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
340 return -EINVAL; in amdgpu_set_power_dpm_force_performance_level()
343 adev->pm.stable_pstate_ctx = NULL; in amdgpu_set_power_dpm_force_performance_level()
344 mutex_unlock(&adev->pm.stable_pstate_ctx_lock); in amdgpu_set_power_dpm_force_performance_level()
346 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
347 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_power_dpm_force_performance_level()
363 return -EPERM; in amdgpu_get_pp_num_states()
364 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_num_states()
365 return -EPERM; in amdgpu_get_pp_num_states()
367 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_num_states()
369 return ret ?: -EPERM; in amdgpu_get_pp_num_states()
374 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_num_states()
398 return -EPERM; in amdgpu_get_pp_cur_state()
399 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_cur_state()
400 return -EPERM; in amdgpu_get_pp_cur_state()
402 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_cur_state()
404 return ret ?: -EPERM; in amdgpu_get_pp_cur_state()
410 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_cur_state()
421 i = -EINVAL; in amdgpu_get_pp_cur_state()
434 return -EPERM; in amdgpu_get_pp_force_state()
435 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_force_state()
436 return -EPERM; in amdgpu_get_pp_force_state()
438 if (adev->pm.pp_force_state_enabled) in amdgpu_get_pp_force_state()
457 return -EPERM; in amdgpu_set_pp_force_state()
458 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_force_state()
459 return -EPERM; in amdgpu_set_pp_force_state()
461 adev->pm.pp_force_state_enabled = false; in amdgpu_set_pp_force_state()
468 return -EINVAL; in amdgpu_set_pp_force_state()
472 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_force_state()
490 adev->pm.pp_force_state_enabled = true; in amdgpu_set_pp_force_state()
493 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_force_state()
494 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
499 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_force_state()
500 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_force_state()
510 * will attempt to upload a new powerplay table and re-initialize
525 return -EPERM; in amdgpu_get_pp_table()
526 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_table()
527 return -EPERM; in amdgpu_get_pp_table()
529 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_table()
531 return ret ?: -EPERM; in amdgpu_get_pp_table()
535 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_table()
541 size = PAGE_SIZE - 1; in amdgpu_get_pp_table()
558 return -EPERM; in amdgpu_set_pp_table()
559 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_table()
560 return -EPERM; in amdgpu_set_pp_table()
562 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_table()
568 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_table()
569 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_table()
634 * - a list of engine clock levels and voltages labeled OD_SCLK
636 * - a list of memory clock levels and voltages labeled OD_MCLK
638 * - a list of valid ranges for sclk, mclk, and voltage labeled OD_RANGE
654 * - minimum and maximum engine clock labeled OD_SCLK
656 * - minimum(not available for Vega20 and Navi1x) and maximum memory
659 * - three <frequency, voltage> points labeled OD_VDDC_CURVE.
663 * - voltage offset(in mV) applied on target voltage calculation.
669 * - a list of valid ranges for sclk, mclk, voltage curve points
676 * - minimum and maximum engine clock labeled OD_SCLK
678 * - a list of valid ranges for sclk labeled OD_RANGE
684 * - minimum and maximum engine clock labeled OD_SCLK
685 * - minimum and maximum core clocks labeled OD_CCLK
687 * - a list of valid ranges for sclk and cclk labeled OD_RANGE
691 * - First select manual using power_dpm_force_performance_level
693 * - For clock frequency setting, enter a new value by writing a
711 * string that contains "vo offset". E.g., "vo -10" will update the extra
712 * voltage offset applied to the whole v/f curve line as -10mv.
714 * - When you have edited all of the states as needed, write "c" (commit)
717 * - If you want to reset to the default power levels, write "r" (reset)
739 return -EPERM; in amdgpu_set_pp_od_clk_voltage()
740 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_od_clk_voltage()
741 return -EPERM; in amdgpu_set_pp_od_clk_voltage()
744 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
761 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
778 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
788 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
809 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
810 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
815 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
816 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_od_clk_voltage()
817 return -EINVAL; in amdgpu_set_pp_od_clk_voltage()
839 return -EPERM; in amdgpu_get_pp_od_clk_voltage()
840 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_od_clk_voltage()
841 return -EPERM; in amdgpu_get_pp_od_clk_voltage()
843 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
845 return ret ?: -EPERM; in amdgpu_get_pp_od_clk_voltage()
852 if (ret == -ENOENT) { in amdgpu_get_pp_od_clk_voltage()
864 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_od_clk_voltage()
877 * - Current ppfeature masks
878 * - List of the all supported powerplay features with their naming,
896 return -EPERM; in amdgpu_set_pp_features()
897 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_features()
898 return -EPERM; in amdgpu_set_pp_features()
902 return -EINVAL; in amdgpu_set_pp_features()
904 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_features()
910 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_features()
911 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_features()
914 return -EINVAL; in amdgpu_set_pp_features()
929 return -EPERM; in amdgpu_get_pp_features()
930 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_features()
931 return -EPERM; in amdgpu_get_pp_features()
933 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_features()
935 return ret ?: -EPERM; in amdgpu_get_pp_features()
941 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_features()
976 * .. code-block:: bash
995 return -EPERM; in amdgpu_get_pp_dpm_clock()
996 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_dpm_clock()
997 return -EPERM; in amdgpu_get_pp_dpm_clock()
999 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_dpm_clock()
1001 return ret ?: -EPERM; in amdgpu_get_pp_dpm_clock()
1004 if (ret == -ENOENT) in amdgpu_get_pp_dpm_clock()
1010 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_dpm_clock()
1033 bytes = min(count, sizeof(buf_cpy) - 1); in amdgpu_read_mask()
1041 return -EINVAL; in amdgpu_read_mask()
1061 return -EPERM; in amdgpu_set_pp_dpm_clock()
1062 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_dpm_clock()
1063 return -EPERM; in amdgpu_set_pp_dpm_clock()
1069 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_dpm_clock()
1075 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_dpm_clock()
1076 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_dpm_clock()
1079 return -EINVAL; in amdgpu_set_pp_dpm_clock()
1244 return -EPERM; in amdgpu_get_pp_sclk_od()
1245 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_sclk_od()
1246 return -EPERM; in amdgpu_get_pp_sclk_od()
1248 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_sclk_od()
1250 return ret ?: -EPERM; in amdgpu_get_pp_sclk_od()
1254 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_sclk_od()
1270 return -EPERM; in amdgpu_set_pp_sclk_od()
1271 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_sclk_od()
1272 return -EPERM; in amdgpu_set_pp_sclk_od()
1277 return -EINVAL; in amdgpu_set_pp_sclk_od()
1279 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_sclk_od()
1285 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_sclk_od()
1286 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_sclk_od()
1301 return -EPERM; in amdgpu_get_pp_mclk_od()
1302 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_mclk_od()
1303 return -EPERM; in amdgpu_get_pp_mclk_od()
1305 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_mclk_od()
1307 return ret ?: -EPERM; 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_resume_and_get(ddev->dev); in amdgpu_set_pp_mclk_od()
1342 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_mclk_od()
1343 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_mclk_od()
1358 * To select a profile or create a custom profile, first select manual using
1361 * create a custom set of heuristics, write a string of numbers to the file
1362 * starting with the number of the custom profile along with a setting
1365 * you can apply the custom heuristics to different clock domains. Each
1368 * custom heuristics will be retained until you switch to another profile.
1382 return -EPERM; in amdgpu_get_pp_power_profile_mode()
1383 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pp_power_profile_mode()
1384 return -EPERM; in amdgpu_get_pp_power_profile_mode()
1386 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1388 return ret ?: -EPERM; in amdgpu_get_pp_power_profile_mode()
1394 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pp_power_profile_mode()
1418 return -EPERM; in amdgpu_set_pp_power_profile_mode()
1419 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pp_power_profile_mode()
1420 return -EPERM; in amdgpu_set_pp_power_profile_mode()
1426 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1430 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1433 memcpy(buf_cpy, buf, count-i); in amdgpu_set_pp_power_profile_mode()
1440 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1448 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1454 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1455 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pp_power_profile_mode()
1460 return -EINVAL; in amdgpu_set_pp_power_profile_mode()
1470 return -EPERM; in amdgpu_hwmon_get_sensor_generic()
1471 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_sensor_generic()
1472 return -EPERM; in amdgpu_hwmon_get_sensor_generic()
1474 r = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_get_sensor_generic()
1476 return r ?: -EPERM; in amdgpu_hwmon_get_sensor_generic()
1481 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_sensor_generic()
1580 return -EPERM; in amdgpu_get_pcie_bw()
1581 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pcie_bw()
1582 return -EPERM; in amdgpu_get_pcie_bw()
1584 if (adev->flags & AMD_IS_APU) in amdgpu_get_pcie_bw()
1585 return -ENODATA; in amdgpu_get_pcie_bw()
1587 if (!adev->asic_funcs->get_pcie_usage) in amdgpu_get_pcie_bw()
1588 return -ENODATA; in amdgpu_get_pcie_bw()
1590 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pcie_bw()
1592 return ret ?: -EPERM; in amdgpu_get_pcie_bw()
1596 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pcie_bw()
1599 count0, count1, pcie_get_mps(adev->pdev)); in amdgpu_get_pcie_bw()
1620 return -EPERM; in amdgpu_get_unique_id()
1621 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_unique_id()
1622 return -EPERM; in amdgpu_get_unique_id()
1624 if (adev->unique_id) in amdgpu_get_unique_id()
1625 return sysfs_emit(buf, "%016llx\n", adev->unique_id); in amdgpu_get_unique_id()
1653 adev_to_drm(adev)->unique, in amdgpu_get_thermal_throttling_logging()
1654 atomic_read(&adev->throttling_logging_enabled) ? "enabled" : "disabled", in amdgpu_get_thermal_throttling_logging()
1655 adev->throttling_logging_rs.interval / HZ + 1); in amdgpu_get_thermal_throttling_logging()
1674 return -EINVAL; in amdgpu_set_thermal_throttling_logging()
1677 raw_spin_lock_irqsave(&adev->throttling_logging_rs.lock, flags); in amdgpu_set_thermal_throttling_logging()
1682 adev->throttling_logging_rs.interval = in amdgpu_set_thermal_throttling_logging()
1683 (throttling_logging_interval - 1) * HZ; in amdgpu_set_thermal_throttling_logging()
1684 adev->throttling_logging_rs.begin = 0; in amdgpu_set_thermal_throttling_logging()
1685 adev->throttling_logging_rs.printed = 0; in amdgpu_set_thermal_throttling_logging()
1686 adev->throttling_logging_rs.missed = 0; in amdgpu_set_thermal_throttling_logging()
1687 raw_spin_unlock_irqrestore(&adev->throttling_logging_rs.lock, flags); in amdgpu_set_thermal_throttling_logging()
1689 atomic_set(&adev->throttling_logging_enabled, 1); in amdgpu_set_thermal_throttling_logging()
1691 atomic_set(&adev->throttling_logging_enabled, 0); in amdgpu_set_thermal_throttling_logging()
1718 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_apu_thermal_cap()
1720 return ret ?: -EPERM; in amdgpu_get_apu_thermal_cap()
1728 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_apu_thermal_cap()
1749 return -EINVAL; in amdgpu_set_apu_thermal_cap()
1752 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_apu_thermal_cap()
1758 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_apu_thermal_cap()
1759 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_apu_thermal_cap()
1764 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_apu_thermal_cap()
1765 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_apu_thermal_cap()
1775 if (amdgpu_dpm_get_pm_metrics(adev, NULL, 0) == -EOPNOTSUPP) in amdgpu_pm_metrics_attr_update()
1790 return -EPERM; in amdgpu_get_pm_metrics()
1791 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pm_metrics()
1792 return -EPERM; in amdgpu_get_pm_metrics()
1794 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_pm_metrics()
1796 return ret ?: -EPERM; in amdgpu_get_pm_metrics()
1800 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_pm_metrics()
1828 return -EPERM; in amdgpu_get_gpu_metrics()
1829 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_gpu_metrics()
1830 return -EPERM; in amdgpu_get_gpu_metrics()
1832 ret = pm_runtime_get_if_active(ddev->dev); in amdgpu_get_gpu_metrics()
1834 return ret ?: -EPERM; in amdgpu_get_gpu_metrics()
1841 size = PAGE_SIZE - 1; in amdgpu_get_gpu_metrics()
1846 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_get_gpu_metrics()
1860 if (r == -EOPNOTSUPP) { in amdgpu_show_powershift_percent()
1865 if (mgpu_info.gpu_ins[i].adev->flags & AMD_IS_APU) { in amdgpu_show_powershift_percent()
1886 * there is no powershift and values between [1-100] means that the power
1902 * there is no powershift and values between [1-100] means that the power is
1917 * smartshift(SS2.0) bias level. The value ranges from -100 to 100
1918 * and the default is 0. -100 sets maximum preference to APU
1943 return -EPERM; in amdgpu_set_smartshift_bias()
1944 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_smartshift_bias()
1945 return -EPERM; in amdgpu_set_smartshift_bias()
1947 r = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_smartshift_bias()
1966 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_smartshift_bias()
1967 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_smartshift_bias()
2017 if (!(attr->flags & mask)) in pp_od_clk_voltage_attr_update()
2026 struct device_attribute *dev_attr = &attr->dev_attr; in pp_dpm_dcefclk_attr_update()
2031 if (!(attr->flags & mask)) { in pp_dpm_dcefclk_attr_update()
2048 dev_attr->attr.mode &= ~S_IWUGO; in pp_dpm_dcefclk_attr_update()
2049 dev_attr->store = NULL; in pp_dpm_dcefclk_attr_update()
2058 struct device_attribute *dev_attr = &attr->dev_attr; in pp_dpm_clk_default_attr_update()
2059 enum amdgpu_device_attr_id attr_id = attr->attr_id; in pp_dpm_clk_default_attr_update()
2065 if (!(attr->flags & mask)) { in pp_dpm_clk_default_attr_update()
2096 gc_ver == IP_VERSION(11, 0, 3)) && adev->vcn.num_vcn_inst >= 2)) in pp_dpm_clk_default_attr_update()
2118 gc_ver == IP_VERSION(11, 0, 3)) && adev->vcn.num_vcn_inst >= 2)) in pp_dpm_clk_default_attr_update()
2134 dev_attr->attr.mode &= ~S_IWUGO; in pp_dpm_clk_default_attr_update()
2135 dev_attr->store = NULL; in pp_dpm_clk_default_attr_update()
2144 dev_attr->attr.mode &= ~S_IWUGO; in pp_dpm_clk_default_attr_update()
2145 dev_attr->store = NULL; in pp_dpm_clk_default_attr_update()
2162 * per-process level. This is useful especially when entire SOC is utilized for
2168 * Pstate Policy Selection - This is to select different Pstate profiles which
2171 * XGMI PLPD Policy Selection - When multiple devices are connected over XGMI,
2184 * .. code-block:: console
2202 * XGMI and "soc_pstate_2" for soc pstate policy -
2204 * .. code-block:: console
2222 return -EPERM; in amdgpu_get_pm_policy_attr()
2223 if (adev->in_suspend && !adev->in_runpm) in amdgpu_get_pm_policy_attr()
2224 return -EPERM; in amdgpu_get_pm_policy_attr()
2226 return amdgpu_dpm_get_pm_policy_info(adev, policy_attr->id, buf); in amdgpu_get_pm_policy_attr()
2243 return -EPERM; in amdgpu_set_pm_policy_attr()
2244 if (adev->in_suspend && !adev->in_runpm) in amdgpu_set_pm_policy_attr()
2245 return -EPERM; in amdgpu_set_pm_policy_attr()
2249 tmp_buf[count - 1] = '\0'; in amdgpu_set_pm_policy_attr()
2260 return -EINVAL; in amdgpu_set_pm_policy_attr()
2263 return -EINVAL; in amdgpu_set_pm_policy_attr()
2267 return -EINVAL; in amdgpu_set_pm_policy_attr()
2272 ret = pm_runtime_resume_and_get(ddev->dev); in amdgpu_set_pm_policy_attr()
2276 ret = amdgpu_dpm_set_pm_policy(adev, policy_attr->id, val); in amdgpu_set_pm_policy_attr()
2278 pm_runtime_mark_last_busy(ddev->dev); in amdgpu_set_pm_policy_attr()
2279 pm_runtime_put_autosuspend(ddev->dev); in amdgpu_set_pm_policy_attr()
2316 if (amdgpu_dpm_get_pm_policy_info(adev, policy_attr->id, NULL) == in amdgpu_pm_policy_attr_visible()
2317 -ENOENT) in amdgpu_pm_policy_attr_visible()
2320 return attr->mode; in amdgpu_pm_policy_attr_visible()
2383 struct device_attribute *dev_attr = &attr->dev_attr; in default_attr_update()
2384 enum amdgpu_device_attr_id attr_id = attr->attr_id; in default_attr_update()
2387 if (!(attr->flags & mask)) { in default_attr_update()
2393 if ((adev->flags & AMD_IS_APU && in default_attr_update()
2408 if (adev->flags & AMD_IS_APU || in default_attr_update()
2409 !adev->asic_funcs->get_pcie_usage) in default_attr_update()
2432 if ((adev->flags & AMD_IS_APU && in default_attr_update()
2440 if (amdgpu_dpm_get_power_profile_mode(adev, NULL) == -EOPNOTSUPP) in default_attr_update()
2446 if (amdgpu_dpm_get_mclk_od(adev) == -EOPNOTSUPP) in default_attr_update()
2449 if (amdgpu_dpm_get_sclk_od(adev) == -EOPNOTSUPP) in default_attr_update()
2455 -EOPNOTSUPP) in default_attr_update()
2463 dev_attr->attr.mode &= ~0222; in default_attr_update()
2464 dev_attr->store = NULL; in default_attr_update()
2489 return -EINVAL; in amdgpu_device_attr_create()
2491 dev_attr = &attr->dev_attr; in amdgpu_device_attr_create()
2492 name = dev_attr->attr.name; in amdgpu_device_attr_create()
2494 attr_update = attr->attr_update ? attr->attr_update : default_attr_update; in amdgpu_device_attr_create()
2498 dev_err(adev->dev, "failed to update device file %s, ret = %d\n", in amdgpu_device_attr_create()
2506 ret = device_create_file(adev->dev, dev_attr); in amdgpu_device_attr_create()
2508 dev_err(adev->dev, "failed to create device file %s, ret = %d\n", in amdgpu_device_attr_create()
2514 return -ENOMEM; in amdgpu_device_attr_create()
2516 attr_entry->attr = attr; in amdgpu_device_attr_create()
2517 INIT_LIST_HEAD(&attr_entry->entry); in amdgpu_device_attr_create()
2519 list_add_tail(&attr_entry->entry, attr_list); in amdgpu_device_attr_create()
2526 struct device_attribute *dev_attr = &attr->dev_attr; in amdgpu_device_attr_remove()
2528 device_remove_file(adev->dev, dev_attr); in amdgpu_device_attr_remove()
2566 amdgpu_device_attr_remove(adev, entry->attr); in amdgpu_device_attr_remove_groups()
2567 list_del(&entry->entry); in amdgpu_device_attr_remove_groups()
2577 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp()
2578 int r, temp = 0; in amdgpu_hwmon_show_temp() local
2581 return -EINVAL; in amdgpu_hwmon_show_temp()
2587 (void *)&temp); in amdgpu_hwmon_show_temp()
2592 (void *)&temp); in amdgpu_hwmon_show_temp()
2597 (void *)&temp); in amdgpu_hwmon_show_temp()
2600 r = -EINVAL; in amdgpu_hwmon_show_temp()
2607 return sysfs_emit(buf, "%d\n", temp); in amdgpu_hwmon_show_temp()
2615 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_thresh()
2616 int temp; in amdgpu_hwmon_show_temp_thresh() local
2619 temp = adev->pm.dpm.thermal.min_temp; in amdgpu_hwmon_show_temp_thresh()
2621 temp = adev->pm.dpm.thermal.max_temp; in amdgpu_hwmon_show_temp_thresh()
2623 return sysfs_emit(buf, "%d\n", temp); in amdgpu_hwmon_show_temp_thresh()
2631 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_hotspot_temp_thresh()
2632 int temp; in amdgpu_hwmon_show_hotspot_temp_thresh() local
2635 temp = adev->pm.dpm.thermal.min_hotspot_temp; in amdgpu_hwmon_show_hotspot_temp_thresh()
2637 temp = adev->pm.dpm.thermal.max_hotspot_crit_temp; in amdgpu_hwmon_show_hotspot_temp_thresh()
2639 return sysfs_emit(buf, "%d\n", temp); in amdgpu_hwmon_show_hotspot_temp_thresh()
2647 int hyst = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_mem_temp_thresh()
2648 int temp; in amdgpu_hwmon_show_mem_temp_thresh() local
2651 temp = adev->pm.dpm.thermal.min_mem_temp; in amdgpu_hwmon_show_mem_temp_thresh()
2653 temp = adev->pm.dpm.thermal.max_mem_crit_temp; in amdgpu_hwmon_show_mem_temp_thresh()
2655 return sysfs_emit(buf, "%d\n", temp); in amdgpu_hwmon_show_mem_temp_thresh()
2662 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_label()
2665 return -EINVAL; in amdgpu_hwmon_show_temp_label()
2675 int channel = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_temp_emergency()
2676 int temp = 0; in amdgpu_hwmon_show_temp_emergency() local
2679 return -EINVAL; in amdgpu_hwmon_show_temp_emergency()
2683 temp = adev->pm.dpm.thermal.max_hotspot_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2686 temp = adev->pm.dpm.thermal.max_edge_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2689 temp = adev->pm.dpm.thermal.max_mem_emergency_temp; in amdgpu_hwmon_show_temp_emergency()
2693 return sysfs_emit(buf, "%d\n", temp); in amdgpu_hwmon_show_temp_emergency()
2705 return -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2706 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_pwm1_enable()
2707 return -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2709 ret = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_get_pwm1_enable()
2711 return ret ?: -EPERM; in amdgpu_hwmon_get_pwm1_enable()
2715 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1_enable()
2718 return -EINVAL; in amdgpu_hwmon_get_pwm1_enable()
2734 return -EPERM; in amdgpu_hwmon_set_pwm1_enable()
2735 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_pwm1_enable()
2736 return -EPERM; in amdgpu_hwmon_set_pwm1_enable()
2749 return -EINVAL; in amdgpu_hwmon_set_pwm1_enable()
2751 ret = pm_runtime_resume_and_get(adev->dev); in amdgpu_hwmon_set_pwm1_enable()
2757 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2758 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1_enable()
2761 return -EINVAL; in amdgpu_hwmon_set_pwm1_enable()
2790 return -EPERM; in amdgpu_hwmon_set_pwm1()
2791 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_pwm1()
2792 return -EPERM; in amdgpu_hwmon_set_pwm1()
2798 err = pm_runtime_resume_and_get(adev->dev); in amdgpu_hwmon_set_pwm1()
2808 err = -EINVAL; in amdgpu_hwmon_set_pwm1()
2815 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2816 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_pwm1()
2833 return -EPERM; in amdgpu_hwmon_get_pwm1()
2834 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_pwm1()
2835 return -EPERM; in amdgpu_hwmon_get_pwm1()
2837 err = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_get_pwm1()
2839 return err ?: -EPERM; in amdgpu_hwmon_get_pwm1()
2843 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_pwm1()
2860 return -EPERM; in amdgpu_hwmon_get_fan1_input()
2861 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_input()
2862 return -EPERM; in amdgpu_hwmon_get_fan1_input()
2864 err = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_get_fan1_input()
2866 return err ?: -EPERM; in amdgpu_hwmon_get_fan1_input()
2870 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_input()
2921 return -EPERM; in amdgpu_hwmon_get_fan1_target()
2922 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_target()
2923 return -EPERM; in amdgpu_hwmon_get_fan1_target()
2925 err = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_get_fan1_target()
2927 return err ?: -EPERM; in amdgpu_hwmon_get_fan1_target()
2931 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_target()
2949 return -EPERM; in amdgpu_hwmon_set_fan1_target()
2950 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_fan1_target()
2951 return -EPERM; in amdgpu_hwmon_set_fan1_target()
2957 err = pm_runtime_resume_and_get(adev->dev); in amdgpu_hwmon_set_fan1_target()
2966 err = -ENODATA; in amdgpu_hwmon_set_fan1_target()
2973 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2974 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_target()
2991 return -EPERM; in amdgpu_hwmon_get_fan1_enable()
2992 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_get_fan1_enable()
2993 return -EPERM; in amdgpu_hwmon_get_fan1_enable()
2995 ret = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_get_fan1_enable()
2997 return ret ?: -EPERM; in amdgpu_hwmon_get_fan1_enable()
3001 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_get_fan1_enable()
3004 return -EINVAL; in amdgpu_hwmon_get_fan1_enable()
3020 return -EPERM; in amdgpu_hwmon_set_fan1_enable()
3021 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_fan1_enable()
3022 return -EPERM; in amdgpu_hwmon_set_fan1_enable()
3033 return -EINVAL; in amdgpu_hwmon_set_fan1_enable()
3035 err = pm_runtime_resume_and_get(adev->dev); in amdgpu_hwmon_set_fan1_enable()
3041 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
3042 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_fan1_enable()
3045 return -EINVAL; in amdgpu_hwmon_set_fan1_enable()
3083 if (!(adev->flags & AMD_IS_APU)) in amdgpu_hwmon_show_vddnb()
3084 return -EINVAL; in amdgpu_hwmon_show_vddnb()
3152 enum pp_power_type power_type = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_show_power_cap_generic()
3158 return -EPERM; in amdgpu_hwmon_show_power_cap_generic()
3159 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_show_power_cap_generic()
3160 return -EPERM; in amdgpu_hwmon_show_power_cap_generic()
3162 r = pm_runtime_get_if_active(adev->dev); in amdgpu_hwmon_show_power_cap_generic()
3164 return r ?: -EPERM; in amdgpu_hwmon_show_power_cap_generic()
3174 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_show_power_cap_generic()
3219 to_sensor_dev_attr(attr)->index == PP_PWR_TYPE_FAST ? in amdgpu_hwmon_show_power_label()
3231 int limit_type = to_sensor_dev_attr(attr)->index; in amdgpu_hwmon_set_power_cap()
3236 return -EPERM; in amdgpu_hwmon_set_power_cap()
3237 if (adev->in_suspend && !adev->in_runpm) in amdgpu_hwmon_set_power_cap()
3238 return -EPERM; in amdgpu_hwmon_set_power_cap()
3241 return -EINVAL; in amdgpu_hwmon_set_power_cap()
3250 err = pm_runtime_resume_and_get(adev->dev); in amdgpu_hwmon_set_power_cap()
3256 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
3257 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); in amdgpu_hwmon_set_power_cap()
3318 * - GPU temperature (via the on-die sensor)
3320 * - GPU voltage
3322 * - Northbridge voltage (APUs only)
3324 * - GPU power
3326 * - GPU fan
3328 * - GPU gfx/compute engine clock
3330 * - GPU memory clock (dGPU only)
3334 * - temp[1-3]_input: the on die GPU temperature in millidegrees Celsius
3335 * - temp2_input and temp3_input are supported on SOC15 dGPUs only
3337 * - temp[1-3]_label: temperature channel label
3338 * - temp2_label and temp3_label are supported on SOC15 dGPUs only
3340 * - temp[1-3]_crit: temperature critical max value in millidegrees Celsius
3341 * - temp2_crit and temp3_crit are supported on SOC15 dGPUs only
3343 * - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius
3344 * - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only
3346 * - temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius
3347 * - these are supported on SOC15 dGPUs only
3351 * - in0_input: the voltage on the GPU in millivolts
3353 * - in1_input: the voltage on the Northbridge in millivolts
3357 * - power1_average: average power used by the SoC in microWatts. On APUs this includes the CPU.
3359 …* - power1_input: instantaneous power used by the SoC in microWatts. On APUs this includes the CP…
3361 * - power1_cap_min: minimum cap supported in microWatts
3363 * - power1_cap_max: maximum cap supported in microWatts
3365 * - power1_cap: selected power cap in microWatts
3369 * - pwm1: pulse width modulation fan level (0-255)
3371 …* - pwm1_enable: pulse width modulation fan control method (0: no fan speed control, 1: manual fan…
3373 * - pwm1_min: pulse width modulation fan control minimum level (0)
3375 * - pwm1_max: pulse width modulation fan control maximum level (255)
3377 * - fan1_min: a minimum value Unit: revolution/min (RPM)
3379 * - fan1_max: a maximum value Unit: revolution/max (RPM)
3381 * - fan1_input: fan speed in RPM
3383 * - fan[1-\*]_target: Desired fan speed Unit: revolution/min (RPM)
3385 * - fan[1-\*]_enable: Enable or disable the sensors.1: Enable 0: Disable
3387 * NOTE: DO NOT set the fan speed via "pwm1" and "fan[1-\*]_target" interfaces at the same time.
3392 * - freq1_input: the gfx/compute clock in hertz
3394 * - freq2_input: the memory clock in hertz
3500 umode_t effective_mode = attr->mode; in hwmon_attributes_visible()
3509 if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr || in hwmon_attributes_visible()
3521 if ((adev->flags & AMD_IS_APU) && in hwmon_attributes_visible()
3533 /* Skip crit temp on APU */ in hwmon_attributes_visible()
3534 if ((((adev->flags & AMD_IS_APU) && (adev->family >= AMDGPU_FAMILY_CZ)) || in hwmon_attributes_visible()
3541 if (!adev->pm.dpm_enabled && in hwmon_attributes_visible()
3556 if (((amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3558 ((amdgpu_dpm_get_fan_control_mode(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3562 if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3564 ((amdgpu_dpm_set_fan_control_mode(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3569 if (((adev->family == AMDGPU_FAMILY_SI) || in hwmon_attributes_visible()
3570 ((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(10, 3, 1)) && in hwmon_attributes_visible()
3579 if (((adev->family == AMDGPU_FAMILY_SI) || in hwmon_attributes_visible()
3580 ((adev->flags & AMD_IS_APU) && (gc_ver < IP_VERSION(9, 3, 0)))) && in hwmon_attributes_visible()
3586 …amdgpu_hwmon_get_sensor_generic(adev, AMDGPU_PP_SENSOR_GPU_AVG_POWER, (void *)&tmp) == -EOPNOTSUPP) in hwmon_attributes_visible()
3589 …amdgpu_hwmon_get_sensor_generic(adev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER, (void *)&tmp) == -EOPNOTSU… in hwmon_attributes_visible()
3593 if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3594 (amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3595 (amdgpu_dpm_set_fan_speed_rpm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3596 (amdgpu_dpm_get_fan_speed_rpm(adev, NULL) == -EOPNOTSUPP)) && in hwmon_attributes_visible()
3601 if ((amdgpu_dpm_set_fan_speed_rpm(adev, U32_MAX) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3602 (amdgpu_dpm_get_fan_speed_rpm(adev, NULL) == -EOPNOTSUPP) && in hwmon_attributes_visible()
3607 if ((adev->family == AMDGPU_FAMILY_SI || /* not implemented yet */ in hwmon_attributes_visible()
3608 adev->family == AMDGPU_FAMILY_KV || /* not implemented yet */ in hwmon_attributes_visible()
3616 if ((!(adev->flags & AMD_IS_APU) || in hwmon_attributes_visible()
3624 if (((adev->flags & AMD_IS_APU) && (gc_ver != IP_VERSION(9, 4, 3))) && in hwmon_attributes_visible()
3629 if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0)) && in hwmon_attributes_visible()
3649 return attr->mode; in hwmon_attributes_visible()
3653 if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0)) && in hwmon_attributes_visible()
3692 return -EPERM; in amdgpu_retrieve_od_settings()
3693 if (adev->in_suspend && !adev->in_runpm) in amdgpu_retrieve_od_settings()
3694 return -EPERM; in amdgpu_retrieve_od_settings()
3696 ret = pm_runtime_get_if_active(adev->dev); in amdgpu_retrieve_od_settings()
3698 return ret ?: -EPERM; in amdgpu_retrieve_od_settings()
3704 pm_runtime_put_autosuspend(adev->dev); in amdgpu_retrieve_od_settings()
3721 if (count > sizeof(buf_cpy) - 1) in parse_input_od_command_lines()
3722 return -EINVAL; in parse_input_od_command_lines()
3750 return -EINVAL; in parse_input_od_command_lines()
3773 return -EPERM; in amdgpu_distribute_custom_od_settings()
3774 if (adev->in_suspend && !adev->in_runpm) in amdgpu_distribute_custom_od_settings()
3775 return -EPERM; in amdgpu_distribute_custom_od_settings()
3785 ret = pm_runtime_resume_and_get(adev->dev); in amdgpu_distribute_custom_od_settings()
3804 pm_runtime_mark_last_busy(adev->dev); in amdgpu_distribute_custom_od_settings()
3805 pm_runtime_put_autosuspend(adev->dev); in amdgpu_distribute_custom_od_settings()
3810 pm_runtime_mark_last_busy(adev->dev); in amdgpu_distribute_custom_od_settings()
3811 pm_runtime_put_autosuspend(adev->dev); in amdgpu_distribute_custom_od_settings()
3848 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_curve_show()
3859 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_curve_store()
3871 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE) in fan_curve_visible()
3874 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_CURVE_SET) in fan_curve_visible()
3906 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in acoustic_limit_threshold_show()
3917 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in acoustic_limit_threshold_store()
3929 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE) in acoustic_limit_threshold_visible()
3932 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET) in acoustic_limit_threshold_visible()
3955 * This setting works under auto fan control mode only. It can co-exist with
3966 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in acoustic_target_threshold_show()
3977 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in acoustic_target_threshold_store()
3989 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_RETRIEVE) in acoustic_target_threshold_visible()
3992 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET) in acoustic_target_threshold_visible()
4015 * This setting works under auto fan control mode only. It can co-exist with
4027 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_target_temperature_show()
4038 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_target_temperature_store()
4050 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE) in fan_target_temperature_visible()
4053 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET) in fan_target_temperature_visible()
4076 * This setting works under auto fan control mode only. It can co-exist with
4086 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_minimum_pwm_show()
4097 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_minimum_pwm_store()
4109 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE) in fan_minimum_pwm_visible()
4112 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET) in fan_minimum_pwm_visible()
4140 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_zero_rpm_enable_show()
4151 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_zero_rpm_enable_store()
4163 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_ENABLE_RETRIEVE) in fan_zero_rpm_enable_visible()
4166 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_ENABLE_SET) in fan_zero_rpm_enable_visible()
4197 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_zero_rpm_stop_temp_show()
4208 struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; in fan_zero_rpm_stop_temp_store()
4220 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_STOP_TEMP_RETRIEVE) in fan_zero_rpm_stop_temp_visible()
4223 if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_STOP_TEMP_SET) in fan_zero_rpm_stop_temp_visible()
4312 if (list_empty(&adev->pm.od_kobj_list)) in amdgpu_od_set_fini()
4316 &adev->pm.od_kobj_list, entry) { in amdgpu_od_set_fini()
4317 list_del(&container->entry); in amdgpu_od_set_fini()
4320 &container->attribute, entry) { in amdgpu_od_set_fini()
4321 list_del(&attribute->entry); in amdgpu_od_set_fini()
4322 sysfs_remove_file(&container->kobj, in amdgpu_od_set_fini()
4323 &attribute->attribute.attr); in amdgpu_od_set_fini()
4327 kobject_put(&container->kobj); in amdgpu_od_set_fini()
4336 if (!feature_ops->is_visible) in amdgpu_is_od_feature_supported()
4344 mode = feature_ops->is_visible(adev); in amdgpu_is_od_feature_supported()
4362 for (i = 0; i < ARRAY_SIZE(container->sub_feature); i++) { in amdgpu_od_is_self_contained()
4363 if (container->sub_feature[i].name && in amdgpu_od_is_self_contained()
4365 &container->sub_feature[i].ops)) in amdgpu_od_is_self_contained()
4384 return -ENOMEM; in amdgpu_od_set_init()
4385 list_add(&top_set->entry, &adev->pm.od_kobj_list); in amdgpu_od_set_init()
4387 ret = kobject_init_and_add(&top_set->kobj, in amdgpu_od_set_init()
4389 &adev->dev->kobj, in amdgpu_od_set_init()
4394 INIT_LIST_HEAD(&top_set->attribute); in amdgpu_od_set_init()
4395 top_set->priv = adev; in amdgpu_od_set_init()
4400 if (!container->name) in amdgpu_od_set_init()
4412 &container->ops)) in amdgpu_od_set_init()
4421 ret = -ENOMEM; in amdgpu_od_set_init()
4424 list_add(&attribute->entry, &top_set->attribute); in amdgpu_od_set_init()
4426 attribute->attribute.attr.mode = in amdgpu_od_set_init()
4427 container->ops.is_visible(adev); in amdgpu_od_set_init()
4428 attribute->attribute.attr.name = container->name; in amdgpu_od_set_init()
4429 attribute->attribute.show = in amdgpu_od_set_init()
4430 container->ops.show; in amdgpu_od_set_init()
4431 attribute->attribute.store = in amdgpu_od_set_init()
4432 container->ops.store; in amdgpu_od_set_init()
4433 ret = sysfs_create_file(&top_set->kobj, in amdgpu_od_set_init()
4434 &attribute->attribute.attr); in amdgpu_od_set_init()
4441 ret = -ENOMEM; in amdgpu_od_set_init()
4444 list_add(&sub_set->entry, &adev->pm.od_kobj_list); in amdgpu_od_set_init()
4446 ret = kobject_init_and_add(&sub_set->kobj, in amdgpu_od_set_init()
4448 &top_set->kobj, in amdgpu_od_set_init()
4450 container->name); in amdgpu_od_set_init()
4453 INIT_LIST_HEAD(&sub_set->attribute); in amdgpu_od_set_init()
4454 sub_set->priv = adev; in amdgpu_od_set_init()
4456 for (j = 0; j < ARRAY_SIZE(container->sub_feature); j++) { in amdgpu_od_set_init()
4457 feature = &container->sub_feature[j]; in amdgpu_od_set_init()
4458 if (!feature->name) in amdgpu_od_set_init()
4462 &feature->ops)) in amdgpu_od_set_init()
4471 ret = -ENOMEM; in amdgpu_od_set_init()
4474 list_add(&attribute->entry, &sub_set->attribute); in amdgpu_od_set_init()
4476 attribute->attribute.attr.mode = in amdgpu_od_set_init()
4477 feature->ops.is_visible(adev); in amdgpu_od_set_init()
4478 attribute->attribute.attr.name = feature->name; in amdgpu_od_set_init()
4479 attribute->attribute.show = in amdgpu_od_set_init()
4480 feature->ops.show; in amdgpu_od_set_init()
4481 attribute->attribute.store = in amdgpu_od_set_init()
4482 feature->ops.store; in amdgpu_od_set_init()
4483 ret = sysfs_create_file(&sub_set->kobj, in amdgpu_od_set_init()
4484 &attribute->attribute.attr); in amdgpu_od_set_init()
4495 if (list_is_singular(&adev->pm.od_kobj_list)) in amdgpu_od_set_init()
4512 if (adev->pm.sysfs_initialized) in amdgpu_pm_sysfs_init()
4515 INIT_LIST_HEAD(&adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
4517 if (adev->pm.dpm_enabled == 0) in amdgpu_pm_sysfs_init()
4522 /* under multi-vf mode, the hwmon attributes are all not supported */ in amdgpu_pm_sysfs_init()
4524 adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev, in amdgpu_pm_sysfs_init()
4527 if (IS_ERR(adev->pm.int_hwmon_dev)) { in amdgpu_pm_sysfs_init()
4528 ret = PTR_ERR(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_init()
4529 dev_err(adev->dev, "Unable to register hwmon device: %d\n", ret); in amdgpu_pm_sysfs_init()
4551 &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
4559 } else if (adev->pm.pp_feature & PP_OVERDRIVE_MASK) { in amdgpu_pm_sysfs_init()
4560 dev_info(adev->dev, "overdrive feature is not supported\n"); in amdgpu_pm_sysfs_init()
4564 -EOPNOTSUPP) { in amdgpu_pm_sysfs_init()
4565 ret = devm_device_add_group(adev->dev, in amdgpu_pm_sysfs_init()
4571 adev->pm.sysfs_initialized = true; in amdgpu_pm_sysfs_init()
4576 amdgpu_device_attr_remove_groups(adev, &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_init()
4578 if (adev->pm.int_hwmon_dev) in amdgpu_pm_sysfs_init()
4579 hwmon_device_unregister(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_init()
4588 if (adev->pm.int_hwmon_dev) in amdgpu_pm_sysfs_fini()
4589 hwmon_device_unregister(adev->pm.int_hwmon_dev); in amdgpu_pm_sysfs_fini()
4591 amdgpu_device_attr_remove_groups(adev, &adev->pm.pm_attr_list); in amdgpu_pm_sysfs_fini()
4651 if (adev->flags & AMD_IS_APU) in amdgpu_debugfs_pm_info_pp()
4658 if (adev->flags & AMD_IS_APU) in amdgpu_debugfs_pm_info_pp()
4666 /* GPU Temp */ in amdgpu_debugfs_pm_info_pp()
4780 struct amdgpu_device *adev = (struct amdgpu_device *)m->private; in amdgpu_debugfs_pm_info_show()
4786 return -EPERM; in amdgpu_debugfs_pm_info_show()
4787 if (adev->in_suspend && !adev->in_runpm) in amdgpu_debugfs_pm_info_show()
4788 return -EPERM; in amdgpu_debugfs_pm_info_show()
4790 r = pm_runtime_resume_and_get(dev->dev); in amdgpu_debugfs_pm_info_show()
4807 pm_runtime_put_autosuspend(dev->dev); in amdgpu_debugfs_pm_info_show()
4815 * amdgpu_pm_priv_buffer_read - Read memory region allocated to FW
4822 struct amdgpu_device *adev = file_inode(f)->i_private; in amdgpu_pm_prv_buffer_read()
4828 return -EPERM; in amdgpu_pm_prv_buffer_read()
4829 if (adev->in_suspend && !adev->in_runpm) in amdgpu_pm_prv_buffer_read()
4830 return -EPERM; in amdgpu_pm_prv_buffer_read()
4837 return -EINVAL; in amdgpu_pm_prv_buffer_read()
4855 struct drm_minor *minor = adev_to_drm(adev)->primary; in amdgpu_debugfs_pm_init()
4856 struct dentry *root = minor->debugfs_root; in amdgpu_debugfs_pm_init()
4858 if (!adev->pm.dpm_enabled) in amdgpu_debugfs_pm_init()
4864 if (adev->pm.smu_prv_buffer_size > 0) in amdgpu_debugfs_pm_init()
4868 adev->pm.smu_prv_buffer_size); in amdgpu_debugfs_pm_init()