aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_pm.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2013-12-06 17:32:13 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-12-10 16:43:14 -0500
commit8a1874559f222efcae0c0c41b180f6e1af6b9d2e (patch)
tree8341b7653d73b4671a88b4d889dc2c255378ed7c /drivers/gpu/drm/i915/intel_pm.c
parentd62292c8f778772d1b6ec125d461c8c16fdc0417 (diff)
drm/i915: add initial Runtime PM functions
This patch adds the initial infrastructure to allow a Runtime PM implementation that sets the device to its D3 state. The patch just adds the necessary callbacks and the initial infrastructure. We still don't have any platform that actually uses this infrastructure, we still don't call get/put in all the places we need to, and we don't have any function to save/restore the state of the registers. This is not a problem since no platform uses the code added by this patch. We have a few people simultaneously working on runtime PM, so this initial code could help everybody make their plans. V2: - Move some functions to intel_pm.c - Remove useless pm_runtime_allow() call at init - Remove useless pm_runtime_mark_last_busy() call at get - Use pm_runtime_get_sync() instead of 2 calls - Add a WARN to check if we're really awake V3: - Rebase. V4: - Don't need to call pci_{save,restore}_state and pci_set_power_sate, since they're already called by the PCI layer - Remove wrong pm_runtime_enable() call at init_runtime_pm Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_pm.c')
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index cd3f511847ec..2590a5c90725 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -31,6 +31,7 @@
31#include "../../../platform/x86/intel_ips.h" 31#include "../../../platform/x86/intel_ips.h"
32#include <linux/module.h> 32#include <linux/module.h>
33#include <drm/i915_powerwell.h> 33#include <drm/i915_powerwell.h>
34#include <linux/pm_runtime.h>
34 35
35/** 36/**
36 * RC6 is a special power stage which allows the GPU to enter an very 37 * RC6 is a special power stage which allows the GPU to enter an very
@@ -5961,6 +5962,60 @@ void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv)
5961 hsw_enable_package_c8(dev_priv); 5962 hsw_enable_package_c8(dev_priv);
5962} 5963}
5963 5964
5965void intel_runtime_pm_get(struct drm_i915_private *dev_priv)
5966{
5967 struct drm_device *dev = dev_priv->dev;
5968 struct device *device = &dev->pdev->dev;
5969
5970 if (!HAS_RUNTIME_PM(dev))
5971 return;
5972
5973 pm_runtime_get_sync(device);
5974 WARN(dev_priv->pm.suspended, "Device still suspended.\n");
5975}
5976
5977void intel_runtime_pm_put(struct drm_i915_private *dev_priv)
5978{
5979 struct drm_device *dev = dev_priv->dev;
5980 struct device *device = &dev->pdev->dev;
5981
5982 if (!HAS_RUNTIME_PM(dev))
5983 return;
5984
5985 pm_runtime_mark_last_busy(device);
5986 pm_runtime_put_autosuspend(device);
5987}
5988
5989void intel_init_runtime_pm(struct drm_i915_private *dev_priv)
5990{
5991 struct drm_device *dev = dev_priv->dev;
5992 struct device *device = &dev->pdev->dev;
5993
5994 dev_priv->pm.suspended = false;
5995
5996 if (!HAS_RUNTIME_PM(dev))
5997 return;
5998
5999 pm_runtime_set_active(device);
6000
6001 pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
6002 pm_runtime_mark_last_busy(device);
6003 pm_runtime_use_autosuspend(device);
6004}
6005
6006void intel_fini_runtime_pm(struct drm_i915_private *dev_priv)
6007{
6008 struct drm_device *dev = dev_priv->dev;
6009 struct device *device = &dev->pdev->dev;
6010
6011 if (!HAS_RUNTIME_PM(dev))
6012 return;
6013
6014 /* Make sure we're not suspended first. */
6015 pm_runtime_get_sync(device);
6016 pm_runtime_disable(device);
6017}
6018
5964/* Set up chip specific power management-related functions */ 6019/* Set up chip specific power management-related functions */
5965void intel_init_pm(struct drm_device *dev) 6020void intel_init_pm(struct drm_device *dev)
5966{ 6021{