public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers
@ 2017-06-13 12:07 Adrian Hunter
  2017-06-13 12:07 ` [PATCH V2 1/2] mmc: slot-gpio: Add support to enable irq wake on cd_irq Adrian Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-06-13 12:07 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

Hi

Here are 2 small patches to enable card detect wake for Intel BYT-related
SD card host controllers.


Changes in V2:
	Use a host capability to select card detect wake


Adrian Hunter (2):
      mmc: slot-gpio: Add support to enable irq wake on cd_irq
      mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers

 drivers/mmc/core/core.c           | 5 ++++-
 drivers/mmc/core/slot-gpio.c      | 2 ++
 drivers/mmc/host/sdhci-pci-core.c | 2 +-
 include/linux/mmc/host.h          | 2 ++
 4 files changed, 9 insertions(+), 2 deletions(-)


Regards
Adrian

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

* [PATCH V2 1/2] mmc: slot-gpio: Add support to enable irq wake on cd_irq
  2017-06-13 12:07 [PATCH V2 0/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
@ 2017-06-13 12:07 ` Adrian Hunter
  2017-06-13 12:07 ` [PATCH V2 2/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
  2017-06-13 12:22 ` [PATCH V2 0/2] " Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-06-13 12:07 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

Add host capability MMC_CAP_CD_WAKE to enable irq wake on the card detect
irq.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/core/core.c      | 5 ++++-
 drivers/mmc/core/slot-gpio.c | 2 ++
 include/linux/mmc/host.h     | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 0056547f4301..5a9d837599a1 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2798,8 +2798,11 @@ void mmc_stop_host(struct mmc_host *host)
 	host->removed = 1;
 	spin_unlock_irqrestore(&host->lock, flags);
 #endif
-	if (host->slot.cd_irq >= 0)
+	if (host->slot.cd_irq >= 0) {
+		if (host->slot.cd_wake_enabled)
+			disable_irq_wake(host->slot.cd_irq);
 		disable_irq(host->slot.cd_irq);
+	}
 
 	host->rescan_disable = 1;
 	cancel_delayed_work_sync(&host->detect);
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index a8450a8701e4..863f1dbbfc1b 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -151,6 +151,8 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
 
 	if (irq < 0)
 		host->caps |= MMC_CAP_NEEDS_POLL;
+	else if ((host->caps & MMC_CAP_CD_WAKE) && !enable_irq_wake(irq))
+		host->slot.cd_wake_enabled = true;
 }
 EXPORT_SYMBOL(mmc_gpiod_request_cd_irq);
 
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ac9e29ac93d6..3be13de0c062 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -198,6 +198,7 @@ struct mmc_async_req {
  */
 struct mmc_slot {
 	int cd_irq;
+	bool cd_wake_enabled;
 	void *handler_priv;
 };
 
@@ -288,6 +289,7 @@ struct mmc_host {
 #define MMC_CAP_DRIVER_TYPE_A	(1 << 23)	/* Host supports Driver Type A */
 #define MMC_CAP_DRIVER_TYPE_C	(1 << 24)	/* Host supports Driver Type C */
 #define MMC_CAP_DRIVER_TYPE_D	(1 << 25)	/* Host supports Driver Type D */
+#define MMC_CAP_CD_WAKE		(1 << 28)	/* Enable card detect wake */
 #define MMC_CAP_CMD_DURING_TFR	(1 << 29)	/* Commands during data transfer */
 #define MMC_CAP_CMD23		(1 << 30)	/* CMD23 supported. */
 #define MMC_CAP_HW_RESET	(1 << 31)	/* Hardware reset */
-- 
1.9.1


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

* [PATCH V2 2/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers
  2017-06-13 12:07 [PATCH V2 0/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
  2017-06-13 12:07 ` [PATCH V2 1/2] mmc: slot-gpio: Add support to enable irq wake on cd_irq Adrian Hunter
@ 2017-06-13 12:07 ` Adrian Hunter
  2017-06-13 12:22 ` [PATCH V2 0/2] " Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-06-13 12:07 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

Enable card detect wake for Intel BYT-related SD card host controllers.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-pci-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index bab7d5650401..b40d10616e3c 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -803,7 +803,7 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
 {
 	byt_read_dsm(slot);
 	slot->host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY |
-				 MMC_CAP_AGGRESSIVE_PM;
+				 MMC_CAP_AGGRESSIVE_PM | MMC_CAP_CD_WAKE;
 	slot->cd_idx = 0;
 	slot->cd_override_level = true;
 	if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD ||
-- 
1.9.1


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

* Re: [PATCH V2 0/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers
  2017-06-13 12:07 [PATCH V2 0/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
  2017-06-13 12:07 ` [PATCH V2 1/2] mmc: slot-gpio: Add support to enable irq wake on cd_irq Adrian Hunter
  2017-06-13 12:07 ` [PATCH V2 2/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
@ 2017-06-13 12:22 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2017-06-13 12:22 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

On 13 June 2017 at 14:07, Adrian Hunter <adrian.hunter@intel.com> wrote:
> Hi
>
> Here are 2 small patches to enable card detect wake for Intel BYT-related
> SD card host controllers.
>
>
> Changes in V2:
>         Use a host capability to select card detect wake
>
>
> Adrian Hunter (2):
>       mmc: slot-gpio: Add support to enable irq wake on cd_irq
>       mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers
>
>  drivers/mmc/core/core.c           | 5 ++++-
>  drivers/mmc/core/slot-gpio.c      | 2 ++
>  drivers/mmc/host/sdhci-pci-core.c | 2 +-
>  include/linux/mmc/host.h          | 2 ++
>  4 files changed, 9 insertions(+), 2 deletions(-)
>
>
> Regards
> Adrian

Thanks, applied for next!

Kind regards
Uffe

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

end of thread, other threads:[~2017-06-13 12:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13 12:07 [PATCH V2 0/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
2017-06-13 12:07 ` [PATCH V2 1/2] mmc: slot-gpio: Add support to enable irq wake on cd_irq Adrian Hunter
2017-06-13 12:07 ` [PATCH V2 2/2] mmc: sdhci-pci: Enable card detect wake for Intel BYT-related SD card host controllers Adrian Hunter
2017-06-13 12:22 ` [PATCH V2 0/2] " Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox