drm/amd/pm: Add reset option for fan_ctrl interfaces
Subsystems (3)
PATCH 1/2 drm/amd/pm: Add reset option for fan_ctrl interfaces
Add reset option for fan_ctrl interfaces.
For example:
User can use the "echo r > acoustic_limit_rpm_threshold" command to reset acoustic_limit_rpm_threshold to boot value
Signed-off-by Ma Jun <[email protected]>
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 12 ++++++++++ .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +12 -0
@@ -3680,6 +3680,9 @@ static umode_t fan_curve_visible(struct amdgpu_device *adev)* When you have finished the editing, write "c" (commit) to the file to commit * your changes. * +* If you want to reset to the default value, write "r" (reset) to the file to +* reset them +* * This setting works under auto fan control mode only. It adjusts the PMFW's * behavior about the maximum speed in RPM the fan can spin. Setting via this * interface will switch the fan control to auto mode implicitly.
@@ -3735,6 +3738,9 @@ static umode_t acoustic_limit_threshold_visible(struct amdgpu_device *adev)* When you have finished the editing, write "c" (commit) to the file to commit * your changes. * +* If you want to reset to the default value, write "r" (reset) to the file to +* reset them +* * This setting works under auto fan control mode only. It can co-exist with * other settings which can work also under auto mode. It adjusts the PMFW's * behavior about the maximum speed in RPM the fan can spin when ASIC
@@ -3792,6 +3798,9 @@ static umode_t acoustic_target_threshold_visible(struct amdgpu_device *adev)* When you have finished the editing, write "c" (commit) to the file to commit * your changes. * +* If you want to reset to the default value, write "r" (reset) to the file to +* reset them +* * This setting works under auto fan control mode only. It can co-exist with * other settings which can work also under auto mode. Paring with the * acoustic_target_rpm_threshold setting, they define the maximum speed in
@@ -3850,6 +3859,9 @@ static umode_t fan_target_temperature_visible(struct amdgpu_device *adev)* When you have finished the editing, write "c" (commit) to the file to commit * your changes. * +* If you want to reset to the default value, write "r" (reset) to the file to +* reset them +* * This setting works under auto fan control mode only. It can co-exist with * other settings which can work also under auto mode. It adjusts the PMFW's * behavior about the minimum fan speed in PWM the fan should spin. Setting
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +24 -0
@@ -1533,6 +1533,30 @@ static int smu_v13_0_0_od_restore_table_single(struct smu_context *smu, long inp od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT );break ; +case PP_OD_EDIT_ACOUSTIC_LIMIT : + od_table->OverDriveTable.AcousticLimitRpmThreshold = + boot_overdrive_table->OverDriveTable.AcousticLimitRpmThreshold; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_ACOUSTIC_TARGET : + od_table->OverDriveTable.AcousticTargetRpmThreshold = + boot_overdrive_table->OverDriveTable.AcousticTargetRpmThreshold; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_FAN_TARGET_TEMPERATURE : + od_table->OverDriveTable.FanTargetTemperature = + boot_overdrive_table->OverDriveTable.FanTargetTemperature; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_FAN_MINIMUM_PWM : + od_table->OverDriveTable.FanMinimumPwm = + boot_overdrive_table->OverDriveTable.FanMinimumPwm; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ;default :dev_info (adev->dev,"Invalid table index: %ld\n" , input);return -EINVAL ;
Signature · 1 line
2.34.1
PATCH 2/2 drm/amd/pm: Add reset option for fan_ctrl on smu 13.0.7
Add reset option for fan_ctrl interfaces on the smu v13.0.7 User can use command "echo r > interface_name" to reset the interface to boot value
Signed-off-by Ma Jun <[email protected]>
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 69 +++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +64 -5
@@ -1497,6 +1497,59 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,return size; } +static int smu_v13_0_7_od_restore_table_single (struct smu_context *smu,long input) +{ +struct smu_table_context *table_context = &smu->smu_table; +OverDriveTableExternal_t *boot_overdrive_table = + (OverDriveTableExternal_t *)table_context->boot_overdrive_table; +OverDriveTableExternal_t *od_table = + (OverDriveTableExternal_t *)table_context->overdrive_table; +struct amdgpu_device *adev = smu->adev; +int i; + +switch (input) { +case PP_OD_EDIT_FAN_CURVE : +for (i =0 ; i <NUM_OD_FAN_MAX_POINTS ; i++) { + od_table->OverDriveTable.FanLinearTempPoints[i] = + boot_overdrive_table->OverDriveTable.FanLinearTempPoints[i]; + od_table->OverDriveTable.FanLinearPwmPoints[i] = + boot_overdrive_table->OverDriveTable.FanLinearPwmPoints[i]; + } + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_ACOUSTIC_LIMIT : + od_table->OverDriveTable.AcousticLimitRpmThreshold = + boot_overdrive_table->OverDriveTable.AcousticLimitRpmThreshold; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_ACOUSTIC_TARGET : + od_table->OverDriveTable.AcousticTargetRpmThreshold = + boot_overdrive_table->OverDriveTable.AcousticTargetRpmThreshold; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_FAN_TARGET_TEMPERATURE : + od_table->OverDriveTable.FanTargetTemperature = + boot_overdrive_table->OverDriveTable.FanTargetTemperature; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_FAN_MINIMUM_PWM : + od_table->OverDriveTable.FanMinimumPwm = + boot_overdrive_table->OverDriveTable.FanMinimumPwm; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +default : +dev_info (adev->dev,"Invalid table index: %ld\n" , input); +return -EINVAL ; + } + +return 0 ; +} + static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type, long input[],
@@ -1783,11 +1836,17 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,break ;case PP_OD_RESTORE_DEFAULT_TABLE : - feature_ctrlmask = od_table->OverDriveTable.FeatureCtrlMask; -memcpy (od_table, - table_context->boot_overdrive_table, -sizeof (OverDriveTableExternal_t)); - od_table->OverDriveTable.FeatureCtrlMask = feature_ctrlmask; +if (size ==1 ) { + ret =smu_v13_0_7_od_restore_table_single (smu, input[0 ]); +if (ret) +return ret; + }else { + feature_ctrlmask = od_table->OverDriveTable.FeatureCtrlMask; +memcpy (od_table, + table_context->boot_overdrive_table, +sizeof (OverDriveTableExternal_t)); + od_table->OverDriveTable.FeatureCtrlMask = feature_ctrlmask; + } fallthrough;case PP_OD_COMMIT_DPM_TABLE :
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm/amd/pm: Add reset option for fan_ctrl on smu 13.0.7
Quoted 6 lines · Ma Jun
Add reset option for
fan_ctrlinterfaces on the smu v13.0.7 User can use command "echo r >interface_name" to reset the interface to boot valueSigned-off-by Ma Jun <[email protected]>
Series is:
Acked-by Alex Deucher <[email protected]>
Quoted 94 lines
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 69 +++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +64
-6@@ -1497,6 +1497,59 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,return size; } +static int smu_v13_0_7_od_restore_table_single (struct smu_context *smu,long input) +{ +struct smu_table_context *table_context = &smu->smu_table; +OverDriveTableExternal_t *boot_overdrive_table = + (OverDriveTableExternal_t *)table_context->boot_overdrive_table; +OverDriveTableExternal_t *od_table = + (OverDriveTableExternal_t *)table_context->overdrive_table; +struct amdgpu_device *adev = smu->adev; +int i; + +switch (input) { +case PP_OD_EDIT_FAN_CURVE : +for (i =0 ; i <NUM_OD_FAN_MAX_POINTS ; i++) { + od_table->OverDriveTable.FanLinearTempPoints[i] = + boot_overdrive_table->OverDriveTable.FanLinearTempPoints[i]; + od_table->OverDriveTable.FanLinearPwmPoints[i] = + boot_overdrive_table->OverDriveTable.FanLinearPwmPoints[i]; + } + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_ACOUSTIC_LIMIT : + od_table->OverDriveTable.AcousticLimitRpmThreshold = + boot_overdrive_table->OverDriveTable.AcousticLimitRpmThreshold; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_ACOUSTIC_TARGET : + od_table->OverDriveTable.AcousticTargetRpmThreshold = + boot_overdrive_table->OverDriveTable.AcousticTargetRpmThreshold; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_FAN_TARGET_TEMPERATURE : + od_table->OverDriveTable.FanTargetTemperature = + boot_overdrive_table->OverDriveTable.FanTargetTemperature; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +case PP_OD_EDIT_FAN_MINIMUM_PWM : + od_table->OverDriveTable.FanMinimumPwm = + boot_overdrive_table->OverDriveTable.FanMinimumPwm; + od_table->OverDriveTable.FanMode =FAN_MODE_AUTO ; + od_table->OverDriveTable.FeatureCtrlMask |=BIT (PP_OD_FEATURE_FAN_CURVE_BIT ); +break ; +default : +dev_info (adev->dev,"Invalid table index: %ld\n" , input); +return -EINVAL ; + } + +return 0 ; +} + static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type, long input[],@@ -1783,11 +1836,17 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,break ;case PP_OD_RESTORE_DEFAULT_TABLE : - feature_ctrlmask = od_table->OverDriveTable.FeatureCtrlMask; -memcpy (od_table, - table_context->boot_overdrive_table, -sizeof (OverDriveTableExternal_t)); - od_table->OverDriveTable.FeatureCtrlMask = feature_ctrlmask; +if (size ==1 ) { + ret =smu_v13_0_7_od_restore_table_single (smu, input[0 ]); +if (ret) +return ret; + }else { + feature_ctrlmask = od_table->OverDriveTable.FeatureCtrlMask; +memcpy (od_table, + table_context->boot_overdrive_table, +sizeof (OverDriveTableExternal_t)); + od_table->OverDriveTable.FeatureCtrlMask = feature_ctrlmask; + } fallthrough;case PP_OD_COMMIT_DPM_TABLE : --2.34.1