summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@bouzouki.jf.intel.com>2006-12-13 12:08:58 -0800
committerKeith Packard <keithp@bouzouki.jf.intel.com>2006-12-13 12:08:58 -0800
commit001e272437a0247ffbc4b9ff8a3f2b437cf4c533 (patch)
tree3bc227e53a87fc7d437575ef3a9d8380f61c6485 /src
parentdf0a5a25aa72563a33731f8063602dd7faad8459 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/i830_tv.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/i830_tv.c b/src/i830_tv.c
index b6cc2c9b..42c2aadd 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)