summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alex@botch2.(none)>2008-01-19 18:49:53 -0500
committerAlex Deucher <alex@botch2.(none)>2008-01-19 18:49:53 -0500
commita43003b24022a833e604f41b2873c0350b34181c (patch)
tree051124fc3c01d8eb0ff030fe8d4d4df3a26883c0 /src
parentd4596c52ac9994be26e9ec2d7d57b3892c34abdb (diff)
RADEON: get dac2 adj values from the bios tables
Diffstat (limited to 'src')
-rw-r--r--src/legacy_output.c2
-rw-r--r--src/radeon.h1
-rw-r--r--src/radeon_bios.c52
-rw-r--r--src/radeon_output.c14
-rw-r--r--src/radeon_probe.h4
-rw-r--r--src/radeon_tv.c12
6 files changed, 75 insertions, 10 deletions
diff --git a/src/legacy_output.c b/src/legacy_output.c
index db128ca8..d2d0de67 100644
--- a/src/legacy_output.c
+++ b/src/legacy_output.c
@@ -1126,7 +1126,7 @@ RADEONInitTvDacCntl(xf86OutputPtr output, RADEONSavePtr save)
save->tv_dac_cntl |= (RADEON_TV_DAC_NBLANK |
RADEON_TV_DAC_NHOLD |
RADEON_TV_DAC_STD_PS2 |
- radeon_output->tv_dac_adj);
+ radeon_output->ps2_tvdac_adj);
}
diff --git a/src/radeon.h b/src/radeon.h
index 2a3838c8..d5381966 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -811,6 +811,7 @@ extern Bool RADEONGetClockInfoFromBIOS (ScrnInfoPtr pScrn);
extern Bool RADEONGetLVDSInfoFromBIOS (xf86OutputPtr output);
extern Bool RADEONGetTMDSInfoFromBIOS (xf86OutputPtr output);
extern Bool RADEONGetTVInfoFromBIOS (xf86OutputPtr output);
+extern Bool RADEONGetDAC2InfoFromBIOS (xf86OutputPtr output);
extern Bool RADEONGetHardCodedEDIDFromBIOS (xf86OutputPtr output);
extern void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn,
diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index f928eb4e..829a641e 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -595,6 +595,58 @@ Bool RADEONGetClockInfoFromBIOS (ScrnInfoPtr pScrn)
return TRUE;
}
+Bool RADEONGetDAC2InfoFromBIOS (xf86OutputPtr output)
+{
+ ScrnInfoPtr pScrn = output->scrn;
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONOutputPrivatePtr radeon_output = output->driver_private;
+ int offset, rev, bg, dac;
+
+ if (!info->VBIOS) return FALSE;
+
+ if (info->IsAtomBios) {
+ /* not implemented yet */
+ return FALSE;
+ } else {
+ /* first check TV table */
+ offset = RADEON_BIOS16(info->ROMHeaderStart + 0x32);
+ if (offset) {
+ rev = RADEON_BIOS8(offset + 0x3);
+ if (rev > 1) {
+ bg = RADEON_BIOS8(offset + 0xc) & 0xf;
+ dac = (RADEON_BIOS8(offset + 0xc) >> 4) & 0xf;
+ radeon_output->ps2_tvdac_adj = (bg << 16) | (dac << 20);
+
+ bg = RADEON_BIOS8(offset + 0xd) & 0xf;
+ dac = (RADEON_BIOS8(offset + 0xd) >> 4) & 0xf;
+ radeon_output->pal_tvdac_adj = (bg << 16) | (dac << 20);
+
+ bg = RADEON_BIOS8(offset + 0xe) & 0xf;
+ dac = (RADEON_BIOS8(offset + 0xe) >> 4) & 0xf;
+ radeon_output->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
+
+ return TRUE;
+ }
+ }
+ /* then check CRT table */
+ offset = RADEON_BIOS16(info->ROMHeaderStart + 0x60);
+ if (offset) {
+ rev = RADEON_BIOS8(offset) & 0x3;
+ if (rev < 2) {
+ bg = RADEON_BIOS8(offset + 0x3) & 0xf;
+ dac = (RADEON_BIOS8(offset + 0x3) >> 4) & 0xf;
+ radeon_output->ps2_tvdac_adj = (bg << 16) | (dac << 20);
+ radeon_output->pal_tvdac_adj = radeon_output->ps2_tvdac_adj;
+ radeon_output->ntsc_tvdac_adj = radeon_output->ps2_tvdac_adj;
+
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
Bool RADEONGetLVDSInfoFromBIOS (xf86OutputPtr output)
{
ScrnInfoPtr pScrn = output->scrn;
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 367d0a63..8fc6bc67 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1734,12 +1734,16 @@ RADEONGetTVDacAdjInfo(xf86OutputPtr output)
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONOutputPrivatePtr radeon_output = output->driver_private;
- /* Todo: get this setting from BIOS */
- radeon_output->tv_dac_adj = default_tvdac_adj[info->ChipFamily];
- if (info->IsMobility) { /* some mobility chips may different */
- if (info->ChipFamily == CHIP_FAMILY_RV250)
- radeon_output->tv_dac_adj = 0x00880000;
+ if (!RADEONGetDAC2InfoFromBIOS(output)) {
+ radeon_output->ps2_tvdac_adj = default_tvdac_adj[info->ChipFamily];
+ if (info->IsMobility) { /* some mobility chips may different */
+ if (info->ChipFamily == CHIP_FAMILY_RV250)
+ radeon_output->ps2_tvdac_adj = 0x00880000;
+ }
+ radeon_output->pal_tvdac_adj = radeon_output->ps2_tvdac_adj;
+ radeon_output->ntsc_tvdac_adj = radeon_output->ps2_tvdac_adj;
}
+
}
void RADEONInitConnector(xf86OutputPtr output)
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 17c0f1b1..dd75d2c4 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -206,7 +206,9 @@ typedef struct _RADEONOutputPrivateRec {
int crtc_num;
int DDCReg;
I2CBusPtr pI2CBus;
- CARD32 tv_dac_adj;
+ CARD32 ps2_tvdac_adj;
+ CARD32 pal_tvdac_adj;
+ CARD32 ntsc_tvdac_adj;
/* panel stuff */
int PanelXRes;
int PanelYRes;
diff --git a/src/radeon_tv.c b/src/radeon_tv.c
index 51f21d0a..d5d1e9e7 100644
--- a/src/radeon_tv.c
+++ b/src/radeon_tv.c
@@ -841,9 +841,15 @@ void RADEONInitTVRegisters(xf86OutputPtr output, RADEONSavePtr save,
tmp = (tmp << RADEON_UV_OUTPUT_POST_SCALE_SHIFT) | 0x000b0000;
save->tv_timing_cntl = tmp;
- save->tv_dac_cntl = (RADEON_TV_DAC_NBLANK |
- RADEON_TV_DAC_NHOLD |
- radeon_output->tv_dac_adj /*(8 << 16) | (6 << 20)*/);
+ if (radeon_output->tvStd == TV_STD_NTSC ||
+ radeon_output->tvStd == TV_STD_NTSC_J ||
+ radeon_output->tvStd == TV_STD_PAL_M ||
+ radeon_output->tvStd == TV_STD_PAL_60)
+ save->tv_dac_cntl = radeon_output->ntsc_tvdac_adj;
+ else
+ save->tv_dac_cntl = radeon_output->pal_tvdac_adj;
+
+ save->tv_dac_cntl |= (RADEON_TV_DAC_NBLANK | RADEON_TV_DAC_NHOLD);
if (radeon_output->tvStd == TV_STD_NTSC ||
radeon_output->tvStd == TV_STD_NTSC_J)