@@ -95,19 +95,19 @@ static unsigned long clk_pllv4_recalc_rate(struct clk_hw *hw,
95
95
return (parent_rate * mult ) + (u32 )temp64 ;
96
96
}
97
97
98
- static long clk_pllv4_round_rate (struct clk_hw * hw , unsigned long rate ,
99
- unsigned long * prate )
98
+ static int clk_pllv4_determine_rate (struct clk_hw * hw ,
99
+ struct clk_rate_request * req )
100
100
{
101
101
struct clk_pllv4 * pll = to_clk_pllv4 (hw );
102
- unsigned long parent_rate = * prate ;
102
+ unsigned long parent_rate = req -> best_parent_rate ;
103
103
unsigned long round_rate , i ;
104
104
u32 mfn , mfd = DEFAULT_MFD ;
105
105
bool found = false;
106
106
u64 temp64 ;
107
107
u32 mult ;
108
108
109
109
if (pll -> use_mult_range ) {
110
- temp64 = (u64 )rate ;
110
+ temp64 = (u64 ) req -> rate ;
111
111
do_div (temp64 , parent_rate );
112
112
mult = temp64 ;
113
113
if (mult >= pllv4_mult_range [1 ] &&
@@ -118,7 +118,7 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
118
118
} else {
119
119
for (i = 0 ; i < ARRAY_SIZE (pllv4_mult_table ); i ++ ) {
120
120
round_rate = parent_rate * pllv4_mult_table [i ];
121
- if (rate >= round_rate ) {
121
+ if (req -> rate >= round_rate ) {
122
122
found = true;
123
123
break ;
124
124
}
@@ -127,14 +127,16 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
127
127
128
128
if (!found ) {
129
129
pr_warn ("%s: unable to round rate %lu, parent rate %lu\n" ,
130
- clk_hw_get_name (hw ), rate , parent_rate );
130
+ clk_hw_get_name (hw ), req -> rate , parent_rate );
131
+ req -> rate = 0 ;
132
+
131
133
return 0 ;
132
134
}
133
135
134
136
if (parent_rate <= MAX_MFD )
135
137
mfd = parent_rate ;
136
138
137
- temp64 = (u64 )(rate - round_rate );
139
+ temp64 = (u64 )(req -> rate - round_rate );
138
140
temp64 *= mfd ;
139
141
do_div (temp64 , parent_rate );
140
142
mfn = temp64 ;
@@ -145,14 +147,19 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
145
147
* pair of mfn/mfd, we simply return the round_rate without using
146
148
* the frac part.
147
149
*/
148
- if (mfn >= mfd )
149
- return round_rate ;
150
+ if (mfn >= mfd ) {
151
+ req -> rate = round_rate ;
152
+
153
+ return 0 ;
154
+ }
150
155
151
156
temp64 = (u64 )parent_rate ;
152
157
temp64 *= mfn ;
153
158
do_div (temp64 , mfd );
154
159
155
- return round_rate + (u32 )temp64 ;
160
+ req -> rate = round_rate + (u32 )temp64 ;
161
+
162
+ return 0 ;
156
163
}
157
164
158
165
static bool clk_pllv4_is_valid_mult (struct clk_pllv4 * pll , unsigned int mult )
@@ -229,7 +236,7 @@ static void clk_pllv4_unprepare(struct clk_hw *hw)
229
236
230
237
static const struct clk_ops clk_pllv4_ops = {
231
238
.recalc_rate = clk_pllv4_recalc_rate ,
232
- .round_rate = clk_pllv4_round_rate ,
239
+ .determine_rate = clk_pllv4_determine_rate ,
233
240
.set_rate = clk_pllv4_set_rate ,
234
241
.prepare = clk_pllv4_prepare ,
235
242
.unprepare = clk_pllv4_unprepare ,
0 commit comments