diff mbox

viafb: fix OLPC DCON refresh rate

Message ID 1302905311-3821-1-git-send-email-FlorianSchandinat@gmx.de (mailing list archive)
State Not Applicable
Headers show

Commit Message

Florian Tobias Schandinat April 15, 2011, 10:08 p.m. UTC
This patch fixes a regression introduced by
	fd3cc69848b7e1873e5f12bbcdd572b20277ecf3a
	"viafb: remove duplicated clock storage"
caused by an incosistent mode which pretended to have a higher
refresh rate than it actually had. The wrong refresh rate resulted
in a calculated higher pixclock which the OLPC DCON could not handle.
By reducing the refresh rate to 50Hz we get close to the old
pixclock which makes the OLPC display usable again.
Minor other adjustments are needed as 60Hz is assumed to be a safe
value which is not true for OLPC DCON. This is no problem as we only
support 1200x900 on the OLPC.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Reported-by: Daniel Drake <dsd@laptop.org>
---
 drivers/video/via/hw.c      |    8 ++++++--
 drivers/video/via/viamode.c |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index dc4c778..980e263 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2598,8 +2598,12 @@  int viafb_get_refresh(int hres, int vres, u32 long_refresh)
 			best = &vmode->crtc[i];
 	}
 
-	if (abs(best->refresh_rate - long_refresh) > 3)
-		return 60;
+	if (abs(best->refresh_rate - long_refresh) > 3) {
+		if (hres == 1200 && vres == 900)
+			return 50; /* OLPC DCON only supports 50 Hz */
+		else
+			return 60;
+	}
 
 	return best->refresh_rate;
 }
diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c
index 8c5bc41..260d339 100644
--- a/drivers/video/via/viamode.c
+++ b/drivers/video/via/viamode.c
@@ -606,7 +606,7 @@  static struct crt_mode_table CRTM1200x720[] = {
 /* 1200x900 (DCON) */
 static struct crt_mode_table DCON1200x900[] = {
 	/* r_rate,               hsp,               vsp   */
-	{REFRESH_60, M1200X900_R60_HSP, M1200X900_R60_VSP,
+	{REFRESH_50, M1200X900_R60_HSP, M1200X900_R60_VSP,
 	/* The correct htotal is 1240, but this doesn't raster on VX855. */
 	/* Via suggested changing to a multiple of 16, hence 1264.       */
 	/*  HT,   HA,  HBS, HBE,  HSS, HSE,  VT,  VA, VBS, VBE, VSS, VSE */