From patchwork Tue Mar 12 19:26:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 15310 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 9C08223E48 for ; Tue, 12 Mar 2013 19:35:16 +0000 (UTC) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by fiordland.canonical.com (Postfix) with ESMTP id 3C9F2A18A30 for ; Tue, 12 Mar 2013 19:35:16 +0000 (UTC) Received: by mail-vb0-f53.google.com with SMTP id fj18so76316vbb.40 for ; Tue, 12 Mar 2013 12:35:15 -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=afZ9mgSmpnfr+kUmol00AWOfm2ph5e3C0i+PL3d895A=; b=UhBWhlz2rdDvEikNF6zJwLmmeA1KPZG58I7blO2/ArO62ugHK8a9MpKJlMMhMIRuiG E711U14KcACdei4YyjIN+93Q95akX4E5W02FoJ42iq3E/kPw6aGeMogjh11VkQyLc4rC Nlf9zmQRYcP23Er33zrRsmMR9wgzZx5bmJ/rK/7wxkSnDLvMVyylLAaSGk6vCZHyfzvu 9oRSW62WpkemFLKcX2Xyxa3YPsAJL1F0FHvkt+m424gYwcJT63W5IUzwmH3cGeZxworC Hz+eX90ROEgChrgGFKMi2JUW4lDUZA52lRCdmxiZmBRmjJu3IXeVxtr+0I3Yy4ZWTAQU VDVw== X-Received: by 10.58.84.164 with SMTP id a4mr7249727vez.9.1363116915696; Tue, 12 Mar 2013 12:35:15 -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 nf2csp144903veb; Tue, 12 Mar 2013 12:35:15 -0700 (PDT) X-Received: by 10.14.216.198 with SMTP id g46mr36339355eep.30.1363116914532; Tue, 12 Mar 2013 12:35:14 -0700 (PDT) Received: from eu1sys200aog105.obsmtp.com (eu1sys200aog105.obsmtp.com [207.126.144.119]) by mx.google.com with SMTP id b4si37474148eep.10.2013.03.12.12.35.10 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 Mar 2013 12:35:14 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.119; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.119 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-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKUT+DbgoXbxXk+dQ729OxGy1IvUjPtXMe@postini.com; Tue, 12 Mar 2013 19:35:14 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 130D34D; Tue, 12 Mar 2013 19:25:30 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id F26AB4D4; Tue, 12 Mar 2013 13:06:18 +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 52CF6A8074; Tue, 12 Mar 2013 20:26:11 +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:18 +0100 From: Ulf Hansson To: , Mike Turquette Cc: Linus Walleij , Par-Olof Hakansson , Ulf Hansson Subject: [RESEND PATCH 3/4] clk: Introduce optional unprepare_unused callback Date: Tue, 12 Mar 2013 20:26:04 +0100 Message-ID: <1363116365-3960-4-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: ALoCoQk0Q6sofGDcIbwkKd6drrNouYRHSBlPHNE8fPxXkY1+257UKmyvU/OxMkvNFKoOzFNk7ipd From: Ulf Hansson An unprepare_unused callback is introduced due to the same reasons to why the disable_unused callback was added. During the clk_disable_unused sequence, those clk_hw that needs specific treatment with regards to being unprepared, shall implement the unprepare_unused callback. Signed-off-by: Ulf Hansson Acked-by: Linus Walleij --- drivers/clk/clk.c | 7 +++++-- include/linux/clk-provider.h | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0944348..d8dc6d7c 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -358,9 +358,12 @@ static void clk_unprepare_unused_subtree(struct clk *clk) if (clk->flags & CLK_IGNORE_UNUSED) return; - if (__clk_is_prepared(clk)) - if (clk->ops->unprepare) + if (__clk_is_prepared(clk)) { + if (clk->ops->unprepare_unused) + clk->ops->unprepare_unused(clk->hw); + else if (clk->ops->unprepare) clk->ops->unprepare(clk->hw); + } } /* caller must hold prepare_lock */ diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 86ff6be..9e97fb4 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -49,6 +49,10 @@ struct clk_hw; * This function is allowed to sleep. Optional, if this op is not * set then the prepare count will be used. * + * @unprepare_unused: Unprepare the clock atomically. Only called from + * clk_disable_unused for prepare clocks with special needs. + * Called with prepare mutex held. This function may sleep. + * * @enable: Enable the clock atomically. This must not return until the * clock is generating a valid clock signal, usable by consumer * devices. Called with enable_lock held. This function must not @@ -113,6 +117,7 @@ struct clk_ops { int (*prepare)(struct clk_hw *hw); void (*unprepare)(struct clk_hw *hw); int (*is_prepared)(struct clk_hw *hw); + void (*unprepare_unused)(struct clk_hw *hw); int (*enable)(struct clk_hw *hw); void (*disable)(struct clk_hw *hw); int (*is_enabled)(struct clk_hw *hw);