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

drm/amd/pm: Add reset option for fan_curve on smu13_0_0

Add reset option for fan_curve.
User can use command "echo r > fan_cure" to reset the fan_curve
to boot value

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Ma Jun and committed by
Alex Deucher
f7f9e48f 072ae240

+47 -4
+8
drivers/gpu/drm/amd/pm/amdgpu_pm.c
··· 3446 3446 case 'c': 3447 3447 *type = PP_OD_COMMIT_DPM_TABLE; 3448 3448 return 0; 3449 + case 'r': 3450 + params[parameter_size] = *type; 3451 + *num_of_params = 1; 3452 + *type = PP_OD_RESTORE_DEFAULT_TABLE; 3453 + return 0; 3449 3454 default: 3450 3455 break; 3451 3456 } ··· 3544 3539 * 3545 3540 * When you have finished the editing, write "c" (commit) to the file to commit 3546 3541 * your changes. 3542 + * 3543 + * If you want to reset to the default value, write "r" (reset) to the file to 3544 + * reset them 3547 3545 * 3548 3546 * There are two fan control modes supported: auto and manual. With auto mode, 3549 3547 * PMFW handles the fan speed control(how fan speed reacts to ASIC temperature).
+39 -4
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 1511 1511 return size; 1512 1512 } 1513 1513 1514 + 1515 + static int smu_v13_0_0_od_restore_table_single(struct smu_context *smu, long input) 1516 + { 1517 + struct smu_table_context *table_context = &smu->smu_table; 1518 + OverDriveTableExternal_t *boot_overdrive_table = 1519 + (OverDriveTableExternal_t *)table_context->boot_overdrive_table; 1520 + OverDriveTableExternal_t *od_table = 1521 + (OverDriveTableExternal_t *)table_context->overdrive_table; 1522 + struct amdgpu_device *adev = smu->adev; 1523 + int i; 1524 + 1525 + switch (input) { 1526 + case PP_OD_EDIT_FAN_CURVE: 1527 + for (i = 0; i < NUM_OD_FAN_MAX_POINTS; i++) { 1528 + od_table->OverDriveTable.FanLinearTempPoints[i] = 1529 + boot_overdrive_table->OverDriveTable.FanLinearTempPoints[i]; 1530 + od_table->OverDriveTable.FanLinearPwmPoints[i] = 1531 + boot_overdrive_table->OverDriveTable.FanLinearPwmPoints[i]; 1532 + } 1533 + od_table->OverDriveTable.FanMode = FAN_MODE_AUTO; 1534 + od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT); 1535 + break; 1536 + default: 1537 + dev_info(adev->dev, "Invalid table index: %ld\n", input); 1538 + return -EINVAL; 1539 + } 1540 + 1541 + return 0; 1542 + } 1543 + 1514 1544 static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu, 1515 1545 enum PP_OD_DPM_TABLE_COMMAND type, 1516 1546 long input[], ··· 1827 1797 break; 1828 1798 1829 1799 case PP_OD_RESTORE_DEFAULT_TABLE: 1830 - feature_ctrlmask = od_table->OverDriveTable.FeatureCtrlMask; 1831 - memcpy(od_table, 1800 + if (size == 1) { 1801 + ret = smu_v13_0_0_od_restore_table_single(smu, input[0]); 1802 + if (ret) 1803 + return ret; 1804 + } else { 1805 + feature_ctrlmask = od_table->OverDriveTable.FeatureCtrlMask; 1806 + memcpy(od_table, 1832 1807 table_context->boot_overdrive_table, 1833 1808 sizeof(OverDriveTableExternal_t)); 1834 - od_table->OverDriveTable.FeatureCtrlMask = feature_ctrlmask; 1809 + od_table->OverDriveTable.FeatureCtrlMask = feature_ctrlmask; 1810 + } 1835 1811 fallthrough; 1836 - 1837 1812 case PP_OD_COMMIT_DPM_TABLE: 1838 1813 /* 1839 1814 * The member below instructs PMFW the settings focused in