drm/amdgpu: fix uvd can't initialized when dpm disabled on Ci.
authorRex Zhu <Rex.Zhu@amd.com>
Fri, 3 Feb 2017 09:33:11 +0000 (17:33 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Feb 2017 22:21:32 +0000 (17:21 -0500)
need to start smc when dpm disabled.
otherwise, uvd can't get response from smu.
so uvd ring test and ib test will timeout.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/ci_dpm.c

index 9498e78b90d7a4714b36736d3658f17bc4746ecd..a947022bfee81c289173cb8aac6f1c7a36671d1a 100644 (file)
@@ -2210,7 +2210,6 @@ static void ci_clear_vc(struct amdgpu_device *adev)
 
 static int ci_upload_firmware(struct amdgpu_device *adev)
 {
-       struct ci_power_info *pi = ci_get_pi(adev);
        int i, ret;
 
        if (amdgpu_ci_is_smc_running(adev)) {
@@ -2227,7 +2226,7 @@ static int ci_upload_firmware(struct amdgpu_device *adev)
        amdgpu_ci_stop_smc_clock(adev);
        amdgpu_ci_reset_smc(adev);
 
-       ret = amdgpu_ci_load_smc_ucode(adev, pi->sram_end);
+       ret = amdgpu_ci_load_smc_ucode(adev, SMC_RAM_END);
 
        return ret;
 
@@ -6278,13 +6277,13 @@ static int ci_dpm_sw_init(void *handle)
        adev->pm.current_mclk = adev->clock.default_mclk;
        adev->pm.int_thermal_type = THERMAL_TYPE_NONE;
 
-       if (amdgpu_dpm == 0)
-               return 0;
-
        ret = ci_dpm_init_microcode(adev);
        if (ret)
                return ret;
 
+       if (amdgpu_dpm == 0)
+               return 0;
+
        INIT_WORK(&adev->pm.dpm.thermal.work, amdgpu_dpm_thermal_work_handler);
        mutex_lock(&adev->pm.mutex);
        ret = ci_dpm_init(adev);
@@ -6328,8 +6327,15 @@ static int ci_dpm_hw_init(void *handle)
 
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       if (!amdgpu_dpm)
+       if (!amdgpu_dpm) {
+               ret = ci_upload_firmware(adev);
+               if (ret) {
+                       DRM_ERROR("ci_upload_firmware failed\n");
+                       return ret;
+               }
+               ci_dpm_start_smc(adev);
                return 0;
+       }
 
        mutex_lock(&adev->pm.mutex);
        ci_dpm_setup_asic(adev);
@@ -6351,6 +6357,8 @@ static int ci_dpm_hw_fini(void *handle)
                mutex_lock(&adev->pm.mutex);
                ci_dpm_disable(adev);
                mutex_unlock(&adev->pm.mutex);
+       } else {
+               ci_dpm_stop_smc(adev);
        }
 
        return 0;