aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2016-10-26 06:05:00 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-10-27 15:18:58 -0400
commit3495a103579380288a130dc1862488cd8a4293f5 (patch)
treefd07fb6b1dc0c61a15ba563cad3ef2e46687f45c /drivers/gpu/drm
parent415282b15e15c2d7fb18e29c5b554cc7f4ff5c52 (diff)
drm/amdgpu: turn on/off uvd clock when dpm enable/disable on CI
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 3295fbbdf8c8..e9b1964d4e61 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -887,9 +887,6 @@ static void ci_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate)
887{ 887{
888 struct ci_power_info *pi = ci_get_pi(adev); 888 struct ci_power_info *pi = ci_get_pi(adev);
889 889
890 if (pi->uvd_power_gated == gate)
891 return;
892
893 pi->uvd_power_gated = gate; 890 pi->uvd_power_gated = gate;
894 891
895 ci_update_uvd_dpm(adev, gate); 892 ci_update_uvd_dpm(adev, gate);
@@ -4201,8 +4198,15 @@ static int ci_update_uvd_dpm(struct amdgpu_device *adev, bool gate)
4201{ 4198{
4202 struct ci_power_info *pi = ci_get_pi(adev); 4199 struct ci_power_info *pi = ci_get_pi(adev);
4203 u32 tmp; 4200 u32 tmp;
4201 int ret = 0;
4204 4202
4205 if (!gate) { 4203 if (!gate) {
4204 /* turn the clocks on when decoding */
4205 ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
4206 AMD_CG_STATE_UNGATE);
4207 if (ret)
4208 return ret;
4209
4206 if (pi->caps_uvd_dpm || 4210 if (pi->caps_uvd_dpm ||
4207 (adev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table.count <= 0)) 4211 (adev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table.count <= 0))
4208 pi->smc_state_table.UvdBootLevel = 0; 4212 pi->smc_state_table.UvdBootLevel = 0;
@@ -4214,9 +4218,17 @@ static int ci_update_uvd_dpm(struct amdgpu_device *adev, bool gate)
4214 tmp &= ~DPM_TABLE_475__UvdBootLevel_MASK; 4218 tmp &= ~DPM_TABLE_475__UvdBootLevel_MASK;
4215 tmp |= (pi->smc_state_table.UvdBootLevel << DPM_TABLE_475__UvdBootLevel__SHIFT); 4219 tmp |= (pi->smc_state_table.UvdBootLevel << DPM_TABLE_475__UvdBootLevel__SHIFT);
4216 WREG32_SMC(ixDPM_TABLE_475, tmp); 4220 WREG32_SMC(ixDPM_TABLE_475, tmp);
4221 ret = ci_enable_uvd_dpm(adev, true);
4222 } else {
4223 ret = ci_enable_uvd_dpm(adev, false);
4224 if (ret)
4225 return ret;
4226
4227 ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
4228 AMD_CG_STATE_GATE);
4217 } 4229 }
4218 4230
4219 return ci_enable_uvd_dpm(adev, !gate); 4231 return ret;
4220} 4232}
4221 4233
4222static u8 ci_get_vce_boot_level(struct amdgpu_device *adev) 4234static u8 ci_get_vce_boot_level(struct amdgpu_device *adev)