1
2
3
4
5
6
7
8#include <linux/clk-provider.h>
9
10#include "composite.h"
11
12static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
13 unsigned long *parent_rate)
14{
15 struct sprd_comp *cc = hw_to_sprd_comp(hw);
16
17 return sprd_div_helper_round_rate(&cc->common, &cc->div,
18 rate, parent_rate);
19}
20
21static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
22 unsigned long parent_rate)
23{
24 struct sprd_comp *cc = hw_to_sprd_comp(hw);
25
26 return sprd_div_helper_recalc_rate(&cc->common, &cc->div, parent_rate);
27}
28
29static int sprd_comp_set_rate(struct clk_hw *hw, unsigned long rate,
30 unsigned long parent_rate)
31{
32 struct sprd_comp *cc = hw_to_sprd_comp(hw);
33
34 return sprd_div_helper_set_rate(&cc->common, &cc->div,
35 rate, parent_rate);
36}
37
38static u8 sprd_comp_get_parent(struct clk_hw *hw)
39{
40 struct sprd_comp *cc = hw_to_sprd_comp(hw);
41
42 return sprd_mux_helper_get_parent(&cc->common, &cc->mux);
43}
44
45static int sprd_comp_set_parent(struct clk_hw *hw, u8 index)
46{
47 struct sprd_comp *cc = hw_to_sprd_comp(hw);
48
49 return sprd_mux_helper_set_parent(&cc->common, &cc->mux, index);
50}
51
52const struct clk_ops sprd_comp_ops = {
53 .get_parent = sprd_comp_get_parent,
54 .set_parent = sprd_comp_set_parent,
55
56 .round_rate = sprd_comp_round_rate,
57 .recalc_rate = sprd_comp_recalc_rate,
58 .set_rate = sprd_comp_set_rate,
59};
60EXPORT_SYMBOL_GPL(sprd_comp_ops);
61