drm/amdgpu: move gpu reset out of amdgpu_device_suspend
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 4 Oct 2019 19:57:21 +0000 (14:57 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Oct 2019 19:51:39 +0000 (15:51 -0400)
Move it into the caller.  There are cases were we don't
want it.  We need it for hibernation, but we don't need
it for runtime pm, so drop it for runtime pm.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index 9532338ae16404e7685166e01fdf469683b066eb..b29bdf22c8bf177b766754daa005656b0466d3b7 100644 (file)
@@ -3176,10 +3176,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
                /* Shut down the device */
                pci_disable_device(dev->pdev);
                pci_set_power_state(dev->pdev, PCI_D3hot);
-       } else {
-               r = amdgpu_asic_reset(adev);
-               if (r)
-                       DRM_ERROR("amdgpu asic reset failed\n");
        }
 
        return 0;
index 62256fe70abd1ef9a27d6ff38dba8fb1f89baf8f..1094a98fb6f9a9c676e64a1f2cff6f7edc2d3a4f 100644 (file)
@@ -1155,8 +1155,13 @@ static int amdgpu_pmops_resume(struct device *dev)
 static int amdgpu_pmops_freeze(struct device *dev)
 {
        struct drm_device *drm_dev = dev_get_drvdata(dev);
+       struct amdgpu_device *adev = drm_dev->dev_private;
+       int r;
 
-       return amdgpu_device_suspend(drm_dev, false, true);
+       r = amdgpu_device_suspend(drm_dev, false, true);
+       if (r)
+               return r;
+       return amdgpu_asic_reset(adev);
 }
 
 static int amdgpu_pmops_thaw(struct device *dev)