From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paulo Zanoni Subject: [PATCH 04/15] drm/i915: really clear the IIR registers Date: Tue, 23 Jul 2013 19:33:44 -0300 Message-ID: <1374618835-28120-5-git-send-email-przanoni@gmail.com> References: <1374618835-28120-1-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ye0-f169.google.com (mail-ye0-f169.google.com [209.85.213.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BD87E67B1 for ; Tue, 23 Jul 2013 15:34:55 -0700 (PDT) Received: by mail-ye0-f169.google.com with SMTP id q1so193795yen.14 for ; Tue, 23 Jul 2013 15:34:54 -0700 (PDT) In-Reply-To: <1374618835-28120-1-git-send-email-przanoni@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org From: Paulo Zanoni As written on our docs, the IIR registers are capable of storing 2 interrupts, so if we write once to them there's no guarantee they will become zero. So on this patch we write to the register, read to check if it's zero, and then write again in case it's needed. Also replace I915_WRITE(iir, I915_READ(iir)) with I915_WRITE(iir, 0xffffffff), and then move the POSTING_READs on IER because we removed the extra IIR read. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/i915_irq.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b1b6552..29eac7a 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -82,10 +82,14 @@ static const u32 hpd_status_i915[] = { /* i915 and valleyview are the same */ #define INTEL_IRQ_REG_RESET(type, do_iir) do { \ I915_WRITE(type##MR, 0xffffffff); \ I915_WRITE(type##ER, 0); \ - if (do_iir) \ - I915_WRITE(type##IR, I915_READ(type##IR)); \ - else \ - POSTING_READ(type##ER); \ + POSTING_READ(type##ER); \ + if (do_iir) { \ + I915_WRITE(type##IR, 0xffffffff); \ + if (I915_READ(type##IR)) { \ + I915_WRITE(type##IR, 0xffffffff); \ + POSTING_READ(type##IR); \ + } \ + } \ } while (0) /* For display hotplug interrupt */ -- 1.8.1.2