summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorKeerthy2018-09-04 08:49:36 +0200
committerTero Kristo2018-10-03 14:29:15 +0200
commit435365485f40cf12747d1daa2253a4f4b46b8148 (patch)
tree62c9d83c8512fd4ac19afa38ce97c2a3165a57f4 /drivers/clk/clk.c
parentclk: Add functions to save/restore clock context en-masse (diff)
downloadkernel-qcow2-linux-435365485f40cf12747d1daa2253a4f4b46b8148.tar.gz
kernel-qcow2-linux-435365485f40cf12747d1daa2253a4f4b46b8148.tar.xz
kernel-qcow2-linux-435365485f40cf12747d1daa2253a4f4b46b8148.zip
clk: clk: Add clk_gate_restore_context function
The clock gate restore context function enables or disables the gate clocks based on the enable_count. This is done in cases where the clock context is lost and based on the enable_count the clock either needs to be enabled/disabled. Signed-off-by: Keerthy <j-keerthy@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Tero Kristo <t-kristo@ti.com>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8a0254a1c303..dd775771a7cc 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -923,6 +923,25 @@ static int clk_core_enable_lock(struct clk_core *core)
return ret;
}
+/**
+ * clk_gate_restore_context - restore context for poweroff
+ * @hw: the clk_hw pointer of clock whose state is to be restored
+ *
+ * The clock gate restore context function enables or disables
+ * the gate clocks based on the enable_count. This is done in cases
+ * where the clock context is lost and based on the enable_count
+ * the clock either needs to be enabled/disabled. This
+ * helps restore the state of gate clocks.
+ */
+void clk_gate_restore_context(struct clk_hw *hw)
+{
+ if (hw->clk->core->enable_count)
+ hw->clk->core->ops->enable(hw);
+ else
+ hw->clk->core->ops->disable(hw);
+}
+EXPORT_SYMBOL_GPL(clk_gate_restore_context);
+
static int _clk_save_context(struct clk_core *clk)
{
struct clk_core *child;