[Intel-gfx] [PATCH v2 4.1/10] drm/i915: get a permanent RPM reference on platforms w/o RPM support

Imre Deak imre.deak at intel.com
Wed Dec 16 05:53:32 PST 2015

Currently we get a permanent RPM reference if the platform doesn't
support RPM, but this is implicit via the dependency of the power well
functionality on RPM the RPM support, see
sanitize_disable_power_well_option(). Make things more explicit by
taking an RPM reference only for the purpose of keeping RPM disabled.
This provides better documentation and safety against future changes
that would break the above dependency.

- fix intel_runtime_pm_get vs. intel_runtime_pm_put in

Suggested-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Imre Deak <imre.deak at intel.com>
 drivers/gpu/drm/i915/intel_runtime_pm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index cee54ea..c35f12c 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -1992,6 +1992,13 @@ void intel_power_domains_fini(struct drm_i915_private *dev_priv)
 	/* Remove the refcount we took to keep power well support disabled. */
 	if (!i915.disable_power_well)
 		intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
+	/*
+	 * Remove the refcount we took in intel_runtime_pm_enable() in case
+	 * the platform doesn't support runtime PM.
+	 */
+	if (!HAS_RUNTIME_PM(dev_priv))
+		intel_runtime_pm_put(dev_priv);
 static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv)
@@ -2305,6 +2312,9 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	struct device *device = &dev->pdev->dev;
+	if (!HAS_RUNTIME_PM(dev_priv))
+		intel_runtime_pm_get(dev_priv);
 	pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */

More information about the Intel-gfx mailing list