|
@@ -502,6 +502,8 @@ static int i915_drm_freeze(struct drm_device *dev)
|
|
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
struct drm_crtc *crtc;
|
|
|
|
|
|
+ intel_runtime_pm_get(dev_priv);
|
|
|
+
|
|
|
/* ignore lid events during suspend */
|
|
|
mutex_lock(&dev_priv->modeset_restore_lock);
|
|
|
dev_priv->modeset_restore = MODESET_SUSPENDED;
|
|
@@ -686,6 +688,8 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
|
|
|
mutex_lock(&dev_priv->modeset_restore_lock);
|
|
|
dev_priv->modeset_restore = MODESET_DONE;
|
|
|
mutex_unlock(&dev_priv->modeset_restore_lock);
|
|
|
+
|
|
|
+ intel_runtime_pm_put(dev_priv);
|
|
|
return error;
|
|
|
}
|
|
|
|
|
@@ -900,6 +904,36 @@ static int i915_pm_poweroff(struct device *dev)
|
|
|
return i915_drm_freeze(drm_dev);
|
|
|
}
|
|
|
|
|
|
+static int i915_runtime_suspend(struct device *device)
|
|
|
+{
|
|
|
+ struct pci_dev *pdev = to_pci_dev(device);
|
|
|
+ struct drm_device *dev = pci_get_drvdata(pdev);
|
|
|
+ struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
+
|
|
|
+ WARN_ON(!HAS_RUNTIME_PM(dev));
|
|
|
+
|
|
|
+ DRM_DEBUG_KMS("Suspending device\n");
|
|
|
+
|
|
|
+ dev_priv->pm.suspended = true;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int i915_runtime_resume(struct device *device)
|
|
|
+{
|
|
|
+ struct pci_dev *pdev = to_pci_dev(device);
|
|
|
+ struct drm_device *dev = pci_get_drvdata(pdev);
|
|
|
+ struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
+
|
|
|
+ WARN_ON(!HAS_RUNTIME_PM(dev));
|
|
|
+
|
|
|
+ DRM_DEBUG_KMS("Resuming device\n");
|
|
|
+
|
|
|
+ dev_priv->pm.suspended = false;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static const struct dev_pm_ops i915_pm_ops = {
|
|
|
.suspend = i915_pm_suspend,
|
|
|
.resume = i915_pm_resume,
|
|
@@ -907,6 +941,8 @@ static const struct dev_pm_ops i915_pm_ops = {
|
|
|
.thaw = i915_pm_thaw,
|
|
|
.poweroff = i915_pm_poweroff,
|
|
|
.restore = i915_pm_resume,
|
|
|
+ .runtime_suspend = i915_runtime_suspend,
|
|
|
+ .runtime_resume = i915_runtime_resume,
|
|
|
};
|
|
|
|
|
|
static const struct vm_operations_struct i915_gem_vm_ops = {
|