summaryrefslogtreecommitdiffstats
path: root/include/linux/clk.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r--include/linux/clk.h65
1 files changed, 64 insertions, 1 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 7da754d79f9d..a7773b5c0b9f 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -312,7 +312,26 @@ struct clk *clk_get(struct device *dev, const char *id);
312 */ 312 */
313int __must_check clk_bulk_get(struct device *dev, int num_clks, 313int __must_check clk_bulk_get(struct device *dev, int num_clks,
314 struct clk_bulk_data *clks); 314 struct clk_bulk_data *clks);
315 315/**
316 * clk_bulk_get_all - lookup and obtain all available references to clock
317 * producer.
318 * @dev: device for clock "consumer"
319 * @clks: pointer to the clk_bulk_data table of consumer
320 *
321 * This helper function allows drivers to get all clk consumers in one
322 * operation. If any of the clk cannot be acquired then any clks
323 * that were obtained will be freed before returning to the caller.
324 *
325 * Returns a positive value for the number of clocks obtained while the
326 * clock references are stored in the clk_bulk_data table in @clks field.
327 * Returns 0 if there're none and a negative value if something failed.
328 *
329 * Drivers must assume that the clock source is not enabled.
330 *
331 * clk_bulk_get should not be called from within interrupt context.
332 */
333int __must_check clk_bulk_get_all(struct device *dev,
334 struct clk_bulk_data **clks);
316/** 335/**
317 * devm_clk_bulk_get - managed get multiple clk consumers 336 * devm_clk_bulk_get - managed get multiple clk consumers
318 * @dev: device for clock "consumer" 337 * @dev: device for clock "consumer"
@@ -327,6 +346,22 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks,
327 */ 346 */
328int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, 347int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
329 struct clk_bulk_data *clks); 348 struct clk_bulk_data *clks);
349/**
350 * devm_clk_bulk_get_all - managed get multiple clk consumers
351 * @dev: device for clock "consumer"
352 * @clks: pointer to the clk_bulk_data table of consumer
353 *
354 * Returns a positive value for the number of clocks obtained while the
355 * clock references are stored in the clk_bulk_data table in @clks field.
356 * Returns 0 if there're none and a negative value if something failed.
357 *
358 * This helper function allows drivers to get several clk
359 * consumers in one operation with management, the clks will
360 * automatically be freed when the device is unbound.
361 */
362
363int __must_check devm_clk_bulk_get_all(struct device *dev,
364 struct clk_bulk_data **clks);
330 365
331/** 366/**
332 * devm_clk_get - lookup and obtain a managed reference to a clock producer. 367 * devm_clk_get - lookup and obtain a managed reference to a clock producer.
@@ -488,6 +523,19 @@ void clk_put(struct clk *clk);
488void clk_bulk_put(int num_clks, struct clk_bulk_data *clks); 523void clk_bulk_put(int num_clks, struct clk_bulk_data *clks);
489 524
490/** 525/**
526 * clk_bulk_put_all - "free" all the clock source
527 * @num_clks: the number of clk_bulk_data
528 * @clks: the clk_bulk_data table of consumer
529 *
530 * Note: drivers must ensure that all clk_bulk_enable calls made on this
531 * clock source are balanced by clk_bulk_disable calls prior to calling
532 * this function.
533 *
534 * clk_bulk_put_all should not be called from within interrupt context.
535 */
536void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks);
537
538/**
491 * devm_clk_put - "free" a managed clock source 539 * devm_clk_put - "free" a managed clock source
492 * @dev: device used to acquire the clock 540 * @dev: device used to acquire the clock
493 * @clk: clock source acquired with devm_clk_get() 541 * @clk: clock source acquired with devm_clk_get()
@@ -659,6 +707,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks,
659 return 0; 707 return 0;
660} 708}
661 709
710static inline int __must_check clk_bulk_get_all(struct device *dev,
711 struct clk_bulk_data **clks)
712{
713 return 0;
714}
715
662static inline struct clk *devm_clk_get(struct device *dev, const char *id) 716static inline struct clk *devm_clk_get(struct device *dev, const char *id)
663{ 717{
664 return NULL; 718 return NULL;
@@ -670,6 +724,13 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clk
670 return 0; 724 return 0;
671} 725}
672 726
727static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
728 struct clk_bulk_data **clks)
729{
730
731 return 0;
732}
733
673static inline struct clk *devm_get_clk_from_child(struct device *dev, 734static inline struct clk *devm_get_clk_from_child(struct device *dev,
674 struct device_node *np, const char *con_id) 735 struct device_node *np, const char *con_id)
675{ 736{
@@ -680,6 +741,8 @@ static inline void clk_put(struct clk *clk) {}
680 741
681static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {} 742static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {}
682 743
744static inline void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) {}
745
683static inline void devm_clk_put(struct device *dev, struct clk *clk) {} 746static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
684 747
685 748