From patchwork Tue Dec 18 23:16:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13649 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 579EE23E19 for ; Tue, 18 Dec 2012 23:16:49 +0000 (UTC) Received: from mail-ie0-f175.google.com (mail-ie0-f175.google.com [209.85.223.175]) by fiordland.canonical.com (Postfix) with ESMTP id DEF40A1866E for ; Tue, 18 Dec 2012 23:16:48 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id qd14so1793076ieb.34 for ; Tue, 18 Dec 2012 15:16:48 -0800 (PST) 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=R7RvxiQJDoLDSh2tcS7fuy6JHM+tzP7atHacsp4rWEQ=; b=loAL9n8oedlv63GALhtAYjBMqm9QOWXWV45aMEbFafdg9U1HfzqBNU+38weztcvOMZ 5h37kYxlEj5jqMi+GCTX6i6pMHRJovX98FHOVShA0OwL36RDWE3aYUCi5tEj7nyTHkP7 Hx6v3lk0OejCkifgn2Fcens0vQ0eDKEMzunJThRHyi0qZfWvpsMwUGmj53N2i1lQCuda qxLLr4pk/3VuQ7coLwxRkI2XO1NujNttnayyGf7gLSSTkwY7raObT1Phi7isZARomY82 CJFQqOe9rznLFgGiGTKFPlAq/PVNP5Z8UESIoPwZ+XCOqTJLaGeav834yZrYDLhVZIiY Voig== X-Received: by 10.42.75.6 with SMTP id y6mr4288118icj.30.1355872608332; Tue, 18 Dec 2012 15:16:48 -0800 (PST) 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.50.67.115 with SMTP id m19csp197644igt; Tue, 18 Dec 2012 15:16:47 -0800 (PST) X-Received: by 10.14.203.8 with SMTP id e8mr9720048eeo.2.1355872607194; Tue, 18 Dec 2012 15:16:47 -0800 (PST) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) by mx.google.com with SMTP id j49si7907730eep.45.2012.12.18.15.16.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Dec 2012 15:16:47 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.113; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.113 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-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUND5W0eZGxK9sben1A+psuSUPO3MvaXQ@postini.com; Tue, 18 Dec 2012 23:16:47 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 045E3AD; Tue, 18 Dec 2012 23:16:42 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C2E22592A; Tue, 18 Dec 2012 23:16:40 +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 relay1.stm.gmessaging.net (Postfix) with ESMTPS id 3FCBA24C2E5; Wed, 19 Dec 2012 00:16:42 +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; Wed, 19 Dec 2012 00:16:41 +0100 From: Ulf Hansson To: , Mike Turquette Cc: Linus Walleij , Philippe Begnic , Ulf Hansson Subject: [PATCH 3/3] clk: Introduce optional unprepare_unused callback Date: Wed, 19 Dec 2012 00:16:23 +0100 Message-ID: <1355872583-20928-4-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1355872583-20928-1-git-send-email-ulf.hansson@stericsson.com> References: <1355872583-20928-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlCJxAUexu9D+OUcPNSIhUe52swtwJurdMuXGCzOj1YGmL/AWN9TAk599+A56EBXW2oWx6l 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 --- 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 2c4c2a1..81437cf 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -216,9 +216,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);