aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2021-09-19 10:47:53 +0200
committerJérôme Forissier <jerome@forissier.org>2021-10-27 15:03:22 +0200
commit6c9ed8423414aceb4ded7de166fe29ed919b3847 (patch)
tree25b78239a06fe262d0493fbf9a93b8ae5752a3a0 /core
parent7e6a39fece279eaa050892caeee62776588f3ac3 (diff)
drivers: clk: implement clk_is_enabled()
Add clock API function clk_is_enabled(). It is not very useful at runtime since clock state can change at any time. The API function is useful during specific system sequences where OP-TEE core knows is executes atomically (primary core boot, low power sequences). Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Diffstat (limited to 'core')
-rw-r--r--core/drivers/clk/clk.c5
-rw-r--r--core/include/drivers/clk.h10
2 files changed, 15 insertions, 0 deletions
diff --git a/core/drivers/clk/clk.c b/core/drivers/clk/clk.c
index 56cf4d09..0d15095c 100644
--- a/core/drivers/clk/clk.c
+++ b/core/drivers/clk/clk.c
@@ -111,6 +111,11 @@ static bool clk_is_enabled_no_lock(struct clk *clk)
return refcount_val(&clk->enabled_count) != 0;
}
+bool clk_is_enabled(struct clk *clk)
+{
+ return clk_is_enabled_no_lock(clk);
+}
+
static void clk_disable_no_lock(struct clk *clk)
{
struct clk *parent = NULL;
diff --git a/core/include/drivers/clk.h b/core/include/drivers/clk.h
index 73629a43..083a44f0 100644
--- a/core/include/drivers/clk.h
+++ b/core/include/drivers/clk.h
@@ -132,6 +132,16 @@ TEE_Result clk_enable(struct clk *clk);
void clk_disable(struct clk *clk);
/**
+ * clk_is_enabled - Informative state on the clock
+ *
+ * This function is useful during specific system sequences where core
+ * executes atomically (primary core boot, some low power sequences).
+ *
+ * @clk: Clock refernece
+ */
+bool clk_is_enabled(struct clk *clk);
+
+/**
* clk_get_parent - Get the current clock parent
*
* @clk: Clock for which the parent is needed