@@ -2224,8 +2224,9 @@ static int smu_bump_power_profile_mode(struct smu_context *smu,
22242224}
22252225
22262226static int smu_adjust_power_state_dynamic (struct smu_context * smu ,
2227- enum amd_dpm_forced_level level ,
2228- bool skip_display_settings )
2227+ enum amd_dpm_forced_level level ,
2228+ bool skip_display_settings ,
2229+ bool force_update )
22292230{
22302231 int ret = 0 ;
22312232 int index = 0 ;
@@ -2254,7 +2255,7 @@ static int smu_adjust_power_state_dynamic(struct smu_context *smu,
22542255 }
22552256 }
22562257
2257- if (smu_dpm_ctx -> dpm_level != level ) {
2258+ if (force_update || smu_dpm_ctx -> dpm_level != level ) {
22582259 ret = smu_asic_set_performance_level (smu , level );
22592260 if (ret ) {
22602261 dev_err (smu -> adev -> dev , "Failed to set performance level!" );
@@ -2265,13 +2266,12 @@ static int smu_adjust_power_state_dynamic(struct smu_context *smu,
22652266 smu_dpm_ctx -> dpm_level = level ;
22662267 }
22672268
2268- if (smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
2269- smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM ) {
2269+ if (smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM ) {
22702270 index = fls (smu -> workload_mask );
22712271 index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0 ;
22722272 workload [0 ] = smu -> workload_setting [index ];
22732273
2274- if (smu -> power_profile_mode != workload [0 ])
2274+ if (force_update || smu -> power_profile_mode != workload [0 ])
22752275 smu_bump_power_profile_mode (smu , workload , 0 );
22762276 }
22772277
@@ -2292,11 +2292,13 @@ static int smu_handle_task(struct smu_context *smu,
22922292 ret = smu_pre_display_config_changed (smu );
22932293 if (ret )
22942294 return ret ;
2295- ret = smu_adjust_power_state_dynamic (smu , level , false);
2295+ ret = smu_adjust_power_state_dynamic (smu , level , false, false );
22962296 break ;
22972297 case AMD_PP_TASK_COMPLETE_INIT :
2298+ ret = smu_adjust_power_state_dynamic (smu , level , true, true);
2299+ break ;
22982300 case AMD_PP_TASK_READJUST_POWER_STATE :
2299- ret = smu_adjust_power_state_dynamic (smu , level , true);
2301+ ret = smu_adjust_power_state_dynamic (smu , level , true, false );
23002302 break ;
23012303 default :
23022304 break ;
@@ -2343,8 +2345,7 @@ static int smu_switch_power_profile(void *handle,
23432345 workload [0 ] = smu -> workload_setting [index ];
23442346 }
23452347
2346- if (smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
2347- smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM )
2348+ if (smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM )
23482349 smu_bump_power_profile_mode (smu , workload , 0 );
23492350
23502351 return 0 ;
0 commit comments