diff options
author | Alex Deucher <alex@botch2.com> | 2007-03-13 02:31:30 -0400 |
---|---|---|
committer | Alex Deucher <alex@botch2.com> | 2007-03-13 02:31:30 -0400 |
commit | b53db3bc5ba7648d392dc630ef47e57fb8a0afb4 (patch) | |
tree | 77e1cb0eb96be9c5cdf4578fbd707576ed9c932b /src | |
parent | 7d1392be291e99fd3dde2292b82423b5f78d3a21 (diff) |
fix clk calculation on older lynx chips
Diffstat (limited to 'src')
-rw-r--r-- | src/regsmi.h | 12 | ||||
-rw-r--r-- | src/smi_dac.c | 11 | ||||
-rw-r--r-- | src/smi_driver.c | 15 |
3 files changed, 28 insertions, 10 deletions
diff --git a/src/regsmi.h b/src/regsmi.h index c325571..8319d5b 100644 --- a/src/regsmi.h +++ b/src/regsmi.h @@ -40,13 +40,13 @@ authorization from the XFree86 Project and SIlicon Motion. /* Chip tags */ #define PCI_SMI_VENDOR_ID PCI_VENDOR_SMI #define SMI_UNKNOWN 0 -#define SMI_LYNX PCI_CHIP_SMI910 -#define SMI_LYNXE PCI_CHIP_SMI810 -#define SMI_LYNX3D PCI_CHIP_SMI820 -#define SMI_LYNXEM PCI_CHIP_SMI710 +#define SMI_LYNX PCI_CHIP_SMI910 +#define SMI_LYNXE PCI_CHIP_SMI810 +#define SMI_LYNX3D PCI_CHIP_SMI820 +#define SMI_LYNXEM PCI_CHIP_SMI710 #define SMI_LYNXEMplus PCI_CHIP_SMI712 -#define SMI_LYNX3DM PCI_CHIP_SMI720 -#define SMI_COUGAR3DR PCI_CHIP_SMI731 +#define SMI_LYNX3DM PCI_CHIP_SMI720 +#define SMI_COUGAR3DR PCI_CHIP_SMI731 /* I/O Functions */ static __inline__ CARD8 diff --git a/src/smi_dac.c b/src/smi_dac.c index 9fda7fa..ac73323 100644 --- a/src/smi_dac.c +++ b/src/smi_dac.c @@ -41,6 +41,8 @@ SMI_CommonCalcClock(int scrnIndex, long freq, int min_m, int min_n1, int max_n1, int min_n2, int max_n2, long freq_min, long freq_max, unsigned char *mdiv, unsigned char *ndiv) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SMIPtr pSmi = SMIPTR(pScrn); double div, diff, best_diff; unsigned int m; unsigned char n1, n2; @@ -90,7 +92,14 @@ SMI_CommonCalcClock(int scrnIndex, long freq, int min_m, int min_n1, ((double)(best_m) / (double)(best_n1) / (1 << best_n2)) * BASE_FREQ, best_m, best_n1, best_n2)); - *ndiv = best_n1 | (best_n2 << 7); + if (SMI_LYNX_SERIES(pSmi->Chipset)) { + *ndiv = best_n1 | (best_n2 << 6); + } else { + *ndiv = best_n1 | (best_n2 << 7); + if (freq > 120000) + *ndiv |= 1 << 6; + } + *mdiv = best_m; } diff --git a/src/smi_driver.c b/src/smi_driver.c index 45eae6a..9b2ff4b 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -2563,7 +2563,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (pSmi->MCLK > 0) { SMI_CommonCalcClock(pScrn->scrnIndex, pSmi->MCLK, - 1, 1, 31, 0, 2, + 1, 1, 63, 0, 2, pScrn->clockRanges->minClock, pScrn->clockRanges->maxClock, &new->SR6A, &new->SR6B); @@ -2586,11 +2586,20 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* calculate vclk1 */ vclk = mode->Clock; - SMI_CommonCalcClock(pScrn->scrnIndex, vclk, - 1, 1, 31, 0, 2, + if (SMI_LYNX_SERIES(pSmi->Chipset)) { + SMI_CommonCalcClock(pScrn->scrnIndex, vclk, + 1, 1, 63, 0, 2, pScrn->clockRanges->minClock, pScrn->clockRanges->maxClock, &new->SR6C, &new->SR6D); + } else { + SMI_CommonCalcClock(pScrn->scrnIndex, vclk, + 1, 1, 63, 0, 1, + pScrn->clockRanges->minClock, + pScrn->clockRanges->maxClock, + &new->SR6C, &new->SR6D); + } + /* use vclk1 */ new->SR68 = 0x54; |