aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_clk.h
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2018-04-18 16:50:01 +0200
committerStephen Boyd <sboyd@kernel.org>2018-05-02 08:31:07 -0700
commiteb06d6bbc45a7561de78a00fb17bfbb75893ee26 (patch)
treea5e299d56b1be6444464fa079076559ee42f74fe /include/linux/of_clk.h
parentLinux 4.17-rc1 (diff)
downloadlinux-dev-eb06d6bbc45a7561de78a00fb17bfbb75893ee26.tar.xz
linux-dev-eb06d6bbc45a7561de78a00fb17bfbb75893ee26.zip
clk: Extract OF clock helpers in <linux/of_clk.h>
The use of of_clk_get_parent_{count,name}() and of_clk_init() is not limited to clock providers. Hence move these helpers into their own header file, so callers that are not clock providers no longer have to include <linux/clk-provider.h>. Suggested-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'include/linux/of_clk.h')
-rw-r--r--include/linux/of_clk.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/of_clk.h b/include/linux/of_clk.h
new file mode 100644
index 000000000000..b27da9f164cb
--- /dev/null
+++ b/include/linux/of_clk.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * OF clock helpers
+ */
+
+#ifndef __LINUX_OF_CLK_H
+#define __LINUX_OF_CLK_H
+
+#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
+
+unsigned int of_clk_get_parent_count(struct device_node *np);
+const char *of_clk_get_parent_name(struct device_node *np, int index);
+void of_clk_init(const struct of_device_id *matches);
+
+#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */
+
+static inline unsigned int of_clk_get_parent_count(struct device_node *np)
+{
+ return 0;
+}
+static inline const char *of_clk_get_parent_name(struct device_node *np,
+ int index)
+{
+ return NULL;
+}
+static inline void of_clk_init(const struct of_device_id *matches) {}
+
+#endif /* !CONFIG_COMMON_CLK || !CONFIG_OF */
+
+#endif /* __LINUX_OF_CLK_H */