Skip to contentSkip to conversation

eDP setup fix

RFT In review Adam Jackson 3 participants 5 messages May 12, 2010 – May 13, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I got a report of KMS setup failing on an eDP panel. dmesg shows us trying to set 1.62GHz for the link rate, which would be perfectly legal for the requested mode, but the VBT appears to claim that the panel only supports 2.7GHz.

This patch attempts to scrape the eDP setup parameters out of the VBT and use those instead of forcing something else down the panel's throat. I don't have any eDP machines to test with at the moment, so wider testing would be appreciated. In particular I'm not trying to get the voltage or pre-emphasis levels out of the VBT either, but hopefully that isn't necessary.

- ajax

#1 lore raw

PATCH 1/1 drm/i915/edp: Use fixed panel timing information from VBT

eDP panels are often fixed-rate. Grab the link speed and lane count from the VBT and use those instead of trying to compute them.

---
 drivers/gpu/drm/i915/i915_drv.h   |    2 ++
 drivers/gpu/drm/i915/intel_bios.c |   18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |   29 +++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 7f797ef..78212c2 100644
@@ -326,6 +326,8 @@ typedef struct drm_i915_private {
 	unsigned int edp_support:1;
 	int lvds_ssc_freq;
 	int edp_bpp;
+	int edp_link_bw;
+	int edp_lane_count;
 
 	struct notifier_block lid_notifier;
 
drivers/gpu/drm/i915/intel_bios.c +18 -0
index 4c748d8..ac60a6f 100644
@@ -26,6 +26,7 @@
  */
 #include "drmP.h"
 #include "drm.h"
+#include "drm_dp_helper.h"
 #include "i915_drm.h"
 #include "i915_drv.h"
 #include "intel_bios.h"
@@ -437,6 +438,23 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
 		dev_priv->edp_bpp = 30;
 		break;
 	}
+
+	if (edp->link_params[panel_type].rate == EDP_RATE_1_62)
+	    dev_priv->edp_link_bw = DP_LINK_BW_1_62;
+	else
+	    dev_priv->edp_link_bw = DP_LINK_BW_2_7;
+
+	switch (edp->link_params[panel_type].lanes) {
+	case EDP_LANE_1:
+	    dev_priv->edp_lane_count = 1;
+	    break;
+	case EDP_LANE_2:
+	    dev_priv->edp_lane_count = 2;
+	    break;
+	case EDP_LANE_4:
+	    dev_priv->edp_lane_count = 4;
+	    break;
+	}
 }
 
 static void
drivers/gpu/drm/i915/intel_dp.c +29 -0
index f6299bb..c77c567 100644
@@ -494,6 +494,31 @@ intel_dp_i2c_init(struct intel_encoder *intel_encoder,
 }
 
 static bool
+intel_edp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
+		     struct drm_display_mode *adjusted_mode)
+{
+	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
+	struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
+	struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
+
+	/* the VBT tells us what the panel demands. hopefully it exists. */
+	if (dev_priv->edp_lane_count == 0) {
+		DRM_DEBUG_KMS("no eDP block found, guessing parameters\n");
+		return false;
+	}
+
+	dp_priv->link_bw = dev_priv->edp_link_bw;
+	dp_priv->lane_count = dev_priv->edp_lane_count;
+	adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw);
+
+	DRM_DEBUG_KMS("eDP link bw %02x lane count %d clock %d\n",
+		      dp_priv->link_bw, dp_priv->lane_count,
+		      adjusted_mode->clock);
+
+	return true;
+}
+
+static bool
 intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
 		    struct drm_display_mode *adjusted_mode)
 {
@@ -504,6 +529,10 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
 	int max_clock = intel_dp_max_link_bw(intel_encoder) == DP_LINK_BW_2_7 ? 1 : 0;
 	static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
 
+	if (IS_eDP(intel_encoder))
+	    if (intel_edp_mode_fixup(encoder, mode, adjusted_mode))
+		return true;
+
 	for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
 		for (clock = 0; clock <= max_clock; clock++) {
 			int link_avail = intel_dp_link_clock(bws[clock]) * lane_count;
Signature · 1 line
1.7.0.1
#2 lore raw

Re: [PATCH] drm/i915/edp: Use fixed panel timing information from VBT

Quoted 5 lines · Adam Jackson

eDP panels are often fixed-rate. Grab the link speed and lane count from the VBT and use those instead of trying to compute them.

---

Looks good to me, and it might just fix
https://bugs.freedesktop.org/show_bug.cgi?id=28070

We just have one 1366x768 panel which works fine for me last time I tried, but that bug has a larger one, and from log it seems driver still use 1.6Ghz which may lead to the problem as you addressed. I'll ask the reporter to try your patch.

Thanks!

Quoted 108 lines
 drivers/gpu/drm/i915/i915_drv.h   |    2 ++
 drivers/gpu/drm/i915/intel_bios.c |   18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |   29 +++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 7f797ef..78212c2 100644
@@ -326,6 +326,8 @@ typedef struct drm_i915_private {
 	unsigned int edp_support:1;
 	int lvds_ssc_freq;
 	int edp_bpp;
+	int edp_link_bw;
+	int edp_lane_count;
 
 	struct notifier_block lid_notifier;
 
drivers/gpu/drm/i915/intel_bios.c +18 -0
index 4c748d8..ac60a6f 100644
@@ -26,6 +26,7 @@
  */
 #include "drmP.h"
 #include "drm.h"
+#include "drm_dp_helper.h"
 #include "i915_drm.h"
 #include "i915_drv.h"
 #include "intel_bios.h"
@@ -437,6 +438,23 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
 		dev_priv->edp_bpp = 30;
 		break;
 	}
+
+	if (edp->link_params[panel_type].rate == EDP_RATE_1_62)
+	    dev_priv->edp_link_bw = DP_LINK_BW_1_62;
+	else
+	    dev_priv->edp_link_bw = DP_LINK_BW_2_7;
+
+	switch (edp->link_params[panel_type].lanes) {
+	case EDP_LANE_1:
+	    dev_priv->edp_lane_count = 1;
+	    break;
+	case EDP_LANE_2:
+	    dev_priv->edp_lane_count = 2;
+	    break;
+	case EDP_LANE_4:
+	    dev_priv->edp_lane_count = 4;
+	    break;
+	}
 }
 
 static void
drivers/gpu/drm/i915/intel_dp.c +29 -0
index f6299bb..c77c567 100644
@@ -494,6 +494,31 @@ intel_dp_i2c_init(struct intel_encoder *intel_encoder,
 }
 
 static bool
+intel_edp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
+		     struct drm_display_mode *adjusted_mode)
+{
+	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
+	struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
+	struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
+
+	/* the VBT tells us what the panel demands. hopefully it exists. */
+	if (dev_priv->edp_lane_count == 0) {
+		DRM_DEBUG_KMS("no eDP block found, guessing parameters\n");
+		return false;
+	}
+
+	dp_priv->link_bw = dev_priv->edp_link_bw;
+	dp_priv->lane_count = dev_priv->edp_lane_count;
+	adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw);
+
+	DRM_DEBUG_KMS("eDP link bw %02x lane count %d clock %d\n",
+		      dp_priv->link_bw, dp_priv->lane_count,
+		      adjusted_mode->clock);
+
+	return true;
+}
+
+static bool
 intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
 		    struct drm_display_mode *adjusted_mode)
 {
@@ -504,6 +529,10 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
 	int max_clock = intel_dp_max_link_bw(intel_encoder) == DP_LINK_BW_2_7 ? 1 : 0;
 	static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
 
+	if (IS_eDP(intel_encoder))
+	    if (intel_edp_mode_fixup(encoder, mode, adjusted_mode))
+		return true;
+
 	for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
 		for (clock = 0; clock <= max_clock; clock++) {
 			int link_avail = intel_dp_link_clock(bws[clock]) * lane_count;
Signature · 6 lines
1.7.0.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH] drm/i915/edp: Use fixed panel timing information from VBT

ajax, thanks a lot for working on this!

I've tried the patch but it doesn't fix my issue (I've updated the bug with dmesg output).

Kind regards,
Dick

#4 lore raw

Re: [PATCH] drm/i915/edp: Use fixed panel timing information from VBT

In reply to Zhenyu Wang
Quoted 7 lines · Zhenyu Wang
Quoted 5 lines · Adam Jackson

eDP panels are often fixed-rate. Grab the link speed and lane count from the VBT and use those instead of trying to compute them.

---

Quoted 7 lines

Looks good to me, and it might just fix
https://bugs.freedesktop.org/show_bug.cgi?id=28070

We just have one 1366x768 panel which works fine for me last time I tried, but that bug has a larger one, and from log it seems driver still use 1.6Ghz which may lead to the problem as you addressed. I'll ask the reporter to try your patch.

Ick. His VBT reports 1.62GHz x1, which is definitely not going to hold a 1920x1080 mode. Guess we'll have to do this the hard way.

- ajax

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx