From: Mans Rullgard <mans@mansr.com>
Date: Mon, 7 Jul 2008 23:59:08 +0000 (+0100)
Subject: omapfb: ensure fck/lcd < 173MHz
X-Git-Url: http://git.mansr.com/?p=linux-omap;a=commitdiff_plain;h=0523ece1bad659c48c66aea364d83f7490e7e5ae

omapfb: ensure fck/lcd < 173MHz
---

diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index c17371c..85d6cad 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -738,14 +738,16 @@ static void setup_color_conv_coef(void)
 	MOD_REG_FLD(at2_reg, (1 << 11), ct->full_range);
 }
 
+#define MAX_FCK_LCD 173000000
+
 static void calc_ck_div(int is_tft, int pck, int *lck_div, int *pck_div)
 {
 	unsigned long fck, lck;
 
-	*lck_div = 1;
 	pck = max(1, pck);
 	fck = clk_get_rate(dispc.dss1_fck);
-	lck = fck;
+	*lck_div = (fck + MAX_FCK_LCD - 1) / MAX_FCK_LCD;
+	lck = fck / *lck_div;
 	*pck_div = (lck + pck - 1) / pck;
 	if (is_tft)
 		*pck_div = max(2, *pck_div);
