aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-02-10 12:19:45 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-02-12 12:53:00 -0500
commit658ac4c6a29cfe7cedd494fb4b74acc3643dabab (patch)
treee60f4fa6288f6e817f4cd892e94d495438de2582
parent6e4930f6ee74a4aefe13a153f0fecae78cf8ad97 (diff)
drm/i915: Disable display when fused off
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 v4: rebase on top of drm-nightly use DRM_INFO() for the message telling display is fused off try to read the FUSE_LOCK bit to determine if PCH display is disabled v5: Don't read SFUSE_STRAP (register on the PCH) if num_pipes is already 0 from the initial device info struct (to prevent hangs) (Daniel Vetter) Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> (for v3) Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (for v3) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c32
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h2
2 files changed, 33 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e281298c6fd5..033c943b6bae 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1466,16 +1466,46 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
1466 * - it's judged too laborious to fill n static structures with the limit 1466 * - it's judged too laborious to fill n static structures with the limit
1467 * when a simple if statement does the job, 1467 * when a simple if statement does the job,
1468 * - run-time checks (eg read fuse/strap registers) are needed. 1468 * - run-time checks (eg read fuse/strap registers) are needed.
1469 *
1470 * This function needs to be called:
1471 * - after the MMIO has been setup as we are reading registers,
1472 * - after the PCH has been detected,
1473 * - before the first usage of the fields it can tweak.
1469 */ 1474 */
1470static void intel_device_info_runtime_init(struct drm_device *dev) 1475static void intel_device_info_runtime_init(struct drm_device *dev)
1471{ 1476{
1477 struct drm_i915_private *dev_priv = dev->dev_private;
1472 struct intel_device_info *info; 1478 struct intel_device_info *info;
1473 1479
1474 info = (struct intel_device_info *)&to_i915(dev)->info; 1480 info = (struct intel_device_info *)&dev_priv->info;
1475 1481
1476 info->num_sprites = 1; 1482 info->num_sprites = 1;
1477 if (IS_VALLEYVIEW(dev)) 1483 if (IS_VALLEYVIEW(dev))
1478 info->num_sprites = 2; 1484 info->num_sprites = 2;
1485
1486 if (info->num_pipes > 0 &&
1487 (INTEL_INFO(dev)->gen == 7 || INTEL_INFO(dev)->gen == 8) &&
1488 !IS_VALLEYVIEW(dev)) {
1489 u32 fuse_strap = I915_READ(FUSE_STRAP);
1490 u32 sfuse_strap = I915_READ(SFUSE_STRAP);
1491
1492 /*
1493 * SFUSE_STRAP is supposed to have a bit signalling the display
1494 * is fused off. Unfortunately it seems that, at least in
1495 * certain cases, fused off display means that PCH display
1496 * reads don't land anywhere. In that case, we read 0s.
1497 *
1498 * On CPT/PPT, we can detect this case as SFUSE_STRAP_FUSE_LOCK
1499 * should be set when taking over after the firmware.
1500 */
1501 if (fuse_strap & ILK_INTERNAL_DISPLAY_DISABLE ||
1502 sfuse_strap & SFUSE_STRAP_DISPLAY_DISABLED ||
1503 (dev_priv->pch_type == PCH_CPT &&
1504 !(sfuse_strap & SFUSE_STRAP_FUSE_LOCK))) {
1505 DRM_INFO("Display fused off, disabling\n");
1506 info->num_pipes = 0;
1507 }
1508 }
1479} 1509}
1480 1510
1481/** 1511/**
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index ad044b7d12e6..fc03142e4ae7 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5444,6 +5444,8 @@
5444 5444
5445/* SFUSE_STRAP */ 5445/* SFUSE_STRAP */
5446#define SFUSE_STRAP 0xc2014 5446#define SFUSE_STRAP 0xc2014
5447#define SFUSE_STRAP_FUSE_LOCK (1<<13)
5448#define SFUSE_STRAP_DISPLAY_DISABLED (1<<7)
5447#define SFUSE_STRAP_DDIB_DETECTED (1<<2) 5449#define SFUSE_STRAP_DDIB_DETECTED (1<<2)
5448#define SFUSE_STRAP_DDIC_DETECTED (1<<1) 5450#define SFUSE_STRAP_DDIC_DETECTED (1<<1)
5449#define SFUSE_STRAP_DDID_DETECTED (1<<0) 5451#define SFUSE_STRAP_DDID_DETECTED (1<<0)