summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2020-06-04 11:35:45 +0800
committerAlex Deucher <alexander.deucher@amd.com>2020-07-01 01:59:16 -0400
commit26ef32518a569bc338ae6c42b147bb10046aee49 (patch)
tree56d3b828eb36eeb01f7bf2d673df010dba500e6e /drivers/gpu/drm
parent4e8cb0c011222a7d2cafaca4072a371ad5ecc837 (diff)
downloadlinux-26ef32518a569bc338ae6c42b147bb10046aee49.tar.bz2
drm/amd/powerplay: maximize code sharing between .hw_init and .resume
Then 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>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/powerplay/amdgpu_smu.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index dab0addf3241..2b0e4582c66c 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1193,10 +1193,28 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
* Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools.
*/
ret = smu_set_tool_table_location(smu);
+ if (ret)
+ return ret;
if (!smu_is_dpm_running(smu))
pr_info("dpm has been disabled\n");
+ /*
+ * Use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify
+ * pool location.
+ */
+ ret = smu_notify_memory_pool_location(smu);
+ if (ret)
+ return ret;
+
+ ret = smu_enable_thermal_alert(smu);
+ if (ret)
+ return ret;
+
+ ret = smu_i2c_eeprom_init(smu, &adev->pm.smu_i2c);
+ if (ret)
+ return ret;
+
return ret;
}
@@ -1276,22 +1294,6 @@ static int smu_hw_init(void *handle)
if (ret)
goto failed;
- /*
- * Use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify
- * pool location.
- */
- ret = smu_notify_memory_pool_location(smu);
- if (ret)
- goto failed;
-
- ret = smu_enable_thermal_alert(smu);
- if (ret)
- goto failed;
-
- ret = smu_i2c_eeprom_init(smu, &adev->pm.smu_i2c);
- if (ret)
- goto failed;
-
adev->pm.dpm_enabled = true;
pr_info("SMU is initialized successfully!\n");
@@ -1488,14 +1490,6 @@ static int smu_resume(void *handle)
if (ret)
goto failed;
- ret = smu_enable_thermal_alert(smu);
- if (ret)
- goto failed;
-
- ret = smu_i2c_eeprom_init(smu, &adev->pm.smu_i2c);
- if (ret)
- goto failed;
-
if (smu->is_apu)
smu_set_gfx_cgpg(&adev->smu, true);