diff options
-rw-r--r-- | src/atombios_output.c | 19 | ||||
-rw-r--r-- | src/legacy_output.c | 2 | ||||
-rw-r--r-- | src/radeon_modes.c | 10 | ||||
-rw-r--r-- | src/radeon_output.c | 209 | ||||
-rw-r--r-- | src/radeon_probe.h | 72 |
5 files changed, 112 insertions, 200 deletions
diff --git a/src/atombios_output.c b/src/atombios_output.c index 636373d6..a6bfa7a0 100644 --- a/src/atombios_output.c +++ b/src/atombios_output.c @@ -282,7 +282,8 @@ atombios_output_digital_setup(xf86OutputPtr output, DisplayModePtr mode) case 1: disp_data.ucMisc = 0; disp_data.ucAction = PANEL_ENCODER_ACTION_ENABLE; - if (radeon_output->type == OUTPUT_HDMI) + if ((radeon_output->ConnectorType == CONNECTOR_HDMI_TYPE_A) || + (radeon_output->ConnectorType == CONNECTOR_HDMI_TYPE_B)) disp_data.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; disp_data.usPixelClock = cpu_to_le16(mode->Clock / 10); if (radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { @@ -310,7 +311,8 @@ atombios_output_digital_setup(xf86OutputPtr output, DisplayModePtr mode) xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "Coherent Mode enabled\n"); } } - if (radeon_output->type == OUTPUT_HDMI) + if ((radeon_output->ConnectorType == CONNECTOR_HDMI_TYPE_A) || + (radeon_output->ConnectorType == CONNECTOR_HDMI_TYPE_B)) disp_data2.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; disp_data2.usPixelClock = cpu_to_le16(mode->Clock / 10); disp_data2.ucTruncate = 0; @@ -585,7 +587,7 @@ atombios_output_dig_transmitter_setup(xf86OutputPtr output, DisplayModePtr mode) break; } - if (OUTPUT_IS_DVI || (radeon_output->type == OUTPUT_HDMI)) { + if (radeon_output->active_device & (ATOM_DEVICE_DFP_SUPPORT)) { if (radeon_output->coherent_mode) { disp_data.v2.acConfig.fCoherentMode = 1; xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "UNIPHY%d transmitter: Coherent Mode enabled\n",disp_data.v2.acConfig.ucTransmitterSel); @@ -653,7 +655,7 @@ atombios_output_dig_transmitter_setup(xf86OutputPtr output, DisplayModePtr mode) break; } - if (OUTPUT_IS_DVI || (radeon_output->type == OUTPUT_HDMI)) { + if (radeon_output->active_device & (ATOM_DEVICE_DFP_SUPPORT)) { if (radeon_output->coherent_mode) { disp_data.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_COHERENT; xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "DIG%d transmitter: Coherent Mode enabled\n", num); @@ -694,7 +696,7 @@ atombios_output_scaler_setup(xf86OutputPtr output, DisplayModePtr mode) disp_data.ucScaler = radeon_crtc->crtc_id; - if (OUTPUT_IS_TV) { + if (radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT)) { switch (radeon_output->tvStd) { case TV_STD_NTSC: disp_data.ucTVStandard = ATOM_TV_NTSC; @@ -726,7 +728,10 @@ atombios_output_scaler_setup(xf86OutputPtr output, DisplayModePtr mode) } disp_data.ucEnable = SCALER_ENABLE_MULTITAP_MODE; ErrorF("Using TV scaler %x %x\n", disp_data.ucTVStandard, disp_data.ucEnable); - + } else if (radeon_output->active_device & (ATOM_DEVICE_CV_SUPPORT)) { + disp_data.ucTVStandard = ATOM_TV_CV; + disp_data.ucEnable = SCALER_ENABLE_MULTITAP_MODE; + ErrorF("Using CV scaler %x %x\n", disp_data.ucTVStandard, disp_data.ucEnable); } else if (radeon_output->Flags & RADEON_USE_RMX) { ErrorF("Using RMX\n"); if (radeon_output->rmx_type == RMX_FULL) @@ -1177,7 +1182,7 @@ atombios_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output) if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT) { if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) { - if (radeon_output->type == OUTPUT_STV) + if (radeon_output->ConnectorType == CONNECTOR_STV) return MT_STV; else return MT_CTV; diff --git a/src/legacy_output.c b/src/legacy_output.c index e4e81d0f..54896145 100644 --- a/src/legacy_output.c +++ b/src/legacy_output.c @@ -573,7 +573,7 @@ legacy_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output) if (radeon_output->devices & (ATOM_DEVICE_TV_SUPPORT)) { if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) { - if (radeon_output->type == OUTPUT_STV) + if (radeon_output->ConnectorType == CONNECTOR_STV) found = MT_STV; else found = MT_CTV; diff --git a/src/radeon_modes.c b/src/radeon_modes.c index fa3301e1..50b32a9b 100644 --- a/src/radeon_modes.c +++ b/src/radeon_modes.c @@ -266,7 +266,7 @@ static void RADEONAddScreenModes(xf86OutputPtr output, DisplayModePtr *modeList) if (sscanf(ppModeName[i], "%dx%d", &width, &height) != 2) continue; - if (radeon_output->type == OUTPUT_LVDS) { + if (radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { /* already added the native mode */ if (width == radeon_output->PanelXRes && height == radeon_output->PanelYRes) continue; @@ -329,12 +329,12 @@ RADEONProbeOutputModes(xf86OutputPtr output) ErrorF("in RADEONProbeOutputModes\n"); if (output->status == XF86OutputStatusConnected) { - if (OUTPUT_IS_TV) { + if (radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT)) { if (IS_AVIVO_VARIANT) modes = RADEONATOMTVModes(output); else modes = RADEONTVModes(output); - } else if (radeon_output->type == OUTPUT_CV) { + } else if (radeon_output->active_device & (ATOM_DEVICE_CV_SUPPORT)) { atomBiosResult = RHDAtomBiosFunc(pScrn->scrnIndex, info->atomBIOS, ATOMBIOS_GET_CV_MODES, &atomBiosArg); if (atomBiosResult == ATOM_SUCCESS) { @@ -350,7 +350,7 @@ RADEONProbeOutputModes(xf86OutputPtr output) modes = RADEONeMacModes(output); #endif if (modes == NULL) { - if ((radeon_output->type == OUTPUT_LVDS) && info->IsAtomBios) { + if ((radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT)) && info->IsAtomBios) { atomBiosResult = RHDAtomBiosFunc(pScrn->scrnIndex, info->atomBIOS, ATOMBIOS_GET_PANEL_EDID, &atomBiosArg); @@ -361,7 +361,7 @@ RADEONProbeOutputModes(xf86OutputPtr output) } } if (modes == NULL) { - if (radeon_output->type == OUTPUT_LVDS) + if (radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT)) modes = RADEONFPNativeMode(output); /* add the screen modes */ RADEONAddScreenModes(output, &modes); diff --git a/src/radeon_output.c b/src/radeon_output.c index e5023106..de1af5de 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -104,8 +104,8 @@ const char *ConnectorTypeName[17] = { "DVI-I", "DVI-D", "DVI-A", - "STV", - "CTV", + "S-video", + "Composite", "LVDS", "Digital", "SCART", @@ -118,20 +118,6 @@ const char *ConnectorTypeName[17] = { "Unsupported" }; -const char *OutputType[11] = { - "None", - "VGA", - "DVI", - "DVI", - "DVI", - "LVDS", - "S-video", - "Composite", - "Component", - "HDMI", - "DisplayPort", -}; - static const RADEONTMDSPll default_tmds_pll[CHIP_FAMILY_LAST][4] = { {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, /*CHIP_FAMILY_UNKNOW*/ @@ -267,32 +253,40 @@ radeon_ddc_connected(xf86OutputPtr output) } } if (MonInfo) { - if (radeon_output->type == OUTPUT_LVDS) + switch (radeon_output->ConnectorType) { + case CONNECTOR_LVDS: MonType = MT_LCD; - else if (radeon_output->type == OUTPUT_DVI_D) - MonType = MT_DFP; - else if (radeon_output->type == OUTPUT_HDMI) - MonType = MT_DFP; - else if (radeon_output->type == OUTPUT_DP) - MonType = MT_DFP; - else if (radeon_output->type == OUTPUT_DVI_I && - (MonInfo->rawData[0x14] & 0x80)) /* if it's digital and DVI */ - MonType = MT_DFP; - else - MonType = MT_CRT; - - if (radeon_output->shared_ddc) { - if (radeon_output->type == OUTPUT_VGA) { - if (MonInfo->rawData[0x14] & 0x80) /* if it's digital and VGA */ - MonType = MT_NONE; - else - MonType = MT_CRT; - } else { + break; + case CONNECTOR_DVI_D: + case CONNECTOR_HDMI_TYPE_A: + case CONNECTOR_HDMI_TYPE_B: + if (radeon_output->shared_ddc) { if (MonInfo->rawData[0x14] & 0x80) /* if it's digital and DVI/HDMI/etc. */ MonType = MT_DFP; else MonType = MT_NONE; - } + } else + MonType = MT_DFP; + break; + case CONNECTOR_DISPLAY_PORT: + MonType = MT_DP; + case CONNECTOR_DVI_I: + if (MonInfo->rawData[0x14] & 0x80) /* if it's digital and DVI */ + MonType = MT_DFP; + else + MonType = MT_CRT; + break; + case CONNECTOR_VGA: + case CONNECTOR_DVI_A: + default: + if (radeon_output->shared_ddc) { + if (MonInfo->rawData[0x14] & 0x80) /* if it's digital and VGA */ + MonType = MT_NONE; + else + MonType = MT_CRT; + } else + MonType = MT_CRT; + break; } if (MonType != MT_NONE) @@ -363,7 +357,7 @@ RADEONConnectorFindMonitor(xf86OutputPtr output) if (radeon_output->MonType == MT_UNKNOWN) { radeon_output->MonType = radeon_ddc_connected(output); if (!radeon_output->MonType) { - if (radeon_output->type == OUTPUT_LVDS) { + if (radeon_output->devices & (ATOM_DEVICE_LCD_SUPPORT)) { if (xf86ReturnOptValBool(info->Options, OPTION_IGNORE_LID_STATUS, TRUE)) radeon_output->MonType = MT_LCD; else @@ -450,27 +444,9 @@ radeon_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) return MODE_BANDWIDTH; } - if (OUTPUT_IS_TV) { + if (radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT)) { /* FIXME: Update when more modes are added */ - if (IS_AVIVO_VARIANT) { - int max_v; - - /* tv-scaler can scale horizontal width - * but frame ends must match tv_pll - * for now cap v size - */ - if (radeon_output->tvStd == TV_STD_NTSC || - radeon_output->tvStd == TV_STD_NTSC_J || - radeon_output->tvStd == TV_STD_PAL_M) - max_v = 480; - else - max_v = 600; - - if (pMode->VDisplay == max_v) - return MODE_OK; - else - return MODE_CLOCK_RANGE; - } else { + if (!info->IsAtomBios) { if (pMode->HDisplay == 800 && pMode->VDisplay == 600) return MODE_OK; else @@ -478,7 +454,7 @@ radeon_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) } } - if (radeon_output->type == OUTPUT_LVDS) { + if (radeon_output->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { if (radeon_output->rmx_type == RMX_OFF) { if (pMode->HDisplay != radeon_output->PanelXRes || pMode->VDisplay != radeon_output->PanelYRes) @@ -1031,21 +1007,20 @@ radeon_detect(xf86OutputPtr output) if (radeon_output->MonType == MT_NONE && info->first_load_no_devices) { if (info->IsMobility) { - if (radeon_output->type == OUTPUT_LVDS) { + if (radeon_output->devices & (ATOM_DEVICE_LCD_SUPPORT)) { radeon_output->MonType = MT_LCD; info->first_load_no_devices = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Using LVDS default\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Using LCD default\n"); } } else { - if (radeon_output->type == OUTPUT_VGA || - radeon_output->type == OUTPUT_DVI_I) { + if (radeon_output->devices & (ATOM_DEVICE_CRT_SUPPORT)) { radeon_output->MonType = MT_CRT; info->first_load_no_devices = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Using VGA default\n"); - } else if (radeon_output->type == OUTPUT_DVI_D) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Using CRT default\n"); + } else if (radeon_output->devices & (ATOM_DEVICE_DFP_SUPPORT)) { radeon_output->MonType = MT_DFP; info->first_load_no_devices = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Using DVI default\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Using DFP default\n"); } } } @@ -1055,27 +1030,37 @@ radeon_detect(xf86OutputPtr output) /* set montype so users can force outputs on even if detection fails */ if (radeon_output->MonType == MT_NONE) { connected = FALSE; - if (radeon_output->type == OUTPUT_LVDS) + switch (radeon_output->ConnectorType) { + case CONNECTOR_LVDS: radeon_output->MonType = MT_LCD; - else if (radeon_output->type == OUTPUT_VGA) - radeon_output->MonType = MT_CRT; - else if (radeon_output->type == OUTPUT_STV) - radeon_output->MonType = MT_STV; - else if (radeon_output->type == OUTPUT_CTV) - radeon_output->MonType = MT_CTV; - else if (radeon_output->type == OUTPUT_CV) - radeon_output->MonType = MT_CV; - else if (radeon_output->type == OUTPUT_DVI_D) - radeon_output->MonType = MT_DFP; - else if (radeon_output->type == OUTPUT_HDMI) + break; + case CONNECTOR_DVI_D: + case CONNECTOR_HDMI_TYPE_A: + case CONNECTOR_HDMI_TYPE_B: radeon_output->MonType = MT_DFP; - else if (radeon_output->type == OUTPUT_DVI_A) + break; + case CONNECTOR_VGA: + case CONNECTOR_DVI_A: + default: radeon_output->MonType = MT_CRT; - else if (radeon_output->type == OUTPUT_DVI_I) { + break; + case CONNECTOR_DVI_I: if (radeon_output->DVIType == DVI_ANALOG) radeon_output->MonType = MT_CRT; else if (radeon_output->DVIType == DVI_DIGITAL) radeon_output->MonType = MT_DFP; + break; + case CONNECTOR_STV: + radeon_output->MonType = MT_STV; + break; + case CONNECTOR_CTV: + radeon_output->MonType = MT_CTV; + break; + case CONNECTOR_DIN: + radeon_output->MonType = MT_CV; + break; + case CONNECTOR_DISPLAY_PORT: + break; } } @@ -1323,7 +1308,7 @@ radeon_create_resources(xf86OutputPtr output) "RRConfigureOutputProperty error, %d\n", err); } /* Set the current value of the property */ - if (radeon_output->type == OUTPUT_LVDS) + if (radeon_output->devices & (ATOM_DEVICE_LCD_SUPPORT)) s = "full"; else s = "off"; @@ -1687,59 +1672,6 @@ static const xf86OutputFuncsRec radeon_output_funcs = { .destroy = radeon_destroy }; -void RADEONSetOutputType(ScrnInfoPtr pScrn, RADEONOutputPrivatePtr radeon_output) -{ - RADEONOutputType output = OUTPUT_NONE; - - switch(radeon_output->ConnectorType) { - case CONNECTOR_VGA: - output = OUTPUT_VGA; break; - case CONNECTOR_DVI_I: - output = OUTPUT_DVI_I; break; - case CONNECTOR_DVI_D: - output = OUTPUT_DVI_D; break; - case CONNECTOR_DVI_A: - output = OUTPUT_DVI_A; break; - case CONNECTOR_DIN: - if (radeon_output->devices & ATOM_DEVICE_CV_SUPPORT) - output = OUTPUT_CV; - else if (radeon_output->devices & ATOM_DEVICE_TV1_SUPPORT) - output = OUTPUT_STV; - break; - case CONNECTOR_STV: - output = OUTPUT_STV; break; - case CONNECTOR_CTV: - output = OUTPUT_CTV; break; - case CONNECTOR_LVDS: - output = OUTPUT_LVDS; break; - case CONNECTOR_HDMI_TYPE_A: - case CONNECTOR_HDMI_TYPE_B: - output = OUTPUT_HDMI; break; - case CONNECTOR_DISPLAY_PORT: - output = OUTPUT_DP; break; - case CONNECTOR_DIGITAL: - case CONNECTOR_NONE: - case CONNECTOR_UNSUPPORTED: - default: - output = OUTPUT_NONE; break; - } - radeon_output->type = output; -} - -#if 0 -static -Bool AVIVOI2CReset(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - - OUTREG(AVIVO_I2C_STOP, 1); - INREG(AVIVO_I2C_STOP); - OUTREG(AVIVO_I2C_STOP, 0x0); - return TRUE; -} -#endif - Bool RADEONI2CDoLock(xf86OutputPtr output, int lock_state) { @@ -3122,7 +3054,6 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) radeon_output->MonType = MT_UNKNOWN; radeon_output->ConnectorType = info->BiosConnector[i].ConnectorType; radeon_output->devices = info->BiosConnector[i].devices; - radeon_output->output_id = info->BiosConnector[i].output_id; radeon_output->ddc_i2c = info->BiosConnector[i].ddc_i2c; radeon_output->igp_lane_info = info->BiosConnector[i].igp_lane_info; radeon_output->shared_ddc = info->BiosConnector[i].shared_ddc; @@ -3130,7 +3061,6 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) radeon_output->linkb = info->BiosConnector[i].linkb; radeon_output->connector_id = info->BiosConnector[i].connector_object; - RADEONSetOutputType(pScrn, radeon_output); if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D) || (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I) || (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_A)) { @@ -3156,7 +3086,8 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) output = xf86OutputCreate(pScrn, &radeon_output_funcs, "HDMI-0"); } } else - output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]); + output = xf86OutputCreate(pScrn, &radeon_output_funcs, + ConnectorTypeName[radeon_output->ConnectorType]); if (!output) { return FALSE; @@ -3164,10 +3095,10 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) output->driver_private = radeon_output; output->possible_crtcs = 1; /* crtc2 can drive LVDS, it just doesn't have RMX */ - if (radeon_output->type != OUTPUT_LVDS) + if (!(radeon_output->devices & (ATOM_DEVICE_LCD_SUPPORT))) output->possible_crtcs |= 2; - /* we can clone the DACs, and probably TV-out, + /* we can clone the DACs, and probably TV-out, but I'm not sure it's worth the trouble */ output->possible_clones = 0; diff --git a/src/radeon_probe.h b/src/radeon_probe.h index 7b52c4e1..6da24c27 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -109,27 +109,6 @@ typedef struct { uint32_t value; }RADEONTMDSPll; -typedef enum -{ - OUTPUT_NONE, - OUTPUT_VGA, - OUTPUT_DVI_I, - OUTPUT_DVI_D, - OUTPUT_DVI_A, - OUTPUT_LVDS, - OUTPUT_STV, - OUTPUT_CTV, - OUTPUT_CV, - OUTPUT_HDMI, - OUTPUT_DP -} RADEONOutputType; - -#define OUTPUT_IS_DVI ((radeon_output->type == OUTPUT_DVI_D || \ - radeon_output->type == OUTPUT_DVI_I || \ - radeon_output->type == OUTPUT_DVI_A)) -#define OUTPUT_IS_TV ((radeon_output->type == OUTPUT_STV || \ - radeon_output->type == OUTPUT_CTV)) - /* standards */ typedef enum { @@ -202,18 +181,27 @@ typedef struct { } RADEONBIOSConnector; typedef struct _RADEONOutputPrivateRec { - int num; - RADEONOutputType type; - void *dev_priv; - uint32_t ddc_line; + uint16_t connector_id; + uint32_t devices; + uint32_t active_device; + Bool enabled; + + RADEONConnectorType ConnectorType; RADEONDviType DVIType; RADEONMonitorType MonType; - int crtc_num; - int DDCReg; + // DDC info + I2CBusPtr pI2CBus; + RADEONI2CBusRec ddc_i2c; + Bool shared_ddc; + // router info + // HDP info + + // tv dac uint32_t ps2_tvdac_adj; uint32_t pal_tvdac_adj; uint32_t ntsc_tvdac_adj; + /* panel stuff */ int PanelXRes; int PanelYRes; @@ -225,16 +213,24 @@ typedef struct _RADEONOutputPrivateRec { int VBlank; int Flags; /* Saved copy of mode flags */ int DotClock; + + // lvds int PanelPwrDly; int lvds_misc; int lvds_ss_id; + + // tmds RADEONTMDSPll tmds_pll[4]; + + // RMX RADEONRMXType rmx_type; + /* dvo */ I2CDevPtr DVOChip; RADEONI2CBusRec dvo_i2c; int dvo_i2c_slave_addr; Bool dvo_duallink; + /* TV out */ TVStd default_tvStd; TVStd tvStd; @@ -245,33 +241,13 @@ typedef struct _RADEONOutputPrivateRec { int SupportedTVStds; Bool tv_on; int load_detection; + /* dig block */ int transmitter_config; Bool coherent_mode; int igp_lane_info; Bool linkb; - char *name; - int output_id; - //int devices; - Bool enabled; - - // re-org - uint16_t connector_id; - uint32_t devices; - uint32_t active_device; - //RADEONConnectorType connector_type; - RADEONConnectorType ConnectorType; - // DDC info - I2CBusPtr pI2CBus; - RADEONI2CBusRec ddc_i2c; - // router info - // HDP info - // shared_ddc - Bool shared_ddc; - // cvtv pin - // preferred mode - } RADEONOutputPrivateRec, *RADEONOutputPrivatePtr; struct avivo_pll_state { |