[Unichrome-devel] xf86-video-unichrome master branch updated. (942ed146)
Brought to you by:
dwdeath
From: <li...@fr...> - 2009-10-14 13:19:24
|
Reporting from xf86-video-unichrome: Main unichrome.sf.net repository Please visit: http://cgit.freedesktop.org/~libv/xf86-video-unichrome Or get your own copy by using: git-clone git://anongit.freedesktop.org/~libv/xf86-video-unichrome The branch, master has been updated via 942ed14 Crtc: Add initial VT3157 support. from 61ed79b ID: the VT3108 K9VGM-V is really the K9MM-V. Summary of changes: src/via_crtc.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 121 insertions(+), 0 deletions(-) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 942ed146d5765efb5e0b259068232f80c8683e12 Author: Luc Verhaegen <li...@sk...> Date: Wed Oct 14 15:22:20 2009 +0200 Crtc: Add initial VT3157 support. * Add FIFOSet routines. * Add PLL calculation routine. * Fill in further switches assuming that VT3157 is broadly compatible, checking other limits is a TODO. 942ed146d5765efb5e0b259068232f80c8683e12 diff --git a/src/via_crtc.c b/src/via_crtc.c index 81ed073..1b70f4b 100644 --- a/src/via_crtc.c +++ b/src/via_crtc.c @@ -185,6 +185,51 @@ VT3118PLLGenerate(struct ViaCrtc *Crtc, int Clock) /* * */ +static CARD32 +VT3157PLLGenerate(struct ViaCrtc *Crtc, int Clock) +{ + CARD32 PLL = 0; + CARD32 Divider, Shift, Multiplier; + CARD32 RoundUp; + int Diff = INT_MAX, NewDiff; + + VIAFUNC(Crtc); + + for (Shift = 0; Shift < 4; Shift++) { + for (Divider = 2; Divider < 52; Divider++) { + for (RoundUp = 0; RoundUp < 2; RoundUp++) { + if (RoundUp) + Multiplier = (((Clock * Divider) << Shift) + 14317) / 14318; + else + Multiplier = ((Clock * Divider) << Shift) / 14318; + + if (Multiplier > 257) + continue; + + if (Multiplier < (6 * (Divider - 8))) + continue; + + NewDiff = abs(((14318000 * Multiplier) / (Divider << Shift)) - + (Clock * 1000)); + if (NewDiff > Diff) + continue; + + Diff = NewDiff; + + PLL = ((Divider - 2) << 16) | (Shift << 10) | (Multiplier - 2); + } + } + } + + ViaDebug(Crtc->scrnIndex, "%s: PLL: 0x%06X (%d off from %d)\n", + __func__, PLL, Diff / 1000, Clock); + + return PLL; +} + +/* + * + */ static void ViaBusClockSet(struct ViaCrtc *Crtc, int flags) { @@ -314,6 +359,22 @@ VT3118Crtc1PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags) * */ static void +VT3157Crtc1PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags) +{ + CARD32 PLL = 0; + + if (!(flags & PLL_FLAG_EXTERNAL)) + PLL = VT3157PLLGenerate(Crtc, Clock); + + ViaDebug(Crtc->scrnIndex, "%s: %dkHz -> 0x%06X.\n", __func__, Clock, PLL); + + VT3108Crtc1PLLSetLow(Crtc, PLL, flags); +} + +/* + * + */ +static void VT3122Crtc2PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags) { VIAPtr pVia = VIAPTR(xf86Screens[Crtc->scrnIndex]); @@ -396,6 +457,22 @@ VT3118Crtc2PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags) /* * */ +static void +VT3157Crtc2PLLSet(struct ViaCrtc *Crtc, CARD32 Clock, int flags) +{ + CARD32 PLL = 0; + + if (!(flags & PLL_FLAG_EXTERNAL)) + PLL = VT3157PLLGenerate(Crtc, Clock); + + ViaDebug(Crtc->scrnIndex, "%s: %dkHz -> 0x%06X.\n", __func__, Clock, PLL); + + VT3108Crtc2PLLSetLow(Crtc, PLL, flags); +} + +/* + * + */ typedef struct { CARD16 X; CARD16 Y; @@ -692,6 +769,20 @@ VT3344Crtc1FIFOSet(struct ViaCrtc *Crtc, DisplayModePtr Mode) VT3108Crtc1FIFOHelper(Crtc, 47, 20, 16, 0); } +/* + * + */ +static void +VT3157Crtc1FIFOSet(struct ViaCrtc *Crtc, DisplayModePtr Mode) +{ + VIAFUNC(Crtc); + + VIACrtc1FetchCountSet(Crtc, Mode); + + /* Depth = 192 / 2 - 1; Threshold = 128 / 4; + HighThreshold = 128 / 4; Expire = 124 / 4 */ + VT3108Crtc1FIFOHelper(Crtc, 95, 32, 32, 31); +} /* * @@ -872,6 +963,21 @@ VT3344Crtc2FIFOSet(struct ViaCrtc *Crtc, DisplayModePtr Mode) } /* + * + */ +static void +VT3157Crtc2FIFOSet(struct ViaCrtc *Crtc, DisplayModePtr Mode) +{ + VIAFUNC(Crtc); + + VIACrtc2FetchCountSet(Crtc, Mode); + + /* Depth: 96 / 8 - 1; Threshold: 64 / 4; + HighThreshold: 32 / 4; Expire: 128 /4 */ + VT3108Crtc2FIFOHelper(Crtc, 11, 16, 8, 32); +} + +/* * Check whether our CRTC1 supports this mode. */ static ModeStatus @@ -1749,6 +1855,7 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3108: case VT3118: case VT3344: + case VT3157: break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: Unsupported chipset\n", __func__); @@ -1789,6 +1896,9 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3344: Crtc->FIFOSet = VT3344Crtc1FIFOSet; break; + case VT3157: + Crtc->FIFOSet = VT3157Crtc1FIFOSet; + break; default: /* should never happen, fix up the check at the top of this function */ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: unsupported chipset\n", __func__); @@ -1808,6 +1918,9 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3118: Crtc->PLLSet = VT3118Crtc1PLLSet; break; + case VT3157: + Crtc->PLLSet = VT3157Crtc1PLLSet; + break; default: /* should never happen, fix up the check at the top of this function */ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: Unsupported chipset\n", __func__); @@ -1826,6 +1939,7 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3108: case VT3118: case VT3344: + case VT3157: Crtc->GammaEnable = VT3108Crtc1GammaEnable; break; default: @@ -1884,6 +1998,9 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3344: Crtc->FIFOSet = VT3344Crtc2FIFOSet; break; + case VT3157: + Crtc->FIFOSet = VT3157Crtc2FIFOSet; + break; default: /* should never happen, fix up the check at the top of this function */ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: unsupported chipset\n", __func__); @@ -1903,6 +2020,9 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3118: Crtc->PLLSet = VT3118Crtc2PLLSet; break; + case VT3157: + Crtc->PLLSet = VT3157Crtc2PLLSet; + break; default: /* should never happen, fix up the check at the top of this function */ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: Unsupported chipset\n", __func__); @@ -1920,6 +2040,7 @@ ViaCrtcInit(ScrnInfoPtr pScrn) case VT3108: case VT3118: case VT3344: + case VT3157: Crtc->ScaleSet = VT3108Crtc2ScaleSet; break; default: ----------------------------------------------------------------------- |