Lines Matching refs:rate
60 u64 rate = (u64)parent_rate * m;
65 rate += DIV_ROUND_UP_ULL(frac_rate,
69 return DIV_ROUND_UP_ULL(rate, n);
83 * it would result in a division by zero. The rate can't be
98 static unsigned int __pll_params_with_frac(unsigned long rate,
105 u64 val = (u64)rate * n;
107 /* Bail out if we are already over the requested rate */
108 if (rate < parent_rate * m / n)
121 static bool meson_clk_pll_is_better(unsigned long rate,
128 if (abs(now - rate) < abs(best - rate))
132 if (now <= rate && best < now)
153 static unsigned int meson_clk_get_pll_range_m(unsigned long rate,
158 u64 val = (u64)rate * n;
166 static int meson_clk_get_pll_range_index(unsigned long rate,
181 if (rate <= pll->range->min * parent_rate) {
184 } else if (rate >= pll->range->max * parent_rate) {
190 *m = meson_clk_get_pll_range_m(rate, parent_rate, *n, pll);
199 static int meson_clk_get_pll_get_index(unsigned long rate,
207 return meson_clk_get_pll_range_index(rate, parent_rate,
215 static int meson_clk_get_pll_settings(unsigned long rate,
226 ret = meson_clk_get_pll_get_index(rate, parent_rate,
232 if (meson_clk_pll_is_better(rate, best, now, pll)) {
237 if (now == rate)
245 static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
254 ret = meson_clk_get_pll_settings(rate, *parent_rate, &m, &n, pll);
260 if (!MESON_PARM_APPLICABLE(&pll->frac) || rate == round)
264 * The rate provided by the setting is not an exact match, let's
267 frac = __pll_params_with_frac(rate, *parent_rate, m, n, pll);
363 static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
372 if (parent_rate == 0 || rate == 0)
377 ret = meson_clk_get_pll_settings(rate, parent_rate, &m, &n, pll);
389 frac = __pll_params_with_frac(rate, parent_rate, m, n, pll);
399 pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
418 * the other ops except set_rate since the rate is fixed.