Lines Matching +full:fixed +full:- +full:rate
1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/clk-provider.h>
13 * DOC: basic fixed multiplier and divider clock that cannot gate
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
26 unsigned long long int rate; in clk_factor_recalc_rate() local
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()
30 return (unsigned long)rate; in clk_factor_recalc_rate()
33 static long clk_factor_round_rate(struct clk_hw *hw, unsigned long rate, in clk_factor_round_rate() argument
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()
48 static int clk_factor_set_rate(struct clk_hw *hw, unsigned long rate, in clk_factor_set_rate() argument
76 clk_hw_unregister(&fix->hw); in devm_clk_hw_register_fixed_factor_release()
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
143 * @flags: fixed factor flags
147 * Return: Pointer to fixed factor clk_hw structure that was registered or
160 * devm_clk_hw_register_fixed_factor_parent_hw - Register a fixed factor clock with
165 * @flags: fixed factor flags
169 * Return: Pointer to fixed factor clk_hw structure that was registered or
177 -1, flags, mult, div, true); in devm_clk_hw_register_fixed_factor_parent_hw()
186 parent_hw, -1, flags, mult, div, in clk_hw_register_fixed_factor_parent_hw()
195 return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, -1, in clk_hw_register_fixed_factor()
210 return hw->clk; in clk_register_fixed_factor()
242 return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, -1, in devm_clk_hw_register_fixed_factor()
251 const char *clk_name = node->name; in _of_fixed_factor_clk_setup()
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()
290 * of_fixed_factor_clk_setup() - Setup function for simple fixed factor 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()
316 clk = _of_fixed_factor_clk_setup(pdev->dev.of_node); in of_fixed_factor_clk_probe()
326 { .compatible = "fixed-factor-clock" },