From patchwork Thu Apr 24 10:26:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 4048891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7F76F9F1F4 for ; Thu, 24 Apr 2014 10:32:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1FFE202DD for ; Thu, 24 Apr 2014 10:32:39 +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 CE24C2028D for ; Thu, 24 Apr 2014 10:32:38 +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 1WdGve-0001yc-Er; Thu, 24 Apr 2014 10:30:54 +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 1WdGry-00049L-Do for linux-arm-kernel@lists.infradead.org; Thu, 24 Apr 2014 10:27:09 +0000 Received: from ayla.of.borg ([84.193.72.141]) by xavier.telenet-ops.be with bizsmtp id tmSk1n00x32ts5g01mSkl6; Thu, 24 Apr 2014 12:26:44 +0200 Received: from geert by ayla.of.borg with local (Exim 4.76) (envelope-from ) id 1WdGrc-0006v5-FZ; Thu, 24 Apr 2014 12:26:44 +0200 From: Geert Uytterhoeven To: "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] PM / clock_ops: Add helpers combining generic runtime and generic clock PM Date: Thu, 24 Apr 2014 12:26:33 +0200 Message-Id: <1398335198-26555-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398335198-26555-1-git-send-email-geert+renesas@glider.be> References: <1398335198-26555-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_032706_833252_43582AF0 X-CRM114-Status: GOOD ( 10.35 ) X-Spam-Score: 0.0 (/) Cc: devicetree@vger.kernel.org, Geert Uytterhoeven , linux-sh@vger.kernel.org, Ben Dooks , linux-omap@vger.kernel.org, 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 helpers pm_generic_runtime_clk_suspend() and pm_generic_clk_runtime_resume(), combining generic runtime PM and generic clock PM. Signed-off-by: Geert Uytterhoeven --- drivers/base/power/clock_ops.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/pm_clock.h | 6 ++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 2d5c9c1eceb1..3cdb9fa2920d 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -523,3 +524,42 @@ void pm_clk_add_notifier(struct bus_type *bus, clknb->nb.notifier_call = pm_clk_notify; bus_register_notifier(bus, &clknb->nb); } + +/** + * pm_generic_runtime_clk_suspend - Generic runtime suspend and clock disable + * callback for subsystems. + * @dev: Device to resume. + */ +int pm_generic_runtime_clk_suspend(struct device *dev) +{ + int ret; + + dev_dbg(dev, "%s\n", __func__); + + ret = pm_generic_runtime_suspend(dev); + if (ret) + return ret; + + ret = pm_clk_suspend(dev); + if (ret) { + pm_generic_runtime_resume(dev); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(pm_generic_runtime_clk_suspend); + +/** + * pm_generic_clk_runtime_resume - Generic clock enable and runtime resume + * callback for subsystems. + * @dev: Device to resume. + */ +int pm_generic_clk_runtime_resume(struct device *dev) +{ + dev_dbg(dev, "%s\n", __func__); + + pm_clk_resume(dev); + return pm_generic_runtime_resume(dev); +} +EXPORT_SYMBOL_GPL(pm_generic_clk_runtime_resume); diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h index 6981aa288c45..bf1e4d09a0ca 100644 --- a/include/linux/pm_clock.h +++ b/include/linux/pm_clock.h @@ -35,6 +35,8 @@ extern int pm_clk_add_clk(struct device *dev, struct clk *clk); extern void pm_clk_remove(struct device *dev, const char *con_id); extern int pm_clk_suspend(struct device *dev); extern int pm_clk_resume(struct device *dev); +extern int pm_generic_runtime_clk_suspend(struct device *dev); +extern int pm_generic_clk_runtime_resume(struct device *dev); #else static inline bool pm_clk_no_clocks(struct device *dev) { @@ -59,6 +61,10 @@ static inline void pm_clk_remove(struct device *dev, const char *con_id) } #define pm_clk_suspend NULL #define pm_clk_resume NULL +static inline int pm_generic_runtime_clk_suspend(struct device *dev) + { return 0; } +static inline int pm_generic_clk_runtime_resume(struct device *dev) + { return 0; } #endif #ifdef CONFIG_HAVE_CLK