diff mbox

[resend] i915: high power consumption after suspend/resume

Message ID cb0375e10911100642p348cc701la840e0b39aa8615f@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Andrew Lutomirski Nov. 10, 2009, 2:42 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7f436ec..71472a9 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -99,11 +99,28 @@  static int i915_resume(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret = 0;
+	u8 gdrst;
+	unsigned long timeout;
+

 	if (pci_enable_device(dev->pdev))
 		return -1;
 	pci_set_master(dev->pdev);

+	pci_read_config_byte(dev->pdev, GDRST, &gdrst);
+	pci_write_config_byte(dev->pdev, GDRST, gdrst | GDRST_RENDER);
+	udelay(50);
+	//pci_write_config_byte(dev->pdev, GDRST, gdrst & 0xfe);
+	
+	/* ...we don't want to loop forever though, 500ms should be plenty */
+	timeout = jiffies + msecs_to_jiffies(500);
+	do {
+		udelay(100);
+		pci_read_config_byte(dev->pdev, GDRST, &gdrst);
+	} while ((gdrst & 0x1) && time_after(timeout, jiffies));
+	printk(KERN_INFO "i915: Reset on resume took %d ms\n",
+	       jiffies_to_msecs(jiffies - timeout + msecs_to_jiffies(500)));
+
 	i915_restore_state(dev);

 	intel_opregion_init(dev, 1);