Skip to contentSkip to conversation

mmc: tegra: Enable wake on SD card event

PATCH In review Aniruddha Rao 3 participants 3 messages Jan 13, 2022 – Jan 24, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: tegra: Enable wake on SD card event

Enable GPIO wake source on SD card detect line. Physical card insertion/removal event should wake the system from suspend.

---
 drivers/mmc/host/sdhci-tegra.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +8 -1
index 35ebba0..5c84bd5 100644
@@ -1673,6 +1673,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 	/* HW busy detection is supported, but R1B responses are required. */
 	host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
 
+	/* GPIO CD can be set as a wakeup source */
+	host->mmc->caps |= MMC_CAP_CD_WAKE;
+
 	tegra_sdhci_parse_dt(host);
 
 	tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
@@ -1840,7 +1843,7 @@ static int sdhci_tegra_suspend(struct device *dev)
 		return ret;
 	}
 
-	return 0;
+	return mmc_gpio_set_cd_wake(host->mmc, true);
 }
 
 static int sdhci_tegra_resume(struct device *dev)
@@ -1848,6 +1851,10 @@ static int sdhci_tegra_resume(struct device *dev)
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	int ret;
 
+	ret = mmc_gpio_set_cd_wake(host->mmc, false);
+	if (ret)
+		return ret;
+
 	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Aniruddha Rao

Enable GPIO wake source on SD card detect line. Physical card insertion/removal event should wake the system from suspend.

Quoted 39 lines
---
 drivers/mmc/host/sdhci-tegra.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +8 -1
index 35ebba0..5c84bd5 100644
@@ -1673,6 +1673,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 	/* HW busy detection is supported, but R1B responses are required. */
 	host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
 
+	/* GPIO CD can be set as a wakeup source */
+	host->mmc->caps |= MMC_CAP_CD_WAKE;
+
 	tegra_sdhci_parse_dt(host);
 
 	tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
@@ -1840,7 +1843,7 @@ static int sdhci_tegra_suspend(struct device *dev)
 		return ret;
 	}
 
-	return 0;
+	return mmc_gpio_set_cd_wake(host->mmc, true);
 }
 
 static int sdhci_tegra_resume(struct device *dev)
@@ -1848,6 +1851,10 @@ static int sdhci_tegra_resume(struct device *dev)
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	int ret;
 
+	ret = mmc_gpio_set_cd_wake(host->mmc, false);
+	if (ret)
+		return ret;
+
 	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
#2 lore raw
In reply to Aniruddha Rao
Quoted 6 lines · Aniruddha Rao

Enable GPIO wake source on SD card detect line. Physical card insertion/removal event should wake the system from suspend.

Applied for next, thanks!

Kind regards
Uffe

Quoted 41 lines
---
 drivers/mmc/host/sdhci-tegra.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +8 -2
index 35ebba0..5c84bd5 100644
@@ -1673,6 +1673,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
        /* HW busy detection is supported, but R1B responses are required. */
        host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
 
+       /* GPIO CD can be set as a wakeup source */
+       host->mmc->caps |= MMC_CAP_CD_WAKE;
+
        tegra_sdhci_parse_dt(host);
 
        tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
@@ -1840,7 +1843,7 @@ static int sdhci_tegra_suspend(struct device *dev)
                return ret;
        }
 
-       return 0;
+       return mmc_gpio_set_cd_wake(host->mmc, true);
 }
 
 static int sdhci_tegra_resume(struct device *dev)
@@ -1848,6 +1851,10 @@ static int sdhci_tegra_resume(struct device *dev)
        struct sdhci_host *host = dev_get_drvdata(dev);
        int ret;
 
+       ret = mmc_gpio_set_cd_wake(host->mmc, false);
+       if (ret)
+               return ret;
+
        ret = pm_runtime_force_resume(dev);
        if (ret)
                return ret;
--

2.7.4