Commit 1c155b3d authored by Ulf Hansson's avatar Ulf Hansson Committed by Mike Turquette

clk: Unprepare the unused prepared slow clocks at late init

The unused ungated fast clocks are already being disabled from
clk_disable_unused at late init. This patch extend this sequence
to the slow unused prepared clocks to be unprepared.

Unless the optional .is_prepared callback is implemented by a
clk_hw the clk_disable_unused sequence will not unprepare any
unused clocks, since it will fall back to use the software
prepare counter.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
[mturquette@linaro.org: fixed hlist accessors per b67bfe0d]
parent 3d6ee287
...@@ -335,6 +335,28 @@ late_initcall(clk_debug_init); ...@@ -335,6 +335,28 @@ late_initcall(clk_debug_init);
static inline int clk_debug_register(struct clk *clk) { return 0; } static inline int clk_debug_register(struct clk *clk) { return 0; }
#endif #endif
/* caller must hold prepare_lock */
static void clk_unprepare_unused_subtree(struct clk *clk)
{
struct clk *child;
if (!clk)
return;
hlist_for_each_entry(child, &clk->children, child_node)
clk_unprepare_unused_subtree(child);
if (clk->prepare_count)
return;
if (clk->flags & CLK_IGNORE_UNUSED)
return;
if (__clk_is_prepared(clk))
if (clk->ops->unprepare)
clk->ops->unprepare(clk->hw);
}
/* caller must hold prepare_lock */ /* caller must hold prepare_lock */
static void clk_disable_unused_subtree(struct clk *clk) static void clk_disable_unused_subtree(struct clk *clk)
{ {
...@@ -386,6 +408,12 @@ static int clk_disable_unused(void) ...@@ -386,6 +408,12 @@ static int clk_disable_unused(void)
hlist_for_each_entry(clk, &clk_orphan_list, child_node) hlist_for_each_entry(clk, &clk_orphan_list, child_node)
clk_disable_unused_subtree(clk); clk_disable_unused_subtree(clk);
hlist_for_each_entry(clk, &clk_root_list, child_node)
clk_unprepare_unused_subtree(clk);
hlist_for_each_entry(clk, &clk_orphan_list, child_node)
clk_unprepare_unused_subtree(clk);
mutex_unlock(&prepare_lock); mutex_unlock(&prepare_lock);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment