drm/i915: Parse the eDP link configuration from the vBIOS
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 24 Sep 2010 09:24:28 +0000 (10:24 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 24 Sep 2010 13:22:11 +0000 (14:22 +0100)
First step, lets have a look at the values for troublesome panels and
see if they may be used to improve our link training.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_lvds.c

index 6aa34317dcbf3de03787ee2ad3ba52e9b8811437..cbfb99dce6aa8d18df037bd25da52753d7b97c50 100644 (file)
@@ -338,9 +338,18 @@ typedef struct drm_i915_private {
        unsigned int lvds_vbt:1;
        unsigned int int_crt_support:1;
        unsigned int lvds_use_ssc:1;
-       unsigned int edp_support:1;
        int lvds_ssc_freq;
-       int edp_bpp;
+
+       struct {
+               u8 rate:4;
+               u8 lanes:4;
+               u8 preemphasis:4;
+               u8 vswing:4;
+
+               u8 initialized:1;
+               u8 support:1;
+               u8 bpp:6;
+       } edp;
 
        struct notifier_block lid_notifier;
 
index 123e31d5a80b9be19d69d1b20749525d48470ba8..42a7a5b33a0adc8f024b24157265db01d78f793a 100644 (file)
@@ -401,14 +401,11 @@ parse_driver_features(struct drm_i915_private *dev_priv,
        if (!driver)
                return;
 
-       if (driver && SUPPORTS_EDP(dev) &&
-           driver->lvds_config == BDB_DRIVER_FEATURE_EDP) {
-               dev_priv->edp_support = 1;
-       } else {
-               dev_priv->edp_support = 0;
-       }
+       if (SUPPORTS_EDP(dev) &&
+           driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
+               dev_priv->edp.support = 1;
 
-       if (driver && driver->dual_frequency)
+       if (driver->dual_frequency)
                dev_priv->render_reclock_avail = true;
 }
 
@@ -417,28 +414,44 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
 {
        struct bdb_edp *edp;
 
+       dev_priv->edp.bpp = 18;
+
        edp = find_section(bdb, BDB_EDP);
        if (!edp) {
-               if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp_support) {
+               if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp.support) {
                        DRM_DEBUG_KMS("No eDP BDB found but eDP panel "
-                                     "supported, assume 18bpp panel color "
-                                     "depth.\n");
-                       dev_priv->edp_bpp = 18;
+                                     "supported, assume %dbpp panel color "
+                                     "depth.\n",
+                                     dev_priv->edp.bpp);
                }
                return;
        }
 
        switch ((edp->color_depth >> (panel_type * 2)) & 3) {
        case EDP_18BPP:
-               dev_priv->edp_bpp = 18;
+               dev_priv->edp.bpp = 18;
                break;
        case EDP_24BPP:
-               dev_priv->edp_bpp = 24;
+               dev_priv->edp.bpp = 24;
                break;
        case EDP_30BPP:
-               dev_priv->edp_bpp = 30;
+               dev_priv->edp.bpp = 30;
                break;
        }
+
+       dev_priv->edp.rate = edp->link_params[panel_type].rate;
+       dev_priv->edp.lanes = edp->link_params[panel_type].lanes;
+       dev_priv->edp.preemphasis = edp->link_params[panel_type].preemphasis;
+       dev_priv->edp.vswing = edp->link_params[panel_type].vswing;
+
+       DRM_DEBUG_KMS("eDP vBIOS settings: bpp=%d, rate=%d, lanes=%d, preemphasis=%d, vswing=%d\n",
+                     dev_priv->edp.bpp,
+                     dev_priv->edp.rate,
+                     dev_priv->edp.lanes,
+                     dev_priv->edp.preemphasis,
+                     dev_priv->edp.vswing);
+
+       dev_priv->edp.initialized = true;
 }
 
 static void
index 6fbaa633d9461e022c2e0961dae7347bc7030d69..4843d027aaad08702693c39e63e66ede32816369 100644 (file)
@@ -3705,7 +3705,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
                        else
                                temp |= PIPE_6BPC;
                } else if (has_edp_encoder || (is_dp && intel_pch_has_edp(crtc))) {
-                       switch (dev_priv->edp_bpp/3) {
+                       switch (dev_priv->edp.bpp/3) {
                        case 8:
                                temp |= PIPE_8BPC;
                                break;
index ec26ee7ca9929cf63d9094efc3d626ebdcd984d0..117eb9988250bc96b6d8b63399e770e07acea25e 100644 (file)
@@ -139,7 +139,7 @@ intel_dp_link_required(struct drm_device *dev, struct intel_dp *intel_dp, int pi
        struct drm_i915_private *dev_priv = dev->dev_private;
 
        if (IS_eDP(intel_dp) || IS_PCH_eDP(intel_dp))
-               return (pixel_clock * dev_priv->edp_bpp) / 8;
+               return (pixel_clock * dev_priv->edp.bpp + 7) / 8;
        else
                return pixel_clock * 3;
 }
@@ -653,7 +653,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
                if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) {
                        lane_count = intel_dp->lane_count;
                        if (IS_PCH_eDP(intel_dp))
-                               bpp = dev_priv->edp_bpp;
+                               bpp = dev_priv->edp.bpp;
                        break;
                }
        }
index 95e035a6009e0d9148ccaf74acdbd036e1dba09a..98172bcf485ff9b7fcecfadeaec846e918732869 100644 (file)
@@ -864,7 +864,7 @@ void intel_lvds_init(struct drm_device *dev)
        if (HAS_PCH_SPLIT(dev)) {
                if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0)
                        return;
-               if (dev_priv->edp_support) {
+               if (dev_priv->edp.support) {
                        DRM_DEBUG_KMS("disable LVDS for eDP support\n");
                        return;
                }