Commit 2e3b2cb9 authored by Yifan Zhang's avatar Yifan Zhang Committed by Alex Deucher

drm/amd/pm: only poweron/off vcn/jpeg when they are valid.

If vcn is disabled in kernel parameters, don't touch vcn,
otherwise it may cause vcn hang.

v2: delete unnecessary logs
v3: move "is_vcn_enabled" check to smu_dpm_setvcn/jpeg_enable (Evan)
Signed-off-by: default avatarYifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 813ba1ff
...@@ -215,6 +215,20 @@ static int smu_set_gfx_imu_enable(struct smu_context *smu) ...@@ -215,6 +215,20 @@ static int smu_set_gfx_imu_enable(struct smu_context *smu)
return smu_set_gfx_power_up_by_imu(smu); return smu_set_gfx_power_up_by_imu(smu);
} }
static bool is_vcn_enabled(struct amdgpu_device *adev)
{
int i;
for (i = 0; i < adev->num_ip_blocks; i++) {
if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_JPEG) &&
!adev->ip_blocks[i].status.valid)
return false;
}
return true;
}
static int smu_dpm_set_vcn_enable(struct smu_context *smu, static int smu_dpm_set_vcn_enable(struct smu_context *smu,
bool enable) bool enable)
{ {
...@@ -222,6 +236,12 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu, ...@@ -222,6 +236,12 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu,
struct smu_power_gate *power_gate = &smu_power->power_gate; struct smu_power_gate *power_gate = &smu_power->power_gate;
int ret = 0; int ret = 0;
/*
* don't poweron vcn/jpeg when they are skipped.
*/
if (!is_vcn_enabled(smu->adev))
return 0;
if (!smu->ppt_funcs->dpm_set_vcn_enable) if (!smu->ppt_funcs->dpm_set_vcn_enable)
return 0; return 0;
...@@ -242,6 +262,9 @@ static int smu_dpm_set_jpeg_enable(struct smu_context *smu, ...@@ -242,6 +262,9 @@ static int smu_dpm_set_jpeg_enable(struct smu_context *smu,
struct smu_power_gate *power_gate = &smu_power->power_gate; struct smu_power_gate *power_gate = &smu_power->power_gate;
int ret = 0; int ret = 0;
if (!is_vcn_enabled(smu->adev))
return 0;
if (!smu->ppt_funcs->dpm_set_jpeg_enable) if (!smu->ppt_funcs->dpm_set_jpeg_enable)
return 0; return 0;
......
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