Lines Matching full:rate

152  * Calculate m/n:d rate
155 * rate = ----------- x ---
159 calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div) in calc_rate() argument
162 rate = mult_frac(rate, 2, hid_div + 1); in calc_rate()
165 rate = mult_frac(rate, m, n); in calc_rate()
167 return rate; in calc_rate()
210 unsigned long clk_flags, rate = req->rate; in _freq_tbl_determine_rate() local
217 f = qcom_find_freq_floor(f, rate); in _freq_tbl_determine_rate()
220 f = qcom_find_freq(f, rate); in _freq_tbl_determine_rate()
239 rate = f->freq; in _freq_tbl_determine_rate()
241 if (!rate) in _freq_tbl_determine_rate()
242 rate = req->rate; in _freq_tbl_determine_rate()
243 rate /= 2; in _freq_tbl_determine_rate()
244 rate *= f->pre_div + 1; in _freq_tbl_determine_rate()
248 u64 tmp = rate; in _freq_tbl_determine_rate()
251 rate = tmp; in _freq_tbl_determine_rate()
254 rate = clk_hw_get_rate(p); in _freq_tbl_determine_rate()
257 req->best_parent_rate = rate; in _freq_tbl_determine_rate()
258 req->rate = f->freq; in _freq_tbl_determine_rate()
271 unsigned long parent_rate, rate; in __clk_rcg2_select_conf() local
281 /* Search in each provided config the one that is near the wanted rate */ in __clk_rcg2_select_conf()
292 rate = calc_rate(parent_rate, conf->n, conf->m, conf->n, conf->pre_div); in __clk_rcg2_select_conf()
294 if (rate == req_rate) { in __clk_rcg2_select_conf()
299 rate_diff = abs_diff(req_rate, rate); in __clk_rcg2_select_conf()
311 WARN(1, "%s: can't find a configuration for rate %lu\n", in __clk_rcg2_select_conf()
323 unsigned long clk_flags, rate = req->rate; in _freq_tbl_fm_determine_rate() local
329 f = qcom_find_freq_multi(f, rate); in _freq_tbl_fm_determine_rate()
333 conf = __clk_rcg2_select_conf(hw, f, rate); in _freq_tbl_fm_determine_rate()
346 rate = f->freq; in _freq_tbl_fm_determine_rate()
348 if (!rate) in _freq_tbl_fm_determine_rate()
349 rate = req->rate; in _freq_tbl_fm_determine_rate()
350 rate /= 2; in _freq_tbl_fm_determine_rate()
351 rate *= conf->pre_div + 1; in _freq_tbl_fm_determine_rate()
355 u64 tmp = rate; in _freq_tbl_fm_determine_rate()
359 rate = tmp; in _freq_tbl_fm_determine_rate()
362 rate = clk_hw_get_rate(p); in _freq_tbl_fm_determine_rate()
366 req->best_parent_rate = rate; in _freq_tbl_fm_determine_rate()
367 req->rate = f->freq; in _freq_tbl_fm_determine_rate()
468 static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, in __clk_rcg2_set_rate() argument
476 f = qcom_find_freq_floor(rcg->freq_tbl, rate); in __clk_rcg2_set_rate()
479 f = qcom_find_freq(rcg->freq_tbl, rate); in __clk_rcg2_set_rate()
491 static int __clk_rcg2_fm_set_rate(struct clk_hw *hw, unsigned long rate) in __clk_rcg2_fm_set_rate() argument
498 f = qcom_find_freq_multi(rcg->freq_multi_tbl, rate); in __clk_rcg2_fm_set_rate()
502 conf = __clk_rcg2_select_conf(hw, f, rate); in __clk_rcg2_fm_set_rate()
515 static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, in clk_rcg2_set_rate() argument
518 return __clk_rcg2_set_rate(hw, rate, CEIL); in clk_rcg2_set_rate()
521 static int clk_rcg2_set_floor_rate(struct clk_hw *hw, unsigned long rate, in clk_rcg2_set_floor_rate() argument
524 return __clk_rcg2_set_rate(hw, rate, FLOOR); in clk_rcg2_set_floor_rate()
527 static int clk_rcg2_fm_set_rate(struct clk_hw *hw, unsigned long rate, in clk_rcg2_fm_set_rate() argument
530 return __clk_rcg2_fm_set_rate(hw, rate); in clk_rcg2_fm_set_rate()
534 unsigned long rate, unsigned long parent_rate, u8 index) in clk_rcg2_set_rate_and_parent() argument
536 return __clk_rcg2_set_rate(hw, rate, CEIL); in clk_rcg2_set_rate_and_parent()
540 unsigned long rate, unsigned long parent_rate, u8 index) in clk_rcg2_set_floor_rate_and_parent() argument
542 return __clk_rcg2_set_rate(hw, rate, FLOOR); in clk_rcg2_set_floor_rate_and_parent()
546 unsigned long rate, unsigned long parent_rate, u8 index) in clk_rcg2_fm_set_rate_and_parent() argument
548 return __clk_rcg2_fm_set_rate(hw, rate); in clk_rcg2_fm_set_rate_and_parent()
686 static const struct frac_entry frac_table_675m[] = { /* link rate of 270M */
697 static struct frac_entry frac_table_810m[] = { /* Link rate of 162M */
708 static int clk_edp_pixel_set_rate(struct clk_hw *hw, unsigned long rate, in clk_edp_pixel_set_rate() argument
726 request = rate; in clk_edp_pixel_set_rate()
748 unsigned long rate, unsigned long parent_rate, u8 index) in clk_edp_pixel_set_rate_and_parent() argument
751 return clk_edp_pixel_set_rate(hw, rate, parent_rate); in clk_edp_pixel_set_rate_and_parent()
776 request = req->rate; in clk_edp_pixel_determine_rate()
788 req->rate = calc_rate(req->best_parent_rate, in clk_edp_pixel_determine_rate()
818 if (req->rate == 0) in clk_byte_determine_rate()
822 req->best_parent_rate = parent_rate = clk_hw_round_rate(p, req->rate); in clk_byte_determine_rate()
824 div = DIV_ROUND_UP((2 * parent_rate), req->rate) - 1; in clk_byte_determine_rate()
827 req->rate = calc_rate(parent_rate, 0, 0, 0, div); in clk_byte_determine_rate()
832 static int clk_byte_set_rate(struct clk_hw *hw, unsigned long rate, in clk_byte_set_rate() argument
840 div = DIV_ROUND_UP((2 * parent_rate), rate) - 1; in clk_byte_set_rate()
849 unsigned long rate, unsigned long parent_rate, u8 index) in clk_byte_set_rate_and_parent() argument
852 return clk_byte_set_rate(hw, rate, parent_rate); in clk_byte_set_rate_and_parent()
873 unsigned long rate = req->rate; in clk_byte2_determine_rate() local
875 if (rate == 0) in clk_byte2_determine_rate()
879 req->best_parent_rate = parent_rate = clk_hw_round_rate(p, rate); in clk_byte2_determine_rate()
881 div = DIV_ROUND_UP((2 * parent_rate), rate) - 1; in clk_byte2_determine_rate()
884 req->rate = calc_rate(parent_rate, 0, 0, 0, div); in clk_byte2_determine_rate()
889 static int clk_byte2_set_rate(struct clk_hw *hw, unsigned long rate, in clk_byte2_set_rate() argument
899 div = DIV_ROUND_UP((2 * parent_rate), rate) - 1; in clk_byte2_set_rate()
919 unsigned long rate, unsigned long parent_rate, u8 index) in clk_byte2_set_rate_and_parent() argument
922 return clk_byte2_set_rate(hw, rate, parent_rate); in clk_byte2_set_rate_and_parent()
953 request = (req->rate * frac->den) / frac->num; in clk_pixel_determine_rate()
961 req->rate = (src_rate * frac->num) / frac->den; in clk_pixel_determine_rate()
968 static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate, in clk_pixel_set_rate() argument
991 request = (rate * frac->den) / frac->num; in clk_pixel_set_rate()
1010 static int clk_pixel_set_rate_and_parent(struct clk_hw *hw, unsigned long rate, in clk_pixel_set_rate_and_parent() argument
1013 return clk_pixel_set_rate(hw, rate, parent_rate); in clk_pixel_set_rate_and_parent()
1049 if (req->rate == clk_hw_get_rate(xo)) { in clk_gfx3d_determine_rate()
1057 parent_req.rate = req->rate * mux_div; in clk_gfx3d_determine_rate()
1059 /* This has to be a fixed rate PLL */ in clk_gfx3d_determine_rate()
1062 if (parent_req.rate == p0_rate) { in clk_gfx3d_determine_rate()
1063 req->rate = req->best_parent_rate = p0_rate; in clk_gfx3d_determine_rate()
1069 /* Are we going back to a previously used rate? */ in clk_gfx3d_determine_rate()
1070 if (clk_hw_get_rate(p2) == parent_req.rate) in clk_gfx3d_determine_rate()
1093 req->rate = req->best_parent_rate = parent_req.rate; in clk_gfx3d_determine_rate()
1094 req->rate /= mux_div; in clk_gfx3d_determine_rate()
1099 static int clk_gfx3d_set_rate_and_parent(struct clk_hw *hw, unsigned long rate, in clk_gfx3d_set_rate_and_parent() argument
1119 static int clk_gfx3d_set_rate(struct clk_hw *hw, unsigned long rate, in clk_gfx3d_set_rate() argument
1189 static int clk_rcg2_shared_set_rate(struct clk_hw *hw, unsigned long rate, in clk_rcg2_shared_set_rate() argument
1195 f = qcom_find_freq(rcg->freq_tbl, rate); in clk_rcg2_shared_set_rate()
1211 unsigned long rate, unsigned long parent_rate, u8 index) in clk_rcg2_shared_set_rate_and_parent() argument
1213 return clk_rcg2_shared_set_rate(hw, rate, parent_rate); in clk_rcg2_shared_set_rate_and_parent()
1229 /* Write back the stored configuration corresponding to current rate */ in clk_rcg2_shared_enable()
1535 * Rate changes with consumer writing a register in in clk_rcg2_enable_dfs()
1561 static int clk_rcg2_dp_set_rate(struct clk_hw *hw, unsigned long rate, in clk_rcg2_dp_set_rate() argument
1571 rational_best_approximation(parent_rate, rate, in clk_rcg2_dp_set_rate()
1606 unsigned long rate, unsigned long parent_rate, u8 index) in clk_rcg2_dp_set_rate_and_parent() argument
1608 return clk_rcg2_dp_set_rate(hw, rate, parent_rate); in clk_rcg2_dp_set_rate_and_parent()
1618 /* Parent rate is a fixed phy link rate */ in clk_rcg2_dp_determine_rate()
1619 rational_best_approximation(req->best_parent_rate, req->rate, in clk_rcg2_dp_determine_rate()
1628 req->rate = tmp; in clk_rcg2_dp_determine_rate()