mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
drm/amd/powerplay: update current profile mode only when it's really applied
No need to update current profile mode if the new profile mode does not take effect in fact. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
c0415c8722
commit
e815a9e62b
2 changed files with 12 additions and 10 deletions
|
@ -4904,13 +4904,12 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
|
||||||
uint8_t FPS;
|
uint8_t FPS;
|
||||||
uint8_t use_rlc_busy;
|
uint8_t use_rlc_busy;
|
||||||
uint8_t min_active_level;
|
uint8_t min_active_level;
|
||||||
|
uint32_t power_profile_mode = input[size];
|
||||||
hwmgr->power_profile_mode = input[size];
|
|
||||||
|
|
||||||
smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
|
smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
|
||||||
1<<hwmgr->power_profile_mode);
|
1 << power_profile_mode);
|
||||||
|
|
||||||
if (hwmgr->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
|
if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
|
||||||
if (size == 0 || size > 4)
|
if (size == 0 || size > 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -4924,6 +4923,8 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
|
||||||
use_rlc_busy << 16 | min_active_level<<24);
|
use_rlc_busy << 16 | min_active_level<<24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hwmgr->power_profile_mode = power_profile_mode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3819,15 +3819,14 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
|
||||||
{
|
{
|
||||||
DpmActivityMonitorCoeffInt_t activity_monitor;
|
DpmActivityMonitorCoeffInt_t activity_monitor;
|
||||||
int workload_type, result = 0;
|
int workload_type, result = 0;
|
||||||
|
uint32_t power_profile_mode = input[size];
|
||||||
|
|
||||||
hwmgr->power_profile_mode = input[size];
|
if (power_profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
|
||||||
|
pr_err("Invalid power profile mode %d\n", power_profile_mode);
|
||||||
if (hwmgr->power_profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
|
|
||||||
pr_err("Invalid power profile mode %d\n", hwmgr->power_profile_mode);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hwmgr->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
|
if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
|
||||||
if (size < 10)
|
if (size < 10)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -3895,10 +3894,12 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
|
||||||
|
|
||||||
/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
|
/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
|
||||||
workload_type =
|
workload_type =
|
||||||
conv_power_profile_to_pplib_workload(hwmgr->power_profile_mode);
|
conv_power_profile_to_pplib_workload(power_profile_mode);
|
||||||
smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
|
smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
|
||||||
1 << workload_type);
|
1 << workload_type);
|
||||||
|
|
||||||
|
hwmgr->power_profile_mode = power_profile_mode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue