[PATCH 1/3] drm/i915: check the DDC and AUX bits of the VBT on DDI machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>

Our code currently assumes that port X will use the DP AUX channel X
and the DDC pin X. The VBT should tell us how things are mapped, so
add some WARNs in case we discover our assumptions are wrong (or in
case the VBT is just wrong, which is also perfectly possible).

Why would someone wire port B to AUX C and DDC D?

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_bios.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 79bb651..a6700ab 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -575,6 +575,8 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	uint8_t hdmi_level_shift;
 	int i, j;
+	bool is_dvi, is_dp;
+	uint8_t aux_channel;
 	int dvo_ports[][2] = {
 		{0, 10}, {1, 7}, {2, 8}, {3, 9}, {6, /* Unused */ 0},
 	};
@@ -598,6 +600,31 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	if (!child)
 		return;
 
+	aux_channel = child->raw[25];
+
+	is_dvi = child->common.device_type & (1 << 4);
+	is_dp = child->common.device_type & (1 << 2);
+
+	if (is_dvi) {
+		WARN(child->common.ddc_pin == 0x05 && port != PORT_B,
+		     "Unexpected DDC pin for port B\n");
+		WARN(child->common.ddc_pin == 0x04 && port != PORT_C,
+		     "Unexpected DDC pin for port C\n");
+		WARN(child->common.ddc_pin == 0x06 && port != PORT_D,
+		     "Unexpected DDC pin for port D\n");
+	}
+
+	if (is_dp) {
+		WARN(aux_channel == 0x40 && port != PORT_A,
+		     "Unexpected AUX channel for port A\n");
+		WARN(aux_channel == 0x10 && port != PORT_B,
+		     "Unexpected AUX channel for port B\n");
+		WARN(aux_channel == 0x20 && port != PORT_C,
+		     "Unexpected AUX channel for port C\n");
+		WARN(aux_channel == 0x30 && port != PORT_D,
+		     "Unexpected AUX channel for port D\n");
+	}
+
 	if (bdb->version >= 158) {
 		/* The VBT HDMI level shift values match the table we have. */
 		hdmi_level_shift = child->raw[7] & 0xF;
-- 
1.8.1.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux