Skip to contentSkip to conversation

drm/i915: eDP vs. DP detection changes

PATCH In review [email protected] 4 participants 13 messages Nov 1, 2013 – Nov 28, 2013

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

cover drm/i915: eDP vs. DP detection changes

This series attempts to fix eDP detection, on VLV mainly. And it succeeds in doing so for at least one VLV machine that has eDP on port B instead of port C.

The last simplification patch was suggested by Jesse. I suppose it might cause false positives on some machines that currently work ,so I'll happily leave the decision whether to merge it to someone else ;)

Ville Syrjälä (3):
drm/i915: Check VBT for eDP ports on VLV drm/i915: Make intel_dp_is_edp() less specific drm/i915: Simplify DP vs. eDP detection

 drivers/gpu/drm/i915/intel_display.c |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c      | 36 ++++++++++++++----------------------
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 3 files changed, 17 insertions(+), 26 deletions(-)

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

#1 lore raw

PATCH 1/3 drm/i915: Check VBT for eDP ports on VLV

From: Ville Syrjälä <[email protected]>

VLV can have eDP on either port B or C, or even both. Based on the VBT spec, intel_dpd_is_edp() should work on VLV too, assuming we check the correct ports.

So instead of hardcoding port D, rename the function to intel_dp_is_edp() and pass the port as a parameter, and use it on VLV ports B and C.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051

---
 drivers/gpu/drm/i915/intel_display.c |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c      | 14 ++++++++++----
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -3
index 8f40ae3..3cdfbda 100644
@@ -9954,7 +9954,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_ddi_init(dev, PORT_D);
 	} else if (HAS_PCH_SPLIT(dev)) {
 		int found;
-		dpd_is_edp = intel_dpd_is_edp(dev);
+		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
 
 		if (has_edp_a(dev))
 			intel_dp_init(dev, DP_A, PORT_A);
@@ -9991,8 +9991,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC,
 					PORT_C);
 			if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED)
-				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C,
-					      PORT_C);
+				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
 		}
 
 		intel_dsi_init(dev);
drivers/gpu/drm/i915/intel_dp.c +10 -4
index b3cc333..ede023c 100644
@@ -3263,11 +3263,16 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
 }
 
 /* check the VBT to see whether the eDP is on DP-D port */
-bool intel_dpd_is_edp(struct drm_device *dev)
+bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	union child_device_config *p_child;
 	int i;
+	static const short port_mapping[] = {
+		[PORT_B] = PORT_IDPB,
+		[PORT_C] = PORT_IDPC,
+		[PORT_D] = PORT_IDPD,
+	};
 
 	if (!dev_priv->vbt.child_dev_num)
 		return false;
@@ -3275,7 +3280,7 @@ bool intel_dpd_is_edp(struct drm_device *dev)
 	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
 		p_child = dev_priv->vbt.child_dev + i;
 
-		if (p_child->common.dvo_port == PORT_IDPD &&
+		if (p_child->common.dvo_port == port_mapping[port] &&
 		    p_child->common.device_type == DEVICE_TYPE_eDP)
 			return true;
 	}
@@ -3564,12 +3569,13 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	case PORT_A:
 		type = DRM_MODE_CONNECTOR_eDP;
 		break;
+	case PORT_B:
 	case PORT_C:
-		if (IS_VALLEYVIEW(dev))
+		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
 			type = DRM_MODE_CONNECTOR_eDP;
 		break;
 	case PORT_D:
-		if (HAS_PCH_SPLIT(dev) && intel_dpd_is_edp(dev))
+		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
 			type = DRM_MODE_CONNECTOR_eDP;
 		break;
 	default:	/* silence GCC warning */
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 9d2624f..3612896 100644
@@ -707,7 +707,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder);
 void intel_dp_check_link_status(struct intel_dp *intel_dp);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_config *pipe_config);
-bool intel_dpd_is_edp(struct drm_device *dev);
+bool intel_dp_is_edp(struct drm_device *dev, enum port port);
 void ironlake_edp_backlight_on(struct intel_dp *intel_dp);
 void ironlake_edp_backlight_off(struct intel_dp *intel_dp);
 void ironlake_edp_panel_on(struct intel_dp *intel_dp);
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV

drivers/gpu/drm/i915/intel_display.c static void intel_setup_outputs(struct drm_device *dev) · line 9995

Quoted 6 lines · On Fri, 1 Nov 2013 18:22:39 +0200 [email protected] wrote:
drivers/gpu/drm/i915/intel_display.c +1 -2
 			if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED)
-				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C,
-					      PORT_C);
+				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
 		}

Spurious whitespace change, but it's fine.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#3 lore raw

PATCH 2/3 drm/i915: Make intel_dp_is_edp() less specific

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

All the bits in the VBT child device type have some speciifc meaning, so looking for an exact match isn't always the right thing. On some VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different eDP panels, we are left with the set of bits that should still tell us if the port is eDP or not.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051

---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index ede023c..87cfb12 100644
@@ -3281,7 +3281,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		p_child = dev_priv->vbt.child_dev + i;
 
 		if (p_child->common.dvo_port == port_mapping[port] &&
-		    p_child->common.device_type == DEVICE_TYPE_eDP)
+		    (p_child->common.device_type & 0x1f3f) == (DEVICE_TYPE_eDP & 0x1f3f))
 			return true;
 	}
 	return false;
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific

Quoted 22 lines · On Fri, 1 Nov 2013 18:22:40 +0200 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

All the bits in the VBT child device type have some speciifc meaning, so looking for an exact match isn't always the right thing. On some VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different eDP panels, we are left with the set of bits that should still tell us if the port is eDP or not.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051

---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ede023c..87cfb12 100644

drivers/gpu/drm/i915/intel_dp.c bool intel_dp_is_edp(struct drm_device *dev, enum port port) · line 3287

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -3281,7 +3281,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		p_child = dev_priv->vbt.child_dev + i;
 
 		if (p_child->common.dvo_port == port_mapping[port] &&
-		    p_child->common.device_type == DEVICE_TYPE_eDP)
+		    (p_child->common.device_type & 0x1f3f) == (DEVICE_TYPE_eDP & 0x1f3f))
 			return true;
 	}
 	return false;

Is there no way to split out these magic bits individually into something readable? If not, I guess we'll have to trust you, but it seems fragile.

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 1/2 drm/i915: Give names to the VBT child device type bits

From: Ville Syrjälä <[email protected]>

---
 drivers/gpu/drm/i915/intel_bios.c | 10 +++++-----
 drivers/gpu/drm/i915/intel_bios.h | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +5 -5
index e29bcae..6dd622d 100644
@@ -624,11 +624,11 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 
 	aux_channel = child->raw[25];
 
-	is_dvi = child->common.device_type & (1 << 4);
-	is_dp = child->common.device_type & (1 << 2);
-	is_crt = child->common.device_type & (1 << 0);
-	is_hdmi = is_dvi && (child->common.device_type & (1 << 11)) == 0;
-	is_edp = is_dp && (child->common.device_type & (1 << 12));
+	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
+	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
+	is_crt = child->common.device_type & DEVICE_TYPE_ANALOG_OUTPUT;
+	is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
+	is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
 
 	info->supports_dvi = is_dvi;
 	info->supports_hdmi = is_hdmi;
drivers/gpu/drm/i915/intel_bios.h +16 -0
index 287cc5a..f439c14 100644
@@ -638,6 +638,22 @@ int intel_parse_bios(struct drm_device *dev);
 #define	 DEVICE_TYPE_DP		0x68C6
 #define	 DEVICE_TYPE_eDP	0x78C6
 
+#define  DEVICE_TYPE_CLASS_EXTENSION	(1 << 15)
+#define  DEVICE_TYPE_POWER_MANAGEMENT	(1 << 14)
+#define  DEVICE_TYPE_HOTPLUG_SIGNALING	(1 << 13)
+#define  DEVICE_TYPE_INTERNAL_CONNECTOR	(1 << 12)
+#define  DEVICE_TYPE_NOT_HDMI_OUTPUT	(1 << 11)
+#define  DEVICE_TYPE_MIPI_OUTPUT	(1 << 10)
+#define  DEVICE_TYPE_COMPOSITE_OUTPUT	(1 << 9)
+#define  DEVICE_TYPE_DUAL_CHANNEL	(1 << 8)
+#define  DEVICE_TYPE_HIGH_SPEED_LINK	(1 << 6)
+#define  DEVICE_TYPE_LVDS_SINGALING	(1 << 5)
+#define  DEVICE_TYPE_TMDS_DVI_SIGNALING	(1 << 4)
+#define  DEVICE_TYPE_VIDEO_SIGNALING	(1 << 3)
+#define  DEVICE_TYPE_DISPLAYPORT_OUTPUT	(1 << 2)
+#define  DEVICE_TYPE_DIGITAL_OUTPUT	(1 << 1)
+#define  DEVICE_TYPE_ANALOG_OUTPUT	(1 << 0)
+
 /* define the DVO port for HDMI output type */
 #define		DVO_B		1
 #define		DVO_C		2
Signature · 6 lines
1.8.1.5

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

PATCH v2 2/2 drm/i915: Make intel_dp_is_edp() less specific

From: Ville Syrjälä <[email protected]>

All the bits in the VBT child device type have some speciifc meaning, so looking for an exact match isn't always the right thing. On some VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different eDP panels, we are left with the set of bits that should still tell us if the port is eDP or not.

v2: Use the named bits for VBT child device type

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051

---
 drivers/gpu/drm/i915/intel_bios.h | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.h +18 -0
index f439c14..f580a2b 100644
@@ -654,6 +654,24 @@ int intel_parse_bios(struct drm_device *dev);
 #define  DEVICE_TYPE_DIGITAL_OUTPUT	(1 << 1)
 #define  DEVICE_TYPE_ANALOG_OUTPUT	(1 << 0)
 
+/*
+ * Bits we care about when checking for DEVICE_TYPE_eDP
+ * Depending on the system, the other bits may or may not
+ * be set for eDP outputs.
+ */
+#define DEVICE_TYPE_eDP_BITS \
+	(DEVICE_TYPE_INTERNAL_CONNECTOR | \
+	 DEVICE_TYPE_NOT_HDMI_OUTPUT | \
+	 DEVICE_TYPE_MIPI_OUTPUT | \
+	 DEVICE_TYPE_COMPOSITE_OUTPUT | \
+	 DEVICE_TYPE_DUAL_CHANNEL | \
+	 DEVICE_TYPE_LVDS_SINGALING | \
+	 DEVICE_TYPE_TMDS_DVI_SIGNALING | \
+	 DEVICE_TYPE_VIDEO_SIGNALING | \
+	 DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
+	 DEVICE_TYPE_DIGITAL_OUTPUT | \
+	 DEVICE_TYPE_ANALOG_OUTPUT)
+
 /* define the DVO port for HDMI output type */
 #define		DVO_B		1
 #define		DVO_C		2
drivers/gpu/drm/i915/intel_dp.c +2 -1
index f25a49e..ee3f573 100644
@@ -3284,7 +3284,8 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		p_child = dev_priv->vbt.child_dev + i;
 
 		if (p_child->common.dvo_port == port_mapping[port] &&
-		    p_child->common.device_type == DEVICE_TYPE_eDP)
+		    (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
+		    (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
 			return true;
 	}
 	return false;
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 2/2
#7 lore raw

Re: [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific

2013/11/1 <[email protected]>:

Quoted 11 lines

From: Ville Syrjälä <[email protected]>

All the bits in the VBT child device type have some speciifc meaning, so looking for an exact match isn't always the right thing. On some VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different eDP panels, we are left with the set of bits that should still tell us if the port is eDP or not.

v2: Use the named bits for VBT child device type

We go with this patch until they start creating analog eDP panels or whatever else their creative minds come up with :)

Quoted 59 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051

---
 drivers/gpu/drm/i915/intel_bios.h | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.h +18 -0
index f439c14..f580a2b 100644
@@ -654,6 +654,24 @@ int intel_parse_bios(struct drm_device *dev);
 #define  DEVICE_TYPE_DIGITAL_OUTPUT    (1 << 1)
 #define  DEVICE_TYPE_ANALOG_OUTPUT     (1 << 0)
 
+/*
+ * Bits we care about when checking for DEVICE_TYPE_eDP
+ * Depending on the system, the other bits may or may not
+ * be set for eDP outputs.
+ */
+#define DEVICE_TYPE_eDP_BITS \
+       (DEVICE_TYPE_INTERNAL_CONNECTOR | \
+        DEVICE_TYPE_NOT_HDMI_OUTPUT | \
+        DEVICE_TYPE_MIPI_OUTPUT | \
+        DEVICE_TYPE_COMPOSITE_OUTPUT | \
+        DEVICE_TYPE_DUAL_CHANNEL | \
+        DEVICE_TYPE_LVDS_SINGALING | \
+        DEVICE_TYPE_TMDS_DVI_SIGNALING | \
+        DEVICE_TYPE_VIDEO_SIGNALING | \
+        DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
+        DEVICE_TYPE_DIGITAL_OUTPUT | \
+        DEVICE_TYPE_ANALOG_OUTPUT)
+
 /* define the DVO port for HDMI output type */
 #define                DVO_B           1
 #define                DVO_C           2
drivers/gpu/drm/i915/intel_dp.c +2 -2
index f25a49e..ee3f573 100644
@@ -3284,7 +3284,8 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
                p_child = dev_priv->vbt.child_dev + i;
 
                if (p_child->common.dvo_port == port_mapping[port] &&
-                   p_child->common.device_type == DEVICE_TYPE_eDP)
+                   (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
+                   (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
                        return true;
        }
        return false;
--

1.8.1.5

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

Signature · 1 line
Paulo Zanoni
#8 lore raw

Re: [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific

Quoted 11 lines · Paulo Zanoni

2013/11/1 <[email protected]>:

Quoted 10 lines

From: Ville Syrjälä <[email protected]>

All the bits in the VBT child device type have some speciifc meaning, so looking for an exact match isn't always the right thing. On some VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different eDP panels, we are left with the set of bits that should still tell us if the port is eDP or not.

Quoted 6 lines
Quoted 1 line

v2: Use the named bits for VBT child device type

We go with this patch until they start creating analog eDP panels or whatever else their creative minds come up with :)

Both merged, thanks for patches&review.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by on v1 1/2
#9 lore raw

Re: [PATCH 1/2] drm/i915: Give names to the VBT child device type bits

In reply to [email protected]

2013/11/1 <[email protected]>:

Quoted 3 lines

From: Ville Syrjälä <[email protected]>

I guess you can blame Paulo for being lazy here...

On a future patch, you might also want to do something about the definition of bits below the comment "/* Add the device class for LFP, TV, HDMI */".

Quoted 60 lines
---
 drivers/gpu/drm/i915/intel_bios.c | 10 +++++-----
 drivers/gpu/drm/i915/intel_bios.h | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +5 -5
index e29bcae..6dd622d 100644
@@ -624,11 +624,11 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 
        aux_channel = child->raw[25];
 
-       is_dvi = child->common.device_type & (1 << 4);
-       is_dp = child->common.device_type & (1 << 2);
-       is_crt = child->common.device_type & (1 << 0);
-       is_hdmi = is_dvi && (child->common.device_type & (1 << 11)) == 0;
-       is_edp = is_dp && (child->common.device_type & (1 << 12));
+       is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
+       is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
+       is_crt = child->common.device_type & DEVICE_TYPE_ANALOG_OUTPUT;
+       is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
+       is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
 
        info->supports_dvi = is_dvi;
        info->supports_hdmi = is_hdmi;
drivers/gpu/drm/i915/intel_bios.h +16 -1
index 287cc5a..f439c14 100644
@@ -638,6 +638,22 @@ int intel_parse_bios(struct drm_device *dev);
 #define         DEVICE_TYPE_DP         0x68C6
 #define         DEVICE_TYPE_eDP        0x78C6
 
+#define  DEVICE_TYPE_CLASS_EXTENSION   (1 << 15)
+#define  DEVICE_TYPE_POWER_MANAGEMENT  (1 << 14)
+#define  DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
+#define  DEVICE_TYPE_INTERNAL_CONNECTOR        (1 << 12)
+#define  DEVICE_TYPE_NOT_HDMI_OUTPUT   (1 << 11)
+#define  DEVICE_TYPE_MIPI_OUTPUT       (1 << 10)
+#define  DEVICE_TYPE_COMPOSITE_OUTPUT  (1 << 9)
+#define  DEVICE_TYPE_DUAL_CHANNEL      (1 << 8)
+#define  DEVICE_TYPE_HIGH_SPEED_LINK   (1 << 6)
+#define  DEVICE_TYPE_LVDS_SINGALING    (1 << 5)
+#define  DEVICE_TYPE_TMDS_DVI_SIGNALING        (1 << 4)
+#define  DEVICE_TYPE_VIDEO_SIGNALING   (1 << 3)
+#define  DEVICE_TYPE_DISPLAYPORT_OUTPUT        (1 << 2)
+#define  DEVICE_TYPE_DIGITAL_OUTPUT    (1 << 1)
+#define  DEVICE_TYPE_ANALOG_OUTPUT     (1 << 0)
+
 /* define the DVO port for HDMI output type */
 #define                DVO_B           1
 #define                DVO_C           2
--

1.8.1.5

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

Signature · 1 line
Paulo Zanoni
#10 lore raw

PATCH 3/3 drm/i915: Simplify DP vs. eDP detection

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Reduce the eDP detection to just checking if it's port A, or if the VBT tells us that the port is eDP for the other ports.

---
 drivers/gpu/drm/i915/intel_dp.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +6 -20
index 87cfb12..1e6bf7b 100644
@@ -3274,6 +3274,9 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		[PORT_D] = PORT_IDPD,
 	};
 
+	if (port == PORT_A)
+		return true;
+
 	if (!dev_priv->vbt.child_dev_num)
 		return false;
 
@@ -3560,27 +3563,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	intel_dp->DP = I915_READ(intel_dp->output_reg);
 	intel_dp->attached_connector = intel_connector;
 
-	type = DRM_MODE_CONNECTOR_DisplayPort;
-	/*
-	 * FIXME : We need to initialize built-in panels before external panels.
-	 * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
-	 */
-	switch (port) {
-	case PORT_A:
+	if (intel_dp_is_edp(dev, port))
 		type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_B:
-	case PORT_C:
-		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_D:
-		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	default:	/* silence GCC warning */
-		break;
-	}
+	else
+		type = DRM_MODE_CONNECTOR_DisplayPort;
 
 	/*
 	 * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/3
#11 lore raw

Re: [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection

Quoted 46 lines · On Fri, 1 Nov 2013 18:22:41 +0200 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Reduce the eDP detection to just checking if it's port A, or if the VBT tells us that the port is eDP for the other ports.

---
 drivers/gpu/drm/i915/intel_dp.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -15
index 87cfb12..1e6bf7b 100644
@@ -3274,6 +3274,9 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		[PORT_D] = PORT_IDPD,
 	};
 
+	if (port == PORT_A)
+		return true;
+
 	if (!dev_priv->vbt.child_dev_num)
 		return false;
 
@@ -3560,27 +3563,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	intel_dp->DP = I915_READ(intel_dp->output_reg);
 	intel_dp->attached_connector = intel_connector;
 
-	type = DRM_MODE_CONNECTOR_DisplayPort;
-	/*
-	 * FIXME : We need to initialize built-in panels before external panels.
-	 * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
-	 */
-	switch (port) {
-	case PORT_A:
+	if (intel_dp_is_edp(dev, port))
 		type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_B:
-	case PORT_C:
-		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_D:
-		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))

