From bfb6ab837378da66a8fdfb40a85efe50ceeb7627 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Mon, 26 Nov 2012 17:22:10 +0100 Subject: [PATCH] --- yaml --- r: 357855 b: refs/heads/master c: 13c7d8703127334890c894ddab13b3a92a26580a h: refs/heads/master i: 357853: 9e228ddf3b7b530b03a0952dfa0c82ecc97ec5f0 357851: 6efd339248343f6db64899383e6c40137aedd445 357847: b8fa0942645648fdc189b9c96d88b14ca4f8ee56 357839: f80a5254af57d4bb236b6bacb02db50b8017b49c 357823: 90570d16a897daacdf0516292a5342bec1a61c83 v: v3 --- [refs] | 2 +- trunk/drivers/gpu/drm/i915/i915_drv.h | 1 - trunk/drivers/gpu/drm/i915/intel_lvds.c | 44 +++++++++++++++++-------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index d15eecaf6288..47d5b23cd5a0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1974cad0ee4ce84e5cb792e49c4f0d9421e0312c +refs/heads/master: 13c7d8703127334890c894ddab13b3a92a26580a diff --git a/trunk/drivers/gpu/drm/i915/i915_drv.h b/trunk/drivers/gpu/drm/i915/i915_drv.h index 79589bbff3db..9be7efd43c6a 100644 --- a/trunk/drivers/gpu/drm/i915/i915_drv.h +++ b/trunk/drivers/gpu/drm/i915/i915_drv.h @@ -705,7 +705,6 @@ typedef struct drm_i915_private { unsigned int display_clock_mode:1; int lvds_ssc_freq; unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ - unsigned int lvds_val; /* used for checking LVDS channel mode */ struct { int rate; int lanes; diff --git a/trunk/drivers/gpu/drm/i915/intel_lvds.c b/trunk/drivers/gpu/drm/i915/intel_lvds.c index 4158a8839433..31fdbfd48e44 100644 --- a/trunk/drivers/gpu/drm/i915/intel_lvds.c +++ b/trunk/drivers/gpu/drm/i915/intel_lvds.c @@ -52,6 +52,7 @@ struct intel_lvds_encoder { u32 pfit_control; u32 pfit_pgm_ratios; bool pfit_dirty; + bool is_dual_link; struct intel_lvds_connector *attached_connector; }; @@ -922,6 +923,23 @@ static const struct dmi_system_id intel_dual_link_lvds[] = { }; bool intel_is_dual_link_lvds(struct drm_device *dev) +{ + struct intel_encoder *encoder; + struct intel_lvds_encoder *lvds_encoder; + + list_for_each_entry(encoder, &dev->mode_config.encoder_list, + base.head) { + if (encoder->type == INTEL_OUTPUT_LVDS) { + lvds_encoder = to_lvds_encoder(&encoder->base); + + return lvds_encoder->is_dual_link; + } + } + + return false; +} + +static bool compute_is_dual_link_lvds(struct drm_device *dev) { unsigned int val; struct drm_i915_private *dev_priv = dev->dev_private; @@ -940,19 +958,15 @@ bool intel_is_dual_link_lvds(struct drm_device *dev) if (dmi_check_system(intel_dual_link_lvds)) return true; - if (dev_priv->lvds_val) - val = dev_priv->lvds_val; - else { - /* BIOS should set the proper LVDS register value at boot, but - * in reality, it doesn't set the value when the lid is closed; - * we need to check "the value to be set" in VBT when LVDS - * register is uninitialized. - */ - val = I915_READ(lvds_reg); - if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED))) - val = dev_priv->bios_lvds_val; - dev_priv->lvds_val = val; - } + /* BIOS should set the proper LVDS register value at boot, but + * in reality, it doesn't set the value when the lid is closed; + * we need to check "the value to be set" in VBT when LVDS + * register is uninitialized. + */ + val = I915_READ(lvds_reg); + if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED))) + val = dev_priv->bios_lvds_val; + return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP; } @@ -1162,6 +1176,10 @@ bool intel_lvds_init(struct drm_device *dev) goto failed; out: + lvds_encoder->is_dual_link = compute_is_dual_link_lvds(dev); + DRM_DEBUG_KMS("detected %s-link lvds configuration\n", + lvds_encoder->is_dual_link ? "dual" : "single"); + /* * Unlock registers and just * leave them unlocked