From 106e4b44c5af6552cbd079c4ec34def9dcfb168a Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 24 Apr 2009 10:55:09 +0800 Subject: SDVO: switch bus once for i2c transfer 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 Tested-by: Ma Ling Signed-off-by: Ma Ling --- src/i830_sdvo.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/i830_sdvo.c') diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index a291824b..a4c9120e 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; @@ -1403,7 +1406,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); } @@ -1414,11 +1420,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; } /** @@ -1721,7 +1729,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); @@ -2199,6 +2206,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)) { -- cgit v1.2.3