drivers/gpu/drm/i915/intel_dp.c intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · line 3572

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2 -5
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	default:	/* silence GCC warning */
-		break;
-	}
+	else
+		type = DRM_MODE_CONNECTOR_DisplayPort;
 
 	/*
 	 * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but

Ah much better.

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection

Quoted 57 lines · Jesse Barnes
Quoted 54 lines · On Fri, 1 Nov 2013 18:22:41 +0200 [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Reduce the eDP detection to just checking if it's port A, or if the VBT tells us that the port is eDP for the other ports.

---
 drivers/gpu/drm/i915/intel_dp.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +6 -20
index 87cfb12..1e6bf7b 100644
@@ -3274,6 +3274,9 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		[PORT_D] = PORT_IDPD,
 	};
 
+	if (port == PORT_A)
+		return true;
+
 	if (!dev_priv->vbt.child_dev_num)
 		return false;
 
@@ -3560,27 +3563,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	intel_dp->DP = I915_READ(intel_dp->output_reg);
 	intel_dp->attached_connector = intel_connector;
 
-	type = DRM_MODE_CONNECTOR_DisplayPort;
-	/*
-	 * FIXME : We need to initialize built-in panels before external panels.
-	 * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
-	 */
-	switch (port) {
-	case PORT_A:
+	if (intel_dp_is_edp(dev, port))
 		type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_B:
-	case PORT_C:
-		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_D:
-		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	default:	/* silence GCC warning */
-		break;
-	}
+	else
+		type = DRM_MODE_CONNECTOR_DisplayPort;
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · line 3572

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	/*
 	 * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but

Ah much better.

Ok, now also merged patches 1&3 of the original series here. Patch 1 didn't really apply that well any more, so please double-check what I've done.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch