Lines Matching +full:clock +full:- +full:div

1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/clk-provider.h>
13 * DOC: basic fixed multiplier and divider clock that cannot gate
15 * Traits of this clock:
16 * prepare - clk_prepare only ensures that parents are prepared
17 * enable - clk_enable only ensures that parents are enabled
18 * rate - rate is fixed. clk->rate = parent->rate / div * mult
19 * parent - fixed parent. No clk_set_parent support
28 rate = (unsigned long long int)parent_rate * fix->mult; in clk_factor_recalc_rate()
29 do_div(rate, fix->div); in clk_factor_recalc_rate()
41 best_parent = (rate / fix->mult) * fix->div; in clk_factor_round_rate()
45 return (*prate / fix->div) * fix->mult; in clk_factor_round_rate()
76 clk_hw_unregister(&fix->hw); in devm_clk_hw_register_fixed_factor_release()
83 unsigned long flags, unsigned int mult, unsigned int div, in __clk_hw_register_fixed_factor() argument
94 return ERR_PTR(-EINVAL); in __clk_hw_register_fixed_factor()
102 return ERR_PTR(-ENOMEM); in __clk_hw_register_fixed_factor()
105 fix->mult = mult; in __clk_hw_register_fixed_factor()
106 fix->div = div; in __clk_hw_register_fixed_factor()
107 fix->hw.init = &init; in __clk_hw_register_fixed_factor()
120 hw = &fix->hw; in __clk_hw_register_fixed_factor()
138 * devm_clk_hw_register_fixed_factor_index - Register a fixed factor clock with
140 * @dev: device that is registering this clock
141 * @name: name of this clock
145 * @div: divider
152 unsigned int mult, unsigned int div) in devm_clk_hw_register_fixed_factor_index() argument
155 flags, mult, div, true); in devm_clk_hw_register_fixed_factor_index()
160 * devm_clk_hw_register_fixed_factor_parent_hw - Register a fixed factor clock with
161 * pointer to parent clock
162 * @dev: device that is registering this clock
163 * @name: name of this clock
167 * @div: divider
174 unsigned long flags, unsigned int mult, unsigned int div) in devm_clk_hw_register_fixed_factor_parent_hw() argument
177 -1, flags, mult, div, true); in devm_clk_hw_register_fixed_factor_parent_hw()
183 unsigned long flags, unsigned int mult, unsigned int div) in clk_hw_register_fixed_factor_parent_hw() argument
186 parent_hw, -1, flags, mult, div, in clk_hw_register_fixed_factor_parent_hw()
193 unsigned int mult, unsigned int div) in clk_hw_register_fixed_factor() argument
195 return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, -1, in clk_hw_register_fixed_factor()
196 flags, mult, div, false); in clk_hw_register_fixed_factor()
202 unsigned int mult, unsigned int div) in clk_register_fixed_factor() argument
207 div); in clk_register_fixed_factor()
210 return hw->clk; in clk_register_fixed_factor()
240 unsigned int mult, unsigned int div) in devm_clk_hw_register_fixed_factor() argument
242 return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, -1, in devm_clk_hw_register_fixed_factor()
243 flags, mult, div, true); in devm_clk_hw_register_fixed_factor()
251 const char *clk_name = node->name; in _of_fixed_factor_clk_setup()
252 u32 div, mult; in _of_fixed_factor_clk_setup() local
255 if (of_property_read_u32(node, "clock-div", &div)) { in _of_fixed_factor_clk_setup()
256 pr_err("%s Fixed factor clock <%pOFn> must have a clock-div property\n", in _of_fixed_factor_clk_setup()
258 return ERR_PTR(-EIO); in _of_fixed_factor_clk_setup()
261 if (of_property_read_u32(node, "clock-mult", &mult)) { in _of_fixed_factor_clk_setup()
262 pr_err("%s Fixed factor clock <%pOFn> must have a clock-mult property\n", in _of_fixed_factor_clk_setup()
264 return ERR_PTR(-EIO); in _of_fixed_factor_clk_setup()
267 of_property_read_string(node, "clock-output-names", &clk_name); in _of_fixed_factor_clk_setup()
270 0, mult, div, false); in _of_fixed_factor_clk_setup()
273 * Clear OF_POPULATED flag so that clock registration can be in _of_fixed_factor_clk_setup()
290 * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
291 * @node: device node for the clock
297 CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
304 of_clk_del_provider(pdev->dev.of_node); in of_fixed_factor_clk_remove()
318 clk = _of_fixed_factor_clk_setup(pdev->dev.of_node); in of_fixed_factor_clk_probe()
328 { .compatible = "fixed-factor-clock" },