Commit 097dd837 authored by Imre Deak's avatar Imre Deak Committed by Daniel Vetter

drm/i915: fix S4 suspend while switcheroo state is off

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: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 5a17514e
...@@ -766,9 +766,6 @@ static int i915_drm_thaw(struct drm_device *dev) ...@@ -766,9 +766,6 @@ static int i915_drm_thaw(struct drm_device *dev)
static int i915_resume_early(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 * 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 * 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) ...@@ -808,6 +805,9 @@ static int i915_resume_legacy(struct drm_device *dev)
{ {
int ret; int ret;
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
ret = i915_resume_early(dev); ret = i915_resume_early(dev);
if (ret) if (ret)
return ret; return ret;
...@@ -997,6 +997,9 @@ static int i915_pm_resume_early(struct device *dev) ...@@ -997,6 +997,9 @@ static int i915_pm_resume_early(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return i915_resume_early(drm_dev);
} }
...@@ -1005,6 +1008,9 @@ static int i915_pm_resume(struct device *dev) ...@@ -1005,6 +1008,9 @@ static int i915_pm_resume(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return i915_drm_resume(drm_dev);
} }
...@@ -1018,6 +1024,9 @@ static int i915_pm_freeze(struct device *dev) ...@@ -1018,6 +1024,9 @@ static int i915_pm_freeze(struct device *dev)
return -ENODEV; return -ENODEV;
} }
if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
return i915_drm_freeze(drm_dev); return i915_drm_freeze(drm_dev);
} }
...@@ -1027,6 +1036,9 @@ static int i915_pm_freeze_late(struct device *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_device *drm_dev = pci_get_drvdata(pdev);
struct drm_i915_private *dev_priv = drm_dev->dev_private; 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); return intel_suspend_complete(dev_priv);
} }
...@@ -1035,6 +1047,9 @@ static int i915_pm_thaw_early(struct device *dev) ...@@ -1035,6 +1047,9 @@ static int i915_pm_thaw_early(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return i915_drm_thaw_early(drm_dev);
} }
...@@ -1043,6 +1058,9 @@ static int i915_pm_thaw(struct device *dev) ...@@ -1043,6 +1058,9 @@ static int i915_pm_thaw(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return i915_drm_thaw(drm_dev);
} }
...@@ -1051,6 +1069,9 @@ static int i915_pm_poweroff(struct device *dev) ...@@ -1051,6 +1069,9 @@ static int i915_pm_poweroff(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return i915_drm_freeze(drm_dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment