Lines Matching refs:div

51 	for (clkt = table; clkt->div; clkt++)  in _get_table_maxdiv()
52 if (clkt->div > maxdiv && clkt->val <= mask) in _get_table_maxdiv()
53 maxdiv = clkt->div; in _get_table_maxdiv()
62 for (clkt = table; clkt->div; clkt++) in _get_table_mindiv()
63 if (clkt->div < mindiv) in _get_table_mindiv()
64 mindiv = clkt->div; in _get_table_mindiv()
85 for (clkt = table; clkt->div; clkt++) in _get_table_div()
87 return clkt->div; in _get_table_div()
106 unsigned int div) in _get_table_val() argument
110 for (clkt = table; clkt->div; clkt++) in _get_table_val()
111 if (clkt->div == div) in _get_table_val()
117 unsigned int div, unsigned long flags, u8 width) in _get_val() argument
120 return div; in _get_val()
122 return __ffs(div); in _get_val()
124 return (div == clk_div_mask(width) + 1) ? 0 : div; in _get_val()
126 return _get_table_val(table, div); in _get_val()
127 return div - 1; in _get_val()
135 unsigned int div; in divider_recalc_rate() local
137 div = _get_div(table, val, flags, width); in divider_recalc_rate()
138 if (!div) { in divider_recalc_rate()
145 return DIV_ROUND_UP_ULL((u64)parent_rate, div); in divider_recalc_rate()
163 unsigned int div) in _is_valid_table_div() argument
167 for (clkt = table; clkt->div; clkt++) in _is_valid_table_div()
168 if (clkt->div == div) in _is_valid_table_div()
173 static bool _is_valid_div(const struct clk_div_table *table, unsigned int div, in _is_valid_div() argument
177 return is_power_of_2(div); in _is_valid_div()
179 return _is_valid_table_div(table, div); in _is_valid_div()
183 static int _round_up_table(const struct clk_div_table *table, int div) in _round_up_table() argument
188 for (clkt = table; clkt->div; clkt++) { in _round_up_table()
189 if (clkt->div == div) in _round_up_table()
190 return clkt->div; in _round_up_table()
191 else if (clkt->div < div) in _round_up_table()
194 if ((clkt->div - div) < (up - div)) in _round_up_table()
195 up = clkt->div; in _round_up_table()
201 static int _round_down_table(const struct clk_div_table *table, int div) in _round_down_table() argument
206 for (clkt = table; clkt->div; clkt++) { in _round_down_table()
207 if (clkt->div == div) in _round_down_table()
208 return clkt->div; in _round_down_table()
209 else if (clkt->div > div) in _round_down_table()
212 if ((div - clkt->div) < (div - down)) in _round_down_table()
213 down = clkt->div; in _round_down_table()
223 int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); in _div_round_up() local
226 div = __roundup_pow_of_two(div); in _div_round_up()
228 div = _round_up_table(table, div); in _div_round_up()
230 return div; in _div_round_up()
276 static int _next_div(const struct clk_div_table *table, int div, in _next_div() argument
279 div++; in _next_div()
282 return __roundup_pow_of_two(div); in _next_div()
284 return _round_up_table(table, div); in _next_div()
286 return div; in _next_div()
350 int div; in divider_determine_rate() local
352 div = clk_divider_bestdiv(hw, req->best_parent_hw, req->rate, in divider_determine_rate()
355 req->rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, div); in divider_determine_rate()
365 int div; in divider_ro_determine_rate() local
367 div = _get_div(table, val, flags, width); in divider_ro_determine_rate()
375 req->rate * div); in divider_ro_determine_rate()
378 req->rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, div); in divider_ro_determine_rate()
474 unsigned int div, value; in divider_get_val() local
476 div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); in divider_get_val()
478 if (!_is_valid_div(table, div, flags)) in divider_get_val()
481 value = _get_val(table, div, flags, width); in divider_get_val()
544 struct clk_divider *div; in __clk_hw_register_divider() local
557 div = kzalloc(sizeof(*div), GFP_KERNEL); in __clk_hw_register_divider()
558 if (!div) in __clk_hw_register_divider()
576 div->reg = reg; in __clk_hw_register_divider()
577 div->shift = shift; in __clk_hw_register_divider()
578 div->width = width; in __clk_hw_register_divider()
579 div->flags = clk_divider_flags; in __clk_hw_register_divider()
580 div->lock = lock; in __clk_hw_register_divider()
581 div->hw.init = &init; in __clk_hw_register_divider()
582 div->table = table; in __clk_hw_register_divider()
585 hw = &div->hw; in __clk_hw_register_divider()
588 kfree(div); in __clk_hw_register_divider()
629 struct clk_divider *div; in clk_unregister_divider() local
636 div = to_clk_divider(hw); in clk_unregister_divider()
639 kfree(div); in clk_unregister_divider()
649 struct clk_divider *div; in clk_hw_unregister_divider() local
651 div = to_clk_divider(hw); in clk_hw_unregister_divider()
654 kfree(div); in clk_hw_unregister_divider()