From 4e8cb0c011222a7d2cafaca4072a371ad5ecc837 Mon Sep 17 00:00:00 2001 From: Evan Quan Date: Thu, 4 Jun 2020 11:25:28 +0800 Subject: [PATCH] drm/amd/powerplay: move those operations not needed for resume out Since smu_smc_table_hw_init() is needed for both .hw_init and .resume. By doing this, we can drop unnecessary operations on resume. Signed-off-by: Evan Quan Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index 02e660d..dab0add 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -1130,25 +1130,6 @@ static int smu_smc_table_hw_init(struct smu_context *smu, if (ret) return ret; - if (initialize) { - /* get boot_values from vbios to set revision, gfxclk, and etc. */ - ret = smu_get_vbios_bootup_values(smu); - if (ret) - return ret; - - ret = smu_setup_pptable(smu); - if (ret) - return ret; - - /* - * Send msg GetDriverIfVersion to check if the return value is equal - * with DRIVER_IF_VERSION of smc header. - */ - ret = smu_check_fw_version(smu); - if (ret) - return ret; - } - ret = smu_set_driver_table_location(smu); if (ret) return ret; @@ -1236,10 +1217,20 @@ static int smu_start_smc_engine(struct smu_context *smu) if (smu->ppt_funcs->check_fw_status) { ret = smu->ppt_funcs->check_fw_status(smu); - if (ret) + if (ret) { pr_err("SMC is not ready\n"); + return ret; + } } + /* + * Send msg GetDriverIfVersion to check if the return value is equal + * with DRIVER_IF_VERSION of smc header. + */ + ret = smu_check_fw_version(smu); + if (ret) + return ret; + return ret; } @@ -1268,6 +1259,15 @@ static int smu_hw_init(void *handle) if (!smu->pm_enabled) return 0; + /* get boot_values from vbios to set revision, gfxclk, and etc. */ + ret = smu_get_vbios_bootup_values(smu); + if (ret) + return ret; + + ret = smu_setup_pptable(smu); + if (ret) + return ret; + ret = smu_feature_init_dpm(smu); if (ret) goto failed; -- 2.7.4