From mboxrd@z Thu Jan 1 00:00:00 1970 From: Damien Lespiau Subject: [PATCH 6/8] drm/i915: Disable display when fused off Date: Thu, 12 Dec 2013 14:36:41 +0000 Message-ID: <1386859003-17246-7-git-send-email-damien.lespiau@intel.com> References: <1386859003-17246-1-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id CA540FB3D8 for ; Thu, 12 Dec 2013 06:36:51 -0800 (PST) In-Reply-To: <1386859003-17246-1-git-send-email-damien.lespiau@intel.com> 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 To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org FUSE_STRAP has a bit to inform us that the display has been fused off. Use it to setup the definitive number of pipes at run-time. v2: actually tweak num_pipes, not num_planes v3: also tests SFUSE_STRAP bit 7 Signed-off-by: Damien Lespiau --- drivers/gpu/drm/i915/i915_dma.c | 18 +++++++++++++++++- drivers/gpu/drm/i915/i915_reg.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 28a1142..8810097 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1466,14 +1466,30 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) * - it's judged too laborious to fill n static structures with the limit * when a simple if statement does the job, * - run-time checks (eg read fuse/strap registers) are needed. + * + * This function needs to be called after the MMIO has been setup as we are + * reading registers, and before the first usage of the fields it can tweak. */ static void intel_device_info_runtime_init(struct drm_device *dev) { - struct intel_device_info *info = &to_i915(dev)->info; + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_device_info *info = &dev_priv->info; info->num_sprites = 1; if (IS_VALLEYVIEW(dev)) info->num_sprites = 2; + + if ((INTEL_INFO(dev)->gen == 7 || INTEL_INFO(dev)->gen == 8) && + !IS_VALLEYVIEW(dev)) { + u32 fuse_strap = I915_READ(FUSE_STRAP); + u32 sfuse_strap = I915_READ(SFUSE_STRAP); + + if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE || + sfuse_strap & SFUSE_STRAP_DISPLAY_DISABLED) { + DRM_DEBUG_DRIVER("Display fused off, disabling\n"); + info->num_pipes = 0; + } + } } /** diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index c6d9ba5..85e53ed 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -5411,6 +5411,7 @@ /* SFUSE_STRAP */ #define SFUSE_STRAP 0xc2014 +#define SFUSE_STRAP_DISPLAY_DISABLED (1<<7) #define SFUSE_STRAP_DDIB_DETECTED (1<<2) #define SFUSE_STRAP_DDIC_DETECTED (1<<1) #define SFUSE_STRAP_DDID_DETECTED (1<<0) -- 1.8.3.1