From: ulf.hansson@stericsson.com (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH 2/4] clk: Unprepare the unused prepared slow clocks at late init
Date: Tue, 12 Mar 2013 20:26:03 +0100 [thread overview]
Message-ID: <1363116365-3960-3-git-send-email-ulf.hansson@stericsson.com> (raw)
In-Reply-To: <1363116365-3960-1-git-send-email-ulf.hansson@stericsson.com>
From: Ulf Hansson <ulf.hansson@linaro.org>
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: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/clk/clk.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index deb259a..0944348 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -341,6 +341,29 @@ static inline int clk_debug_register(struct clk *clk) { return 0; }
#endif
/* caller must hold prepare_lock */
+static void clk_unprepare_unused_subtree(struct clk *clk)
+{
+ struct clk *child;
+ struct hlist_node *tmp;
+
+ if (!clk)
+ return;
+
+ hlist_for_each_entry(child, tmp, &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 */
static void clk_disable_unused_subtree(struct clk *clk)
{
struct clk *child;
@@ -393,6 +416,12 @@ static int clk_disable_unused(void)
hlist_for_each_entry(clk, tmp, &clk_orphan_list, child_node)
clk_disable_unused_subtree(clk);
+ hlist_for_each_entry(clk, tmp, &clk_root_list, child_node)
+ clk_unprepare_unused_subtree(clk);
+
+ hlist_for_each_entry(clk, tmp, &clk_orphan_list, child_node)
+ clk_unprepare_unused_subtree(clk);
+
mutex_unlock(&prepare_lock);
return 0;
--
1.7.10
next prev parent reply other threads:[~2013-03-12 19:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-12 19:26 [RESEND PATCH 0/4] clk: Provide option to unprepare unused clocks at late init Ulf Hansson
2013-03-12 19:26 ` [RESEND PATCH 1/4] clk: Introduce optional is_prepared callback Ulf Hansson
2013-03-12 19:26 ` Ulf Hansson [this message]
2013-03-19 19:57 ` [RESEND PATCH 2/4] clk: Unprepare the unused prepared slow clocks at late init Mike Turquette
2013-03-20 9:33 ` Ulf Hansson
2013-03-12 19:26 ` [RESEND PATCH 3/4] clk: Introduce optional unprepare_unused callback Ulf Hansson
2013-03-12 19:26 ` [RESEND PATCH 4/4] clk: ux500: Support is_prepared callback for clk-prcmu Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363116365-3960-3-git-send-email-ulf.hansson@stericsson.com \
--to=ulf.hansson@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).