From patchwork Thu Apr 7 04:23:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 691871 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 p374PSkJ026582 for ; Thu, 7 Apr 2011 04:25:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751186Ab1DGEZ1 (ORCPT ); Thu, 7 Apr 2011 00:25:27 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:12114 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052Ab1DGEZ1 (ORCPT ); Thu, 7 Apr 2011 00:25:27 -0400 Received: from epmmp2 (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LJ90032ULMDRJ20@mailout4.samsung.com> for linux-mmc@vger.kernel.org; Thu, 07 Apr 2011 13:25:25 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LJ900108LMDS5@mmp2.samsung.com> for linux-mmc@vger.kernel.org; Thu, 07 Apr 2011 13:25:25 +0900 (KST) Received: from [165.213.219.108] ([165.213.219.108]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Thu, 07 Apr 2011 13:25:25 +0900 Date: Thu, 07 Apr 2011 13:23:52 +0900 From: Jaehoon Chung Subject: [PATCH] mmc: sdhci: fixed regulator control when suspend/resume To: "linux-mmc@vger.kernel.org" Cc: Chris Ball , Kyungmin Park Message-id: <4D9D3C58.5030901@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Thunderbird 2.0.0.24 (X11/20100317) X-OriginalArrivalTime: 07 Apr 2011 04:25:25.0294 (UTC) FILETIME=[D113C4E0:01CBF4DB] 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, 07 Apr 2011 04:25:39 +0000 (UTC) Suspend/resume is working always enable regulator after resuming. (if there is host->vmmc) I assume that if regulator is enabled, card is inserted. Then We need to restore "vmmc". Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park --- drivers/mmc/host/sdhci.c | 8 +++++--- include/linux/mmc/sdhci.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9e15f41..70cbbd6 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1663,8 +1663,10 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state) free_irq(host->irq, host); - if (host->vmmc) + if (host->vmmc && regulator_is_enabled(host->vmmc)) { ret = regulator_disable(host->vmmc); + host->restore_vmmc = true; + } return ret; } @@ -1675,8 +1677,8 @@ int sdhci_resume_host(struct sdhci_host *host) { int ret; - if (host->vmmc) { - int ret = regulator_enable(host->vmmc); + if (host->vmmc && host->restore_vmmc) { + ret = regulator_enable(host->vmmc); if (ret) return ret; } diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 83bd9f7..1c38261 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -92,6 +92,7 @@ struct sdhci_host { const struct sdhci_ops *ops; /* Low level hw interface */ struct regulator *vmmc; /* Power regulator */ + bool restore_vmmc; /* Restore vmmc */ /* Internal data */ struct mmc_host *mmc; /* MMC structure */