summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMichael Turquette <mturquette@baylibre.com>2016-11-17 18:47:30 +0530
committerTaniya Das <tdas@codeaurora.org>2016-12-22 11:41:12 +0530
commitd8d0e55ed104252f0295767d5e2e026c93404870 (patch)
tree7bfa43f6c5f5c2944fd378c2377f793efa61e25f /include/linux
parent83134d5df11ca497a061a492fb9b20e24f56acca (diff)
clk: introduce CLK_ENABLE_HAND_OFF flag
Some clocks are critical to system operation (e.g. cpu, memory, etc) and should not be gated until a driver that knows best claims such a clock and expressly gates that clock through the normal clk.h api. The typical way to handle this is for the clk driver or some other early code to call clk_prepare_enable on this important clock as soon as it is registered and before the clk_disable_unused garbage collector kicks in. This patch introduces a formal way to handle this scenario that is provided by the clk framework. Clk driver authors can set the CLK_ENABLE_HAND_OFF flag in their clk data, which will cause the clk to be enabled in clk_register(). Then when the first clk consumer driver comes along and calls clk_get() & clk_prepare_enable(), the reference counts taken during clk registration are transfered (or handed off) to the clk consumer. At this point handling the clk is the same as any other clock which as not set the new CLK_ENABLE_HAND_OFF flag. In fact no changes to any clock consumer driver are needed for this to work. Change-Id: Ib5247f6bceb1f555c03103f061af089755b2de62 Signed-off-by: Michael Turquette <mturquette@baylibre.com> Patch-mainline: patchwork.kernel.org @ 02/11/16, 9:19 Signed-off-by: Taniya Das <tdas@codeaurora.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clk-provider.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 744167a9ca8b..f91991b97888 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -33,6 +33,9 @@
#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
#define CLK_RECALC_NEW_RATES BIT(9) /* recalc rates after notifications */
#define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */
+#define CLK_ENABLE_HAND_OFF BIT(12) /* enable clock when registered.
+ hand-off enable_count & prepare_count
+ to first consumer that enables clk */
#define CLK_IS_MEASURE BIT(14) /* measure clock */
struct clk;