From patchwork Tue Mar 12 19:26:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 15308 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 28A9823E00 for ; Tue, 12 Mar 2013 19:26:28 +0000 (UTC) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by fiordland.canonical.com (Postfix) with ESMTP id B4EC6A18A88 for ; Tue, 12 Mar 2013 19:26:27 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id fl15so110978vcb.18 for ; Tue, 12 Mar 2013 12:26:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:mime-version:content-type:x-gm-message-state; bh=9sJo1aBcL2fBa/G+TQhJaw8T8pofVHd5KeYkoCr/LfE=; b=NMv1mTmZwe/SbPJqAoc7YBqsy5Ei1qFnwns8oTY4BwW5WKvVBUbWydn1fF1QrR4fQr PNSFHbRUDzAno8dZJ8N0rik/G5N3cVGRxK/tiOX63EJAjKKtGAtDPm4h+9Oecbo9EpDb T+BMGN7/PFgKmg9nyzGui9hQl0cVGZ0Q4JhmtTAXZ0BljQswa1fD0TIe/cP3kE0Gy/hZ jjA0PRw5vSDO4/aur8I8mNb8q404S5eX5/kZ5ls9hN52dlsILVtCn5+QTSDkX0QhT4FS D8MXesgqi/WKsOMNqoMCqvxAaX7KR8RJaM1wADrIX0pQlJWCb3Uv+Y2wz51DAe/N29hU WhaQ== X-Received: by 10.220.214.6 with SMTP id gy6mr3779844vcb.8.1363116387252; Tue, 12 Mar 2013 12:26:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp144581veb; Tue, 12 Mar 2013 12:26:26 -0700 (PDT) X-Received: by 10.15.45.201 with SMTP id b49mr51277011eew.9.1363116386286; Tue, 12 Mar 2013 12:26:26 -0700 (PDT) Received: from eu1sys200aog110.obsmtp.com (eu1sys200aog110.obsmtp.com [207.126.144.129]) by mx.google.com with SMTP id a41si4381729eew.119.2013.03.12.12.26.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 Mar 2013 12:26:26 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.129; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) smtp.mail=ulf.hansson@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKUT+BWyHoYNaVvq/AoFXig6wU6hKgAC+7@postini.com; Tue, 12 Mar 2013 19:26:25 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C6D4EA6; Tue, 12 Mar 2013 19:18:08 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 830F2563; Tue, 12 Mar 2013 19:26:16 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 79006A8074; Tue, 12 Mar 2013 20:26:08 +0100 (CET) Received: from steludxu1397.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 12 Mar 2013 20:26:15 +0100 From: Ulf Hansson To: , Mike Turquette Cc: Linus Walleij , Par-Olof Hakansson , Ulf Hansson Subject: [RESEND PATCH 2/4] clk: Unprepare the unused prepared slow clocks at late init Date: Tue, 12 Mar 2013 20:26:03 +0100 Message-ID: <1363116365-3960-3-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1363116365-3960-1-git-send-email-ulf.hansson@stericsson.com> References: <1363116365-3960-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnm0d9hAdXdhK1NAyCTe1J0FUAksPmPVBg2BXxE+k2qhgzJfAeNzOgjamHms4oOqsJZzHl/ 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 --- 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;