diff options
Diffstat (limited to 'include/linux/clk.h')
| -rw-r--r-- | include/linux/clk.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index a7773b5c0b9f..d8bc1a856b39 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
| @@ -384,6 +384,17 @@ int __must_check devm_clk_bulk_get_all(struct device *dev, | |||
| 384 | struct clk *devm_clk_get(struct device *dev, const char *id); | 384 | struct clk *devm_clk_get(struct device *dev, const char *id); |
| 385 | 385 | ||
| 386 | /** | 386 | /** |
| 387 | * devm_clk_get_optional - lookup and obtain a managed reference to an optional | ||
| 388 | * clock producer. | ||
| 389 | * @dev: device for clock "consumer" | ||
| 390 | * @id: clock consumer ID | ||
| 391 | * | ||
| 392 | * Behaves the same as devm_clk_get() except where there is no clock producer. | ||
| 393 | * In this case, instead of returning -ENOENT, the function returns NULL. | ||
| 394 | */ | ||
| 395 | struct clk *devm_clk_get_optional(struct device *dev, const char *id); | ||
| 396 | |||
| 397 | /** | ||
| 387 | * devm_get_clk_from_child - lookup and obtain a managed reference to a | 398 | * devm_get_clk_from_child - lookup and obtain a managed reference to a |
| 388 | * clock producer from child node. | 399 | * clock producer from child node. |
| 389 | * @dev: device for clock "consumer" | 400 | * @dev: device for clock "consumer" |
| @@ -718,6 +729,12 @@ static inline struct clk *devm_clk_get(struct device *dev, const char *id) | |||
| 718 | return NULL; | 729 | return NULL; |
| 719 | } | 730 | } |
| 720 | 731 | ||
| 732 | static inline struct clk *devm_clk_get_optional(struct device *dev, | ||
| 733 | const char *id) | ||
| 734 | { | ||
| 735 | return NULL; | ||
| 736 | } | ||
| 737 | |||
| 721 | static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, | 738 | static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, |
| 722 | struct clk_bulk_data *clks) | 739 | struct clk_bulk_data *clks) |
| 723 | { | 740 | { |
| @@ -862,6 +879,25 @@ static inline void clk_bulk_disable_unprepare(int num_clks, | |||
| 862 | clk_bulk_unprepare(num_clks, clks); | 879 | clk_bulk_unprepare(num_clks, clks); |
| 863 | } | 880 | } |
| 864 | 881 | ||
| 882 | /** | ||
| 883 | * clk_get_optional - lookup and obtain a reference to an optional clock | ||
| 884 | * producer. | ||
| 885 | * @dev: device for clock "consumer" | ||
| 886 | * @id: clock consumer ID | ||
| 887 | * | ||
| 888 | * Behaves the same as clk_get() except where there is no clock producer. In | ||
| 889 | * this case, instead of returning -ENOENT, the function returns NULL. | ||
| 890 | */ | ||
| 891 | static inline struct clk *clk_get_optional(struct device *dev, const char *id) | ||
| 892 | { | ||
| 893 | struct clk *clk = clk_get(dev, id); | ||
| 894 | |||
| 895 | if (clk == ERR_PTR(-ENOENT)) | ||
| 896 | return NULL; | ||
| 897 | |||
| 898 | return clk; | ||
| 899 | } | ||
| 900 | |||
| 865 | #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) | 901 | #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) |
| 866 | struct clk *of_clk_get(struct device_node *np, int index); | 902 | struct clk *of_clk_get(struct device_node *np, int index); |
| 867 | struct clk *of_clk_get_by_name(struct device_node *np, const char *name); | 903 | struct clk *of_clk_get_by_name(struct device_node *np, const char *name); |
