xf86-video-intel: Branch 'modesetting' - 2 commits - src/i830_tv.c

Keith Packard keithp at kemper.freedesktop.org
Wed Dec 13 22:12:29 EET 2006


 src/i830_tv.c |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

New commits:
diff-tree 0f6addc8a6aeb9bd041d0f8e8e5850e76764ba51 (from parents)
Merge: 001e272437a0247ffbc4b9ff8a3f2b437cf4c533 3fa5b3998353518c40e2fb0c28b425ee22c8d625
Author: Keith Packard <keithp at bouzouki.jf.intel.com>
Date:   Wed Dec 13 12:10:31 2006 -0800

    Merge branch 'modesetting-origin' into modesetting

diff-tree 001e272437a0247ffbc4b9ff8a3f2b437cf4c533 (from df0a5a25aa72563a33731f8063602dd7faad8459)
Author: Keith Packard <keithp at bouzouki.jf.intel.com>
Date:   Wed Dec 13 12:08:58 2006 -0800

    Auto-detect working TV output by checking TV regs functionality.
    
    We can't figure out which chips are supposed to have TV out, so instead we
    prod the TV_DAC register to see if it will hold the value written to it, if
    not, we assume the chip doesn't have TV out.

diff --git a/src/i830_tv.c b/src/i830_tv.c
index b6cc2c9..42c2aad 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -583,8 +583,11 @@ i830_tv_detect_type (xf86CrtcPtr    crtc
 	tv_dac |= (TVDAC_STATE_CHG_EN |
 		   TVDAC_A_SENSE_CTL |
 		   TVDAC_B_SENSE_CTL |
-		   TVDAC_C_SENSE_CTL);
-	tv_dac = DAC_CTL_OVERRIDE | DAC_A_0_7_V | DAC_B_0_7_V | DAC_C_0_7_V;
+		   TVDAC_C_SENSE_CTL |
+		   DAC_CTL_OVERRIDE |
+		   DAC_A_0_7_V |
+		   DAC_B_0_7_V |
+		   DAC_C_0_7_V);
 	OUTREG(TV_CTL, tv_ctl);
 	OUTREG(TV_DAC, tv_dac);
 	i830WaitForVblank(pScrn);
@@ -612,7 +615,7 @@ i830_tv_detect_type (xf86CrtcPtr    crtc
 	type = TV_TYPE_COMPONENT;
     } else {
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		   "Couldn't detect TV connection\n");
+		   "No TV connection detected\n");
 	type = TV_TYPE_NONE;
     }
     
@@ -730,10 +733,34 @@ i830_tv_init(ScrnInfoPtr pScrn)
     xf86OutputPtr	    output;
     I830OutputPrivatePtr    intel_output;
     struct i830_tv_priv	    *dev_priv;
+    CARD32		    tv_dac_on, tv_dac_off, save_tv_dac;
  
     if ((INREG(TV_CTL) & TV_FUSE_STATE_MASK) == TV_FUSE_STATE_DISABLED)
 	return;
 
+    /*
+     * Sanity check the TV output by checking to see if the
+     * DAC register holds a value
+     */
+    save_tv_dac = INREG(TV_DAC);
+    
+    OUTREG(TV_DAC, save_tv_dac | TVDAC_STATE_CHG_EN);
+    tv_dac_on = INREG(TV_DAC);
+    
+    OUTREG(TV_DAC, save_tv_dac & ~TVDAC_STATE_CHG_EN);
+    tv_dac_off = INREG(TV_DAC);
+    
+    OUTREG(TV_DAC, save_tv_dac);
+    
+    /*
+     * If the register does not hold the state change enable
+     * bit, (either as a 0 or a 1), assume it doesn't really
+     * exist
+     */
+    if ((tv_dac_on & TVDAC_STATE_CHG_EN) == 0 || 
+	(tv_dac_off & TVDAC_STATE_CHG_EN) != 0)
+	return;
+    
     output = xf86OutputCreate (pScrn, &i830_tv_output_funcs, "TV");
     
     if (!output)



More information about the xorg-commit mailing list