Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/6] drm/i915: Disable display when fused off
Date: Thu, 12 Dec 2013 11:21:01 +0000	[thread overview]
Message-ID: <1386847263-2885-5-git-send-email-damien.lespiau@intel.com> (raw)
In-Reply-To: <1386847263-2885-1-git-send-email-damien.lespiau@intel.com>

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 <damien.lespiau@intel.com>
---
 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 0f75d5c7..a95a1c0 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 = INTEL_INFO(dev);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_device_info *info = &dev_priv->info;
 
 	info->num_planes = 1;
 	if (IS_VALLEYVIEW(dev))
 		info->num_planes = 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

  parent reply	other threads:[~2013-12-12 11:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-12 11:20 Supporting fused display configurations v2 Damien Lespiau
2013-12-12 11:20 ` [PATCH 1/6] drm/i915: Make the intel_device_info structure kept in dev_priv writable Damien Lespiau
2013-12-12 11:42   ` Ville Syrjälä
2013-12-12 11:20 ` [PATCH 2/6] drm/i915: Move num_plane to the intel_device_info structure Damien Lespiau
2013-12-12 11:40   ` Ville Syrjälä
2013-12-12 11:21 ` [PATCH 3/6] drm/i915: Consolidate FUSE_STRAP in one set of defines Damien Lespiau
2013-12-12 11:21 ` Damien Lespiau [this message]
2013-12-12 11:21 ` [PATCH 5/6] drm/i915: Remove the Quanta special case Damien Lespiau
2013-12-12 11:21 ` [PATCH 6/6] drm/i915: Use I915_MAX_PIPES in the pipe/plane_to_crtc_mapping definitions Damien Lespiau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386847263-2885-5-git-send-email-damien.lespiau@intel.com \
    --to=damien.lespiau@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox