diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2019-06-19 05:39:25 -0400 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2019-06-25 17:28:01 -0400 |
commit | 2f25528e4edddc6eddd42c8d41c9c9e341c8b9da (patch) | |
tree | dd46a675c85fa3225bb83984716a4b862105a9e2 /include/linux/clk.h | |
parent | a188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff) |
clk: Add clk_bulk_get_optional() function
clk_bulk_get_optional() allows to get a group of clocks where one
or more is optional. For a not available clock, e.g. not specifed
in the clock consumer node in DT, its respective struct clk pointer
will be NULL. This allows for operating on a group of returned
clocks (struct clk_bulk_data array) with existing clk_bulk* APIs.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r-- | include/linux/clk.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index f689fc58d7be..1b50e7d1675c 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -332,6 +332,19 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, | |||
332 | */ | 332 | */ |
333 | int __must_check clk_bulk_get_all(struct device *dev, | 333 | int __must_check clk_bulk_get_all(struct device *dev, |
334 | struct clk_bulk_data **clks); | 334 | struct clk_bulk_data **clks); |
335 | |||
336 | /** | ||
337 | * clk_bulk_get_optional - lookup and obtain a number of references to clock producer | ||
338 | * @dev: device for clock "consumer" | ||
339 | * @num_clks: the number of clk_bulk_data | ||
340 | * @clks: the clk_bulk_data table of consumer | ||
341 | * | ||
342 | * Behaves the same as clk_bulk_get() except where there is no clock producer. | ||
343 | * In this case, instead of returning -ENOENT, the function returns 0 and | ||
344 | * NULL for a clk for which a clock producer could not be determined. | ||
345 | */ | ||
346 | int __must_check clk_bulk_get_optional(struct device *dev, int num_clks, | ||
347 | struct clk_bulk_data *clks); | ||
335 | /** | 348 | /** |
336 | * devm_clk_bulk_get - managed get multiple clk consumers | 349 | * devm_clk_bulk_get - managed get multiple clk consumers |
337 | * @dev: device for clock "consumer" | 350 | * @dev: device for clock "consumer" |
@@ -718,6 +731,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks, | |||
718 | return 0; | 731 | return 0; |
719 | } | 732 | } |
720 | 733 | ||
734 | static inline int __must_check clk_bulk_get_optional(struct device *dev, | ||
735 | int num_clks, struct clk_bulk_data *clks) | ||
736 | { | ||
737 | return 0; | ||
738 | } | ||
739 | |||
721 | static inline int __must_check clk_bulk_get_all(struct device *dev, | 740 | static inline int __must_check clk_bulk_get_all(struct device *dev, |
722 | struct clk_bulk_data **clks) | 741 | struct clk_bulk_data **clks) |
723 | { | 742 | { |