From f633a151a01b06a7b86107d93f9f53e05601c02c Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 28 Jan 2014 10:19:07 +0200 Subject: [PATCH] OMAPDSS: DSS: fclk rate rounding test --- drivers/video/omap2/dss/dss.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 9009f62defd0..de35be6d6e20 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c @@ -473,8 +473,22 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min, fckd_stop = max(DIV_ROUND_UP(prate * m, fck_hw_max), 1ul); for (fckd = fckd_start; fckd >= fckd_stop; --fckd) { + unsigned long rfclk; fck = prate / fckd * m; + /* do we get the right rate with this? */ + rfclk = clk_round_rate(dss.dss_clk, fck); + + if (rfclk != fck) { + /* no we don't. try rounding the other way */ + fck += 1; + + rfclk = clk_round_rate(dss.dss_clk, fck); + + if (rfclk != fck) + DSSERR("mismatch %lu != %lu\n", rfclk, fck); + } + if (func(fck, data)) return true; } -- 1.8.3.2