From patchwork Mon Dec 5 17:36:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5477 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 BCFE323E0E for ; Mon, 5 Dec 2011 17:36:50 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id A024EA184E3 for ; Mon, 5 Dec 2011 17:36:50 +0000 (UTC) Received: by mail-lpp01m010-f52.google.com with SMTP id m6so417580lag.11 for ; Mon, 05 Dec 2011 09:36:50 -0800 (PST) Received: by 10.152.144.73 with SMTP id sk9mr6620783lab.34.1323106610555; Mon, 05 Dec 2011 09:36:50 -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.152.41.198 with SMTP id h6cs270358lal; Mon, 5 Dec 2011 09:36:49 -0800 (PST) Received: by 10.14.6.65 with SMTP id 41mr1221540eem.12.1323106603752; Mon, 05 Dec 2011 09:36:43 -0800 (PST) Received: from eu1sys200aog106.obsmtp.com (eu1sys200aog106.obsmtp.com. [207.126.144.121]) by mx.google.com with SMTP id a14si1205133een.110.2011.12.05.09.36.39 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Dec 2011 09:36:43 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.121 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.121; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.121 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-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKTt0BJ8yb9zfEgk+r3RrvTrDpIA7dfPDs@postini.com; Mon, 05 Dec 2011 17:36:43 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 90A8D5C; Mon, 5 Dec 2011 17:36:34 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id A50B259; Mon, 5 Dec 2011 17:15:29 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 7CF39A8072; Mon, 5 Dec 2011 18:36:30 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 5 Dec 2011 18:36:36 +0100 From: Ulf Hansson To: , Cc: Russell King , Ulf Hansson , Lee Jones Subject: [PATCH 14/14] mmc: mmci: Use ios_handler to save power Date: Mon, 5 Dec 2011 18:36:00 +0100 Message-ID: <1323106560-5218-15-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1323106560-5218-1-git-send-email-ulf.hansson@stericsson.com> References: <1323106560-5218-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 To disable a levelshifter when we are in an idle state will decrease current consumption. We make use of the ios_handler at runtime suspend and at regular suspend to accomplish this. Of course depending on the used levelshifter the decrease of current differs. For ST6G3244ME the value is up to ~200 uA. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index c0d6026..b98ee98 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1491,10 +1491,22 @@ static int mmci_save(struct amba_device *dev) { struct mmc_host *mmc = amba_get_drvdata(dev); unsigned long flags; + struct mmc_ios ios; + int ret = 0; if (mmc) { struct mmci_host *host = mmc_priv(mmc); + /* Let the ios_handler act on a POWER_OFF to save power. */ + if (host->plat->ios_handler) { + memcpy(&ios, &mmc->ios, sizeof(struct mmc_ios)); + ios.power_mode = MMC_POWER_OFF; + ret = host->plat->ios_handler(mmc_dev(mmc), + &ios); + if (ret) + return ret; + } + spin_lock_irqsave(&host->lock, flags); /* @@ -1513,7 +1525,7 @@ static int mmci_save(struct amba_device *dev) amba_vcore_disable(dev); } - return 0; + return ret; } static int mmci_restore(struct amba_device *dev) @@ -1536,6 +1548,11 @@ static int mmci_restore(struct amba_device *dev) writel(MCI_IRQENABLE, host->base + MMCIMASK0); spin_unlock_irqrestore(&host->lock, flags); + + /* Restore settings done by the ios_handler. */ + if (host->plat->ios_handler) + host->plat->ios_handler(mmc_dev(mmc), + &mmc->ios); } return 0;