aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2015-12-17 06:44:56 -0500
committerImre Deak <imre.deak@intel.com>2015-12-17 08:59:38 -0500
commit25b181b46e4340f69793a886f2cd46608487783b (patch)
tree44b15599da033b6e0a31f55b3bb29d6f92efb98f /drivers/gpu/drm/i915
parentb268c699aca5c17d997d358d25256fc6abefd29c (diff)
drm/i915: get a permanent RPM reference on platforms w/o RPM support
Currently we disable RPM functionality on platforms that doesn't support this by not putting/getting the RPM reference we receive from the RPM core during driver loading/unloading respectively. This is somewhat obscure, so make it more explicit by keeping a reference dedicated for this particular purpose whenever the driver is loaded. This makes it possible to remove the HAS_RUNTIME_PM() special casing from every other places in the next patch. v2: - fix intel_runtime_pm_get vs. intel_runtime_pm_put in intel_power_domains_fini() v3: - take only a low level RPM reference so the ref tracking asserts continue to work (Ville) - update the commit message - move the patch earlier for bisectability Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1450352696-16135-1-git-send-email-imre.deak@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/intel_runtime_pm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index fc7cf2c38b1c..bf2492fe5b41 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -1975,6 +1975,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
1975 */ 1975 */
1976void intel_power_domains_fini(struct drm_i915_private *dev_priv) 1976void intel_power_domains_fini(struct drm_i915_private *dev_priv)
1977{ 1977{
1978 struct device *device = &dev_priv->dev->pdev->dev;
1979
1978 /* 1980 /*
1979 * The i915.ko module is still not prepared to be loaded when 1981 * The i915.ko module is still not prepared to be loaded when
1980 * the power well is not enabled, so just enable it in case 1982 * the power well is not enabled, so just enable it in case
@@ -1989,6 +1991,13 @@ void intel_power_domains_fini(struct drm_i915_private *dev_priv)
1989 /* Remove the refcount we took to keep power well support disabled. */ 1991 /* Remove the refcount we took to keep power well support disabled. */
1990 if (!i915.disable_power_well) 1992 if (!i915.disable_power_well)
1991 intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); 1993 intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
1994
1995 /*
1996 * Remove the refcount we took in intel_runtime_pm_enable() in case
1997 * the platform doesn't support runtime PM.
1998 */
1999 if (!HAS_RUNTIME_PM(dev_priv))
2000 pm_runtime_put(device);
1992} 2001}
1993 2002
1994static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv) 2003static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv)
@@ -2303,8 +2312,14 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
2303 struct drm_device *dev = dev_priv->dev; 2312 struct drm_device *dev = dev_priv->dev;
2304 struct device *device = &dev->pdev->dev; 2313 struct device *device = &dev->pdev->dev;
2305 2314
2315 /*
2316 * Take a permanent reference to disable the RPM functionality and drop
2317 * it only when unloading the driver. Use the low level get/put helpers,
2318 * so the driver's own RPM reference tracking asserts also work on
2319 * platforms without RPM support.
2320 */
2306 if (!HAS_RUNTIME_PM(dev)) 2321 if (!HAS_RUNTIME_PM(dev))
2307 return; 2322 pm_runtime_get_sync(device);
2308 2323
2309 pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */ 2324 pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
2310 pm_runtime_mark_last_busy(device); 2325 pm_runtime_mark_last_busy(device);