[Intel-gfx] [PATCH] switch control bus to ddc active state only one time during edid transmission

Ma Ling ling.ma at intel.com
Thu Apr 16 10:51:01 CEST 2009


Before sdvo try to get edid by i2c bus, it must do switch control bus to ddc active state from sdvo only state.
However if current state has been ddc active state, redundant switch operation in our driver will cause error-
"Unable to write to SDVOCTRL_E for SDVOB Slave 0x70". The patch will do switch control bus only one time during
whole edid transmission.

It has fixed bug #19937

Signed-off-by: Zhenyu Wang <zhenyu.z.wang at intel.com>
Signed-off-by: Ma Ling <ling.ma at intel.com>
---
 src/i830_sdvo.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 29ccd4e..a50feb1 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -114,6 +114,9 @@ struct i830_sdvo_priv {
     /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */
     uint32_t broadcast_rgb;
 
+    /** This flag means if we should switch ddc bus before next i2c Start */
+    Bool ddc_bus_switch;
+
     /** State for save/restore */
     /** @{ */
     int save_sdvo_mult;
@@ -1397,7 +1400,10 @@ i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout)
     I2CBusPtr		    i2cbus = intel_output->pI2CBus;
     struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
 
-    i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
+    if (dev_priv->ddc_bus_switch) {
+        i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
+        dev_priv->ddc_bus_switch = FALSE;
+    }
     return i2cbus->I2CStart(i2cbus, timeout);
 }
 
@@ -1408,11 +1414,13 @@ i830_sdvo_ddc_i2c_stop(I2CDevPtr d)
     xf86OutputPtr	    output = d->pI2CBus->DriverPrivate.ptr;
     I830OutputPrivatePtr    intel_output = output->driver_private;
     I2CBusPtr		    i2cbus = intel_output->pI2CBus, savebus;
+    struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
 
     savebus = d->pI2CBus;
     d->pI2CBus = i2cbus;
     i2cbus->I2CStop(d);
     d->pI2CBus = savebus;
+    dev_priv->ddc_bus_switch = TRUE;
 }
 
 /**
@@ -1715,7 +1723,6 @@ i830_sdvo_detect(xf86OutputPtr output)
     {
 	xf86MonPtr edid_mon;
 	/* Check EDID in DVI-I case */
-	i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus);
 	edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
 	if (edid_mon && !DIGITAL(edid_mon->features.input_type)) {
 	    xfree(edid_mon);
@@ -2192,6 +2199,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
     ddcbus->I2CStop = i830_sdvo_ddc_i2c_stop;
     ddcbus->I2CAddress = i830_sdvo_ddc_i2c_address;
     ddcbus->DriverPrivate.ptr = output;
+    dev_priv->ddc_bus_switch = TRUE;
     
     if (!xf86I2CBusInit(ddcbus)) 
     {
-- 
1.5.4.4






More information about the Intel-gfx mailing list