drm/i915: leave rc6 enabled at suspend time v4
authorJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 12 Jun 2014 15:35:45 +0000 (08:35 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 12 Jun 2014 15:47:05 +0000 (17:47 +0200)
This allows the system to enter the lowest power mode during system freeze.

v2: delete force wake timer at suspend (Imre)
v3: add GT work suspend function (Imre)
v4: use uncore forcewake reset (Daniel)

Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_uncore.c

index 458b778cd495eb981002e135d2e8bfa2e67d3c6c..704dfe36c2ed5e42d808b0926a7bd9d6ee138d73 100644 (file)
@@ -529,7 +529,7 @@ static int i915_drm_freeze(struct drm_device *dev)
                drm_irq_uninstall(dev);
                dev_priv->enable_hotplug_processing = false;
 
-               intel_disable_gt_powersave(dev);
+               intel_suspend_gt_powersave(dev);
 
                /*
                 * Disable CRTCs directly since we want to preserve sw state
@@ -548,8 +548,8 @@ static int i915_drm_freeze(struct drm_device *dev)
 
        i915_save_state(dev);
 
+       intel_uncore_forcewake_reset(dev, false);
        intel_opregion_fini(dev);
-       intel_uncore_fini(dev);
 
        console_lock();
        intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED);
index 49414d30e8d42d3068cbd21990f1403e3e8b1f5a..be4cd5e965335bc3e97b063c3f614f910821e70f 100644 (file)
@@ -2085,6 +2085,7 @@ extern void intel_uncore_early_sanitize(struct drm_device *dev);
 extern void intel_uncore_init(struct drm_device *dev);
 extern void intel_uncore_check_errors(struct drm_device *dev);
 extern void intel_uncore_fini(struct drm_device *dev);
+extern void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore);
 
 void
 i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
index bda0ae3d80cc667a5f2706fade10ed58825d34ff..a23b83d3bc056b4f0a3485523b9ac2535642795b 100644 (file)
@@ -961,6 +961,7 @@ void intel_init_gt_powersave(struct drm_device *dev);
 void intel_cleanup_gt_powersave(struct drm_device *dev);
 void intel_enable_gt_powersave(struct drm_device *dev);
 void intel_disable_gt_powersave(struct drm_device *dev);
+void intel_suspend_gt_powersave(struct drm_device *dev);
 void intel_reset_gt_powersave(struct drm_device *dev);
 void ironlake_teardown_rc6(struct drm_device *dev);
 void gen6_update_ring_freq(struct drm_device *dev);
index d1e53abec1b5f808fbf5457f565f2343689e41f6..685b4910eb930a70c4ad102e0b3afddf6c0f7215 100644 (file)
@@ -4675,6 +4675,26 @@ void intel_cleanup_gt_powersave(struct drm_device *dev)
                valleyview_cleanup_gt_powersave(dev);
 }
 
+/**
+ * intel_suspend_gt_powersave - suspend PM work and helper threads
+ * @dev: drm device
+ *
+ * We don't want to disable RC6 or other features here, we just want
+ * to make sure any work we've queued has finished and won't bother
+ * us while we're suspended.
+ */
+void intel_suspend_gt_powersave(struct drm_device *dev)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
+       /* Interrupts should be disabled already to avoid re-arming. */
+       WARN_ON(dev->irq_enabled);
+
+       flush_delayed_work(&dev_priv->rps.delayed_resume_work);
+
+       cancel_work_sync(&dev_priv->rps.work);
+}
+
 void intel_disable_gt_powersave(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
index 79cba593df0d33dd1bb1fe6732e94d62ec39fe73..53e13ae6126c89e3b0b332867bf0e94af83b9f95 100644 (file)
@@ -315,7 +315,7 @@ static void gen6_force_wake_timer(unsigned long arg)
        intel_runtime_pm_put(dev_priv);
 }
 
-static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
+void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        unsigned long irqflags;