diff options
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r-- | include/linux/clk.h | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index b0252726df61..ad5c43e8ae8a 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -81,7 +81,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb); | |||
81 | 81 | ||
82 | int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); | 82 | int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); |
83 | 83 | ||
84 | #endif /* !CONFIG_COMMON_CLK */ | 84 | #endif |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * clk_get - lookup and obtain a reference to a clock producer. | 87 | * clk_get - lookup and obtain a reference to a clock producer. |
@@ -101,6 +101,26 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); | |||
101 | struct clk *clk_get(struct device *dev, const char *id); | 101 | struct clk *clk_get(struct device *dev, const char *id); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * devm_clk_get - lookup and obtain a managed reference to a clock producer. | ||
105 | * @dev: device for clock "consumer" | ||
106 | * @id: clock comsumer ID | ||
107 | * | ||
108 | * Returns a struct clk corresponding to the clock producer, or | ||
109 | * valid IS_ERR() condition containing errno. The implementation | ||
110 | * uses @dev and @id to determine the clock consumer, and thereby | ||
111 | * the clock producer. (IOW, @id may be identical strings, but | ||
112 | * clk_get may return different clock producers depending on @dev.) | ||
113 | * | ||
114 | * Drivers must assume that the clock source is not enabled. | ||
115 | * | ||
116 | * devm_clk_get should not be called from within interrupt context. | ||
117 | * | ||
118 | * The clock will automatically be freed when the device is unbound | ||
119 | * from the bus. | ||
120 | */ | ||
121 | struct clk *devm_clk_get(struct device *dev, const char *id); | ||
122 | |||
123 | /** | ||
104 | * clk_prepare - prepare a clock source | 124 | * clk_prepare - prepare a clock source |
105 | * @clk: clock source | 125 | * @clk: clock source |
106 | * | 126 | * |
@@ -206,6 +226,18 @@ unsigned long clk_get_rate(struct clk *clk); | |||
206 | */ | 226 | */ |
207 | void clk_put(struct clk *clk); | 227 | void clk_put(struct clk *clk); |
208 | 228 | ||
229 | /** | ||
230 | * devm_clk_put - "free" a managed clock source | ||
231 | * @dev: device used to acuqire the clock | ||
232 | * @clk: clock source acquired with devm_clk_get() | ||
233 | * | ||
234 | * Note: drivers must ensure that all clk_enable calls made on this | ||
235 | * clock source are balanced by clk_disable calls prior to calling | ||
236 | * this function. | ||
237 | * | ||
238 | * clk_put should not be called from within interrupt context. | ||
239 | */ | ||
240 | void devm_clk_put(struct device *dev, struct clk *clk); | ||
209 | 241 | ||
210 | /* | 242 | /* |
211 | * The remaining APIs are optional for machine class support. | 243 | * The remaining APIs are optional for machine class support. |
@@ -220,7 +252,7 @@ void clk_put(struct clk *clk); | |||
220 | * Returns rounded clock rate in Hz, or negative errno. | 252 | * Returns rounded clock rate in Hz, or negative errno. |
221 | */ | 253 | */ |
222 | long clk_round_rate(struct clk *clk, unsigned long rate); | 254 | long clk_round_rate(struct clk *clk, unsigned long rate); |
223 | 255 | ||
224 | /** | 256 | /** |
225 | * clk_set_rate - set the clock rate for a clock source | 257 | * clk_set_rate - set the clock rate for a clock source |
226 | * @clk: clock source | 258 | * @clk: clock source |
@@ -229,7 +261,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate); | |||
229 | * Returns success (0) or negative errno. | 261 | * Returns success (0) or negative errno. |
230 | */ | 262 | */ |
231 | int clk_set_rate(struct clk *clk, unsigned long rate); | 263 | int clk_set_rate(struct clk *clk, unsigned long rate); |
232 | 264 | ||
233 | /** | 265 | /** |
234 | * clk_set_parent - set the parent clock source for this clock | 266 | * clk_set_parent - set the parent clock source for this clock |
235 | * @clk: clock source | 267 | * @clk: clock source |