summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2020-06-04 06:00:11 +0200
committerAlex Deucher <alexander.deucher@amd.com>2020-07-01 07:59:17 +0200
commite6f1eb4cbf53269cdab8dd4ae1ad2bba384e6ca6 (patch)
tree4816169dbad6a7e6782ff72f2b11c7a08a27adf5
parentdrm/amd/powerplay: better namings (diff)
downloadlinux-e6f1eb4cbf53269cdab8dd4ae1ad2bba384e6ca6.tar.xz
linux-e6f1eb4cbf53269cdab8dd4ae1ad2bba384e6ca6.zip
drm/amd/powerplay: maximize code sharing between .hw_fini and .suspend
Thus redundant code can be dropped. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/amdgpu_smu.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 71bc4dff5b27..359d1f5a8cca 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1376,6 +1376,26 @@ static int smu_disable_dpms(struct smu_context *smu)
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)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1396,19 +1416,9 @@ static int smu_hw_fini(void *handle)
adev->pm.dpm_enabled = false;
- 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) {
- pr_warn("Fail to stop Dpms!\n");
+ ret = smu_smc_hw_cleanup(smu);
+ if (ret)
return ret;
- }
return 0;
}
@@ -1445,15 +1455,7 @@ static int smu_suspend(void *handle)
adev->pm.dpm_enabled = false;
- 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);
+ ret = smu_smc_hw_cleanup(smu);
if (ret)
return ret;