Re: [Intel-gfx] [PATCH 06/16] drm/i915: vlv: fix switcheroo/legacy suspend/resume

2014-09-29 Thread Sagar Arun Kamble
Reviewed-by: Sagar Kamble sagar.a.kam...@intel.com

On Wed, 2014-09-10 at 18:16 +0300, Imre Deak wrote:
 During switcheroo/legacy suspend we don't call the suspend_late handler but
 when resuming afterwards we call resume_early. This happened to work so far,
 since suspend_late only disabled the PCI device. This changed in
 
 commit 016970beb05da6285c2f3ed2bee1c676cb75972e
 Author: Sagar Kamble sagar.a.kam...@intel.com
 Date:   Wed Aug 13 23:07:06 2014 +0530
 
 drm/i915: Sharing platform specific sequence between runtime and system 
 susp
 
 after which we also saved/restored the VLV Gunit HW state in
 suspend_late/resume_early. So now since we don't save the state during
 suspend a following resume will restore a corrupted state.
 
 Fix this by calling the suspend_late handler during both switcheroo and
 legacy suspend.
 
 CC: Sagar Kamble sagar.a.kam...@intel.com
 Signed-off-by: Imre Deak imre.d...@intel.com
 ---
  drivers/gpu/drm/i915/i915_drv.c | 17 +
  1 file changed, 9 insertions(+), 8 deletions(-)
 
 diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
 index 89b63fc..ca74d6d 100644
 --- a/drivers/gpu/drm/i915/i915_drv.c
 +++ b/drivers/gpu/drm/i915/i915_drv.c
 @@ -648,11 +648,7 @@ int i915_suspend(struct drm_device *dev, pm_message_t 
 state)
   if (error)
   return error;
  
 - /* Shut down the device */
 - pci_disable_device(dev-pdev);
 - pci_set_power_state(dev-pdev, PCI_D3hot);
 -
 - return 0;
 + return i915_drm_suspend_late(dev);
  }
  
  static int i915_drm_thaw_early(struct drm_device *dev)
 @@ -769,7 +765,7 @@ static int i915_resume_early(struct drm_device *dev)
   return i915_drm_thaw_early(dev);
  }
  
 -int i915_resume(struct drm_device *dev)
 +static int i915_drm_resume(struct drm_device *dev)
  {
   struct drm_i915_private *dev_priv = dev-dev_private;
   int ret;
 @@ -795,7 +791,12 @@ static int i915_resume_legacy(struct drm_device *dev)
   if (ret)
   return ret;
  
 - return i915_resume(dev);
 + return i915_drm_resume(dev);
 +}
 +
 +int i915_resume(struct drm_device *dev)
 +{
 + return i915_resume_legacy(dev);
  }
  
  /**
 @@ -980,7 +981,7 @@ static int i915_pm_resume(struct device *dev)
   struct pci_dev *pdev = to_pci_dev(dev);
   struct drm_device *drm_dev = pci_get_drvdata(pdev);
  
 - return i915_resume(drm_dev);
 + return i915_drm_resume(drm_dev);
  }
  
  static int i915_pm_freeze(struct device *dev)


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 06/16] drm/i915: vlv: fix switcheroo/legacy suspend/resume

2014-09-10 Thread Imre Deak
During switcheroo/legacy suspend we don't call the suspend_late handler but
when resuming afterwards we call resume_early. This happened to work so far,
since suspend_late only disabled the PCI device. This changed in

commit 016970beb05da6285c2f3ed2bee1c676cb75972e
Author: Sagar Kamble sagar.a.kam...@intel.com
Date:   Wed Aug 13 23:07:06 2014 +0530

drm/i915: Sharing platform specific sequence between runtime and system susp

after which we also saved/restored the VLV Gunit HW state in
suspend_late/resume_early. So now since we don't save the state during
suspend a following resume will restore a corrupted state.

Fix this by calling the suspend_late handler during both switcheroo and
legacy suspend.

CC: Sagar Kamble sagar.a.kam...@intel.com
Signed-off-by: Imre Deak imre.d...@intel.com
---
 drivers/gpu/drm/i915/i915_drv.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 89b63fc..ca74d6d 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -648,11 +648,7 @@ int i915_suspend(struct drm_device *dev, pm_message_t 
state)
if (error)
return error;
 
-   /* Shut down the device */
-   pci_disable_device(dev-pdev);
-   pci_set_power_state(dev-pdev, PCI_D3hot);
-
-   return 0;
+   return i915_drm_suspend_late(dev);
 }
 
 static int i915_drm_thaw_early(struct drm_device *dev)
@@ -769,7 +765,7 @@ static int i915_resume_early(struct drm_device *dev)
return i915_drm_thaw_early(dev);
 }
 
-int i915_resume(struct drm_device *dev)
+static int i915_drm_resume(struct drm_device *dev)
 {
struct drm_i915_private *dev_priv = dev-dev_private;
int ret;
@@ -795,7 +791,12 @@ static int i915_resume_legacy(struct drm_device *dev)
if (ret)
return ret;
 
-   return i915_resume(dev);
+   return i915_drm_resume(dev);
+}
+
+int i915_resume(struct drm_device *dev)
+{
+   return i915_resume_legacy(dev);
 }
 
 /**
@@ -980,7 +981,7 @@ static int i915_pm_resume(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
 
-   return i915_resume(drm_dev);
+   return i915_drm_resume(drm_dev);
 }
 
 static int i915_pm_freeze(struct device *dev)
-- 
1.8.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx