From patchwork Tue Apr 5 12:34:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manna, Animesh" X-Patchwork-Id: 8751231 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 564C69F3D1 for ; Tue, 5 Apr 2016 12:37:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 547072038E for ; Tue, 5 Apr 2016 12:37:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ABE60203C3 for ; Tue, 5 Apr 2016 12:37:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 402B46E777; Tue, 5 Apr 2016 12:37:00 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 677CB6E777 for ; Tue, 5 Apr 2016 12:36:59 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 05 Apr 2016 05:37:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,444,1455004800"; d="scan'208";a="948403127" Received: from unknown (HELO amanna-desktop.iind.intel.com) ([10.223.25.127]) by orsmga002.jf.intel.com with ESMTP; 05 Apr 2016 05:36:57 -0700 From: Animesh Manna To: intel-gfx@lists.freedesktop.org Date: Tue, 5 Apr 2016 18:04:37 +0530 Message-Id: <1459859678-16343-6-git-send-email-animesh.manna@intel.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1459859678-16343-1-git-send-email-animesh.manna@intel.com> References: <1459859678-16343-1-git-send-email-animesh.manna@intel.com> Subject: [Intel-gfx] [PATCH 5/6] drm/i915: Enable HPD interrupts with master ctl interrupt X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While suspending the device hpd related interrupts are enabled to get the interrupt when device is in suspend state. Though display is in DC9 but system can be in S0 or S0i3 state. Hot plug during S0 state will generate de_port_interrupt but if system is in S0i3 state then display driver will get hotplug interrupt as pcu_hpd_interrupt which will come via pmc. So added the interrupt handling for pcu hpd interrupt. Signed-off-by: Animesh Manna Signed-off-by: A.Sunil Kamath --- drivers/gpu/drm/i915/i915_irq.c | 56 ++++++++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_reg.h | 12 +++++++++ 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index c85eb8d..35d7423 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -110,9 +110,9 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* BXT hpd list */ static const u32 hpd_bxt[HPD_NUM_PINS] = { - [HPD_PORT_A] = BXT_DE_PORT_HP_DDIA, - [HPD_PORT_B] = BXT_DE_PORT_HP_DDIB, - [HPD_PORT_C] = BXT_DE_PORT_HP_DDIC + [HPD_PORT_A] = (BXT_DE_PORT_HP_DDIA | BXT_PCU_DC9_HP_DDIA), + [HPD_PORT_B] = (BXT_DE_PORT_HP_DDIB | BXT_PCU_DC9_HP_DDIB), + [HPD_PORT_C] = (BXT_DE_PORT_HP_DDIC | BXT_PCU_DC9_HP_DDIC) }; /* IIR can theoretically queue up two events. Be paranoid. */ @@ -2337,6 +2337,22 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) DRM_ERROR("The master control interrupt lied (DE PORT)!\n"); } + if (master_ctl & GEN8_PCU_IRQ) { + iir = I915_READ(GEN8_PCU_IIR); + if (iir) { + u32 tmp_mask; + I915_WRITE(GEN8_PCU_IIR, iir); + ret = IRQ_HANDLED; + if (IS_BROXTON(dev)) { + tmp_mask = iir & BXT_PCU_DC9_HOTPLUG_MASK; + if (tmp_mask) + bxt_hpd_irq_handler(dev, tmp_mask, hpd_bxt); + } else + DRM_ERROR("Unexpected PCU interrupt\n"); + } else + DRM_ERROR("The master control interrupt lied (PCU)!\n"); + } + for_each_pipe(dev_priv, pipe) { u32 flip_done, fault_errors; @@ -4681,6 +4697,19 @@ void intel_irq_uninstall(struct drm_i915_private *dev_priv) dev_priv->pm.irqs_enabled = false; } +static void bxt_enable_pcu_interrupt(struct drm_i915_private *dev_priv) +{ + u32 de_pcu_hpd_enable_mask, de_pcu_imr, de_pcu_ier; + + de_pcu_hpd_enable_mask = GEN9_DE_PCU_PORTA_HOTPLUG | + GEN9_DE_PCU_PORTB_HOTPLUG | + GEN9_DE_PCU_PORTC_HOTPLUG; + + de_pcu_imr = (I915_READ(GEN8_PCU_IMR) & 0x0); + de_pcu_ier = (I915_READ(GEN8_PCU_IER) | de_pcu_hpd_enable_mask); + GEN5_IRQ_INIT(GEN8_PCU_, de_pcu_imr, de_pcu_ier); +} + /** * intel_runtime_pm_disable_interrupts - runtime interrupt disabling * @dev_priv: i915 device instance @@ -4690,8 +4719,29 @@ void intel_irq_uninstall(struct drm_i915_private *dev_priv) */ void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv) { + struct drm_device *dev = dev_priv->dev; + unsigned long flags = 0; + dev_priv->dev->driver->irq_uninstall(dev_priv->dev); dev_priv->pm.irqs_enabled = false; + + if (IS_BROXTON(dev) && dev_priv->vbt.hpd_wakeup_enabled) { + + /* Enable HPD related interrupts during DC9 for HPD wakeup */ + + I915_WRITE(GEN8_MASTER_IRQ, GEN8_MASTER_IRQ_CONTROL); + POSTING_READ(GEN8_MASTER_IRQ); + + spin_lock_irqsave(&dev_priv->irq_lock, flags); + if (dev_priv->display.hpd_irq_setup) + dev_priv->display.hpd_irq_setup(dev_priv->dev); + spin_unlock_irqrestore(&dev_priv->irq_lock, flags); + + bxt_enable_pcu_interrupt(dev_priv); + + dev_priv->pm.irqs_enabled = true; + } + synchronize_irq(dev_priv->dev->irq); } diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index cc42bd9..15f9021 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -5954,6 +5954,18 @@ enum skl_disp_power_wells { #define GEN8_PCU_IIR _MMIO(0x444e8) #define GEN8_PCU_IER _MMIO(0x444ec) +/* BXT PCU DC9 hotplug control */ +#define BXT_PCU_DC9_HP_DDIA (1<<31) +#define BXT_PCU_DC9_HP_DDIB (1<<30) +#define BXT_PCU_DC9_HP_DDIC (1<<29) +#define BXT_PCU_DC9_HOTPLUG_MASK (BXT_PCU_DC9_HP_DDIA | \ + BXT_PCU_DC9_HP_DDIB | \ + BXT_PCU_DC9_HP_DDIC) + +#define GEN9_DE_PCU_PORTA_HOTPLUG (1 << 31) +#define GEN9_DE_PCU_PORTB_HOTPLUG (1 << 30) +#define GEN9_DE_PCU_PORTC_HOTPLUG (1 << 29) + #define ILK_DISPLAY_CHICKEN2 _MMIO(0x42004) /* Required on all Ironlake and Sandybridge according to the B-Spec. */ #define ILK_ELPIN_409_SELECT (1 << 25)