From patchwork Tue Mar 19 19:57:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 2304311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 12A4FDFB79 for ; Tue, 19 Mar 2013 20:01:15 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UI2fi-0003cR-4d; Tue, 19 Mar 2013 19:58:10 +0000 Received: from mail-da0-x232.google.com ([2607:f8b0:400e:c00::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UI2fe-0003c8-O6 for linux-arm-kernel@lists.infradead.org; Tue, 19 Mar 2013 19:58:07 +0000 Received: by mail-da0-f50.google.com with SMTP id t1so509727dae.37 for ; Tue, 19 Mar 2013 12:58:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:content-type:mime-version:content-transfer-encoding:to :from:in-reply-to:cc:references:message-id:user-agent:subject:date :x-gm-message-state; bh=0X10/XVYOUIfsuMSWvG/v5ZR57wCeFTsFruQrf2taz4=; b=lDDjM09Kqa3wyW5Q7dvhr2sz5syk7Xl2bVCGkrP1udisIJBNzRoIQVwgmNM0eXY8bg XZN/3j/g5bMLJ/sgW4VkIz33WbbCiWuVI7B+uEgC9+txwz5qFzdxAGxiObEjUvJCMovw ZmjnejnmIB+zcv3fjp4xLGbvUS3rzhmrPdAkzON6lMg9Ys6PMTbUtsMU82y/qmaDU02m Nh4tYQv5pEM2wq70lX3Oef0sodxKcybIUwcDNiePcQcueEQV7j/AIJKH/TVtiSKww5us Qslqcy4o2g16PcMUEhMtwzE7R1PYVQfJnPaSt9OJQEuM/qndQ6XVUPT/hPUSGVCP7Mj3 X6tw== X-Received: by 10.68.49.73 with SMTP id s9mr4984043pbn.106.1363723081368; Tue, 19 Mar 2013 12:58:01 -0700 (PDT) Received: from localhost (adsl-69-228-93-79.dsl.pltn13.pacbell.net. [69.228.93.79]) by mx.google.com with ESMTPS id qd8sm25362045pbc.29.2013.03.19.12.57.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 19 Mar 2013 12:58:00 -0700 (PDT) MIME-Version: 1.0 To: Ulf Hansson , From: Mike Turquette In-Reply-To: <1363116365-3960-3-git-send-email-ulf.hansson@stericsson.com> References: <1363116365-3960-1-git-send-email-ulf.hansson@stericsson.com> <1363116365-3960-3-git-send-email-ulf.hansson@stericsson.com> Message-ID: <20130319195752.8663.43172@quantum> User-Agent: alot/0.3.3+ Subject: Re: [RESEND PATCH 2/4] clk: Unprepare the unused prepared slow clocks at late init Date: Tue, 19 Mar 2013 12:57:52 -0700 X-Gm-Message-State: ALoCoQngb5sBSARvXfDMnFVtOo4ITfit6+IWshXf1U87BSwruY3p7ls+19B47e3O2kqit39v4DJC X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130319_155806_916181_C8AE18A1 X-CRM114-Status: GOOD ( 16.53 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linus Walleij , Ulf Hansson , Par-Olof Hakansson X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Quoting Ulf Hansson (2013-03-12 12:26:03) > From: Ulf Hansson > > 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 > Acked-by: Linus Walleij Hi Ulf, I've taken all of these patches into clk-next. Thanks for the resend. I had to fix up this patch due to commit b67bfe0d, "hlist: drop the node parameter from iterators". The merged version is below. Let me know if you have any issues with it. Regards, Mike From ae3865ca119ad82afbf003b4eee38533f32bd0fe Mon Sep 17 00:00:00 2001 From: Ulf Hansson Date: Tue, 12 Mar 2013 20:26:03 +0100 Subject: [PATCH] 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: Ulf Hansson Acked-by: Linus Walleij Signed-off-by: Mike Turquette [mturquette@linaro.org: fixed hlist accessors per b67bfe0d] --- drivers/clk/clk.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7571b50..c0141f3 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -336,6 +336,28 @@ 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; + + 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 */ static void clk_disable_unused_subtree(struct clk *clk) { struct clk *child; @@ -386,6 +408,12 @@ static int clk_disable_unused(void) hlist_for_each_entry(clk, &clk_orphan_list, child_node) 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); return 0;