clk: qcom: Return highest rate when round_rate() exceeds plan
authorStephen Boyd <sboyd@codeaurora.org>
Fri, 16 May 2014 23:07:10 +0000 (16:07 -0700)
committerMike Turquette <mturquette@linaro.org>
Thu, 29 May 2014 16:30:22 +0000 (09:30 -0700)
Some drivers may want to call clk_set_rate() with a very large
number to force the clock to go as fast as it possibly can
without having to know the range between the highest rate and
second highest rate. Add support for this by defaulting to the
highest rate in the frequency table if we can't find a frequency
greater than what is requested.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/qcom/clk-rcg2.c

index 0996a3a398550f36acdfc2320d70e64075e2afe5..cbecaec3056256576de0567a51d439766ef11794 100644 (file)
@@ -181,7 +181,8 @@ struct freq_tbl *find_freq(const struct freq_tbl *f, unsigned long rate)
                if (rate <= f->freq)
                        return f;
 
-       return NULL;
+       /* Default to our fastest rate */
+       return f - 1;
 }
 
 static long _freq_tbl_determine_rate(struct clk_hw *hw,