Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/pm: add fan acoustic limit OD setting support for SMU13

Add SMU13 fan acoustic limit OD setting support.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Evan Quan and committed by
Alex Deucher
548009ad d7bf1b55

+176 -2
+6
Documentation/gpu/amdgpu/thermal.rst
··· 70 70 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c 71 71 :doc: fan_curve 72 72 73 + acoustic_limit_rpm_threshold 74 + ---------------------------- 75 + 76 + .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c 77 + :doc: acoustic_limit_rpm_threshold 78 + 73 79 GFXOFF 74 80 ====== 75 81
+2
drivers/gpu/drm/amd/include/kgd_pp_interface.h
··· 114 114 OD_VDDGFX_OFFSET, 115 115 OD_CCLK, 116 116 OD_FAN_CURVE, 117 + OD_ACOUSTIC_LIMIT, 117 118 }; 118 119 119 120 enum amd_pp_sensors { ··· 190 189 PP_OD_COMMIT_DPM_TABLE, 191 190 PP_OD_EDIT_VDDGFX_OFFSET, 192 191 PP_OD_EDIT_FAN_CURVE, 192 + PP_OD_EDIT_ACOUSTIC_LIMIT, 193 193 }; 194 194 195 195 struct pp_states_info {
+63
drivers/gpu/drm/amd/pm/amdgpu_pm.c
··· 3575 3575 return umode; 3576 3576 } 3577 3577 3578 + /** 3579 + * DOC: acoustic_limit_rpm_threshold 3580 + * 3581 + * The amdgpu driver provides a sysfs API for checking and adjusting the 3582 + * acoustic limit in RPM for fan control. 3583 + * 3584 + * Reading back the file shows you the current setting and the permitted 3585 + * ranges if changable. 3586 + * 3587 + * Writing an integer to the file, change the setting accordingly. 3588 + * 3589 + * When you have finished the editing, write "c" (commit) to the file to commit 3590 + * your changes. 3591 + * 3592 + * This setting works under auto fan control mode only. It adjusts the PMFW's 3593 + * behavior about the maximum speed in RPM the fan can spin. Setting via this 3594 + * interface will switch the fan control to auto mode implicitly. 3595 + */ 3596 + static ssize_t acoustic_limit_threshold_show(struct kobject *kobj, 3597 + struct kobj_attribute *attr, 3598 + char *buf) 3599 + { 3600 + struct od_kobj *container = container_of(kobj, struct od_kobj, kobj); 3601 + struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; 3602 + 3603 + return (ssize_t)amdgpu_retrieve_od_settings(adev, OD_ACOUSTIC_LIMIT, buf); 3604 + } 3605 + 3606 + static ssize_t acoustic_limit_threshold_store(struct kobject *kobj, 3607 + struct kobj_attribute *attr, 3608 + const char *buf, 3609 + size_t count) 3610 + { 3611 + struct od_kobj *container = container_of(kobj, struct od_kobj, kobj); 3612 + struct amdgpu_device *adev = (struct amdgpu_device *)container->priv; 3613 + 3614 + return (ssize_t)amdgpu_distribute_custom_od_settings(adev, 3615 + PP_OD_EDIT_ACOUSTIC_LIMIT, 3616 + buf, 3617 + count); 3618 + } 3619 + 3620 + static umode_t acoustic_limit_threshold_visible(struct amdgpu_device *adev) 3621 + { 3622 + umode_t umode = 0000; 3623 + 3624 + if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE) 3625 + umode |= S_IRUSR | S_IRGRP | S_IROTH; 3626 + 3627 + if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET) 3628 + umode |= S_IWUSR; 3629 + 3630 + return umode; 3631 + } 3632 + 3578 3633 static struct od_feature_set amdgpu_od_set = { 3579 3634 .containers = { 3580 3635 [0] = { ··· 3641 3586 .is_visible = fan_curve_visible, 3642 3587 .show = fan_curve_show, 3643 3588 .store = fan_curve_store, 3589 + }, 3590 + }, 3591 + [1] = { 3592 + .name = "acoustic_limit_rpm_threshold", 3593 + .ops = { 3594 + .is_visible = acoustic_limit_threshold_visible, 3595 + .show = acoustic_limit_threshold_show, 3596 + .store = acoustic_limit_threshold_store, 3644 3597 }, 3645 3598 }, 3646 3599 },
+2
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
··· 316 316 317 317 #define OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE BIT(0) 318 318 #define OD_OPS_SUPPORT_FAN_CURVE_SET BIT(1) 319 + #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE BIT(2) 320 + #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET BIT(3) 319 321 320 322 struct amdgpu_pm { 321 323 struct mutex mutex;
+2
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 2483 2483 clk_type = SMU_OD_CCLK; break; 2484 2484 case OD_FAN_CURVE: 2485 2485 clk_type = SMU_OD_FAN_CURVE; break; 2486 + case OD_ACOUSTIC_LIMIT: 2487 + clk_type = SMU_OD_ACOUSTIC_LIMIT; break; 2486 2488 default: 2487 2489 clk_type = SMU_CLK_COUNT; break; 2488 2490 }
+1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
··· 281 281 SMU_OD_RANGE, 282 282 SMU_OD_VDDGFX_OFFSET, 283 283 SMU_OD_FAN_CURVE, 284 + SMU_OD_ACOUSTIC_LIMIT, 284 285 SMU_CLK_COUNT, 285 286 }; 286 287
+50 -1
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 103 103 #define PP_OD_FEATURE_GFX_VF_CURVE 4 104 104 #define PP_OD_FEATURE_FAN_CURVE_TEMP 5 105 105 #define PP_OD_FEATURE_FAN_CURVE_PWM 6 106 + #define PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT 7 106 107 107 108 #define LINK_SPEED_MAX 3 108 109 ··· 1133 1132 od_min_setting = overdrive_lowerlimits->FanLinearPwmPoints; 1134 1133 od_max_setting = overdrive_upperlimits->FanLinearPwmPoints; 1135 1134 break; 1135 + case PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT: 1136 + od_min_setting = overdrive_lowerlimits->AcousticLimitRpmThreshold; 1137 + od_max_setting = overdrive_upperlimits->AcousticLimitRpmThreshold; 1138 + break; 1136 1139 default: 1137 1140 od_min_setting = od_max_setting = INT_MAX; 1138 1141 break; ··· 1385 1380 1386 1381 break; 1387 1382 1383 + case SMU_OD_ACOUSTIC_LIMIT: 1384 + if (!smu_v13_0_0_is_od_feature_supported(smu, 1385 + PP_OD_FEATURE_FAN_CURVE_BIT)) 1386 + break; 1387 + 1388 + size += sysfs_emit_at(buf, size, "OD_ACOUSTIC_LIMIT:\n"); 1389 + size += sysfs_emit_at(buf, size, "%d\n", 1390 + (int)od_table->OverDriveTable.AcousticLimitRpmThreshold); 1391 + 1392 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 1393 + smu_v13_0_0_get_od_setting_limits(smu, 1394 + PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT, 1395 + &min_value, 1396 + &max_value); 1397 + size += sysfs_emit_at(buf, size, "ACOUSTIC_LIMIT: %u %u\n", 1398 + min_value, max_value); 1399 + break; 1400 + 1388 1401 case SMU_OD_RANGE: 1389 1402 if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) && 1390 1403 !smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) && ··· 1648 1625 od_table->OverDriveTable.FanLinearTempPoints[input[0]] = input[1]; 1649 1626 od_table->OverDriveTable.FanLinearPwmPoints[input[0]] = input[2]; 1650 1627 od_table->OverDriveTable.FanMode = FAN_MODE_MANUAL_LINEAR; 1628 + od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT); 1629 + break; 1630 + 1631 + case PP_OD_EDIT_ACOUSTIC_LIMIT: 1632 + if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) { 1633 + dev_warn(adev->dev, "Fan curve setting not supported!\n"); 1634 + return -ENOTSUPP; 1635 + } 1636 + 1637 + smu_v13_0_0_get_od_setting_limits(smu, 1638 + PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT, 1639 + &minimum, 1640 + &maximum); 1641 + if (input[0] < minimum || 1642 + input[0] > maximum) { 1643 + dev_info(adev->dev, "acoustic limit threshold setting(%ld) must be within [%d, %d]!\n", 1644 + input[0], minimum, maximum); 1645 + return -EINVAL; 1646 + } 1647 + 1648 + od_table->OverDriveTable.AcousticLimitRpmThreshold = input[0]; 1649 + od_table->OverDriveTable.FanMode = FAN_MODE_AUTO; 1651 1650 od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT); 1652 1651 break; 1653 1652 ··· 1930 1885 if (smu_v13_0_0_is_od_feature_supported(smu, 1931 1886 PP_OD_FEATURE_FAN_CURVE_BIT)) 1932 1887 adev->pm.od_feature_mask |= OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE | 1933 - OD_OPS_SUPPORT_FAN_CURVE_SET; 1888 + OD_OPS_SUPPORT_FAN_CURVE_SET | 1889 + OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE | 1890 + OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET; 1934 1891 } 1935 1892 1936 1893 static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu) ··· 1990 1943 user_od_table->OverDriveTable.FanLinearPwmPoints[i] = 1991 1944 user_od_table_bak.OverDriveTable.FanLinearPwmPoints[i]; 1992 1945 } 1946 + user_od_table->OverDriveTable.AcousticLimitRpmThreshold = 1947 + user_od_table_bak.OverDriveTable.AcousticLimitRpmThreshold; 1993 1948 } 1994 1949 1995 1950 smu_v13_0_0_set_supported_od_feature_mask(smu);
+50 -1
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
··· 79 79 #define PP_OD_FEATURE_GFX_VF_CURVE 4 80 80 #define PP_OD_FEATURE_FAN_CURVE_TEMP 5 81 81 #define PP_OD_FEATURE_FAN_CURVE_PWM 6 82 + #define PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT 7 82 83 83 84 #define LINK_SPEED_MAX 3 84 85 ··· 1113 1112 od_min_setting = overdrive_lowerlimits->FanLinearPwmPoints; 1114 1113 od_max_setting = overdrive_upperlimits->FanLinearPwmPoints; 1115 1114 break; 1115 + case PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT: 1116 + od_min_setting = overdrive_lowerlimits->AcousticLimitRpmThreshold; 1117 + od_max_setting = overdrive_upperlimits->AcousticLimitRpmThreshold; 1118 + break; 1116 1119 default: 1117 1120 od_min_setting = od_max_setting = INT_MAX; 1118 1121 break; ··· 1365 1360 1366 1361 break; 1367 1362 1363 + case SMU_OD_ACOUSTIC_LIMIT: 1364 + if (!smu_v13_0_7_is_od_feature_supported(smu, 1365 + PP_OD_FEATURE_FAN_CURVE_BIT)) 1366 + break; 1367 + 1368 + size += sysfs_emit_at(buf, size, "OD_ACOUSTIC_LIMIT:\n"); 1369 + size += sysfs_emit_at(buf, size, "%d\n", 1370 + (int)od_table->OverDriveTable.AcousticLimitRpmThreshold); 1371 + 1372 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 1373 + smu_v13_0_7_get_od_setting_limits(smu, 1374 + PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT, 1375 + &min_value, 1376 + &max_value); 1377 + size += sysfs_emit_at(buf, size, "ACOUSTIC_LIMIT: %u %u\n", 1378 + min_value, max_value); 1379 + break; 1380 + 1368 1381 case SMU_OD_RANGE: 1369 1382 if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) && 1370 1383 !smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) && ··· 1628 1605 od_table->OverDriveTable.FanLinearTempPoints[input[0]] = input[1]; 1629 1606 od_table->OverDriveTable.FanLinearPwmPoints[input[0]] = input[2]; 1630 1607 od_table->OverDriveTable.FanMode = FAN_MODE_MANUAL_LINEAR; 1608 + od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT); 1609 + break; 1610 + 1611 + case PP_OD_EDIT_ACOUSTIC_LIMIT: 1612 + if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) { 1613 + dev_warn(adev->dev, "Fan curve setting not supported!\n"); 1614 + return -ENOTSUPP; 1615 + } 1616 + 1617 + smu_v13_0_7_get_od_setting_limits(smu, 1618 + PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT, 1619 + &minimum, 1620 + &maximum); 1621 + if (input[0] < minimum || 1622 + input[0] > maximum) { 1623 + dev_info(adev->dev, "acoustic limit threshold setting(%ld) must be within [%d, %d]!\n", 1624 + input[0], minimum, maximum); 1625 + return -EINVAL; 1626 + } 1627 + 1628 + od_table->OverDriveTable.AcousticLimitRpmThreshold = input[0]; 1629 + od_table->OverDriveTable.FanMode = FAN_MODE_AUTO; 1631 1630 od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT); 1632 1631 break; 1633 1632 ··· 1905 1860 if (smu_v13_0_7_is_od_feature_supported(smu, 1906 1861 PP_OD_FEATURE_FAN_CURVE_BIT)) 1907 1862 adev->pm.od_feature_mask |= OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE | 1908 - OD_OPS_SUPPORT_FAN_CURVE_SET; 1863 + OD_OPS_SUPPORT_FAN_CURVE_SET | 1864 + OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE | 1865 + OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET; 1909 1866 } 1910 1867 1911 1868 static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu) ··· 1965 1918 user_od_table->OverDriveTable.FanLinearPwmPoints[i] = 1966 1919 user_od_table_bak.OverDriveTable.FanLinearPwmPoints[i]; 1967 1920 } 1921 + user_od_table->OverDriveTable.AcousticLimitRpmThreshold = 1922 + user_od_table_bak.OverDriveTable.AcousticLimitRpmThreshold; 1968 1923 } 1969 1924 1970 1925 smu_v13_0_7_set_supported_od_feature_mask(smu);