0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/clk-provider.h>
0009
0010 #include "composite.h"
0011
0012 static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
0013 unsigned long *parent_rate)
0014 {
0015 struct sprd_comp *cc = hw_to_sprd_comp(hw);
0016
0017 return sprd_div_helper_round_rate(&cc->common, &cc->div,
0018 rate, parent_rate);
0019 }
0020
0021 static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
0022 unsigned long parent_rate)
0023 {
0024 struct sprd_comp *cc = hw_to_sprd_comp(hw);
0025
0026 return sprd_div_helper_recalc_rate(&cc->common, &cc->div, parent_rate);
0027 }
0028
0029 static int sprd_comp_set_rate(struct clk_hw *hw, unsigned long rate,
0030 unsigned long parent_rate)
0031 {
0032 struct sprd_comp *cc = hw_to_sprd_comp(hw);
0033
0034 return sprd_div_helper_set_rate(&cc->common, &cc->div,
0035 rate, parent_rate);
0036 }
0037
0038 static u8 sprd_comp_get_parent(struct clk_hw *hw)
0039 {
0040 struct sprd_comp *cc = hw_to_sprd_comp(hw);
0041
0042 return sprd_mux_helper_get_parent(&cc->common, &cc->mux);
0043 }
0044
0045 static int sprd_comp_set_parent(struct clk_hw *hw, u8 index)
0046 {
0047 struct sprd_comp *cc = hw_to_sprd_comp(hw);
0048
0049 return sprd_mux_helper_set_parent(&cc->common, &cc->mux, index);
0050 }
0051
0052 const struct clk_ops sprd_comp_ops = {
0053 .get_parent = sprd_comp_get_parent,
0054 .set_parent = sprd_comp_set_parent,
0055
0056 .round_rate = sprd_comp_round_rate,
0057 .recalc_rate = sprd_comp_recalc_rate,
0058 .set_rate = sprd_comp_set_rate,
0059 };
0060 EXPORT_SYMBOL_GPL(sprd_comp_ops);