xf86-video-intel: src/i830_sdvo.c

Keith Packard keithp at kemper.freedesktop.org
Mon Mar 19 08:05:37 EET 2007


 src/i830_sdvo.c |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

New commits:
diff-tree 991719c21a6cc1b5d9b7cbe30d4b333718b3e686 (from 9118122a232d4cf7760bcb0874fe970c25251378)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Sun Mar 18 23:05:33 2007 -0700

    Make i830_sdvo_write_sdvox write everything twice.
    
    For some reason, certain chips don't correctly enable the SDVO hardware when
    this register is written only once. We're following what the BIOS code does
    and writing it twice now, but with extra posting reads to boot. Yes, this is
    cult-and-paste, but it fixes problems found on deployed hardware.

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index fb6a7c8..b67ecbc 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -90,12 +90,26 @@ static void i830_sdvo_write_sdvox(xf86Ou
     I830OutputPrivatePtr    intel_output = output->driver_private;
     struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
     I830Ptr		    pI830 = I830PTR(pScrn);
+    CARD32		    bval = val, cval = val;
+    int			    i;
 
-    if (dev_priv->output_device == SDVOC)
-	OUTREG(SDVOB, INREG(SDVOB));
-    OUTREG(dev_priv->output_device, val);
     if (dev_priv->output_device == SDVOB)
-	OUTREG(SDVOC, INREG(SDVOC));
+	cval = INREG(SDVOC);
+    else
+	bval = INREG(SDVOB);
+    
+    /*
+     * Write the registers twice for luck. Sometimes,
+     * writing them only once doesn't appear to 'stick'.
+     * The BIOS does this too. Yay, magic
+     */
+    for (i = 0; i < 2; i++)
+    {
+	OUTREG(SDVOB, bval);
+	POSTING_READ(SDVOB);
+	OUTREG(SDVOC, cval);
+	POSTING_READ(SDVOC);
+    }
 }
 
 /** Read a single byte from the given address on the SDVO device. */
@@ -740,7 +754,6 @@ i830_sdvo_dpms(xf86OutputPtr output, int
 	    temp = INREG(dev_priv->output_device);
 	    if ((temp & SDVO_ENABLE) != 0) {
 		i830_sdvo_write_sdvox(output, temp & ~SDVO_ENABLE);
-		POSTING_READ(dev_priv->output_device);
 	    }
 	}
     } else {
@@ -750,19 +763,7 @@ i830_sdvo_dpms(xf86OutputPtr output, int
 
 	temp = INREG(dev_priv->output_device);
 	if ((temp & SDVO_ENABLE) == 0)
-	{
 	    i830_sdvo_write_sdvox(output, temp | SDVO_ENABLE);
-	    POSTING_READ(dev_priv->output_device);
-#if 0
-	    /* Do it again!  If we remove this below register write, or the
-	     * exact same one 2 lines up, the mac mini SDVO output doesn't
-	     * turn on.
-	     */
-	    i830_sdvo_write_sdvox(output, INREG(dev_priv->output_device) |
-				  SDVO_ENABLE);
-	    POSTING_READ(dev_priv->output_device);
-#endif
-	}
 	for (i = 0; i < 2; i++)
 	    i830WaitForVblank(pScrn);
 



More information about the xorg-commit mailing list