diff options
Diffstat (limited to 'drivers/clk/qcom/clk-rcg2.c')
-rw-r--r-- | drivers/clk/qcom/clk-rcg2.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index cd185d5cc67a..cfa9eb4fe9ca 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/div64.h> | 24 | #include <asm/div64.h> |
25 | 25 | ||
26 | #include "clk-rcg.h" | 26 | #include "clk-rcg.h" |
27 | #include "common.h" | ||
27 | 28 | ||
28 | #define CMD_REG 0x0 | 29 | #define CMD_REG 0x0 |
29 | #define CMD_UPDATE BIT(0) | 30 | #define CMD_UPDATE BIT(0) |
@@ -172,27 +173,13 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) | |||
172 | return calc_rate(parent_rate, m, n, mode, hid_div); | 173 | return calc_rate(parent_rate, m, n, mode, hid_div); |
173 | } | 174 | } |
174 | 175 | ||
175 | static const | ||
176 | struct freq_tbl *find_freq(const struct freq_tbl *f, unsigned long rate) | ||
177 | { | ||
178 | if (!f) | ||
179 | return NULL; | ||
180 | |||
181 | for (; f->freq; f++) | ||
182 | if (rate <= f->freq) | ||
183 | return f; | ||
184 | |||
185 | /* Default to our fastest rate */ | ||
186 | return f - 1; | ||
187 | } | ||
188 | |||
189 | static long _freq_tbl_determine_rate(struct clk_hw *hw, | 176 | static long _freq_tbl_determine_rate(struct clk_hw *hw, |
190 | const struct freq_tbl *f, unsigned long rate, | 177 | const struct freq_tbl *f, unsigned long rate, |
191 | unsigned long *p_rate, struct clk **p) | 178 | unsigned long *p_rate, struct clk **p) |
192 | { | 179 | { |
193 | unsigned long clk_flags; | 180 | unsigned long clk_flags; |
194 | 181 | ||
195 | f = find_freq(f, rate); | 182 | f = qcom_find_freq(f, rate); |
196 | if (!f) | 183 | if (!f) |
197 | return -EINVAL; | 184 | return -EINVAL; |
198 | 185 | ||
@@ -268,7 +255,7 @@ static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate) | |||
268 | struct clk_rcg2 *rcg = to_clk_rcg2(hw); | 255 | struct clk_rcg2 *rcg = to_clk_rcg2(hw); |
269 | const struct freq_tbl *f; | 256 | const struct freq_tbl *f; |
270 | 257 | ||
271 | f = find_freq(rcg->freq_tbl, rate); | 258 | f = qcom_find_freq(rcg->freq_tbl, rate); |
272 | if (!f) | 259 | if (!f) |
273 | return -EINVAL; | 260 | return -EINVAL; |
274 | 261 | ||