Skip to contentSkip to conversation

mmc: sdhci-s3c: add to enable wakeup for sd-card

PATCH New Jaehoon Chung 1 participant 1 message Oct 18, 2011

Subsystems (4)
lore
Share & tools
lore

Jaehoon Chung

author maintainer
#0 lore raw

PATCH 2/2 mmc: sdhci-s3c: add to enable wakeup for sd-card

---
 drivers/mmc/host/sdhci-s3c.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
drivers/mmc/host/sdhci-s3c.c +14 -1
index 3d00e72..c544a8c 100644
@@ -373,6 +373,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc)
 			if (pdata->ext_cd_gpio_invert)
 				status = !status;
 			sdhci_s3c_notify_change(sc->pdev, status);
+			device_init_wakeup(dev, pdata->wakeup);
 		} else {
 			dev_warn(dev, "cannot request irq for card detect\n");
 			sc->ext_cd_irq = 0;
@@ -625,13 +626,25 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
 static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
 {
 	struct sdhci_host *host = platform_get_drvdata(dev);
+	struct sdhci_s3c *sc = sdhci_priv(host);
+	int ret = 0;
+
+	ret = sdhci_suspend_host(host, pm);
+	if (!ret && device_may_wakeup(&dev->dev))
+		if (sc->ext_cd_irq)
+			enable_irq_wake(sc->ext_cd_irq);
 
-	return sdhci_suspend_host(host, pm);
+	return ret;
 }
 
 static int sdhci_s3c_resume(struct platform_device *dev)
 {
 	struct sdhci_host *host = platform_get_drvdata(dev);
+	struct sdhci_s3c *sc = sdhci_priv(host);
+
+	if (device_may_wakeup(&dev->dev))
+		if (sc->ext_cd_irq)
+			disable_irq_wake(sc->ext_cd_irq);
 
 	return sdhci_resume_host(host);
 }