summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_drv.c
diff options
context:
space:
mode:
authorPaulo Zanoni2014-03-08 00:12:33 +0100
committerDaniel Vetter2014-04-01 23:31:28 +0200
commit97bea20794f600ae9248bef296e3b62d12087a1e (patch)
tree9de3270f683c67dee2bece24e7e054b2d6a09a97 /drivers/gpu/drm/i915/i915_drv.c
parentdrm/i915: kill dev_priv->pm.regsave (diff)
downloadkernel-qcow2-linux-97bea20794f600ae9248bef296e3b62d12087a1e.tar.gz
kernel-qcow2-linux-97bea20794f600ae9248bef296e3b62d12087a1e.tar.xz
kernel-qcow2-linux-97bea20794f600ae9248bef296e3b62d12087a1e.zip
drm/i915: add gen-specific runtime suspend/resume functions
We're adding runtime suspend support to more platforms, so organize the code in a way that all a new platform needs to do is to add its own gen-specific functions. Also rename the i915_ functions to intel_ to make it clear that it's the top level one, not something that just runs on i915 platforms. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.c')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 11f77a8e4c4d..b3600cbb81cf 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -833,7 +833,23 @@ static int i915_pm_poweroff(struct device *dev)
return i915_drm_freeze(drm_dev);
}
-static int i915_runtime_suspend(struct device *device)
+static void hsw_runtime_suspend(struct drm_i915_private *dev_priv)
+{
+ struct drm_device *dev = dev_priv->dev;
+
+ if (HAS_PC8(dev))
+ hsw_enable_pc8(dev_priv);
+}
+
+static void hsw_runtime_resume(struct drm_i915_private *dev_priv)
+{
+ struct drm_device *dev = dev_priv->dev;
+
+ if (HAS_PC8(dev))
+ hsw_disable_pc8(dev_priv);
+}
+
+static int intel_runtime_suspend(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
struct drm_device *dev = pci_get_drvdata(pdev);
@@ -844,8 +860,8 @@ static int i915_runtime_suspend(struct device *device)
DRM_DEBUG_KMS("Suspending device\n");
- if (HAS_PC8(dev))
- hsw_enable_pc8(dev_priv);
+ if (IS_HASWELL(dev))
+ hsw_runtime_suspend(dev_priv);
i915_gem_release_all_mmaps(dev_priv);
@@ -865,7 +881,7 @@ static int i915_runtime_suspend(struct device *device)
return 0;
}
-static int i915_runtime_resume(struct device *device)
+static int intel_runtime_resume(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
struct drm_device *dev = pci_get_drvdata(pdev);
@@ -878,8 +894,8 @@ static int i915_runtime_resume(struct device *device)
intel_opregion_notify_adapter(dev, PCI_D0);
dev_priv->pm.suspended = false;
- if (HAS_PC8(dev))
- hsw_disable_pc8(dev_priv);
+ if (IS_HASWELL(dev))
+ hsw_runtime_resume(dev_priv);
DRM_DEBUG_KMS("Device resumed\n");
return 0;
@@ -892,8 +908,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,
+ .runtime_suspend = intel_runtime_suspend,
+ .runtime_resume = intel_runtime_resume,
};
static const struct vm_operations_struct i915_gem_vm_ops = {