All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: tegra: Enable wake on SD card event
@ 2022-01-13  5:16 Aniruddha Rao
  2022-01-13  6:44 ` Adrian Hunter
  2022-01-24 14:41 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Aniruddha Rao @ 2022-01-13  5:16 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson, thierry.reding, jonathanh, p.zabel
  Cc: linux-mmc, linux-tegra, linux-kernel, anrao

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

Signed-off-by: Aniruddha Rao <anrao@nvidia.com>
---
 drivers/mmc/host/sdhci-tegra.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 35ebba0..5c84bd5 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -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


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

* Re: [PATCH] mmc: tegra: Enable wake on SD card event
  2022-01-13  5:16 [PATCH] mmc: tegra: Enable wake on SD card event Aniruddha Rao
@ 2022-01-13  6:44 ` Adrian Hunter
  2022-01-24 14:41 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2022-01-13  6:44 UTC (permalink / raw)
  To: Aniruddha Rao, ulf.hansson, thierry.reding, jonathanh, p.zabel
  Cc: linux-mmc, linux-tegra, linux-kernel

On 13/01/2022 07:16, Aniruddha Rao wrote:
> Enable GPIO wake source on SD card detect line.
> Physical card insertion/removal event should wake the system
> from suspend.
> 
> Signed-off-by: Aniruddha Rao <anrao@nvidia.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-tegra.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
> index 35ebba0..5c84bd5 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -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;
> 


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

* Re: [PATCH] mmc: tegra: Enable wake on SD card event
  2022-01-13  5:16 [PATCH] mmc: tegra: Enable wake on SD card event Aniruddha Rao
  2022-01-13  6:44 ` Adrian Hunter
@ 2022-01-24 14:41 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-01-24 14:41 UTC (permalink / raw)
  To: Aniruddha Rao
  Cc: adrian.hunter, thierry.reding, jonathanh, p.zabel, linux-mmc,
	linux-tegra, linux-kernel

On Thu, 13 Jan 2022 at 06:16, Aniruddha Rao <anrao@nvidia.com> wrote:
>
> Enable GPIO wake source on SD card detect line.
> Physical card insertion/removal event should wake the system
> from suspend.
>
> Signed-off-by: Aniruddha Rao <anrao@nvidia.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-tegra.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
> index 35ebba0..5c84bd5 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -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
>

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

end of thread, other threads:[~2022-01-24 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  5:16 [PATCH] mmc: tegra: Enable wake on SD card event Aniruddha Rao
2022-01-13  6:44 ` Adrian Hunter
2022-01-24 14:41 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.