From patchwork Thu Feb 4 08:58:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhangi Shrivastava X-Patchwork-Id: 8214921 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A8779BEEE5 for ; Thu, 4 Feb 2016 08:55:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE3332012E for ; Thu, 4 Feb 2016 08:55:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D551F20138 for ; Thu, 4 Feb 2016 08:55:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 356366E125; Thu, 4 Feb 2016 00:55:25 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FD676E125 for ; Thu, 4 Feb 2016 00:55:21 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 04 Feb 2016 00:55:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,393,1449561600"; d="scan'208";a="876758784" Received: from shubhangi-desktop.iind.intel.com ([10.223.25.115]) by orsmga001.jf.intel.com with ESMTP; 04 Feb 2016 00:55:19 -0800 From: Shubhangi Shrivastava To: intel-gfx@lists.freedesktop.org Date: Thu, 4 Feb 2016 14:28:30 +0530 Message-Id: <1454576310-8727-2-git-send-email-shubhangi.shrivastava@intel.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1454576310-8727-1-git-send-email-shubhangi.shrivastava@intel.com> References: <1454576310-8727-1-git-send-email-shubhangi.shrivastava@intel.com> Cc: Shubhangi Shrivastava Subject: [Intel-gfx] [PATCH 2/2] drm/i915: Set invert bit for hpd based on VBT 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=-4.7 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 This patch sets the invert bit for hpd detection for each port based on vbt configuration. since each AOB can be designed to depend on invert bit or not, it is expected if an AOB requires invert bit, the user will set respective bit in VBT. Signed-off-by: Sivakumar Thulasimani Signed-off-by: Durgadoss R Signed-off-by: Shubhangi Shrivastava --- drivers/gpu/drm/i915/i915_irq.c | 49 +++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 9 ++++++++ 2 files changed, 58 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 25a8937..305e6dd 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -3424,6 +3424,54 @@ static void ibx_hpd_irq_setup(struct drm_device *dev) I915_WRITE(PCH_PORT_HOTPLUG, hotplug); } +/* + * For BXT invert bit has to be set based on AOB design + * for HPD detection logic, update it based on VBT fields. + */ +static void bxt_hpd_set_invert(struct drm_device *dev, u32 hotplug_port) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + int i, reg_val, val = 0; + + for (i = 0; i < dev_priv->vbt.child_dev_num; i++) { + + /* Proceed only if invert bit is set */ + if (dev_priv->vbt.child_dev[i].common.hpd_invert == 0) + continue; + + /* + * Convert dvo_port to PORT_X and set appropriate bit + * only if hotplug is enabled on that port + */ + switch (dev_priv->vbt.child_dev[i].common.dvo_port) { + case DVO_PORT_DPA: + case DVO_PORT_HDMIA: + if (hotplug_port & BXT_DE_PORT_HP_DDIA) + val |= BXT_DDIA_HPD_INVERT; + break; + case DVO_PORT_DPB: + case DVO_PORT_HDMIB: + if (hotplug_port & BXT_DE_PORT_HP_DDIB) + val |= BXT_DDIB_HPD_INVERT; + break; + case DVO_PORT_DPC: + case DVO_PORT_HDMIC: + if (hotplug_port & BXT_DE_PORT_HP_DDIC) + val |= BXT_DDIC_HPD_INVERT; + break; + default: + DRM_ERROR("HPD invert set for invalid dvo port %d\n", + dev_priv->vbt.child_dev[i].common.dvo_port); + break; + } + } + reg_val = I915_READ(BXT_HOTPLUG_CTL); + DRM_DEBUG_KMS("Invert bit setting: hp_ctl:%x hp_port:%x val:%x\n", + reg_val, hotplug_port, val); + reg_val &= ~BXT_DDI_HPD_INVERT_MASK; + I915_WRITE(BXT_HOTPLUG_CTL, reg_val | val); +} + static void spt_hpd_irq_setup(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -3494,6 +3542,7 @@ static void bxt_hpd_irq_setup(struct drm_device *dev) hotplug |= PORTC_HOTPLUG_ENABLE | PORTB_HOTPLUG_ENABLE | PORTA_HOTPLUG_ENABLE; I915_WRITE(PCH_PORT_HOTPLUG, hotplug); + bxt_hpd_set_invert(dev, enabled_irqs); } static void ibx_irq_postinstall(struct drm_device *dev) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 0a98889..01bd3c5 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -5936,6 +5936,15 @@ enum skl_disp_power_wells { #define GEN8_PCU_IIR _MMIO(0x444e8) #define GEN8_PCU_IER _MMIO(0x444ec) +/* BXT hotplug control */ +#define BXT_HOTPLUG_CTL _MMIO(0xC4030) +#define BXT_DDIA_HPD_INVERT (1 << 27) +#define BXT_DDIC_HPD_INVERT (1 << 11) +#define BXT_DDIB_HPD_INVERT (1 << 3) +#define BXT_DDI_HPD_INVERT_MASK (BXT_DDIA_HPD_INVERT | \ + BXT_DDIB_HPD_INVERT | \ + BXT_DDIC_HPD_INVERT) + #define ILK_DISPLAY_CHICKEN2 _MMIO(0x42004) /* Required on all Ironlake and Sandybridge according to the B-Spec. */ #define ILK_ELPIN_409_SELECT (1 << 25)