@@ -57,10 +57,22 @@ static int clk_factor_set_rate(struct clk_hw *hw, unsigned long rate,
57
57
return 0 ;
58
58
}
59
59
60
+ static unsigned long clk_factor_recalc_accuracy (struct clk_hw * hw ,
61
+ unsigned long parent_accuracy )
62
+ {
63
+ struct clk_fixed_factor * fix = to_clk_fixed_factor (hw );
64
+
65
+ if (fix -> flags & CLK_FIXED_FACTOR_FIXED_ACCURACY )
66
+ return fix -> acc ;
67
+
68
+ return parent_accuracy ;
69
+ }
70
+
60
71
const struct clk_ops clk_fixed_factor_ops = {
61
72
.round_rate = clk_factor_round_rate ,
62
73
.set_rate = clk_factor_set_rate ,
63
74
.recalc_rate = clk_factor_recalc_rate ,
75
+ .recalc_accuracy = clk_factor_recalc_accuracy ,
64
76
};
65
77
EXPORT_SYMBOL_GPL (clk_fixed_factor_ops );
66
78
@@ -79,13 +91,12 @@ static void devm_clk_hw_register_fixed_factor_release(struct device *dev, void *
79
91
static struct clk_hw *
80
92
__clk_hw_register_fixed_factor (struct device * dev , struct device_node * np ,
81
93
const char * name , const char * parent_name ,
82
- const struct clk_hw * parent_hw , int index ,
94
+ const struct clk_hw * parent_hw , const struct clk_parent_data * pdata ,
83
95
unsigned long flags , unsigned int mult , unsigned int div ,
84
- bool devm )
96
+ unsigned long acc , unsigned int fixflags , bool devm )
85
97
{
86
98
struct clk_fixed_factor * fix ;
87
99
struct clk_init_data init = { };
88
- struct clk_parent_data pdata = { .index = index };
89
100
struct clk_hw * hw ;
90
101
int ret ;
91
102
@@ -105,6 +116,8 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
105
116
fix -> mult = mult ;
106
117
fix -> div = div ;
107
118
fix -> hw .init = & init ;
119
+ fix -> acc = acc ;
120
+ fix -> flags = fixflags ;
108
121
109
122
init .name = name ;
110
123
init .ops = & clk_fixed_factor_ops ;
@@ -114,7 +127,7 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
114
127
else if (parent_hw )
115
128
init .parent_hws = & parent_hw ;
116
129
else
117
- init .parent_data = & pdata ;
130
+ init .parent_data = pdata ;
118
131
init .num_parents = 1 ;
119
132
120
133
hw = & fix -> hw ;
@@ -151,8 +164,10 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_index(struct device *dev,
151
164
const char * name , unsigned int index , unsigned long flags ,
152
165
unsigned int mult , unsigned int div )
153
166
{
154
- return __clk_hw_register_fixed_factor (dev , NULL , name , NULL , NULL , index ,
155
- flags , mult , div , true);
167
+ const struct clk_parent_data pdata = { .index = index };
168
+
169
+ return __clk_hw_register_fixed_factor (dev , NULL , name , NULL , NULL , & pdata ,
170
+ flags , mult , div , 0 , 0 , true);
156
171
}
157
172
EXPORT_SYMBOL_GPL (devm_clk_hw_register_fixed_factor_index );
158
173
@@ -173,30 +188,59 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_parent_hw(struct device *dev,
173
188
const char * name , const struct clk_hw * parent_hw ,
174
189
unsigned long flags , unsigned int mult , unsigned int div )
175
190
{
191
+ const struct clk_parent_data pdata = { .index = -1 };
192
+
176
193
return __clk_hw_register_fixed_factor (dev , NULL , name , NULL , parent_hw ,
177
- -1 , flags , mult , div , true);
194
+ & pdata , flags , mult , div , 0 , 0 , true);
178
195
}
179
196
EXPORT_SYMBOL_GPL (devm_clk_hw_register_fixed_factor_parent_hw );
180
197
181
198
struct clk_hw * clk_hw_register_fixed_factor_parent_hw (struct device * dev ,
182
199
const char * name , const struct clk_hw * parent_hw ,
183
200
unsigned long flags , unsigned int mult , unsigned int div )
184
201
{
185
- return __clk_hw_register_fixed_factor (dev , NULL , name , NULL ,
186
- parent_hw , -1 , flags , mult , div ,
187
- false);
202
+ const struct clk_parent_data pdata = { .index = -1 };
203
+
204
+ return __clk_hw_register_fixed_factor (dev , NULL , name , NULL , parent_hw ,
205
+ & pdata , flags , mult , div , 0 , 0 , false);
188
206
}
189
207
EXPORT_SYMBOL_GPL (clk_hw_register_fixed_factor_parent_hw );
190
208
191
209
struct clk_hw * clk_hw_register_fixed_factor (struct device * dev ,
192
210
const char * name , const char * parent_name , unsigned long flags ,
193
211
unsigned int mult , unsigned int div )
194
212
{
195
- return __clk_hw_register_fixed_factor (dev , NULL , name , parent_name , NULL , -1 ,
196
- flags , mult , div , false);
213
+ const struct clk_parent_data pdata = { .index = -1 };
214
+
215
+ return __clk_hw_register_fixed_factor (dev , NULL , name , parent_name , NULL ,
216
+ & pdata , flags , mult , div , 0 , 0 , false);
197
217
}
198
218
EXPORT_SYMBOL_GPL (clk_hw_register_fixed_factor );
199
219
220
+ struct clk_hw * clk_hw_register_fixed_factor_fwname (struct device * dev ,
221
+ struct device_node * np , const char * name , const char * fw_name ,
222
+ unsigned long flags , unsigned int mult , unsigned int div )
223
+ {
224
+ const struct clk_parent_data pdata = { .index = -1 , .fw_name = fw_name };
225
+
226
+ return __clk_hw_register_fixed_factor (dev , np , name , NULL , NULL ,
227
+ & pdata , flags , mult , div , 0 , 0 , false);
228
+ }
229
+ EXPORT_SYMBOL_GPL (clk_hw_register_fixed_factor_fwname );
230
+
231
+ struct clk_hw * clk_hw_register_fixed_factor_with_accuracy_fwname (struct device * dev ,
232
+ struct device_node * np , const char * name , const char * fw_name ,
233
+ unsigned long flags , unsigned int mult , unsigned int div ,
234
+ unsigned long acc )
235
+ {
236
+ const struct clk_parent_data pdata = { .index = -1 , .fw_name = fw_name };
237
+
238
+ return __clk_hw_register_fixed_factor (dev , np , name , NULL , NULL ,
239
+ & pdata , flags , mult , div , acc ,
240
+ CLK_FIXED_FACTOR_FIXED_ACCURACY , false);
241
+ }
242
+ EXPORT_SYMBOL_GPL (clk_hw_register_fixed_factor_with_accuracy_fwname );
243
+
200
244
struct clk * clk_register_fixed_factor (struct device * dev , const char * name ,
201
245
const char * parent_name , unsigned long flags ,
202
246
unsigned int mult , unsigned int div )
@@ -239,16 +283,43 @@ struct clk_hw *devm_clk_hw_register_fixed_factor(struct device *dev,
239
283
const char * name , const char * parent_name , unsigned long flags ,
240
284
unsigned int mult , unsigned int div )
241
285
{
242
- return __clk_hw_register_fixed_factor (dev , NULL , name , parent_name , NULL , -1 ,
243
- flags , mult , div , true);
286
+ const struct clk_parent_data pdata = { .index = -1 };
287
+
288
+ return __clk_hw_register_fixed_factor (dev , NULL , name , parent_name , NULL ,
289
+ & pdata , flags , mult , div , 0 , 0 , true);
244
290
}
245
291
EXPORT_SYMBOL_GPL (devm_clk_hw_register_fixed_factor );
246
292
293
+ struct clk_hw * devm_clk_hw_register_fixed_factor_fwname (struct device * dev ,
294
+ struct device_node * np , const char * name , const char * fw_name ,
295
+ unsigned long flags , unsigned int mult , unsigned int div )
296
+ {
297
+ const struct clk_parent_data pdata = { .index = -1 , .fw_name = fw_name };
298
+
299
+ return __clk_hw_register_fixed_factor (dev , np , name , NULL , NULL ,
300
+ & pdata , flags , mult , div , 0 , 0 , true);
301
+ }
302
+ EXPORT_SYMBOL_GPL (devm_clk_hw_register_fixed_factor_fwname );
303
+
304
+ struct clk_hw * devm_clk_hw_register_fixed_factor_with_accuracy_fwname (struct device * dev ,
305
+ struct device_node * np , const char * name , const char * fw_name ,
306
+ unsigned long flags , unsigned int mult , unsigned int div ,
307
+ unsigned long acc )
308
+ {
309
+ const struct clk_parent_data pdata = { .index = -1 , .fw_name = fw_name };
310
+
311
+ return __clk_hw_register_fixed_factor (dev , np , name , NULL , NULL ,
312
+ & pdata , flags , mult , div , acc ,
313
+ CLK_FIXED_FACTOR_FIXED_ACCURACY , true);
314
+ }
315
+ EXPORT_SYMBOL_GPL (devm_clk_hw_register_fixed_factor_with_accuracy_fwname );
316
+
247
317
#ifdef CONFIG_OF
248
318
static struct clk_hw * _of_fixed_factor_clk_setup (struct device_node * node )
249
319
{
250
320
struct clk_hw * hw ;
251
321
const char * clk_name = node -> name ;
322
+ const struct clk_parent_data pdata = { .index = 0 };
252
323
u32 div , mult ;
253
324
int ret ;
254
325
@@ -266,8 +337,8 @@ static struct clk_hw *_of_fixed_factor_clk_setup(struct device_node *node)
266
337
267
338
of_property_read_string (node , "clock-output-names" , & clk_name );
268
339
269
- hw = __clk_hw_register_fixed_factor (NULL , node , clk_name , NULL , NULL , 0 ,
270
- 0 , mult , div , false);
340
+ hw = __clk_hw_register_fixed_factor (NULL , node , clk_name , NULL , NULL ,
341
+ & pdata , 0 , mult , div , 0 , 0 , false);
271
342
if (IS_ERR (hw )) {
272
343
/*
273
344
* Clear OF_POPULATED flag so that clock registration can be
0 commit comments