summaryrefslogtreecommitdiff
path: root/include/linux/clk.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-14 12:37:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-14 12:37:41 -0700
commit1430858fa827e0c11921f26f429ccf22188d4a56 (patch)
tree78316691167fee8d794d7977d97338d512872387 /include/linux/clk.h
parent2931dc7d9daf7addc10a126aedf1e630a1a05b49 (diff)
parent3c48d86cc959309ee168fb87737a8cb3f97c5224 (diff)
Merge tag 'clk-bulk-get-prep-enable' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk api update from Stephen Boyd: "Small patch to add the clk_bulk_prepare_enable() and clk_bulk_disable_unprepare() API to the newly introduced clk bulk APIs. It would be good to get this into the -rc1 so that other driver trees can use it for code targeted for the next merge window" * tag 'clk-bulk-get-prep-enable' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: Provide bulk prepare_enable disable_unprepare variants
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r--include/linux/clk.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 91bd464f4c9b..12c96d94d1fa 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -657,6 +657,28 @@ static inline void clk_disable_unprepare(struct clk *clk)
clk_unprepare(clk);
}
+static inline int clk_bulk_prepare_enable(int num_clks,
+ struct clk_bulk_data *clks)
+{
+ int ret;
+
+ ret = clk_bulk_prepare(num_clks, clks);
+ if (ret)
+ return ret;
+ ret = clk_bulk_enable(num_clks, clks);
+ if (ret)
+ clk_bulk_unprepare(num_clks, clks);
+
+ return ret;
+}
+
+static inline void clk_bulk_disable_unprepare(int num_clks,
+ struct clk_bulk_data *clks)
+{
+ clk_bulk_disable(num_clks, clks);
+ clk_bulk_unprepare(num_clks, clks);
+}
+
#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
struct clk *of_clk_get(struct device_node *np, int index);
struct clk *of_clk_get_by_name(struct device_node *np, const char *name);