Commit e6f1eb4c authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: maximize code sharing between .hw_fini and .suspend

Thus redundant code can be dropped.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a35a10d9
...@@ -1376,6 +1376,26 @@ static int smu_disable_dpms(struct smu_context *smu) ...@@ -1376,6 +1376,26 @@ static int smu_disable_dpms(struct smu_context *smu)
return ret; return ret;
} }
static int smu_smc_hw_cleanup(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
int ret = 0;
smu_i2c_eeprom_fini(smu, &adev->pm.smu_i2c);
ret = smu_disable_thermal_alert(smu);
if (ret) {
pr_warn("Fail to stop thermal control!\n");
return ret;
}
ret = smu_disable_dpms(smu);
if (ret)
return ret;
return 0;
}
static int smu_hw_fini(void *handle) static int smu_hw_fini(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
...@@ -1396,19 +1416,9 @@ static int smu_hw_fini(void *handle) ...@@ -1396,19 +1416,9 @@ static int smu_hw_fini(void *handle)
adev->pm.dpm_enabled = false; adev->pm.dpm_enabled = false;
smu_i2c_eeprom_fini(smu, &adev->pm.smu_i2c); ret = smu_smc_hw_cleanup(smu);
if (ret)
ret = smu_disable_thermal_alert(smu);
if (ret) {
pr_warn("Fail to stop thermal control!\n");
return ret;
}
ret = smu_disable_dpms(smu);
if (ret) {
pr_warn("Fail to stop Dpms!\n");
return ret; return ret;
}
return 0; return 0;
} }
...@@ -1445,15 +1455,7 @@ static int smu_suspend(void *handle) ...@@ -1445,15 +1455,7 @@ static int smu_suspend(void *handle)
adev->pm.dpm_enabled = false; adev->pm.dpm_enabled = false;
smu_i2c_eeprom_fini(smu, &adev->pm.smu_i2c); ret = smu_smc_hw_cleanup(smu);
ret = smu_disable_thermal_alert(smu);
if (ret) {
pr_warn("Fail to stop thermal control!\n");
return ret;
}
ret = smu_disable_dpms(smu);
if (ret) if (ret)
return ret; return ret;
......
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