From patchwork Thu Apr 21 10:32:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 724381 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3LAX45d025757 for ; Thu, 21 Apr 2011 10:33:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752220Ab1DUKdD (ORCPT ); Thu, 21 Apr 2011 06:33:03 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:57207 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935Ab1DUKdB (ORCPT ); Thu, 21 Apr 2011 06:33:01 -0400 Received: from axis700.grange (pD9EB9449.dip0.t-ipconnect.de [217.235.148.73]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Lbh4l-1PY3rw05N5-00kaPz; Thu, 21 Apr 2011 12:32:55 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 873BE189B89; Thu, 21 Apr 2011 12:32:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 7F0E0189B88; Thu, 21 Apr 2011 12:32:54 +0200 (CEST) Date: Thu, 21 Apr 2011 12:32:54 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-mmc@vger.kernel.org cc: linux-sh@vger.kernel.org, Magnus Damm , Simon Horman , Ian Molton Subject: [PATCH] MMC: TMIO: add runtime PM calls to global suspend() / redume() methods Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:kdCbhi6Fl6lUh8NNmaqIZPbkhK8MpSp/pzZORLdar4V biQ6UgvIYiLfb1C+d1FlYcsKNthRo6sG4iSIfsOj7/i65ACgNe ttHp0vDKrhQ537GoMym5YTmKeceHKoQ6h1LqPCfa4ko0RJ5NYr V+3UhhfNvEQdsQYbKew6L3d2NJNL5rKFd6MJSRYuU/9t5IYr/X 8r9BhtQlfOjlKzBDAs1ze98j0lS0B5moUYWyz4cViU= Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Apr 2011 10:33:05 +0000 (UTC) The TMIO MMC driver cannot generally suspend itself at runtime even with no card inserted, because otherwise it wouldn't be able to detect new cards. But when the system goes down for a global suspend, we can use runtime PM calls to let it activate platform-specific PM hooks, e.g., to switch off respective power domains. Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/tmio_mmc.h | 2 ++ drivers/mmc/host/tmio_mmc_pio.c | 6 ++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 249c724..58138a2 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -52,6 +52,8 @@ struct tmio_mmc_host { void (*set_pwr)(struct platform_device *host, int state); void (*set_clk_div)(struct platform_device *host, int state); + int pm_error; + /* pio related stuff */ struct scatterlist *sg_ptr; struct scatterlist *sg_orig; diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index d1791ba..26598f1 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -980,6 +980,8 @@ int tmio_mmc_host_suspend(struct device *dev) if (!ret) tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL); + host->pm_error = pm_runtime_put_sync(dev); + return ret; } EXPORT_SYMBOL(tmio_mmc_host_suspend); @@ -987,6 +989,10 @@ EXPORT_SYMBOL(tmio_mmc_host_suspend); int tmio_mmc_host_resume(struct device *dev) { struct mmc_host *mmc = dev_get_drvdata(dev); + struct tmio_mmc_host *host = mmc_priv(mmc); + + if (!host->pm_error) + pm_runtime_get_sync(dev); tmio_mmc_reset(mmc_priv(mmc));