Lines Matching +full:fixed +full:- +full:rate

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
4 * Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
6 * Fixed rate clock implementation
9 #include <linux/clk-provider.h>
18 * DOC: basic fixed-rate clock that cannot gate
21 * prepare - clk_(un)prepare only ensures parents are prepared
22 * enable - clk_enable only ensures parents are enabled
23 * rate - rate is always a fixed value. No clk_set_rate support
24 * parent - fixed parent. No clk_set_parent support
32 return to_clk_fixed_rate(hw)->fixed_rate; in clk_fixed_rate_recalc_rate()
38 struct clk_fixed_rate *fixed = to_clk_fixed_rate(hw); in clk_fixed_rate_recalc_accuracy() local
40 if (fixed->flags & CLK_FIXED_RATE_PARENT_ACCURACY) in clk_fixed_rate_recalc_accuracy()
43 return fixed->fixed_accuracy; in clk_fixed_rate_recalc_accuracy()
61 clk_hw_unregister(&fix->hw); in devm_clk_hw_register_fixed_rate_release()
71 struct clk_fixed_rate *fixed; in __clk_hw_register_fixed_rate() local
74 int ret = -EINVAL; in __clk_hw_register_fixed_rate()
76 /* allocate fixed-rate clock */ in __clk_hw_register_fixed_rate()
78 fixed = devres_alloc(devm_clk_hw_register_fixed_rate_release, in __clk_hw_register_fixed_rate()
79 sizeof(*fixed), GFP_KERNEL); in __clk_hw_register_fixed_rate()
81 fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); in __clk_hw_register_fixed_rate()
82 if (!fixed) in __clk_hw_register_fixed_rate()
83 return ERR_PTR(-ENOMEM); in __clk_hw_register_fixed_rate()
97 fixed->flags = clk_fixed_flags; in __clk_hw_register_fixed_rate()
98 fixed->fixed_rate = fixed_rate; in __clk_hw_register_fixed_rate()
99 fixed->fixed_accuracy = fixed_accuracy; in __clk_hw_register_fixed_rate()
100 fixed->hw.init = &init; in __clk_hw_register_fixed_rate()
103 hw = &fixed->hw; in __clk_hw_register_fixed_rate()
110 devres_free(fixed); in __clk_hw_register_fixed_rate()
112 kfree(fixed); in __clk_hw_register_fixed_rate()
115 devres_add(dev, fixed); in __clk_hw_register_fixed_rate()
131 return hw->clk; in clk_register_fixed_rate()
150 struct clk_fixed_rate *fixed; in clk_hw_unregister_fixed_rate() local
152 fixed = to_clk_fixed_rate(hw); in clk_hw_unregister_fixed_rate()
155 kfree(fixed); in clk_hw_unregister_fixed_rate()
163 const char *clk_name = node->name; in _of_fixed_clk_setup()
164 u32 rate; in _of_fixed_clk_setup() local
168 if (of_property_read_u32(node, "clock-frequency", &rate)) in _of_fixed_clk_setup()
169 return ERR_PTR(-EIO); in _of_fixed_clk_setup()
171 of_property_read_u32(node, "clock-accuracy", &accuracy); in _of_fixed_clk_setup()
173 of_property_read_string(node, "clock-output-names", &clk_name); in _of_fixed_clk_setup()
176 0, rate, accuracy); in _of_fixed_clk_setup()
190 * of_fixed_clk_setup() - Setup function for simple fixed rate clock
197 CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);
203 of_clk_del_provider(pdev->dev.of_node); in of_fixed_clk_remove()
215 hw = _of_fixed_clk_setup(pdev->dev.of_node); in of_fixed_clk_probe()
225 { .compatible = "fixed-clock" },