The pre_pll divisor must be such that ext_clk / pre_pll divisor does not
result in a frequency that is greater than pll_ip_clk_freq. Fix this.

Signed-off-by: Sakari Ailus <sakari.ai...@maxwell.research.nokia.com>
---
 drivers/media/video/smiapp-pll.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/smiapp-pll.c b/drivers/media/video/smiapp-pll.c
index a416e27..a2e41a2 100644
--- a/drivers/media/video/smiapp-pll.c
+++ b/drivers/media/video/smiapp-pll.c
@@ -124,8 +124,9 @@ int smiapp_pll_calculate(struct device *dev, struct 
smiapp_pll_limits *limits,
                                   limits->min_pll_ip_freq_hz));
        limits->min_pre_pll_clk_div =
                max_t(uint16_t, limits->min_pre_pll_clk_div,
-                     clk_div_even(pll->ext_clk_freq_hz /
-                                  limits->max_pll_ip_freq_hz));
+                     clk_div_even_up(
+                             DIV_ROUND_UP(pll->ext_clk_freq_hz,
+                                          limits->max_pll_ip_freq_hz)));
        dev_dbg(dev, "pre-pll check: min / max pre_pll_clk_div: %d / %d\n",
                limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div);
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to