diff options
author | Alex Deucher <alex@samba.(none)> | 2008-01-10 14:49:48 -0500 |
---|---|---|
committer | Alex Deucher <alex@samba.(none)> | 2008-01-10 14:49:48 -0500 |
commit | 000741e250e54122b0adc91694eb4bfa320a70fb (patch) | |
tree | 214947d1626755f985d63e54e0d301c9b8ac9dd5 /src/atombios_output.c | |
parent | 10e7636c02478b8ffe183bb0c46229ca0d6584e1 (diff) |
RADEON: clean up output handling
Diffstat (limited to 'src/atombios_output.c')
-rw-r--r-- | src/atombios_output.c | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/src/atombios_output.c b/src/atombios_output.c index 5ec30987..1a6277e8 100644 --- a/src/atombios_output.c +++ b/src/atombios_output.c @@ -382,15 +382,17 @@ atombios_display_device_control(atomBiosHandlePtr atomBIOS, int device, Bool sta static void atombios_device_dpms(xf86OutputPtr output, int device, int mode) { + RADEONOutputPrivatePtr radeon_output = output->driver_private; RADEONInfoPtr info = RADEONPTR(output->scrn); - int index; + int index = 0; switch (device) { case ATOM_DEVICE_CRT1_SUPPORT: - index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); - break; case ATOM_DEVICE_CRT2_SUPPORT: - index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); + if (radeon_output->DACType == DAC_PRIMARY) + index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); + else if (radeon_output->DACType == DAC_TVDAC) + index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); break; case ATOM_DEVICE_DFP1_SUPPORT: index = GetIndexIntoMasterTable(COMMAND, TMDSAOutputControl); @@ -440,9 +442,9 @@ atombios_output_dpms(xf86OutputPtr output, int mode) * assume we can process. */ count = 0; - tmp = INREG(0x0028); + tmp = INREG(RADEON_BIOS_6_SCRATCH); while((tmp & 0x100) && (count < 5)) { - tmp = INREG(0x0028); + tmp = INREG(RADEON_BIOS_6_SCRATCH); count++; usleep(1000); } @@ -451,7 +453,7 @@ atombios_output_dpms(xf86OutputPtr output, int mode) "%s (WARNING) failed to grab card lock process anyway.\n", __func__); } - OUTREG(0x0028, tmp | 0x100); + OUTREG(RADEON_BIOS_6_SCRATCH, tmp | 0x100); #endif ErrorF("AGD: output dpms %d\n", mode); @@ -484,8 +486,8 @@ atombios_output_dpms(xf86OutputPtr output, int mode) } #if 1 /* release card lock */ - tmp = INREG(0x0028); - OUTREG(0x0028, tmp & (~0x100)); + tmp = INREG(RADEON_BIOS_6_SCRATCH); + OUTREG(RADEON_BIOS_6_SCRATCH, tmp & (~0x100)); #endif } @@ -570,10 +572,13 @@ atombios_output_mode_set(xf86OutputPtr output, atombios_set_output_crtc_source(output); if (radeon_output->MonType == MT_CRT) { - if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT) - atombios_output_dac1_setup(output, adjusted_mode); - else if (radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT) - atombios_output_dac2_setup(output, adjusted_mode); + if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT || + radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT) { + if (radeon_output->DACType == DAC_PRIMARY) + atombios_output_dac1_setup(output, adjusted_mode); + else if (radeon_output->DACType == DAC_TVDAC) + atombios_output_dac2_setup(output, adjusted_mode); + } } else if (radeon_output->MonType == MT_DFP) { if (radeon_output->devices & ATOM_DEVICE_DFP1_SUPPORT) atombios_output_tmds1_setup(output, adjusted_mode); @@ -582,10 +587,13 @@ atombios_output_mode_set(xf86OutputPtr output, else if (radeon_output->devices & ATOM_DEVICE_DFP3_SUPPORT) atombios_output_tmds2_setup(output, adjusted_mode); } else if (radeon_output->MonType == MT_LCD) { - if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT) - atombios_output_lvds_setup(output, adjusted_mode); + if (radeon_output->devices & ATOM_DEVICE_LCD1_SUPPORT) + atombios_output_lvds_setup(output, adjusted_mode); } else if (OUTPUT_IS_TV || (radeon_output->MonType == MT_CV)) { - atombios_output_dac2_setup(output, adjusted_mode); + if (radeon_output->DACType == DAC_PRIMARY) + atombios_output_dac1_setup(output, adjusted_mode); + else if (radeon_output->DACType == DAC_TVDAC) + atombios_output_dac2_setup(output, adjusted_mode); atombios_output_tv1_setup(output, adjusted_mode); } @@ -601,16 +609,28 @@ atom_bios_dac_load_detect(atomBiosHandlePtr atomBIOS, xf86OutputPtr output) if (radeon_output->devices & ATOM_DEVICE_CRT1_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_CRT1_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_A; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else if (radeon_output->devices & ATOM_DEVICE_CRT2_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_CRT2_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_B; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else if (radeon_output->devices & ATOM_DEVICE_CV_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_CV_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_B; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT) { dac_data.sDacload.usDeviceID = ATOM_DEVICE_TV1_SUPPORT; - dac_data.sDacload.ucDacType = ATOM_DAC_B; + if (radeon_output->DACType == DAC_PRIMARY) + dac_data.sDacload.ucDacType = ATOM_DAC_A; + else if (radeon_output->DACType == DAC_TVDAC) + dac_data.sDacload.ucDacType = ATOM_DAC_B; } else { ErrorF("invalid output device for dac detection\n"); return ATOM_NOT_IMPLEMENTED; |