diff options
Diffstat (limited to 'drivers/clk/clk-composite.c')
-rw-r--r-- | drivers/clk/clk-composite.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 4386697236a7..956b7e54fa1c 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c | |||
@@ -27,7 +27,7 @@ static u8 clk_composite_get_parent(struct clk_hw *hw) | |||
27 | const struct clk_ops *mux_ops = composite->mux_ops; | 27 | const struct clk_ops *mux_ops = composite->mux_ops; |
28 | struct clk_hw *mux_hw = composite->mux_hw; | 28 | struct clk_hw *mux_hw = composite->mux_hw; |
29 | 29 | ||
30 | mux_hw->clk = hw->clk; | 30 | __clk_hw_set_clk(mux_hw, hw); |
31 | 31 | ||
32 | return mux_ops->get_parent(mux_hw); | 32 | return mux_ops->get_parent(mux_hw); |
33 | } | 33 | } |
@@ -38,7 +38,7 @@ static int clk_composite_set_parent(struct clk_hw *hw, u8 index) | |||
38 | const struct clk_ops *mux_ops = composite->mux_ops; | 38 | const struct clk_ops *mux_ops = composite->mux_ops; |
39 | struct clk_hw *mux_hw = composite->mux_hw; | 39 | struct clk_hw *mux_hw = composite->mux_hw; |
40 | 40 | ||
41 | mux_hw->clk = hw->clk; | 41 | __clk_hw_set_clk(mux_hw, hw); |
42 | 42 | ||
43 | return mux_ops->set_parent(mux_hw, index); | 43 | return mux_ops->set_parent(mux_hw, index); |
44 | } | 44 | } |
@@ -50,12 +50,14 @@ static unsigned long clk_composite_recalc_rate(struct clk_hw *hw, | |||
50 | const struct clk_ops *rate_ops = composite->rate_ops; | 50 | const struct clk_ops *rate_ops = composite->rate_ops; |
51 | struct clk_hw *rate_hw = composite->rate_hw; | 51 | struct clk_hw *rate_hw = composite->rate_hw; |
52 | 52 | ||
53 | rate_hw->clk = hw->clk; | 53 | __clk_hw_set_clk(rate_hw, hw); |
54 | 54 | ||
55 | return rate_ops->recalc_rate(rate_hw, parent_rate); | 55 | return rate_ops->recalc_rate(rate_hw, parent_rate); |
56 | } | 56 | } |
57 | 57 | ||
58 | static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate, | 58 | static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate, |
59 | unsigned long min_rate, | ||
60 | unsigned long max_rate, | ||
59 | unsigned long *best_parent_rate, | 61 | unsigned long *best_parent_rate, |
60 | struct clk_hw **best_parent_p) | 62 | struct clk_hw **best_parent_p) |
61 | { | 63 | { |
@@ -72,8 +74,10 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate, | |||
72 | int i; | 74 | int i; |
73 | 75 | ||
74 | if (rate_hw && rate_ops && rate_ops->determine_rate) { | 76 | if (rate_hw && rate_ops && rate_ops->determine_rate) { |
75 | rate_hw->clk = hw->clk; | 77 | __clk_hw_set_clk(rate_hw, hw); |
76 | return rate_ops->determine_rate(rate_hw, rate, best_parent_rate, | 78 | return rate_ops->determine_rate(rate_hw, rate, min_rate, |
79 | max_rate, | ||
80 | best_parent_rate, | ||
77 | best_parent_p); | 81 | best_parent_p); |
78 | } else if (rate_hw && rate_ops && rate_ops->round_rate && | 82 | } else if (rate_hw && rate_ops && rate_ops->round_rate && |
79 | mux_hw && mux_ops && mux_ops->set_parent) { | 83 | mux_hw && mux_ops && mux_ops->set_parent) { |
@@ -116,8 +120,9 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate, | |||
116 | 120 | ||
117 | return best_rate; | 121 | return best_rate; |
118 | } else if (mux_hw && mux_ops && mux_ops->determine_rate) { | 122 | } else if (mux_hw && mux_ops && mux_ops->determine_rate) { |
119 | mux_hw->clk = hw->clk; | 123 | __clk_hw_set_clk(mux_hw, hw); |
120 | return mux_ops->determine_rate(mux_hw, rate, best_parent_rate, | 124 | return mux_ops->determine_rate(mux_hw, rate, min_rate, |
125 | max_rate, best_parent_rate, | ||
121 | best_parent_p); | 126 | best_parent_p); |
122 | } else { | 127 | } else { |
123 | pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n"); | 128 | pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n"); |
@@ -132,7 +137,7 @@ static long clk_composite_round_rate(struct clk_hw *hw, unsigned long rate, | |||
132 | const struct clk_ops *rate_ops = composite->rate_ops; | 137 | const struct clk_ops *rate_ops = composite->rate_ops; |
133 | struct clk_hw *rate_hw = composite->rate_hw; | 138 | struct clk_hw *rate_hw = composite->rate_hw; |
134 | 139 | ||
135 | rate_hw->clk = hw->clk; | 140 | __clk_hw_set_clk(rate_hw, hw); |
136 | 141 | ||
137 | return rate_ops->round_rate(rate_hw, rate, prate); | 142 | return rate_ops->round_rate(rate_hw, rate, prate); |
138 | } | 143 | } |
@@ -144,7 +149,7 @@ static int clk_composite_set_rate(struct clk_hw *hw, unsigned long rate, | |||
144 | const struct clk_ops *rate_ops = composite->rate_ops; | 149 | const struct clk_ops *rate_ops = composite->rate_ops; |
145 | struct clk_hw *rate_hw = composite->rate_hw; | 150 | struct clk_hw *rate_hw = composite->rate_hw; |
146 | 151 | ||
147 | rate_hw->clk = hw->clk; | 152 | __clk_hw_set_clk(rate_hw, hw); |
148 | 153 | ||
149 | return rate_ops->set_rate(rate_hw, rate, parent_rate); | 154 | return rate_ops->set_rate(rate_hw, rate, parent_rate); |
150 | } | 155 | } |
@@ -155,7 +160,7 @@ static int clk_composite_is_enabled(struct clk_hw *hw) | |||
155 | const struct clk_ops *gate_ops = composite->gate_ops; | 160 | const struct clk_ops *gate_ops = composite->gate_ops; |
156 | struct clk_hw *gate_hw = composite->gate_hw; | 161 | struct clk_hw *gate_hw = composite->gate_hw; |
157 | 162 | ||
158 | gate_hw->clk = hw->clk; | 163 | __clk_hw_set_clk(gate_hw, hw); |
159 | 164 | ||
160 | return gate_ops->is_enabled(gate_hw); | 165 | return gate_ops->is_enabled(gate_hw); |
161 | } | 166 | } |
@@ -166,7 +171,7 @@ static int clk_composite_enable(struct clk_hw *hw) | |||
166 | const struct clk_ops *gate_ops = composite->gate_ops; | 171 | const struct clk_ops *gate_ops = composite->gate_ops; |
167 | struct clk_hw *gate_hw = composite->gate_hw; | 172 | struct clk_hw *gate_hw = composite->gate_hw; |
168 | 173 | ||
169 | gate_hw->clk = hw->clk; | 174 | __clk_hw_set_clk(gate_hw, hw); |
170 | 175 | ||
171 | return gate_ops->enable(gate_hw); | 176 | return gate_ops->enable(gate_hw); |
172 | } | 177 | } |
@@ -177,7 +182,7 @@ static void clk_composite_disable(struct clk_hw *hw) | |||
177 | const struct clk_ops *gate_ops = composite->gate_ops; | 182 | const struct clk_ops *gate_ops = composite->gate_ops; |
178 | struct clk_hw *gate_hw = composite->gate_hw; | 183 | struct clk_hw *gate_hw = composite->gate_hw; |
179 | 184 | ||
180 | gate_hw->clk = hw->clk; | 185 | __clk_hw_set_clk(gate_hw, hw); |
181 | 186 | ||
182 | gate_ops->disable(gate_hw); | 187 | gate_ops->disable(gate_hw); |
183 | } | 188 | } |