]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: fix S4 suspend while switcheroo state is off
authorImre Deak <imre.deak@intel.com>
Thu, 23 Oct 2014 16:23:19 +0000 (19:23 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 24 Oct 2014 14:34:17 +0000 (16:34 +0200)
If the device is suspended already through the switcheroo interface we
shouldn't suspend it again or resume it after suspend. We have the
corresponding check for S3 suspend already, add it for all the other
S3 and S4 handlers. Also move the check from i915_resume_early() to
i915_resume_legacy(), so that it's done in the high level handler for
all PM events.

v2:
- fix the resume path too, we don't need to special case there
  DRM_SWITCH_POWER_OFF with the device being enabled (in which case we'd
  have to disable the device), since that never happens (Ville)

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.c

index 203bd820d5f799ddafa6ce4f5ad9ac764d158f54..69936322f87d59300b6b44d69ee7123f7d9ed67d 100644 (file)
@@ -766,9 +766,6 @@ static int i915_drm_thaw(struct drm_device *dev)
 
 static int i915_resume_early(struct drm_device *dev)
 {
-       if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
-               return 0;
-
        /*
         * We have a resume ordering issue with the snd-hda driver also
         * requiring our device to be power up. Due to the lack of a
@@ -808,6 +805,9 @@ static int i915_resume_legacy(struct drm_device *dev)
 {
        int ret;
 
+       if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        ret = i915_resume_early(dev);
        if (ret)
                return ret;
@@ -997,6 +997,9 @@ static int i915_pm_resume_early(struct device *dev)
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return i915_resume_early(drm_dev);
 }
 
@@ -1005,6 +1008,9 @@ 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);
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return i915_drm_resume(drm_dev);
 }
 
@@ -1018,6 +1024,9 @@ static int i915_pm_freeze(struct device *dev)
                return -ENODEV;
        }
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return i915_drm_freeze(drm_dev);
 }
 
@@ -1027,6 +1036,9 @@ static int i915_pm_freeze_late(struct device *dev)
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
        struct drm_i915_private *dev_priv = drm_dev->dev_private;
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return intel_suspend_complete(dev_priv);
 }
 
@@ -1035,6 +1047,9 @@ static int i915_pm_thaw_early(struct device *dev)
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return i915_drm_thaw_early(drm_dev);
 }
 
@@ -1043,6 +1058,9 @@ static int i915_pm_thaw(struct device *dev)
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return i915_drm_thaw(drm_dev);
 }
 
@@ -1051,6 +1069,9 @@ static int i915_pm_poweroff(struct device *dev)
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
 
+       if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
+               return 0;
+
        return i915_drm_freeze(drm_dev);
 }