diff options
Diffstat (limited to 'include/linux/clk-provider.h')
-rw-r--r-- | include/linux/clk-provider.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index c12731582920..4989b8a7bed1 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -53,9 +53,18 @@ struct clk_hw; | |||
53 | * @disable: Disable the clock atomically. Called with enable_lock held. | 53 | * @disable: Disable the clock atomically. Called with enable_lock held. |
54 | * This function must not sleep. | 54 | * This function must not sleep. |
55 | * | 55 | * |
56 | * @recalc_rate Recalculate the rate of this clock, by quering hardware. The | 56 | * @is_enabled: Queries the hardware to determine if the clock is enabled. |
57 | * This function must not sleep. Optional, if this op is not | ||
58 | * set then the enable count will be used. | ||
59 | * | ||
60 | * @disable_unused: Disable the clock atomically. Only called from | ||
61 | * clk_disable_unused for gate clocks with special needs. | ||
62 | * Called with enable_lock held. This function must not | ||
63 | * sleep. | ||
64 | * | ||
65 | * @recalc_rate Recalculate the rate of this clock, by querying hardware. The | ||
57 | * parent rate is an input parameter. It is up to the caller to | 66 | * parent rate is an input parameter. It is up to the caller to |
58 | * insure that the prepare_mutex is held across this call. | 67 | * ensure that the prepare_mutex is held across this call. |
59 | * Returns the calculated rate. Optional, but recommended - if | 68 | * Returns the calculated rate. Optional, but recommended - if |
60 | * this op is not set then clock rate will be initialized to 0. | 69 | * this op is not set then clock rate will be initialized to 0. |
61 | * | 70 | * |
@@ -89,7 +98,7 @@ struct clk_hw; | |||
89 | * implementations to split any work between atomic (enable) and sleepable | 98 | * implementations to split any work between atomic (enable) and sleepable |
90 | * (prepare) contexts. If enabling a clock requires code that might sleep, | 99 | * (prepare) contexts. If enabling a clock requires code that might sleep, |
91 | * this must be done in clk_prepare. Clock enable code that will never be | 100 | * this must be done in clk_prepare. Clock enable code that will never be |
92 | * called in a sleepable context may be implement in clk_enable. | 101 | * called in a sleepable context may be implemented in clk_enable. |
93 | * | 102 | * |
94 | * Typically, drivers will call clk_prepare when a clock may be needed later | 103 | * Typically, drivers will call clk_prepare when a clock may be needed later |
95 | * (eg. when a device is opened), and clk_enable when the clock is actually | 104 | * (eg. when a device is opened), and clk_enable when the clock is actually |
@@ -102,6 +111,7 @@ struct clk_ops { | |||
102 | int (*enable)(struct clk_hw *hw); | 111 | int (*enable)(struct clk_hw *hw); |
103 | void (*disable)(struct clk_hw *hw); | 112 | void (*disable)(struct clk_hw *hw); |
104 | int (*is_enabled)(struct clk_hw *hw); | 113 | int (*is_enabled)(struct clk_hw *hw); |
114 | void (*disable_unused)(struct clk_hw *hw); | ||
105 | unsigned long (*recalc_rate)(struct clk_hw *hw, | 115 | unsigned long (*recalc_rate)(struct clk_hw *hw, |
106 | unsigned long parent_rate); | 116 | unsigned long parent_rate); |
107 | long (*round_rate)(struct clk_hw *hw, unsigned long, | 117 | long (*round_rate)(struct clk_hw *hw, unsigned long, |
@@ -327,19 +337,21 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | |||
327 | * error code; drivers must test for an error code after calling clk_register. | 337 | * error code; drivers must test for an error code after calling clk_register. |
328 | */ | 338 | */ |
329 | struct clk *clk_register(struct device *dev, struct clk_hw *hw); | 339 | struct clk *clk_register(struct device *dev, struct clk_hw *hw); |
340 | struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw); | ||
330 | 341 | ||
331 | void clk_unregister(struct clk *clk); | 342 | void clk_unregister(struct clk *clk); |
343 | void devm_clk_unregister(struct device *dev, struct clk *clk); | ||
332 | 344 | ||
333 | /* helper functions */ | 345 | /* helper functions */ |
334 | const char *__clk_get_name(struct clk *clk); | 346 | const char *__clk_get_name(struct clk *clk); |
335 | struct clk_hw *__clk_get_hw(struct clk *clk); | 347 | struct clk_hw *__clk_get_hw(struct clk *clk); |
336 | u8 __clk_get_num_parents(struct clk *clk); | 348 | u8 __clk_get_num_parents(struct clk *clk); |
337 | struct clk *__clk_get_parent(struct clk *clk); | 349 | struct clk *__clk_get_parent(struct clk *clk); |
338 | inline int __clk_get_enable_count(struct clk *clk); | 350 | unsigned int __clk_get_enable_count(struct clk *clk); |
339 | inline int __clk_get_prepare_count(struct clk *clk); | 351 | unsigned int __clk_get_prepare_count(struct clk *clk); |
340 | unsigned long __clk_get_rate(struct clk *clk); | 352 | unsigned long __clk_get_rate(struct clk *clk); |
341 | unsigned long __clk_get_flags(struct clk *clk); | 353 | unsigned long __clk_get_flags(struct clk *clk); |
342 | int __clk_is_enabled(struct clk *clk); | 354 | bool __clk_is_enabled(struct clk *clk); |
343 | struct clk *__clk_lookup(const char *name); | 355 | struct clk *__clk_lookup(const char *name); |
344 | 356 | ||
345 | /* | 357 | /* |