Commit 3510bafe authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amdgpu: Fix vce initialize failed on Kaveri/Mullins

Forgot to add vce pg support via smu for Kaveri/Mullins.

Fixes: 561a5c83eadd ("drm/amd/pp: Unify powergate_uvd/vce/mmhub
                       to set_powergating_by_smu")

v2: refine patch descriptions suggested by Michel
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Tested-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d3200a53
...@@ -66,7 +66,6 @@ static int kv_set_thermal_temperature_range(struct amdgpu_device *adev, ...@@ -66,7 +66,6 @@ static int kv_set_thermal_temperature_range(struct amdgpu_device *adev,
static int kv_init_fps_limits(struct amdgpu_device *adev); static int kv_init_fps_limits(struct amdgpu_device *adev);
static void kv_dpm_powergate_uvd(void *handle, bool gate); static void kv_dpm_powergate_uvd(void *handle, bool gate);
static void kv_dpm_powergate_vce(struct amdgpu_device *adev, bool gate);
static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate); static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);
static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate); static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);
...@@ -1374,6 +1373,8 @@ static int kv_dpm_enable(struct amdgpu_device *adev) ...@@ -1374,6 +1373,8 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
static void kv_dpm_disable(struct amdgpu_device *adev) static void kv_dpm_disable(struct amdgpu_device *adev)
{ {
struct kv_power_info *pi = kv_get_pi(adev);
amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq, amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
AMDGPU_THERMAL_IRQ_LOW_TO_HIGH); AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq, amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
...@@ -1387,7 +1388,8 @@ static void kv_dpm_disable(struct amdgpu_device *adev) ...@@ -1387,7 +1388,8 @@ static void kv_dpm_disable(struct amdgpu_device *adev)
/* powerup blocks */ /* powerup blocks */
kv_dpm_powergate_acp(adev, false); kv_dpm_powergate_acp(adev, false);
kv_dpm_powergate_samu(adev, false); kv_dpm_powergate_samu(adev, false);
kv_dpm_powergate_vce(adev, false); if (pi->caps_vce_pg) /* power on the VCE block */
amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
kv_dpm_powergate_uvd(adev, false); kv_dpm_powergate_uvd(adev, false);
kv_enable_smc_cac(adev, false); kv_enable_smc_cac(adev, false);
...@@ -1551,7 +1553,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev, ...@@ -1551,7 +1553,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev,
int ret; int ret;
if (amdgpu_new_state->evclk > 0 && amdgpu_current_state->evclk == 0) { if (amdgpu_new_state->evclk > 0 && amdgpu_current_state->evclk == 0) {
kv_dpm_powergate_vce(adev, false);
if (pi->caps_stable_p_state) if (pi->caps_stable_p_state)
pi->vce_boot_level = table->count - 1; pi->vce_boot_level = table->count - 1;
else else
...@@ -1573,7 +1574,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev, ...@@ -1573,7 +1574,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev,
kv_enable_vce_dpm(adev, true); kv_enable_vce_dpm(adev, true);
} else if (amdgpu_new_state->evclk == 0 && amdgpu_current_state->evclk > 0) { } else if (amdgpu_new_state->evclk == 0 && amdgpu_current_state->evclk > 0) {
kv_enable_vce_dpm(adev, false); kv_enable_vce_dpm(adev, false);
kv_dpm_powergate_vce(adev, true);
} }
return 0; return 0;
...@@ -1702,24 +1702,32 @@ static void kv_dpm_powergate_uvd(void *handle, bool gate) ...@@ -1702,24 +1702,32 @@ static void kv_dpm_powergate_uvd(void *handle, bool gate)
} }
} }
static void kv_dpm_powergate_vce(struct amdgpu_device *adev, bool gate) static void kv_dpm_powergate_vce(void *handle, bool gate)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct kv_power_info *pi = kv_get_pi(adev); struct kv_power_info *pi = kv_get_pi(adev);
int ret;
if (pi->vce_power_gated == gate)
return;
pi->vce_power_gated = gate; pi->vce_power_gated = gate;
if (!pi->caps_vce_pg) if (gate) {
return; /* stop the VCE block */
ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
if (gate) AMD_PG_STATE_GATE);
amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF); kv_enable_vce_dpm(adev, false);
else if (pi->caps_vce_pg) /* power off the VCE block */
amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON); amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF);
} else {
if (pi->caps_vce_pg) /* power on the VCE block */
amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
kv_enable_vce_dpm(adev, true);
/* re-init the VCE block */
ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
AMD_PG_STATE_UNGATE);
}
} }
static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate) static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate)
{ {
struct kv_power_info *pi = kv_get_pi(adev); struct kv_power_info *pi = kv_get_pi(adev);
...@@ -3313,6 +3321,9 @@ static int kv_set_powergating_by_smu(void *handle, ...@@ -3313,6 +3321,9 @@ static int kv_set_powergating_by_smu(void *handle,
case AMD_IP_BLOCK_TYPE_UVD: case AMD_IP_BLOCK_TYPE_UVD:
kv_dpm_powergate_uvd(handle, gate); kv_dpm_powergate_uvd(handle, gate);
break; break;
case AMD_IP_BLOCK_TYPE_VCE:
kv_dpm_powergate_vce(handle, gate);
break;
default: default:
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment