[PATCH 4/7 v2] drm/i915: Disable display when fused off

Damien Lespiau
2013-12-05T14:12:06Z

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

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
drivers/gpu/drm/i915/i915_dma.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index cd22ec6..3e9828c 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1456,14 +1456,31 @@ 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;
+ u32 fuse_strap;

info->num_planes = 1;
if (IS_VALLEYVIEW(dev))
info->num_planes = 2;
+
+ /*
+ * FUSE_STRAP exists since ILK, but we haven't seen a fused out display
+ * before IVB.
+ */
+ if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev)) {
+ fuse_strap = I915_READ(FUSE_STRAP);
+ if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE) {
+ DRM_DEBUG_DRIVER("Display fused off, disabling\n");
+ info->num_pipes = 0;
+ }
+ }
}

/**
--
1.8.3.1