diff options
author | Alex Deucher <alex@botch2.(none)> | 2007-08-29 23:11:30 -0400 |
---|---|---|
committer | Alex Deucher <alex@botch2.(none)> | 2007-08-29 23:11:30 -0400 |
commit | 12187a6aa93049c002a4171344d03c713f7f3c5d (patch) | |
tree | 993e3612138ead95de035a67e608a4f3e469c90c | |
parent | 61c1fdaa8553581944f78a11e6f9aa76163a468a (diff) |
RADEON: Add quirk and connector tables for apple laptops
As far as I can tell there are three apple laptop variants:
ibook - LVDS, TVDAC drives TV or VGA via dongle
powerbook-duallink - LVDS, TV, External TMDS/Primary DAC
powerbook - LVDS, TV, Internal TMDS/Primary DAC
use Option "MacModel" "<string>"
to enable the appropriate quirks where string is one of the above
We can't yet init the external TMDS directly, but if OF inits it,
it should work. This should also fix bug 9955.
Please test!
-rw-r--r-- | man/radeon.man | 14 | ||||
-rw-r--r-- | src/radeon.h | 15 | ||||
-rw-r--r-- | src/radeon_crtc.c | 8 | ||||
-rw-r--r-- | src/radeon_driver.c | 9 | ||||
-rw-r--r-- | src/radeon_output.c | 95 |
5 files changed, 140 insertions, 1 deletions
diff --git a/man/radeon.man b/man/radeon.man index 88665bf0..8217262a 100644 --- a/man/radeon.man +++ b/man/radeon.man @@ -397,6 +397,20 @@ driver defaults for each chip. The default is .B off .TP +.BI "Option \*qMacModel\*q \*q" string \*q +.br +Used to specify Mac models for connector tables and quirks. Only valid + on PowerPC. +.br +ibook \-\- ibooks +.br +powerbook-duallink \-\- Powerbooks with dual link DVI +.br +powerbook \-\- Powerbooks with single link DVI +.br +The default value is +.B undefined. +.TP .SH SEE ALSO __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) diff --git a/src/radeon.h b/src/radeon.h index b7a69bd7..4c995111 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -153,6 +153,9 @@ typedef enum { OPTION_CONNECTORTABLE, OPTION_DRI, OPTION_DEFAULT_CONNECTOR_TABLE, +#if defined(__powerpc__) + OPTION_MAC_MODEL, +#endif OPTION_DEFAULT_TMDS_PLL } RADEONOpts; @@ -423,6 +426,14 @@ typedef enum { CHIP_ERRATA_PLL_DELAY = 0x00000004 } RADEONErrata; +#if defined(__powerpc__) +typedef enum { + RADEON_MAC_IBOOK = 0x00000001, + RADEON_MAC_POWERBOOK_DL = 0x00000002, + RADEON_MAC_POWERBOOK = 0x00000004 +} RADEONMacModel; +#endif + typedef enum { CARD_PCI, CARD_AGP, @@ -802,6 +813,10 @@ typedef struct { Bool InternalTVOut; int tvdac_use_count; +#if defined(__powerpc__) + RADEONMacModel MacModel; +#endif + Rotation rotation; void (*PointerMoved)(int, int, int); CreateScreenResourcesProcPtr CreateScreenResources; diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index e976e2c9..47e46f38 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -680,7 +680,15 @@ RADEONInitPLLRegisters(ScrnInfoPtr pScrn, RADEONInfoPtr info, save->post_div); save->ppll_ref_div = pll->reference_div; + +#if defined(__powerpc__) + /* apparently programming this otherwise causes a hang??? */ + if (info->MacModel == RADEON_MAC_IBOOK) + save->ppll_div_3 = 0x000600ad; + else +#endif save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16)); + save->htotal_cntl = 0; save->vclk_ecp_cntl = (info->SavedReg.vclk_ecp_cntl & diff --git a/src/radeon_driver.c b/src/radeon_driver.c index fc0f40bf..5c2efd30 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -188,6 +188,9 @@ static const OptionInfoRec RADEONOptions[] = { { OPTION_CONNECTORTABLE, "ConnectorTable", OPTV_STRING, {0}, FALSE }, { OPTION_DEFAULT_CONNECTOR_TABLE, "DefaultConnectorTable", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DEFAULT_TMDS_PLL, "DefaultTMDSPLL", OPTV_BOOLEAN, {0}, FALSE }, +#if defined(__powerpc__) + { OPTION_CONNECTORTABLE, "MacModel", OPTV_STRING, {0}, FALSE }, +#endif { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -4567,6 +4570,12 @@ void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, unsigned char *RADEONMMIO = info->MMIO; CARD8 pllGain; +#if defined(__powerpc__) + /* apparently restoring the pll causes a hang??? */ + if (info->MacModel == RADEON_MAC_IBOOK) + return; +#endif + pllGain = RADEONComputePLLGain(info->pll.reference_freq, restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK, restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK); diff --git a/src/radeon_output.c b/src/radeon_output.c index 168eab42..40d88731 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -2473,6 +2473,78 @@ void RADEONInitConnector(xf86OutputPtr output) } +#if defined(__powerpc__) +static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + + switch (info->MacModel) { + case RADEON_MAC_IBOOK: + info->BiosConnector[0].DDCType = DDC_DVI; + info->BiosConnector[0].DACType = DAC_NONE; + info->BiosConnector[0].TMDSType = TMDS_NONE; + info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY; + info->BiosConnector[0].valid = TRUE; + + info->BiosConnector[1].DDCType = DDC_VGA; + info->BiosConnector[1].DACType = DAC_TVDAC; + info->BiosConnector[1].TMDSType = TMDS_NONE; + info->BiosConnector[1].ConnectorType = CONNECTOR_CRT; + info->BiosConnector[1].valid = TRUE; + + info->BiosConnector[2].ConnectorType = CONNECTOR_STV; + info->BiosConnector[2].DACType = DAC_TVDAC; + info->BiosConnector[2].TMDSType = TMDS_NONE; + info->BiosConnector[2].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[2].valid = TRUE; + return TRUE; + case RADEON_MAC_POWERBOOK_DL: + info->BiosConnector[0].DDCType = DDC_DVI; + info->BiosConnector[0].DACType = DAC_NONE; + info->BiosConnector[0].TMDSType = TMDS_NONE; + info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY; + info->BiosConnector[0].valid = TRUE; + + info->BiosConnector[1].DDCType = DDC_VGA; + info->BiosConnector[1].DACType = DAC_PRIMARY; + info->BiosConnector[1].TMDSType = TMDS_EXT; + info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I; + info->BiosConnector[1].valid = TRUE; + + info->BiosConnector[2].ConnectorType = CONNECTOR_STV; + info->BiosConnector[2].DACType = DAC_TVDAC; + info->BiosConnector[2].TMDSType = TMDS_NONE; + info->BiosConnector[2].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[2].valid = TRUE; + return TRUE; + case RADEON_MAC_POWERBOOK: + info->BiosConnector[0].DDCType = DDC_DVI; + info->BiosConnector[0].DACType = DAC_NONE; + info->BiosConnector[0].TMDSType = TMDS_NONE; + info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY; + info->BiosConnector[0].valid = TRUE; + + info->BiosConnector[1].DDCType = DDC_VGA; + info->BiosConnector[1].DACType = DAC_PRIMARY; + info->BiosConnector[1].TMDSType = TMDS_INT; + info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I; + info->BiosConnector[1].valid = TRUE; + + info->BiosConnector[2].ConnectorType = CONNECTOR_STV; + info->BiosConnector[2].DACType = DAC_TVDAC; + info->BiosConnector[2].TMDSType = TMDS_NONE; + info->BiosConnector[2].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[2].valid = TRUE; + return TRUE; + default: + return FALSE; + } + + return FALSE; +} +#endif + static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -2508,7 +2580,7 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) info->BiosConnector[1].DDCType = DDC_VGA; info->BiosConnector[1].DACType = DAC_PRIMARY; - info->BiosConnector[1].TMDSType = TMDS_EXT; + info->BiosConnector[1].TMDSType = TMDS_UNKNOWN; info->BiosConnector[1].ConnectorType = CONNECTOR_CRT; info->BiosConnector[1].valid = TRUE; } @@ -2589,6 +2661,27 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) info->BiosConnector[i].ConnectorType = CONNECTOR_NONE; } +#if defined(__powerpc__) + optstr = (char *)xf86GetOptValString(info->Options, OPTION_MAC_MODEL); + + info->MacModel = 0; + if (optstr) { + if (!strncmp("ibook", optstr, strlen("ibook"))) + info->MacModel = RADEON_MAC_IBOOK; + else if (!strncmp("powerbook-duallink", optstr, strlen("powerbook-duallink"))) + info->MacModel = RADEON_MAC_POWERBOOK_DL; + else if (!strncmp("powerbook", optstr, strlen("powerbook"))) + info->MacModel = RADEON_MAC_POWERBOOK; + else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid Mac Model: %s\n", optstr); + return FALSE; + } + + if (!RADEONSetupAppleConnectors(pScrn)) + RADEONSetupGenericConnectors(pScrn); + + } else +#endif if (xf86ReturnOptValBool(info->Options, OPTION_DEFAULT_CONNECTOR_TABLE, FALSE)) { RADEONSetupGenericConnectors(pScrn); } else { |