diff options
author | Alex Deucher <alex@botch2.com> | 2007-07-31 01:18:40 -0400 |
---|---|---|
committer | Alex Deucher <alex@botch2.com> | 2007-07-31 01:18:40 -0400 |
commit | 4822a2b837334f408f962646ab5ea4f8b0335ac9 (patch) | |
tree | d1deb0032ff38cf7a200e4f29678b86abfd83700 | |
parent | fe494c9db2995bb8ce7a028ecf9626e0cb0cf506 (diff) |
RADEON: tv-out fixes. works now. tested on rv350.
VT siwtch is busted, and xrandr doesn't play nice yet.
uncomment code in radeon_output.c to test.
-rw-r--r-- | src/radeon_driver.c | 29 | ||||
-rw-r--r-- | src/radeon_output.c | 52 | ||||
-rw-r--r-- | src/radeon_tv.c | 3 |
3 files changed, 71 insertions, 13 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 74711ce..20d43ff 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -4298,7 +4298,7 @@ static void RADEONWriteTVFIFO(ScrnInfoPtr pScrn, CARD16 addr, RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; CARD32 tmp; - + int i = 0; OUTREG(RADEON_TV_HOST_WRITE_DATA, value); @@ -4307,26 +4307,35 @@ static void RADEONWriteTVFIFO(ScrnInfoPtr pScrn, CARD16 addr, do { tmp = INREG(RADEON_TV_HOST_RD_WT_CNTL); + if ((tmp & RADEON_HOST_FIFO_WT_ACK) == 0) + break; + i++; } - while ((tmp & RADEON_HOST_FIFO_WT_ACK) == 0); + while (i < 100000); + /*while ((tmp & RADEON_HOST_FIFO_WT_ACK) == 0);*/ OUTREG(RADEON_TV_HOST_RD_WT_CNTL, 0); } -/* Read from RT FIFO RAM */ +/* Read from TV FIFO RAM */ static CARD32 RADEONReadTVFIFO(ScrnInfoPtr pScrn, CARD16 addr) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; CARD32 tmp; + int i = 0; OUTREG(RADEON_TV_HOST_RD_WT_CNTL, addr); OUTREG(RADEON_TV_HOST_RD_WT_CNTL, addr | RADEON_HOST_FIFO_RD); do { tmp = INREG(RADEON_TV_HOST_RD_WT_CNTL); - } - while ((tmp & RADEON_HOST_FIFO_RD_ACK) == 0); + if ((tmp & RADEON_HOST_FIFO_RD_ACK) == 0) + break; + i++; + } + while (i < 100000); + /*while ((tmp & RADEON_HOST_FIFO_RD_ACK) == 0);*/ OUTREG(RADEON_TV_HOST_RD_WT_CNTL, 0); @@ -4400,12 +4409,14 @@ static void RADEONRestoreTVTimingTables(ScrnInfoPtr pScrn, RADEONSavePtr restore hTable = RADEONGetHTimingTablesAddr(restore->tv_uv_adr); vTable = RADEONGetVTimingTablesAddr(restore->tv_uv_adr); - OUTREG(RADEON_TV_MASTER_CNTL, (RADEON_TV_ASYNC_RST + /* OUTREG(RADEON_TV_MASTER_CNTL, (RADEON_TV_ASYNC_RST | RADEON_CRT_ASYNC_RST | RADEON_RESTART_PHASE_FIX | RADEON_CRT_FIFO_CE_EN | RADEON_TV_FIFO_CE_EN - | RADEON_TV_ON)); + | RADEON_TV_ON));*/ + + OUTREG(RADEON_TV_MASTER_CNTL, restore->tv_master_cntl | RADEON_TV_ON); for (i = 0; i < MAX_H_CODE_TIMING_LEN; i += 2, hTable--) { tmp = ((CARD32)restore->h_code_timing[ i ] << 14) | ((CARD32)restore->h_code_timing[ i + 1 ]); @@ -4416,7 +4427,7 @@ static void RADEONRestoreTVTimingTables(ScrnInfoPtr pScrn, RADEONSavePtr restore for (i = 0; i < MAX_V_CODE_TIMING_LEN; i += 2, vTable++) { tmp = ((CARD32)restore->v_code_timing[ i + 1 ] << 14) | ((CARD32)restore->v_code_timing[ i ]); - RADEONWriteFIFO(pScrn, vTable, tmp); + RADEONWriteTVFIFO(pScrn, vTable, tmp); if (restore->v_code_timing[ i ] == 0 || restore->v_code_timing[ i + 1 ] == 0) break; } @@ -4553,7 +4564,7 @@ void RADEONRestoreTVRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) /* Timing tables are only restored when tv output is active */ if (RADEONTVIsOn(restore->tv_dac_cntl)) - RADEONRestoreTimingTables(pScrn, restore); + RADEONRestoreTVTimingTables(pScrn, restore); OUTREG(RADEON_TV_MASTER_CNTL, (restore->tv_master_cntl diff --git a/src/radeon_output.c b/src/radeon_output.c index d0a12dd..9c11bf6 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -1025,9 +1025,16 @@ radeon_detect(xf86OutputPtr output) ScrnInfoPtr pScrn = output->scrn; RADEONInfoPtr info = RADEONPTR(pScrn); RADEONOutputPrivatePtr radeon_output = output->driver_private; - - radeon_output->MonType = MT_UNKNOWN; - RADEONConnectorFindMonitor(pScrn, output); + + /* assume tv is connected for now */ + if (radeon_output->type == OUTPUT_STV) { + radeon_output->MonType = MT_STV; + } else if (radeon_output->type == OUTPUT_CTV) { + radeon_output->MonType = MT_CTV; + } else { + radeon_output->MonType = MT_UNKNOWN; + RADEONConnectorFindMonitor(pScrn, output); + } /* force montype based on output property */ if (radeon_output->type == OUTPUT_DVI) { @@ -1888,6 +1895,45 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) } } } + + /* add TV out */ +#if 0 + if (info->InternalTVOut) { + /* need to check the bios tables to see if we really have tv out and what type we have */ + RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1); + if (!radeon_output) { + return FALSE; + } + /* hard code type for now */ + radeon_output->MonType = MT_STV; + radeon_output->DDCType = DDC_NONE_DETECTED; + radeon_output->DACType = DAC_TVDAC; + radeon_output->TMDSType = TMDS_NONE; + + /* hard code type for now */ + if (info->IsAtomBios) + radeon_output->ConnectorType = CONNECTOR_STV_ATOM; + else + radeon_output->ConnectorType = CONNECTOR_STV; + + radeon_output->tvStd = TV_STD_NTSC; + radeon_output->hPos = 0; + radeon_output->vPos = 0; + radeon_output->hSize = 0; + + RADEONSetOutputType(pScrn, radeon_output); + output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]); + if (!output) { + return FALSE; + } + output->driver_private = radeon_output; + output->possible_crtcs = 1 | 2; + output->possible_clones = 0; + + RADEONInitConnector(output); + } +#endif + return TRUE; } diff --git a/src/radeon_tv.c b/src/radeon_tv.c index 5acc4ff..a0e680b 100644 --- a/src/radeon_tv.c +++ b/src/radeon_tv.c @@ -333,7 +333,8 @@ void RADEONInitTVRegisters(xf86OutputPtr output, RADEONSavePtr save, | RADEON_AUD_ASYNC_RST | RADEON_DVS_ASYNC_RST | RADEON_CRT_FIFO_CE_EN - | RADEON_TV_FIFO_CE_EN); + | RADEON_TV_FIFO_CE_EN + | RADEON_TV_ON); save->tv_modulator_cntl1 = RADEON_SLEW_RATE_LIMIT | RADEON_SYNC_TIP_LEVEL |