From efe5f8e3e135bf9dc9b8d9bf742e339aa4edb135 Mon Sep 17 00:00:00 2001 From: Tony Prisk Date: Thu, 27 Dec 2012 13:14:30 +1300 Subject: [PATCH] --- yaml --- r: 350726 b: refs/heads/master c: 72480014b86c8b51fb51c5c6a0525876055c37c7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/clk/clk-vt8500.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d77b3fbe74d5..a541b629a5db 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 35a5db55ab96eadb07b3d5f7258558c680ebc2f0 +refs/heads/master: 72480014b86c8b51fb51c5c6a0525876055c37c7 diff --git a/trunk/drivers/clk/clk-vt8500.c b/trunk/drivers/clk/clk-vt8500.c index 0cb26bef427d..3306c2b1906c 100644 --- a/trunk/drivers/clk/clk-vt8500.c +++ b/trunk/drivers/clk/clk-vt8500.c @@ -123,6 +123,10 @@ static long vt8500_dclk_round_rate(struct clk_hw *hw, unsigned long rate, struct clk_device *cdev = to_clk_device(hw); u32 divisor = *prate / rate; + /* If prate / rate would be decimal, incr the divisor */ + if (rate * divisor < *prate) + divisor++; + /* * If this is a request for SDMMC we have to adjust the divisor * when >31 to use the fixed predivisor @@ -141,6 +145,10 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, u32 divisor = parent_rate / rate; unsigned long flags = 0; + /* If prate / rate would be decimal, incr the divisor */ + if (rate * divisor < *prate) + divisor++; + if (divisor == cdev->div_mask + 1) divisor = 0;