aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clk.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r--include/linux/clk.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1d37f42ac294..7213b52b2c0e 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -11,6 +11,8 @@
11#ifndef __LINUX_CLK_H 11#ifndef __LINUX_CLK_H
12#define __LINUX_CLK_H 12#define __LINUX_CLK_H
13 13
14#include <linux/kernel.h>
15
14struct device; 16struct device;
15 17
16/* 18/*
@@ -41,11 +43,31 @@ struct clk;
41struct clk *clk_get(struct device *dev, const char *id); 43struct clk *clk_get(struct device *dev, const char *id);
42 44
43/** 45/**
46 * clk_prepare - prepare a clock source
47 * @clk: clock source
48 *
49 * This prepares the clock source for use.
50 *
51 * Must not be called from within atomic context.
52 */
53#ifdef CONFIG_HAVE_CLK_PREPARE
54int clk_prepare(struct clk *clk);
55#else
56static inline int clk_prepare(struct clk *clk)
57{
58 might_sleep();
59 return 0;
60}
61#endif
62
63/**
44 * clk_enable - inform the system when the clock source should be running. 64 * clk_enable - inform the system when the clock source should be running.
45 * @clk: clock source 65 * @clk: clock source
46 * 66 *
47 * If the clock can not be enabled/disabled, this should return success. 67 * If the clock can not be enabled/disabled, this should return success.
48 * 68 *
69 * May be called from atomic contexts.
70 *
49 * Returns success (0) or negative errno. 71 * Returns success (0) or negative errno.
50 */ 72 */
51int clk_enable(struct clk *clk); 73int clk_enable(struct clk *clk);
@@ -57,6 +79,8 @@ int clk_enable(struct clk *clk);
57 * Inform the system that a clock source is no longer required by 79 * Inform the system that a clock source is no longer required by
58 * a driver and may be shut down. 80 * a driver and may be shut down.
59 * 81 *
82 * May be called from atomic contexts.
83 *
60 * Implementation detail: if the clock source is shared between 84 * Implementation detail: if the clock source is shared between
61 * multiple drivers, clk_enable() calls must be balanced by the 85 * multiple drivers, clk_enable() calls must be balanced by the
62 * same number of clk_disable() calls for the clock source to be 86 * same number of clk_disable() calls for the clock source to be
@@ -64,6 +88,25 @@ int clk_enable(struct clk *clk);
64 */ 88 */
65void clk_disable(struct clk *clk); 89void clk_disable(struct clk *clk);
66 90
91
92/**
93 * clk_unprepare - undo preparation of a clock source
94 * @clk: clock source
95 *
96 * This undoes a previously prepared clock. The caller must balance
97 * the number of prepare and unprepare calls.
98 *
99 * Must not be called from within atomic context.
100 */
101#ifdef CONFIG_HAVE_CLK_PREPARE
102void clk_unprepare(struct clk *clk);
103#else
104static inline void clk_unprepare(struct clk *clk)
105{
106 might_sleep();
107}
108#endif
109
67/** 110/**
68 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. 111 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
69 * This is only valid once the clock source has been enabled. 112 * This is only valid once the clock source has been enabled.