From patchwork Thu Mar 20 16:54:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 3866951 Return-Path: X-Original-To: patchwork-linux-sh@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 6ED3C9F334 for ; Thu, 20 Mar 2014 16:54:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92D0020179 for ; Thu, 20 Mar 2014 16:54:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F11220176 for ; Thu, 20 Mar 2014 16:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752923AbaCTQyj (ORCPT ); Thu, 20 Mar 2014 12:54:39 -0400 Received: from access.ducie-dc1.codethink.co.uk ([185.25.241.217]:60449 "EHLO rt.codethink.co.uk" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751271AbaCTQyi (ORCPT ); Thu, 20 Mar 2014 12:54:38 -0400 Received: from rainbowdash.ducie.codethink.co.uk (localhost [127.0.0.1]) by rt.codethink.co.uk (Postfix) with ESMTPS id E848E1A0BDD; Thu, 20 Mar 2014 16:54:36 +0000 (GMT) Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1WQgEk-0007Bj-O2; Thu, 20 Mar 2014 17:54:34 +0100 From: Ben Dooks To: linux-sh@vger.kernel.org Cc: magnus.damm@gmail.com, horms@verge.net.au, laurent.pinchart@ideasonboard.com, rjw@rjwysocki.net, linux-kernel@lists.codethink.co.uk, Ben Dooks Subject: [PATCH] drivers/sh: pm_runtime implementation needs to suspend and resume devices Date: Thu, 20 Mar 2014 17:54:33 +0100 Message-Id: <1395334473-27600-1-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.9.0 In-Reply-To: <532AAD31.3060307@codethink.co.uk> References: <532AAD31.3060307@codethink.co.uk> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 If we override the platform bus calls for pm_runtime then we end up with the calls to the devices' suspend and resume methods ignored in favour of the bus ones. Change to calling the pm_runtime calls to suspend and resume the devices specifically in the drivers/sh/pm_runtime.c implementation to allow any device that may want to run power management to do so. Note, all the current sh driver implementations do not use their own power management code so this is not a major implementation issues. This also brings the implementation into line with the versions used by the Davinci and Keystone PM domain code, so once fully tested these implementations could be merged together. Signed-off-by: Ben Dooks Acked-by: Geert Uytterhoeven --- drivers/sh/pm_runtime.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c index f4f8851..ced5307 100644 --- a/drivers/sh/pm_runtime.c +++ b/drivers/sh/pm_runtime.c @@ -21,10 +21,43 @@ #include #ifdef CONFIG_PM_RUNTIME +static int sh_pm_runtime_suspend(struct device *dev) +{ + int ret; + + ret = pm_generic_runtime_suspend(dev); + if (ret) { + dev_err(dev, "failed to suspend device\n"); + return ret; + } + + ret = pm_clk_suspend(dev); + if (ret) { + dev_err(dev, "failed to suspend clock\n"); + pm_generic_runtime_resume(dev); + return ret; + } + + return 0; +} + +static int sh_pm_runtime_resume(struct device *dev) +{ + int ret; + + ret = pm_clk_resume(dev); + if (ret) { + dev_err(dev, "failed to resume clock\n"); + return ret; + } + + return pm_generic_runtime_resume(dev); +} + static struct dev_pm_domain default_pm_domain = { .ops = { - .runtime_suspend = pm_clk_suspend, - .runtime_resume = pm_clk_resume, + .runtime_suspend = sh_pm_runtime_suspend, + .runtime_resume = sh_pm_runtime_resume, USE_PLATFORM_PM_SLEEP_OPS }, };