diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-21 18:59:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-21 18:59:46 -0400 |
| commit | 4f6ade91532b5b05ea28219b891f12a3cec528cd (patch) | |
| tree | 8a684205449b2db0798fc22c9f03c40afa9cc849 /include/linux | |
| parent | 31a67102f4762df5544bc2dfb34a931233d2a5b2 (diff) | |
| parent | e9d7f4065408e92338a41b809e437c6e043da090 (diff) | |
Merge branch 'clkdev' of git://git.linaro.org/people/rmk/linux-arm
Pull clkdev updates from Russell King:
"This supplements clkdev with a device-managed API, allowing drivers
cleanup paths to be simplified. We also optimize clk_find() so that
it exits as soon as it finds a perfect match, and we provide a way to
minimise the amount of code platforms need to register clkdev entries.
Some of the code in arm-soc depends on these changes."
* 'clkdev' of git://git.linaro.org/people/rmk/linux-arm:
CLKDEV: provide helpers for common clock framework
ARM: 7392/1: CLKDEV: Optimize clk_find()
ARM: 7376/1: clkdev: Implement managed clk_get()
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/clk.h | 32 | ||||
| -rw-r--r-- | include/linux/clkdev.h | 3 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index b0252726df61..70cf722ac3af 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
| @@ -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. |
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h index d9a4fd028c9d..a6a6f603103b 100644 --- a/include/linux/clkdev.h +++ b/include/linux/clkdev.h | |||
| @@ -40,4 +40,7 @@ void clkdev_drop(struct clk_lookup *cl); | |||
| 40 | void clkdev_add_table(struct clk_lookup *, size_t); | 40 | void clkdev_add_table(struct clk_lookup *, size_t); |
| 41 | int clk_add_alias(const char *, const char *, char *, struct device *); | 41 | int clk_add_alias(const char *, const char *, char *, struct device *); |
| 42 | 42 | ||
| 43 | int clk_register_clkdev(struct clk *, const char *, const char *, ...); | ||
| 44 | int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t); | ||
| 45 | |||
| 43 | #endif | 46 | #endif |
