Skip to content

Commit

Permalink
drm/amd/pm: re-enable the gfx imu when smu resume
Browse files Browse the repository at this point in the history
commit f7f28f2 upstream.

If the gfx imu is poweroff when suspend, then
it need to be re-enabled when resume.

Signed-off-by: Tim Huang <tim.huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Tim Huang authored and gregkh committed May 11, 2023
1 parent c5a513f commit 12c790d
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,15 @@ int smu_get_dpm_freq_range(struct smu_context *smu,

int smu_set_gfx_power_up_by_imu(struct smu_context *smu)
{
if (!smu->ppt_funcs || !smu->ppt_funcs->set_gfx_power_up_by_imu)
return -EOPNOTSUPP;
int ret = 0;
struct amdgpu_device *adev = smu->adev;

return smu->ppt_funcs->set_gfx_power_up_by_imu(smu);
if (smu->ppt_funcs->set_gfx_power_up_by_imu) {
ret = smu->ppt_funcs->set_gfx_power_up_by_imu(smu);
if (ret)
dev_err(adev->dev, "Failed to enable gfx imu!\n");
}
return ret;
}

static u32 smu_get_mclk(void *handle, bool low)
Expand Down Expand Up @@ -195,6 +200,19 @@ static u32 smu_get_sclk(void *handle, bool low)
return clk_freq * 100;
}

static int smu_set_gfx_imu_enable(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;

if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
return 0;

if (amdgpu_in_reset(smu->adev) || adev->in_s0ix)
return 0;

return smu_set_gfx_power_up_by_imu(smu);
}

static int smu_dpm_set_vcn_enable(struct smu_context *smu,
bool enable)
{
Expand Down Expand Up @@ -1390,15 +1408,9 @@ static int smu_hw_init(void *handle)
}

if (smu->is_apu) {
if ((smu->ppt_funcs->set_gfx_power_up_by_imu) &&
likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) {
ret = smu->ppt_funcs->set_gfx_power_up_by_imu(smu);
if (ret) {
dev_err(adev->dev, "Failed to Enable gfx imu!\n");
return ret;
}
}

ret = smu_set_gfx_imu_enable(smu);
if (ret)
return ret;
smu_dpm_set_vcn_enable(smu, true);
smu_dpm_set_jpeg_enable(smu, true);
smu_set_gfx_cgpg(smu, true);
Expand Down Expand Up @@ -1675,6 +1687,10 @@ static int smu_resume(void *handle)
return ret;
}

ret = smu_set_gfx_imu_enable(smu);
if (ret)
return ret;

smu_set_gfx_cgpg(smu, true);

smu->disable_uclk_switch = 0;
Expand Down

0 comments on commit 12c790d

Please sign in to comment.