drm/i915: refactor RPM disabling due to RC6 being disabled
authorImre Deak <imre.deak@intel.com>
Tue, 15 Dec 2015 18:10:31 +0000 (20:10 +0200)
committerImre Deak <imre.deak@intel.com>
Thu, 17 Dec 2015 13:42:46 +0000 (15:42 +0200)
We can make the RPM dependency on RC6 explcit in the code by taking an
actual RPM reference, instead of avoiding to drop the initial one. This
will also enable us to remove the HAS_RUNTIME_PM special casing from
more places in the next patch.

v2:
- fixed typo in commit message (Joonas)

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450203038-5150-4-git-send-email-imre.deak@intel.com
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_runtime_pm.c

index d385d9991eed51e0eafaa458032ce8bd48ecf4c5..4c914fe279653ab934587676f98d5e9c61cf5642 100644 (file)
@@ -6014,7 +6014,17 @@ static void intel_init_emon(struct drm_device *dev)
 
 void intel_init_gt_powersave(struct drm_device *dev)
 {
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
        i915.enable_rc6 = sanitize_rc6_option(dev, i915.enable_rc6);
+       /*
+        * RPM depends on RC6 to save restore the GT HW context, so make RC6 a
+        * requirement.
+        */
+       if (!i915.enable_rc6) {
+               DRM_INFO("RC6 disabled, disabling runtime PM support\n");
+               intel_runtime_pm_get(dev_priv);
+       }
 
        if (IS_CHERRYVIEW(dev))
                cherryview_init_gt_powersave(dev);
@@ -6024,10 +6034,15 @@ void intel_init_gt_powersave(struct drm_device *dev)
 
 void intel_cleanup_gt_powersave(struct drm_device *dev)
 {
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
        if (IS_CHERRYVIEW(dev))
                return;
        else if (IS_VALLEYVIEW(dev))
                valleyview_cleanup_gt_powersave(dev);
+
+       if (!i915.enable_rc6)
+               intel_runtime_pm_put(dev_priv);
 }
 
 static void gen6_suspend_rps(struct drm_device *dev)
index 9945040fa45f349db6b38a62da9e0f621f5a7b91..fc7cf2c38b1cbfd56d12dcdbfb7ff2ca9b69882c 100644 (file)
@@ -2306,15 +2306,6 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
        if (!HAS_RUNTIME_PM(dev))
                return;
 
-       /*
-        * RPM depends on RC6 to save restore the GT HW context, so make RC6 a
-        * requirement.
-        */
-       if (!intel_enable_rc6(dev)) {
-               DRM_INFO("RC6 disabled, disabling runtime PM support\n");
-               return;
-       }
-
        pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
        pm_runtime_mark_last_busy(device);
        pm_runtime_use_autosuspend(device);