drm/amd/powerplay: move those operations not needed for resume out
authorEvan Quan <evan.quan@amd.com>
Thu, 4 Jun 2020 03:25:28 +0000 (11:25 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Jul 2020 05:59:16 +0000 (01:59 -0400)
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 <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c

index 02e660d..dab0add 100644 (file)
@@ -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;