Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/tonga: don't call smu_init on resume

smu_init allocates buffers and initializes them. It does not
touch the hw. There is no need to do it again on resume. It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+19 -6
+19 -6
drivers/gpu/drm/amd/amdgpu/tonga_dpm.c
··· 81 81 82 82 mutex_lock(&adev->pm.mutex); 83 83 84 + /* smu init only needs to be called at startup, not resume. 85 + * It should be in sw_init, but requires the fw info gathered 86 + * in sw_init from other IP modules. 87 + */ 84 88 ret = tonga_smu_init(adev); 85 89 if (ret) { 86 90 DRM_ERROR("SMU initialization failed\n"); ··· 111 107 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 112 108 113 109 mutex_lock(&adev->pm.mutex); 110 + /* smu fini only needs to be called at teardown, not suspend. 111 + * It should be in sw_fini, but we put it here for symmetry 112 + * with smu init. 113 + */ 114 114 tonga_smu_fini(adev); 115 115 mutex_unlock(&adev->pm.mutex); 116 116 return 0; ··· 122 114 123 115 static int tonga_dpm_suspend(void *handle) 124 116 { 125 - struct amdgpu_device *adev = (struct amdgpu_device *)handle; 126 - 127 - tonga_dpm_hw_fini(adev); 128 - 129 117 return 0; 130 118 } 131 119 132 120 static int tonga_dpm_resume(void *handle) 133 121 { 122 + int ret; 134 123 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 135 124 136 - tonga_dpm_hw_init(adev); 125 + mutex_lock(&adev->pm.mutex); 137 126 138 - return 0; 127 + ret = tonga_smu_start(adev); 128 + if (ret) { 129 + DRM_ERROR("SMU start failed\n"); 130 + goto fail; 131 + } 132 + 133 + fail: 134 + mutex_unlock(&adev->pm.mutex); 135 + return ret; 139 136 } 140 137 141 138 static int tonga_dpm_set_clockgating_state(void *handle,