isp_suspend() and isp_resume() return -ENODEV when the ISP version does
not implement the optional hw_suspend()/hw_resume() callbacks. Only
isp_v4_1_1_funcs provides them, isp_v4_1_0_funcs defines just hw_init and
hw_fini, so on ISP v4.1.0 both callbacks are NULL and every system
suspend and resume fails.

amdgpu_ip_block_suspend() and amdgpu_ip_block_resume() treat an error
returned by the IP block as fatal, so this aborts the whole amdgpu
suspend/resume, for example:

  amdgpu 0000:c5:00.0: amdgpu: resume of IP block <isp_ip> failed -19

Because amdgpu_ip_block_resume() bails out before updating the state,
ip_block->status.hw is left stale and the GPU is only partially resumed,
which also breaks subsequent suspend cycles.

An absent callback means there is nothing to do, not an error. This is
how the IP block core itself treats a NULL amd_ip_funcs entry, it skips
the call and reports success. Return 0 in that case so ISP versions
without suspend/resume callbacks no longer break device suspend/resume.

Fixes: 7ed51e3a1381 ("drm/amd/amdgpu: Fix SMU warning during isp 
suspend-resume")
Signed-off-by: Jiqian Chen <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
index 976b65f90bc1..ad667b9fde84 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
@@ -321,7 +321,7 @@ static int isp_resume(struct amdgpu_ip_block *ip_block)
        if (isp->funcs->hw_resume)
                return isp->funcs->hw_resume(isp);
 
-       return -ENODEV;
+       return 0;
 }
 
 static int isp_suspend(struct amdgpu_ip_block *ip_block)
@@ -332,7 +332,7 @@ static int isp_suspend(struct amdgpu_ip_block *ip_block)
        if (isp->funcs->hw_suspend)
                return isp->funcs->hw_suspend(isp);
 
-       return -ENODEV;
+       return 0;
 }
 
 static const struct amd_ip_funcs isp_ip_funcs = {
-- 
2.39.5

Reply via email to