aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clk.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r--include/linux/clk.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 12c96d94d1fa..4c4ef9f34db3 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -331,6 +331,38 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
331 */ 331 */
332struct clk *devm_get_clk_from_child(struct device *dev, 332struct clk *devm_get_clk_from_child(struct device *dev,
333 struct device_node *np, const char *con_id); 333 struct device_node *np, const char *con_id);
334/**
335 * clk_rate_exclusive_get - get exclusivity over the rate control of a
336 * producer
337 * @clk: clock source
338 *
339 * This function allows drivers to get exclusive control over the rate of a
340 * provider. It prevents any other consumer to execute, even indirectly,
341 * opereation which could alter the rate of the provider or cause glitches
342 *
343 * If exlusivity is claimed more than once on clock, even by the same driver,
344 * the rate effectively gets locked as exclusivity can't be preempted.
345 *
346 * Must not be called from within atomic context.
347 *
348 * Returns success (0) or negative errno.
349 */
350int clk_rate_exclusive_get(struct clk *clk);
351
352/**
353 * clk_rate_exclusive_put - release exclusivity over the rate control of a
354 * producer
355 * @clk: clock source
356 *
357 * This function allows drivers to release the exclusivity it previously got
358 * from clk_rate_exclusive_get()
359 *
360 * The caller must balance the number of clk_rate_exclusive_get() and
361 * clk_rate_exclusive_put() calls.
362 *
363 * Must not be called from within atomic context.
364 */
365void clk_rate_exclusive_put(struct clk *clk);
334 366
335/** 367/**
336 * clk_enable - inform the system when the clock source should be running. 368 * clk_enable - inform the system when the clock source should be running.
@@ -473,6 +505,23 @@ long clk_round_rate(struct clk *clk, unsigned long rate);
473int clk_set_rate(struct clk *clk, unsigned long rate); 505int clk_set_rate(struct clk *clk, unsigned long rate);
474 506
475/** 507/**
508 * clk_set_rate_exclusive- set the clock rate and claim exclusivity over
509 * clock source
510 * @clk: clock source
511 * @rate: desired clock rate in Hz
512 *
513 * This helper function allows drivers to atomically set the rate of a producer
514 * and claim exclusivity over the rate control of the producer.
515 *
516 * It is essentially a combination of clk_set_rate() and
517 * clk_rate_exclusite_get(). Caller must balance this call with a call to
518 * clk_rate_exclusive_put()
519 *
520 * Returns success (0) or negative errno.
521 */
522int clk_set_rate_exclusive(struct clk *clk, unsigned long rate);
523
524/**
476 * clk_has_parent - check if a clock is a possible parent for another 525 * clk_has_parent - check if a clock is a possible parent for another
477 * @clk: clock source 526 * @clk: clock source
478 * @parent: parent clock source 527 * @parent: parent clock source
@@ -583,6 +632,14 @@ static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {}
583 632
584static inline void devm_clk_put(struct device *dev, struct clk *clk) {} 633static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
585 634
635
636static inline int clk_rate_exclusive_get(struct clk *clk)
637{
638 return 0;
639}
640
641static inline void clk_rate_exclusive_put(struct clk *clk) {}
642
586static inline int clk_enable(struct clk *clk) 643static inline int clk_enable(struct clk *clk)
587{ 644{
588 return 0; 645 return 0;
@@ -609,6 +666,11 @@ static inline int clk_set_rate(struct clk *clk, unsigned long rate)
609 return 0; 666 return 0;
610} 667}
611 668
669static inline int clk_set_rate_exclusive(struct clk *clk, unsigned long rate)
670{
671 return 0;
672}
673
612static inline long clk_round_rate(struct clk *clk, unsigned long rate) 674static inline long clk_round_rate(struct clk *clk, unsigned long rate)
613{ 675{
614 return 0; 676 return 0;