Lines Matching refs:rate
22 u64 rate = parent; in ccu_nm_calc_rate() local
24 rate *= n; in ccu_nm_calc_rate()
25 do_div(rate, m); in ccu_nm_calc_rate()
27 return rate; in ccu_nm_calc_rate()
30 static void ccu_nm_find_best(unsigned long parent, unsigned long rate, in ccu_nm_find_best() argument
42 if (tmp_rate > rate) in ccu_nm_find_best()
45 if ((rate - tmp_rate) < (rate - best_rate)) { in ccu_nm_find_best()
82 unsigned long rate; in ccu_nm_recalc_rate() local
87 rate = ccu_frac_helper_read_rate(&nm->common, &nm->frac); in ccu_nm_recalc_rate()
90 rate /= nm->fixed_post_div; in ccu_nm_recalc_rate()
92 return rate; in ccu_nm_recalc_rate()
110 rate = ccu_sdm_helper_read_rate(&nm->common, &nm->sdm, m, n); in ccu_nm_recalc_rate()
112 rate = ccu_nm_calc_rate(parent_rate, n, m); in ccu_nm_recalc_rate()
115 rate /= nm->fixed_post_div; in ccu_nm_recalc_rate()
117 return rate; in ccu_nm_recalc_rate()
120 static long ccu_nm_round_rate(struct clk_hw *hw, unsigned long rate, in ccu_nm_round_rate() argument
127 rate *= nm->fixed_post_div; in ccu_nm_round_rate()
129 if (rate < nm->min_rate) { in ccu_nm_round_rate()
130 rate = nm->min_rate; in ccu_nm_round_rate()
132 rate /= nm->fixed_post_div; in ccu_nm_round_rate()
133 return rate; in ccu_nm_round_rate()
136 if (nm->max_rate && rate > nm->max_rate) { in ccu_nm_round_rate()
137 rate = nm->max_rate; in ccu_nm_round_rate()
139 rate /= nm->fixed_post_div; in ccu_nm_round_rate()
140 return rate; in ccu_nm_round_rate()
143 if (ccu_frac_helper_has_rate(&nm->common, &nm->frac, rate)) { in ccu_nm_round_rate()
145 rate /= nm->fixed_post_div; in ccu_nm_round_rate()
146 return rate; in ccu_nm_round_rate()
149 if (ccu_sdm_helper_has_rate(&nm->common, &nm->sdm, rate)) { in ccu_nm_round_rate()
151 rate /= nm->fixed_post_div; in ccu_nm_round_rate()
152 return rate; in ccu_nm_round_rate()
160 ccu_nm_find_best(*parent_rate, rate, &_nm); in ccu_nm_round_rate()
161 rate = ccu_nm_calc_rate(*parent_rate, _nm.n, _nm.m); in ccu_nm_round_rate()
164 rate /= nm->fixed_post_div; in ccu_nm_round_rate()
166 return rate; in ccu_nm_round_rate()
169 static int ccu_nm_set_rate(struct clk_hw *hw, unsigned long rate, in ccu_nm_set_rate() argument
179 rate = rate * nm->fixed_post_div; in ccu_nm_set_rate()
181 if (ccu_frac_helper_has_rate(&nm->common, &nm->frac, rate)) { in ccu_nm_set_rate()
194 rate, nm->lock); in ccu_nm_set_rate()
204 if (ccu_sdm_helper_has_rate(&nm->common, &nm->sdm, rate)) { in ccu_nm_set_rate()
205 ccu_sdm_helper_enable(&nm->common, &nm->sdm, rate); in ccu_nm_set_rate()
208 ccu_sdm_helper_get_factors(&nm->common, &nm->sdm, rate, in ccu_nm_set_rate()
212 ccu_nm_find_best(parent_rate, rate, &_nm); in ccu_nm_set_rate()