aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-04-10 05:48:36 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-06-17 08:44:28 -0400
commitc582935c00227b4efc79630b149b1f077d7716b2 (patch)
treec6f61324c01169f99a21d01d52ef24155cb3975a
parentf2aee319d95fcba3d29424aeaf6d39d4c2a7890a (diff)
OMAPDSS: DISPC: fix 64 bit issue in 5-tap
The DISPC driver uses 64 bit arithmetic to calculate the required clock rate for scaling. The code does not seem to work correctly, and instead calculates with 32 bit numbers, giving wrong result. Fix the code by typecasting values to u64 first, so that the calculations do happen in 64 bits. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index 4488d9367bd3..2db1c986e989 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2166,7 +2166,7 @@ static unsigned long calc_core_clk_five_taps(unsigned long pclk,
2166 if (height > out_height) { 2166 if (height > out_height) {
2167 unsigned int ppl = mgr_timings->x_res; 2167 unsigned int ppl = mgr_timings->x_res;
2168 2168
2169 tmp = pclk * height * out_width; 2169 tmp = (u64)pclk * height * out_width;
2170 do_div(tmp, 2 * out_height * ppl); 2170 do_div(tmp, 2 * out_height * ppl);
2171 core_clk = tmp; 2171 core_clk = tmp;
2172 2172
@@ -2174,14 +2174,14 @@ static unsigned long calc_core_clk_five_taps(unsigned long pclk,
2174 if (ppl == out_width) 2174 if (ppl == out_width)
2175 return 0; 2175 return 0;
2176 2176
2177 tmp = pclk * (height - 2 * out_height) * out_width; 2177 tmp = (u64)pclk * (height - 2 * out_height) * out_width;
2178 do_div(tmp, 2 * out_height * (ppl - out_width)); 2178 do_div(tmp, 2 * out_height * (ppl - out_width));
2179 core_clk = max_t(u32, core_clk, tmp); 2179 core_clk = max_t(u32, core_clk, tmp);
2180 } 2180 }
2181 } 2181 }
2182 2182
2183 if (width > out_width) { 2183 if (width > out_width) {
2184 tmp = pclk * width; 2184 tmp = (u64)pclk * width;
2185 do_div(tmp, out_width); 2185 do_div(tmp, out_width);
2186 core_clk = max_t(u32, core_clk, tmp); 2186 core_clk = max_t(u32, core_clk, tmp);
2187 2187