Lines Matching +full:clock +full:- +full:name

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()
65 if (fix->flags & CLK_FIXED_FACTOR_FIXED_ACCURACY) in clk_factor_recalc_accuracy()
66 return fix->acc; in clk_factor_recalc_accuracy()
88 clk_hw_unregister(&fix->hw); in devm_clk_hw_register_fixed_factor_release()
93 const char *name, const char *parent_name, in __clk_hw_register_fixed_factor() argument
105 return ERR_PTR(-EINVAL); in __clk_hw_register_fixed_factor()
113 return ERR_PTR(-ENOMEM); in __clk_hw_register_fixed_factor()
116 fix->mult = mult; in __clk_hw_register_fixed_factor()
117 fix->div = div; in __clk_hw_register_fixed_factor()
118 fix->hw.init = &init; in __clk_hw_register_fixed_factor()
119 fix->acc = acc; in __clk_hw_register_fixed_factor()
120 fix->flags = fixflags; in __clk_hw_register_fixed_factor()
122 init.name = name; in __clk_hw_register_fixed_factor()
133 hw = &fix->hw; in __clk_hw_register_fixed_factor()
151 * devm_clk_hw_register_fixed_factor_index - Register a fixed factor clock with
153 * @dev: device that is registering this clock
154 * @name: name of this clock
164 const char *name, unsigned int index, unsigned long flags, in devm_clk_hw_register_fixed_factor_index() argument
169 return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, NULL, &pdata, in devm_clk_hw_register_fixed_factor_index()
175 * devm_clk_hw_register_fixed_factor_parent_hw - Register a fixed factor clock with
176 * pointer to parent clock
177 * @dev: device that is registering this clock
178 * @name: name of this clock
188 const char *name, const struct clk_hw *parent_hw, in devm_clk_hw_register_fixed_factor_parent_hw() argument
191 const struct clk_parent_data pdata = { .index = -1 }; in devm_clk_hw_register_fixed_factor_parent_hw()
193 return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw, in devm_clk_hw_register_fixed_factor_parent_hw()
199 const char *name, const struct clk_hw *parent_hw, in clk_hw_register_fixed_factor_parent_hw() argument
202 const struct clk_parent_data pdata = { .index = -1 }; in clk_hw_register_fixed_factor_parent_hw()
204 return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw, in clk_hw_register_fixed_factor_parent_hw()
210 const char *name, const char *parent_name, unsigned long flags, in clk_hw_register_fixed_factor() argument
213 const struct clk_parent_data pdata = { .index = -1 }; in clk_hw_register_fixed_factor()
215 return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, in clk_hw_register_fixed_factor()
221 struct device_node *np, const char *name, const char *fw_name, in clk_hw_register_fixed_factor_fwname() argument
224 const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name }; in clk_hw_register_fixed_factor_fwname()
226 return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL, in clk_hw_register_fixed_factor_fwname()
232 struct device_node *np, const char *name, const char *fw_name, in clk_hw_register_fixed_factor_with_accuracy_fwname() argument
236 const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name }; in clk_hw_register_fixed_factor_with_accuracy_fwname()
238 return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL, in clk_hw_register_fixed_factor_with_accuracy_fwname()
244 struct clk *clk_register_fixed_factor(struct device *dev, const char *name, in clk_register_fixed_factor() argument
250 hw = clk_hw_register_fixed_factor(dev, name, parent_name, flags, mult, in clk_register_fixed_factor()
254 return hw->clk; in clk_register_fixed_factor()
283 const char *name, const char *parent_name, unsigned long flags, in devm_clk_hw_register_fixed_factor() argument
286 const struct clk_parent_data pdata = { .index = -1 }; in devm_clk_hw_register_fixed_factor()
288 return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL, in devm_clk_hw_register_fixed_factor()
294 struct device_node *np, const char *name, const char *fw_name, in devm_clk_hw_register_fixed_factor_fwname() argument
297 const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name }; in devm_clk_hw_register_fixed_factor_fwname()
299 return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL, in devm_clk_hw_register_fixed_factor_fwname()
305 struct device_node *np, const char *name, const char *fw_name, in devm_clk_hw_register_fixed_factor_with_accuracy_fwname() argument
309 const struct clk_parent_data pdata = { .index = -1, .fw_name = fw_name }; in devm_clk_hw_register_fixed_factor_with_accuracy_fwname()
311 return __clk_hw_register_fixed_factor(dev, np, name, NULL, NULL, in devm_clk_hw_register_fixed_factor_with_accuracy_fwname()
321 const char *clk_name = node->name; in _of_fixed_factor_clk_setup()
326 if (of_property_read_u32(node, "clock-div", &div)) { in _of_fixed_factor_clk_setup()
327 pr_err("%s Fixed factor clock <%pOFn> must have a clock-div property\n", in _of_fixed_factor_clk_setup()
329 return ERR_PTR(-EIO); in _of_fixed_factor_clk_setup()
332 if (of_property_read_u32(node, "clock-mult", &mult)) { in _of_fixed_factor_clk_setup()
333 pr_err("%s Fixed factor clock <%pOFn> must have a clock-mult property\n", in _of_fixed_factor_clk_setup()
335 return ERR_PTR(-EIO); in _of_fixed_factor_clk_setup()
338 of_property_read_string(node, "clock-output-names", &clk_name); in _of_fixed_factor_clk_setup()
344 * Clear OF_POPULATED flag so that clock registration can be in _of_fixed_factor_clk_setup()
361 * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
362 * @node: device node for the clock
368 CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
375 of_clk_del_provider(pdev->dev.of_node); in of_fixed_factor_clk_remove()
387 clk = _of_fixed_factor_clk_setup(pdev->dev.of_node); in of_fixed_factor_clk_probe()
397 { .compatible = "fixed-factor-clock" },
404 .name = "of_fixed_factor_clk",