From patchwork Tue Dec 11 14:17:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13478 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 ECE3623FDB for ; Tue, 11 Dec 2012 14:18:21 +0000 (UTC) Received: from mail-ia0-f177.google.com (mail-ia0-f177.google.com [209.85.210.177]) by fiordland.canonical.com (Postfix) with ESMTP id 79EDAA19696 for ; Tue, 11 Dec 2012 14:18:21 +0000 (UTC) Received: by mail-ia0-f177.google.com with SMTP id u21so6728490ial.36 for ; Tue, 11 Dec 2012 06:18:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=92fdLC/B745DsO+MCdWXMjSJJFjXSDDkfLOAhg8cgks=; b=eeM1QyC2yPpgpC3BwEYYv0wvLEdBRKwvqw1qL2u5KqQwQ/44UqzoyjrPNxBHJhrmtm 9EDMUF7H3VXGgcAxvKAN0AJ/A+xrgNcFwif7ERXITdyscky+z1NtNi5wNOG4R2+64aJt jLLreKwpPTGjwANzxbm7Vb0VGUSTS65lUv3nwIak71pF6+hjpVFoolJkWvQPtvpYLuhl VbeUC9ysMLo9v41yMqDS7VVdXiwO3TFcLplDOGUaVoLcEAm+aHZGpRkeyYE2tUANVcc5 mBbCOTnBhSXgHSRVpW3iexOy9rSsG8ADPI/LAvjJBk1wt7UrsRIzd869cRnLGC2qFebi RV5A== Received: by 10.50.36.164 with SMTP id r4mr9943705igj.57.1355235500909; Tue, 11 Dec 2012 06:18:20 -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.148 with SMTP id n20csp134449igt; Tue, 11 Dec 2012 06:18:20 -0800 (PST) Received: by 10.14.184.134 with SMTP id s6mr60538687eem.43.1355235499490; Tue, 11 Dec 2012 06:18:19 -0800 (PST) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) by mx.google.com with SMTP id l8si39226284eem.77.2012.12.11.06.18.13 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Dec 2012 06:18:19 -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-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUMdAoPSJuI5ZugNqX1ZFnoy4uxpLclS5@postini.com; Tue, 11 Dec 2012 14:18:19 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 2162EDD; Tue, 11 Dec 2012 14:09:49 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B8F2BD36; Tue, 11 Dec 2012 14:18:00 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 872B6A807E; Tue, 11 Dec 2012 15:17:54 +0100 (CET) Received: from steludxu1397.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 11 Dec 2012 15:17:59 +0100 From: Ulf Hansson To: , Chris Ball Cc: , Russell King , Linus Walleij , Ulf Hansson Subject: [PATCH] mmc: mmci: Gate the clock in runtime suspend to save power Date: Tue, 11 Dec 2012 15:17:54 +0100 Message-ID: <1355235474-12783-1-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnB0fQwWA7Bi1N/jrV6EpaWZ+5TByhbo/XIaiu7y5T6BwG+GQMtbqnTdFyoniZ/qWE94UhS From: Ulf Hansson The amba bus is already performing same actions but for the apb_pclk. So here we just make sure the clock to card is gated as well to save more power. At runtime resume we will thus restore the clock again. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index aa04b42..0f397a2 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1636,8 +1636,37 @@ static int mmci_resume(struct device *dev) } #endif +#ifdef CONFIG_PM_RUNTIME +static int mmci_runtime_suspend(struct device *dev) +{ + struct amba_device *adev = to_amba_device(dev); + struct mmc_host *mmc = amba_get_drvdata(adev); + + if (mmc) { + struct mmci_host *host = mmc_priv(mmc); + clk_disable_unprepare(host->clk); + } + + return 0; +} + +static int mmci_runtime_resume(struct device *dev) +{ + struct amba_device *adev = to_amba_device(dev); + struct mmc_host *mmc = amba_get_drvdata(adev); + + if (mmc) { + struct mmci_host *host = mmc_priv(mmc); + clk_prepare_enable(host->clk); + } + + return 0; +} +#endif + static const struct dev_pm_ops mmci_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(mmci_suspend, mmci_resume) + SET_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL) }; static struct amba_id mmci_ids[] = {