[Intel-gfx] [PATCH 3/3] Initialize the SDVO device based on the sdvo info parsed from VBT

yakui_zhao yakui.zhao at intel.com
Wed May 27 08:37:48 CEST 2009


When the slave address is found for the SDVO port, the SDVO device will
be initialzied. Otherwise it will be skipped.

http://bugs.freedesktop.org/show_bug.cgi?id=20429

Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/i830_sdvo.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

Index: xf86-video-intel/src/i830_sdvo.c
===================================================================
--- xf86-video-intel.orig/src/i830_sdvo.c	2009-05-27 14:34:41.000000000 +0800
+++ xf86-video-intel/src/i830_sdvo.c	2009-05-27 14:37:22.000000000 +0800
@@ -2105,6 +2105,38 @@
     dev_priv->ddc_bus = 1 << num_bits;
 }
 
+/**
+ * find the slave address for the given SDVO port based on the info
+ * parsed in general definition blocks
+ * return zero if success and the slave address is returned.
+ * Otherwise it will return non-zero.
+ */
+static
+int i830_find_sdvo_slave(ScrnInfoPtr pScrn, int output_device,
+			  uint8_t *slave_addr)
+{
+    uint8_t temp_slave_addr;
+    I830Ptr pI830 = I830PTR(pScrn);
+    uint8_t dvo_port;
+    struct sdvo_device_mapping *p_mapping;
+
+    if (output_device == SDVOB)
+	/* DEVICE_PORT_DVOB */
+	dvo_port = 0;
+    else
+	/* DEVICE_POTR_DVOC */
+	dvo_port = 1;
+
+    p_mapping = &(pI830->sdvo_mappings[dvo_port]);
+    temp_slave_addr = p_mapping->slave_addr;
+    if (!temp_slave_addr) {
+	/* no slave address. return failure */
+	return 1;
+    }
+
+    *slave_addr = temp_slave_addr;
+    return 0;
+}
 
 Bool
 i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
@@ -2115,7 +2147,20 @@
     int			    i;
     unsigned char	    ch[0x40];
     I2CBusPtr		    i2cbus = NULL, ddcbus;
+    uint8_t slave_addr;
+    int ret_value;
 
+    slave_addr = 0;
+    ret_value = i830_find_sdvo_slave(pScrn, output_device, &slave_addr);
+    if (ret_value) {
+	/* No slave address can be found for the SDVO port, return false.
+	 * If it is incorrect, please fix me
+	 */
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+	   	     "Skip the detecion of SDVO%s\n",
+		     (output_device == SDVOB)?"B":"C");
+	return FALSE;
+    }
     output = xf86OutputCreate (pScrn, &i830_sdvo_output_funcs,NULL);
     if (!output)
 	return FALSE;
@@ -2150,14 +2195,12 @@
 	xf86OutputDestroy (output);
 	return FALSE;
     }
-
     if (output_device == SDVOB) {
 	dev_priv->d.DevName = "SDVO Controller B";
-	dev_priv->d.SlaveAddr = 0x70;
     } else {
 	dev_priv->d.DevName = "SDVO Controller C";
-	dev_priv->d.SlaveAddr = 0x72;
     }
+    dev_priv->d.SlaveAddr = slave_addr;
     dev_priv->d.pI2CBus = i2cbus;
     dev_priv->d.DriverPrivate.ptr = output;
     dev_priv->output_device = output_device;





More information about the Intel-gfx mailing list