linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mmc: sdhci: add wake up support
@ 2013-01-05  9:21 Kevin Liu
  2013-01-05  9:21 ` [PATCH v2 2/2] mmc: sdhci-pxav3: " Kevin Liu
  2013-01-14 19:43 ` [PATCH v2 1/2] mmc: sdhci: " Chris Ball
  0 siblings, 2 replies; 4+ messages in thread
From: Kevin Liu @ 2013-01-05  9:21 UTC (permalink / raw)
  To: linux-mmc, Chris Ball
  Cc: Philip Rakity, Aaron Lu, Shawn Guo, Ulf Hansson, Johan Rudholm,
	Daniel Drake, Guennadi Liakhovetski, Adrian Hunter, Jerry Huang,
	Alexander Stein, Girish K S, Haijun Zhang, Viresh Kumar,
	Heiko Stuebner, Thomas Abraham, Chander Kashyap, Jaehoon Chung,
	Sebastian Hesselbarth, Zhangfei Gao, Haojian Zhuang, Chao Xie,
	key

Not to disable SD Host IRQ during suspend if it is wake up source.
Enable wakeup event during suspend.

Signed-off-by: Jialing Fu <jlfu@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
 drivers/mmc/host/sdhci.c |   60 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 089182e..04af0fd 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2455,6 +2455,32 @@ out:
 \*****************************************************************************/
 
 #ifdef CONFIG_PM
+void sdhci_enable_irq_wakeups(struct sdhci_host *host)
+{
+	u8 val;
+	u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE
+			| SDHCI_WAKE_ON_INT;
+
+	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
+	val |= mask ;
+	/* Avoid fake wake up */
+	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
+		val &= ~(SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE);
+	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
+}
+EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups);
+
+void sdhci_disable_irq_wakeups(struct sdhci_host *host)
+{
+	u8 val;
+	u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE
+			| SDHCI_WAKE_ON_INT;
+
+	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
+	val &= ~mask;
+	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
+}
+EXPORT_SYMBOL_GPL(sdhci_disable_irq_wakeups);
 
 int sdhci_suspend_host(struct sdhci_host *host)
 {
@@ -2484,9 +2510,13 @@ int sdhci_suspend_host(struct sdhci_host *host)
 		return ret;
 	}
 
-	sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
-	free_irq(host->irq, host);
-
+	if (!device_may_wakeup(mmc_dev(host->mmc))) {
+		sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
+		free_irq(host->irq, host);
+	} else {
+		sdhci_enable_irq_wakeups(host);
+		enable_irq_wake(host->irq);
+	}
 	return ret;
 }
 
@@ -2501,10 +2531,15 @@ int sdhci_resume_host(struct sdhci_host *host)
 			host->ops->enable_dma(host);
 	}
 
-	ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED,
-			  mmc_hostname(host->mmc), host);
-	if (ret)
-		return ret;
+	if (!device_may_wakeup(mmc_dev(host->mmc))) {
+		ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED,
+				  mmc_hostname(host->mmc), host);
+		if (ret)
+			return ret;
+	} else {
+		sdhci_disable_irq_wakeups(host);
+		disable_irq_wake(host->irq);
+	}
 
 	if ((host->mmc->pm_flags & MMC_PM_KEEP_POWER) &&
 	    (host->quirks2 & SDHCI_QUIRK2_HOST_OFF_CARD_ON)) {
@@ -2532,17 +2567,6 @@ int sdhci_resume_host(struct sdhci_host *host)
 }
 
 EXPORT_SYMBOL_GPL(sdhci_resume_host);
-
-void sdhci_enable_irq_wakeups(struct sdhci_host *host)
-{
-	u8 val;
-	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
-	val |= SDHCI_WAKE_ON_INT;
-	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
-}
-
-EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups);
-
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_PM_RUNTIME
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mmc: sdhci-pxav3: add wake up support
  2013-01-05  9:21 [PATCH v2 1/2] mmc: sdhci: add wake up support Kevin Liu
@ 2013-01-05  9:21 ` Kevin Liu
  2013-01-14 19:43   ` Chris Ball
  2013-01-14 19:43 ` [PATCH v2 1/2] mmc: sdhci: " Chris Ball
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Liu @ 2013-01-05  9:21 UTC (permalink / raw)
  To: linux-mmc, Chris Ball
  Cc: Philip Rakity, Aaron Lu, Shawn Guo, Ulf Hansson, Johan Rudholm,
	Daniel Drake, Guennadi Liakhovetski, Adrian Hunter, Jerry Huang,
	Alexander Stein, Girish K S, Haijun Zhang, Viresh Kumar,
	Heiko Stuebner, Thomas Abraham, Chander Kashyap, Jaehoon Chung,
	Sebastian Hesselbarth, Zhangfei Gao, Haojian Zhuang, Chao Xie,
	key

Signed-off-by: Jialing Fu <jlfu@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
 drivers/mmc/host/sdhci-pxav3.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index b4aca81..ff06aff 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -325,6 +325,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, host);
 
+	if (pdata->pm_caps & MMC_PM_KEEP_POWER) {
+		device_init_wakeup(&pdev->dev, 1);
+		host->mmc->pm_flags |= MMC_PM_WAKE_SDIO_IRQ;
+	} else {
+		device_init_wakeup(&pdev->dev, 0);
+	}
+
 	pm_runtime_put_autosuspend(&pdev->dev);
 
 	return 0;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] mmc: sdhci: add wake up support
  2013-01-05  9:21 [PATCH v2 1/2] mmc: sdhci: add wake up support Kevin Liu
  2013-01-05  9:21 ` [PATCH v2 2/2] mmc: sdhci-pxav3: " Kevin Liu
@ 2013-01-14 19:43 ` Chris Ball
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-01-14 19:43 UTC (permalink / raw)
  To: Kevin Liu
  Cc: linux-mmc, Philip Rakity, Aaron Lu, Shawn Guo, Ulf Hansson,
	Johan Rudholm, Daniel Drake, Guennadi Liakhovetski, Adrian Hunter,
	Jerry Huang, Alexander Stein, Girish K S, Haijun Zhang,
	Viresh Kumar, Heiko Stuebner, Thomas Abraham, Chander Kashyap,
	Jaehoon Chung, Sebastian Hesselbarth, Zhangfei Gao,
	Haojian Zhuang, Chao

Hi,

On Sat, Jan 05 2013, Kevin Liu wrote:
> Not to disable SD Host IRQ during suspend if it is wake up source.
> Enable wakeup event during suspend.
>
> Signed-off-by: Jialing Fu <jlfu@marvell.com>
> Signed-off-by: Kevin Liu <kliu5@marvell.com>

Thanks, pushed to mmc-next for 3.9.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mmc: sdhci-pxav3: add wake up support
  2013-01-05  9:21 ` [PATCH v2 2/2] mmc: sdhci-pxav3: " Kevin Liu
@ 2013-01-14 19:43   ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-01-14 19:43 UTC (permalink / raw)
  To: Kevin Liu
  Cc: linux-mmc, Philip Rakity, Aaron Lu, Shawn Guo, Ulf Hansson,
	Johan Rudholm, Daniel Drake, Guennadi Liakhovetski, Adrian Hunter,
	Jerry Huang, Alexander Stein, Girish K S, Haijun Zhang,
	Viresh Kumar, Heiko Stuebner, Thomas Abraham, Chander Kashyap,
	Jaehoon Chung, Sebastian Hesselbarth, Zhangfei Gao,
	Haojian Zhuang, Chao

Hi,

On Sat, Jan 05 2013, Kevin Liu wrote:
> Signed-off-by: Jialing Fu <jlfu@marvell.com>
> Signed-off-by: Kevin Liu <kliu5@marvell.com>
> ---
>  drivers/mmc/host/sdhci-pxav3.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index b4aca81..ff06aff 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -325,6 +325,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, host);
>  
> +	if (pdata->pm_caps & MMC_PM_KEEP_POWER) {
> +		device_init_wakeup(&pdev->dev, 1);
> +		host->mmc->pm_flags |= MMC_PM_WAKE_SDIO_IRQ;
> +	} else {
> +		device_init_wakeup(&pdev->dev, 0);
> +	}
> +
>  	pm_runtime_put_autosuspend(&pdev->dev);
>  
>  	return 0;

Thanks, pushed to mmc-next for 3.9.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-14 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-05  9:21 [PATCH v2 1/2] mmc: sdhci: add wake up support Kevin Liu
2013-01-05  9:21 ` [PATCH v2 2/2] mmc: sdhci-pxav3: " Kevin Liu
2013-01-14 19:43   ` Chris Ball
2013-01-14 19:43 ` [PATCH v2 1/2] mmc: sdhci: " Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).