From: Dave Airlie <airl...@redhat.com>

This aligns this code more carefully with what is in the upstream X.org MGA
driver.

The freq is a typo, and other changes ports from the same function in the
X.org driver.

Cc: stable at vger.kernel.org
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index a274b99..4d813bb 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -382,12 +382,12 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, 
long clock)
        m = n = p = 0;
        vcomax = 800000;
        vcomin = 400000;
-       pllreffreq = 3333;
+       pllreffreq = 33333;

        delta = 0xffffffff;
        permitteddelta = clock * 5 / 1000;

-       for (testp = 16; testp > 0; testp--) {
+       for (testp = 16; testp > 0; testp >>= 1) {
                if (clock * testp > vcomax)
                        continue;
                if (clock * testp < vcomin)
@@ -404,7 +404,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, 
long clock)
                                if (tmpdelta < delta) {
                                        delta = tmpdelta;
                                        n = testn - 1;
-                                       m = (testm - 1) | ((n >> 1) & 0x80);
+                                       m = testm - 1;
                                        p = testp - 1;
                                }
                                if ((clock * testp) >= 600000)
-- 
1.8.1.2

Reply via email to