aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Miao <eric.miao@linaro.org>2011-08-24 11:09:51 +0800
committerEric Miao <eric.miao@linaro.org>2011-10-14 09:56:47 +0800
commitac854ff7db141583270eedc11e595c12b245d665 (patch)
tree4db16de92858d880c39d8192fee1d07b84b1a3bb
parentaaa07fd52ad4d41cb1f11831d68e0229a3f8383e (diff)
imx: add clk_get_usecount()
Signed-off-by: Eric Miao <eric.miao@linaro.org>
-rw-r--r--arch/arm/plat-mxc/clock.c18
-rw-r--r--arch/arm/plat-mxc/include/mach/clock.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
index cf04908ec84..5643be65e46 100644
--- a/arch/arm/plat-mxc/clock.c
+++ b/arch/arm/plat-mxc/clock.c
@@ -112,6 +112,24 @@ void clk_disable(struct clk *clk)
}
EXPORT_SYMBOL(clk_disable);
+/*!
+ * @brief Function to get the usage count for the requested clock.
+ *
+ * This function returns the reference count for the clock.
+ *
+ * @param clk Handle to clock to disable.
+ *
+ * @return Returns the usage count for the requested clock.
+ */
+int clk_get_usecount(struct clk *clk)
+{
+ if (clk == NULL || IS_ERR(clk))
+ return 0;
+
+ return clk->usecount;
+}
+EXPORT_SYMBOL(clk_get_usecount);
+
/* Retrieve the *current* clock rate. If the clock itself
* does not provide a special calculation routine, ask
* its parent and so on, until one is able to return
diff --git a/arch/arm/plat-mxc/include/mach/clock.h b/arch/arm/plat-mxc/include/mach/clock.h
index 2b4bb90a29c..fdf3b1d2fe0 100644
--- a/arch/arm/plat-mxc/include/mach/clock.h
+++ b/arch/arm/plat-mxc/include/mach/clock.h
@@ -62,6 +62,8 @@ struct clk {
int (*set_parent) (struct clk *, struct clk *);
};
+int clk_get_usecount(struct clk *clk);
+
int clk_register(struct clk *clk);
void clk_unregister(struct clk *clk);