From patchwork Thu Apr 24 10:13:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 4047691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E614BFF02 for ; Thu, 24 Apr 2014 10:16:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A17F020279 for ; Thu, 24 Apr 2014 10:16:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B2CE2010B for ; Thu, 24 Apr 2014 10:16:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WdGfS-0004ci-2H; Thu, 24 Apr 2014 10:14:10 +0000 Received: from xavier.telenet-ops.be ([195.130.132.52]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WdGfN-0004UK-OU for linux-arm-kernel@lists.infradead.org; Thu, 24 Apr 2014 10:14:07 +0000 Received: from ayla.of.borg ([84.193.72.141]) by xavier.telenet-ops.be with bizsmtp id tmDd1n00V32ts5g01mDddD; Thu, 24 Apr 2014 12:13:42 +0200 Received: from geert by ayla.of.borg with local (Exim 4.76) (envelope-from ) id 1WdGev-0006pM-E8; Thu, 24 Apr 2014 12:13:37 +0200 From: Geert Uytterhoeven To: Magnus Damm , Simon Horman , Laurent Pinchart , Ben Dooks , Felipe Balbi , Mike Turquette , "Rafael J. Wysocki" , linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH/RFC 1/4] clk: Add CLK_RUNTIME_PM and clk_may_runtime_pm() Date: Thu, 24 Apr 2014 12:13:20 +0200 Message-Id: <1398334403-26181-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398334403-26181-1-git-send-email-geert+renesas@glider.be> References: <1398334403-26181-1-git-send-email-geert+renesas@glider.be> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140424_031405_979240_CEBB3379 X-CRM114-Status: GOOD ( 12.73 ) X-Spam-Score: 0.0 (/) Cc: linux-omap@vger.kernel.org, Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a flag CLK_RUNTIME_PM, to let low-level clock drivers indicate that a clock is suitable for Runtime PM. Add clk_may_runtime_pm(), to get the status of the flag. This will allow the device core to enable automatic Runtime PM management for devices tied to clocks that are suitable for Runtime PM. Signed-off-by: Geert Uytterhoeven --- drivers/clk/clk.c | 12 ++++++++++++ include/linux/clk-provider.h | 1 + include/linux/clk.h | 1 + 3 files changed, 14 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0b2819551756..a83a2cc0af67 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1115,6 +1115,18 @@ long clk_get_accuracy(struct clk *clk) EXPORT_SYMBOL_GPL(clk_get_accuracy); /** + * clk_may_runtime_pm - check if the clock is suitable for Runtime PM + * @clk: the clock to check + * + * Return true if the clock is suitable for Runtime PM + * Return false if clk is NULL, or if the clock is not suitable for Runtime PM. + */ +bool clk_may_runtime_pm(const struct clk *clk) +{ + return clk && clk->flags & CLK_RUNTIME_PM; +} + +/** * __clk_recalc_rates * @clk: first clk in the subtree * @msg: notification type (see include/linux/clk.h) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 24c8ba4fa6ae..3ca9a7c1f02d 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -30,6 +30,7 @@ #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ +#define CLK_RUNTIME_PM BIT(9) /* clock is suitable for Runtime PM */ struct clk_hw; struct dentry; diff --git a/include/linux/clk.h b/include/linux/clk.h index d030fce1d77e..07f156580064 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -106,6 +106,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); */ long clk_get_accuracy(struct clk *clk); +bool clk_may_runtime_pm(const struct clk *clk); #else /* !CONFIG_COMMON_CLK */ static inline long clk_get_accuracy(struct clk *clk)