Lines Matching refs:rate
60 u64 rate = (u64)parent_rate * m; in __pll_params_to_rate() local
65 rate += DIV_ROUND_UP_ULL(frac_rate, in __pll_params_to_rate()
69 return DIV_ROUND_UP_ULL(rate, n); in __pll_params_to_rate()
98 static unsigned int __pll_params_with_frac(unsigned long rate, in __pll_params_with_frac() argument
105 u64 val = (u64)rate * n; in __pll_params_with_frac()
108 if (rate < parent_rate * m / n) in __pll_params_with_frac()
121 static bool meson_clk_pll_is_better(unsigned long rate, in meson_clk_pll_is_better() argument
128 if (abs(now - rate) < abs(best - rate)) in meson_clk_pll_is_better()
132 if (now <= rate && best < now) in meson_clk_pll_is_better()
153 static unsigned int meson_clk_get_pll_range_m(unsigned long rate, in meson_clk_get_pll_range_m() argument
158 u64 val = (u64)rate * n; in meson_clk_get_pll_range_m()
166 static int meson_clk_get_pll_range_index(unsigned long rate, in meson_clk_get_pll_range_index() argument
181 if (rate <= pll->range->min * parent_rate) { in meson_clk_get_pll_range_index()
184 } else if (rate >= pll->range->max * parent_rate) { in meson_clk_get_pll_range_index()
190 *m = meson_clk_get_pll_range_m(rate, parent_rate, *n, pll); in meson_clk_get_pll_range_index()
199 static int meson_clk_get_pll_get_index(unsigned long rate, in meson_clk_get_pll_get_index() argument
207 return meson_clk_get_pll_range_index(rate, parent_rate, in meson_clk_get_pll_get_index()
215 static int meson_clk_get_pll_settings(unsigned long rate, in meson_clk_get_pll_settings() argument
226 ret = meson_clk_get_pll_get_index(rate, parent_rate, in meson_clk_get_pll_settings()
232 if (meson_clk_pll_is_better(rate, best, now, pll)) { in meson_clk_get_pll_settings()
237 if (now == rate) in meson_clk_get_pll_settings()
245 static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, in meson_clk_pll_round_rate() argument
254 ret = meson_clk_get_pll_settings(rate, *parent_rate, &m, &n, pll); in meson_clk_pll_round_rate()
260 if (!MESON_PARM_APPLICABLE(&pll->frac) || rate == round) in meson_clk_pll_round_rate()
267 frac = __pll_params_with_frac(rate, *parent_rate, m, n, pll); in meson_clk_pll_round_rate()
363 static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, in meson_clk_pll_set_rate() argument
372 if (parent_rate == 0 || rate == 0) in meson_clk_pll_set_rate()
377 ret = meson_clk_get_pll_settings(rate, parent_rate, &m, &n, pll); in meson_clk_pll_set_rate()
389 frac = __pll_params_with_frac(rate, parent_rate, m, n, pll); in meson_clk_pll_set_rate()