Skip to content

Commit e798bd9

Browse files
ThinkOpenlyLinus Torvalds
authored andcommitted
matroxfb: rectify jitter (G450/G550)
This builds upon my previous attempts to resolve some jitter problems seen with the Matrox G450 and G550 -based cards, including odd disparities observed between x86 and Power -based machines in a somewhat less hackish way (removing the hacked ifdefs). Apparently, preference should be given to use the DVI PLL when frequencies permit, the Standard PLL otherwise. The max pixel clock for the panellink interface is extracted from the PInS information on the card and used as a limit to determine which PLL to use. Signed-off-by: Paul A. Clarke <pc@us.ibm.com> Acked-by: Petr Vandrovec <petr@vandrovec.name> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent acb7386 commit e798bd9

4 files changed

Lines changed: 30 additions & 10 deletions

File tree

‎drivers/video/matrox/g450_pll.c‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -331,16 +331,19 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
331331
tmp |= M1064_XPIXCLKCTRL_PLL_UP;
332332
}
333333
matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);
334-
#ifdef __powerpc__
335-
/* This is necessary to avoid jitter on PowerPC
336-
* (OpenFirmware) systems, but apparently
337-
* introduces jitter, at least on a x86-64
338-
* using DVI.
339-
* A simple workaround is disable for non-PPC.
340-
*/
341-
matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0);
342-
#endif /* __powerpc__ */
343-
matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl);
334+
/* DVI PLL preferred for frequencies up to
335+
panel link max, standard PLL otherwise */
336+
if (fout >= MINFO->max_pixel_clock_panellink)
337+
tmp = 0;
338+
else tmp =
339+
M1064_XDVICLKCTRL_DVIDATAPATHSEL |
340+
M1064_XDVICLKCTRL_C1DVICLKSEL |
341+
M1064_XDVICLKCTRL_C1DVICLKEN |
342+
M1064_XDVICLKCTRL_DVILOOPCTL |
343+
M1064_XDVICLKCTRL_P1LOOPBWDTCTL;
344+
matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL,tmp);
345+
matroxfb_DAC_out(PMINFO M1064_XPWRCTRL,
346+
xpwrctrl);
344347

345348
matroxfb_DAC_unlock_irqrestore(flags);
346349
}

‎drivers/video/matrox/matroxfb_DAC1064.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ void DAC1064_global_restore(WPMINFO2);
3333
#define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */
3434
#define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */
3535
#define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */
36+
/* drive DVI by standard(0)/DVI(1) PLL */
37+
/* if set(1), C?DVICLKEN and C?DVICLKSEL must be set(1) */
38+
#define M1064_XDVICLKCTRL_DVIDATAPATHSEL 0x01
39+
/* drive CRTC1 by standard(0)/DVI(1) PLL */
40+
#define M1064_XDVICLKCTRL_C1DVICLKSEL 0x02
41+
/* drive CRTC2 by standard(0)/DVI(1) PLL */
42+
#define M1064_XDVICLKCTRL_C2DVICLKSEL 0x04
43+
/* pixel clock allowed to(0)/blocked from(1) driving CRTC1 */
44+
#define M1064_XDVICLKCTRL_C1DVICLKEN 0x08
45+
/* DVI PLL loop filter bandwidth selection bits */
46+
#define M1064_XDVICLKCTRL_DVILOOPCTL 0x30
47+
/* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */
48+
#define M1064_XDVICLKCTRL_C2DVICLKEN 0x40
49+
/* P1PLL loop filter bandwith selection */
50+
#define M1064_XDVICLKCTRL_P1LOOPBWDTCTL 0x80
3651
#define M1064_XCURCOL0RED 0x08
3752
#define M1064_XCURCOL0GREEN 0x09
3853
#define M1064_XCURCOL0BLUE 0x0A

‎drivers/video/matrox/matroxfb_base.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ struct matrox_fb_info {
424424
} mmio;
425425

426426
unsigned int max_pixel_clock;
427+
unsigned int max_pixel_clock_panellink;
427428

428429
struct matrox_switch* hw_switch;
429430

‎drivers/video/matrox/matroxfb_misc.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ static int parse_pins5(WPMINFO const struct matrox_bios* bd) {
658658
MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) |
659659
wtst_xlat[MINFO->values.reg.mctlwtst & 7];
660660
}
661+
MINFO->max_pixel_clock_panellink = bd->pins[47] * 4000;
661662
return 0;
662663
}
663664

0 commit comments

Comments
 (0)