From patchwork Tue Nov 10 14:42:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lutomirski X-Patchwork-Id: 59060 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAAEgvCY027995 for ; Tue, 10 Nov 2009 14:42:57 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D087F9EDCB; Tue, 10 Nov 2009 06:42:56 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-bw0-f221.google.com (mail-bw0-f221.google.com [209.85.218.221]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B6079E84E for ; Tue, 10 Nov 2009 06:42:54 -0800 (PST) Received: by bwz21 with SMTP id 21so81777bwz.24 for ; Tue, 10 Nov 2009 06:42:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.132.204 with SMTP id c12mr26623fat.32.1257864172937; Tue, 10 Nov 2009 06:42:52 -0800 (PST) In-Reply-To: <20091106135722.5abfdd03@jbarnes-piketon> References: <20091030083742.48f5d4f3@jbarnes-g45> <20091105082829.2d59dcae@jbarnes-piketon> <20091106135722.5abfdd03@jbarnes-piketon> Date: Tue, 10 Nov 2009 09:42:52 -0500 X-Google-Sender-Auth: 2e96bf69357d2123 Message-ID: From: Andrew Lutomirski To: Jesse Barnes Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.sf.net Subject: Re: [Intel-gfx] [resend] i915: high power consumption after suspend/resume X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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);