Commit 260b3f12 authored by Julia Lemire's avatar Julia Lemire Committed by Dave Airlie

drm/mgag200: Bug fix: Modified pll algorithm for EH project

While testing the mgag200 kms driver on the HP ProLiant Gen8, a
bug was seen.  Once the bootloader would load the selected kernel,
the screen would go black.  At first it was assumed that the
mgag200 kms driver was hanging.  But after setting up the grub
serial output, it was seen that the driver was being loaded
properly.  After trying serval monitors, one finaly displayed
the message "Frequency Out of Range".  By comparing the kms pll
algorithm with the previous mgag200 xorg driver pll algorithm,
discrepencies were found.  Once the kms pll algorithm was
modified, the expected pll values were produced.  This fix was
tested on several monitors of varying native resolutions.
Signed-off-by: default avatarJulia Lemire <jlemire@matrox.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 236f651b
...@@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) ...@@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
m = n = p = 0; m = n = p = 0;
vcomax = 800000; vcomax = 800000;
vcomin = 400000; vcomin = 400000;
pllreffreq = 3333; pllreffreq = 33333;
delta = 0xffffffff; delta = 0xffffffff;
permitteddelta = clock * 5 / 1000; permitteddelta = clock * 5 / 1000;
for (testp = 16; testp > 0; testp--) { for (testp = 16; testp > 0; testp >>= 1) {
if (clock * testp > vcomax) if (clock * testp > vcomax)
continue; continue;
if (clock * testp < vcomin) if (clock * testp < vcomin)
continue; continue;
for (testm = 1; testm < 33; testm++) { for (testm = 1; testm < 33; testm++) {
for (testn = 1; testn < 257; testn++) { for (testn = 17; testn < 257; testn++) {
computed = (pllreffreq * testn) / computed = (pllreffreq * testn) /
(testm * testp); (testm * testp);
if (computed > clock) if (computed > clock)
...@@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) ...@@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
if (tmpdelta < delta) { if (tmpdelta < delta) {
delta = tmpdelta; delta = tmpdelta;
n = testn - 1; n = testn - 1;
m = (testm - 1) | ((n >> 1) & 0x80); m = (testm - 1);
p = testp - 1; p = testp - 1;
} }
if ((clock * testp) >= 600000) if ((clock * testp) >= 600000)
p |= 80; p |= 0x80;
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment