mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
drm/amd/pp: Move common dpm check functions to hardwaremanager.c
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e21148ecba
commit
cd277585d6
4 changed files with 10 additions and 29 deletions
|
@ -1011,10 +1011,6 @@ static void cz_reset_acp_boot_level(struct pp_hwmgr *hwmgr)
|
||||||
|
|
||||||
static int cz_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
static int cz_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
if (!smum_is_dpm_running(hwmgr)) {
|
|
||||||
pr_info("dpm has been disabled\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
cz_disable_nb_dpm(hwmgr);
|
cz_disable_nb_dpm(hwmgr);
|
||||||
|
|
||||||
cz_clear_voting_clients(hwmgr);
|
cz_clear_voting_clients(hwmgr);
|
||||||
|
@ -1026,11 +1022,6 @@ static int cz_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
|
|
||||||
static int cz_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
static int cz_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
if (smum_is_dpm_running(hwmgr)) {
|
|
||||||
pr_info("dpm has been enabled\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cz_program_voting_clients(hwmgr);
|
cz_program_voting_clients(hwmgr);
|
||||||
if (cz_start_dpm(hwmgr))
|
if (cz_start_dpm(hwmgr))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -79,6 +79,11 @@ int phm_enable_dynamic_state_management(struct pp_hwmgr *hwmgr)
|
||||||
bool enabled;
|
bool enabled;
|
||||||
PHM_FUNC_CHECK(hwmgr);
|
PHM_FUNC_CHECK(hwmgr);
|
||||||
|
|
||||||
|
if (smum_is_dpm_running(hwmgr)) {
|
||||||
|
pr_info("dpm has been enabled\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != hwmgr->hwmgr_func->dynamic_state_management_enable)
|
if (NULL != hwmgr->hwmgr_func->dynamic_state_management_enable)
|
||||||
ret = hwmgr->hwmgr_func->dynamic_state_management_enable(hwmgr);
|
ret = hwmgr->hwmgr_func->dynamic_state_management_enable(hwmgr);
|
||||||
|
|
||||||
|
@ -96,6 +101,11 @@ int phm_disable_dynamic_state_management(struct pp_hwmgr *hwmgr)
|
||||||
|
|
||||||
PHM_FUNC_CHECK(hwmgr);
|
PHM_FUNC_CHECK(hwmgr);
|
||||||
|
|
||||||
|
if (!smum_is_dpm_running(hwmgr)) {
|
||||||
|
pr_info("dpm has been disabled\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (hwmgr->hwmgr_func->dynamic_state_management_disable)
|
if (hwmgr->hwmgr_func->dynamic_state_management_disable)
|
||||||
ret = hwmgr->hwmgr_func->dynamic_state_management_disable(hwmgr);
|
ret = hwmgr->hwmgr_func->dynamic_state_management_disable(hwmgr);
|
||||||
|
|
||||||
|
|
|
@ -1239,11 +1239,6 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
int tmp_result = 0;
|
int tmp_result = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
tmp_result = (!smum_is_dpm_running(hwmgr)) ? 0 : -1;
|
|
||||||
PP_ASSERT_WITH_CODE(tmp_result == 0,
|
|
||||||
"DPM is already running",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (smu7_voltage_control(hwmgr)) {
|
if (smu7_voltage_control(hwmgr)) {
|
||||||
tmp_result = smu7_enable_voltage_control(hwmgr);
|
tmp_result = smu7_enable_voltage_control(hwmgr);
|
||||||
PP_ASSERT_WITH_CODE(tmp_result == 0,
|
PP_ASSERT_WITH_CODE(tmp_result == 0,
|
||||||
|
@ -1406,11 +1401,6 @@ int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
int tmp_result, result = 0;
|
int tmp_result, result = 0;
|
||||||
|
|
||||||
tmp_result = (smum_is_dpm_running(hwmgr)) ? 0 : -1;
|
|
||||||
PP_ASSERT_WITH_CODE(tmp_result == 0,
|
|
||||||
"DPM is not running right now, no need to disable DPM!",
|
|
||||||
return 0);
|
|
||||||
|
|
||||||
if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
|
if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
|
||||||
PHM_PlatformCaps_ThermalController))
|
PHM_PlatformCaps_ThermalController))
|
||||||
PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
|
PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
|
||||||
|
|
|
@ -2859,11 +2859,6 @@ static int vega10_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
(struct vega10_hwmgr *)(hwmgr->backend);
|
(struct vega10_hwmgr *)(hwmgr->backend);
|
||||||
int tmp_result, result = 0;
|
int tmp_result, result = 0;
|
||||||
|
|
||||||
tmp_result = (!smum_is_dpm_running(hwmgr)) ? 0 : -1;
|
|
||||||
PP_ASSERT_WITH_CODE(!tmp_result,
|
|
||||||
"DPM is already running right , skipping re-enablement!",
|
|
||||||
return 0);
|
|
||||||
|
|
||||||
if ((hwmgr->smu_version == 0x001c2c00) ||
|
if ((hwmgr->smu_version == 0x001c2c00) ||
|
||||||
(hwmgr->smu_version == 0x001c2d00))
|
(hwmgr->smu_version == 0x001c2d00))
|
||||||
smum_send_msg_to_smc_with_parameter(hwmgr,
|
smum_send_msg_to_smc_with_parameter(hwmgr,
|
||||||
|
@ -4687,11 +4682,6 @@ static int vega10_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
|
||||||
{
|
{
|
||||||
int tmp_result, result = 0;
|
int tmp_result, result = 0;
|
||||||
|
|
||||||
tmp_result = (smum_is_dpm_running(hwmgr)) ? 0 : -1;
|
|
||||||
PP_ASSERT_WITH_CODE(tmp_result == 0,
|
|
||||||
"DPM is not running right now, no need to disable DPM!",
|
|
||||||
return 0);
|
|
||||||
|
|
||||||
if (PP_CAP(PHM_PlatformCaps_ThermalController))
|
if (PP_CAP(PHM_PlatformCaps_ThermalController))
|
||||||
vega10_disable_thermal_protection(hwmgr);
|
vega10_disable_thermal_protection(hwmgr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue