Skip to content

Commit

Permalink
clk: clk: Add clk_gate_restore_context function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Keerthy authored and Tero Kristo committed Oct 3, 2018
1 parent 8b95d1c commit 4353654
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/clk-provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -1018,5 +1018,7 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)

#endif /* platform dependent I/O accessors */

void clk_gate_restore_context(struct clk_hw *hw);

#endif /* CONFIG_COMMON_CLK */
#endif /* CLK_PROVIDER_H */

0 comments on commit 4353654

Please sign in to comment.