Skip to contentSkip to conversation

mgag200: fix g200eh pll picking code

PATCH New Dave Airlie 1 participant 1 message Mar 18, 2013

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 mgag200: fix g200eh pll picking code

From: Dave Airlie <[email protected]>

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.

---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/mgag200/mgag200_mode.c +3 -3
index a274b99..4d813bb 100644
@@ -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)
Signature · 1 line
1.8.1.2