Skip to contentSkip to conversation

mmc: sdhci-msm: Add wakeup functionality support for sdio cards

PATCH In review Srinivasarao Pathipati 4 participants 4 messages Apr 26, 2022 – May 26, 2022 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci-msm: Add wakeup functionality support for sdio cards

From: Sarthak Garg <[email protected]>

This adds external GPIO wakeup support to sdhci-msm driver for sdio cards.

Also enables clk gating only in system Suspend/Resume for SDIO card.

Also add the below fixes from 4.9 kernel :

c363224b: Fix wakeup functionality for SDIO 61fc5bf6: Remove flag MMC_PM_WAKE_SDIO_IRQ in mmc_resume_host
a7a2a82e: Set sdio_pending_processing default state to false.

---
 drivers/mmc/core/bus.c  | 7 +++++++
 drivers/mmc/core/sdio.c | 1 +
 2 files changed, 8 insertions(+)
drivers/mmc/core/bus.c +7 -0
index 58a60af..a475fe1 100644
@@ -364,6 +364,13 @@ int mmc_add_card(struct mmc_card *card)
 #endif
 	card->dev.of_node = mmc_of_find_child_device(card->host, 0);
 
+	if (mmc_card_sdio(card)) {
+		ret = device_init_wakeup(&card->dev, true);
+		if (ret)
+			pr_err("%s: %s: failed to init wakeup: %d\n",
+				mmc_hostname(card->host), __func__, ret);
+	}
+
 	device_enable_async_suspend(&card->dev);
 
 	ret = device_add(&card->dev);
drivers/mmc/core/sdio.c +1 -0
index 25799ac..9502318 100644
@@ -1096,6 +1096,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
 	mmc_release_host(host);
 
 	host->pm_flags &= ~MMC_PM_KEEP_POWER;
+	host->pm_flags &= ~MMC_PM_WAKE_SDIO_IRQ;
 	return err;
 }
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Srinivasarao Pathipati

From: Sarthak Garg <[email protected]>

This adds external GPIO wakeup support to sdhci-msm driver for sdio cards.

There is not a single line changed in the sdhci-msm driver, so I am not sure what this is intended to fix.

I assume this is a downstream patch you want to upstream, which is a good thing that we all appreciate. However, before just posting a patch from downstream code, please have a look at the commit message and let it explain what and why you want to change things.

I am deferring to review this, until you post a version with a proper commit message. Sorry.

Kind regards
Uffe

Quoted 50 lines

Also enables clk gating only in system Suspend/Resume for SDIO card.

Also add the below fixes from 4.9 kernel :

c363224b: Fix wakeup functionality for SDIO 61fc5bf6: Remove flag MMC_PM_WAKE_SDIO_IRQ in mmc_resume_host
a7a2a82e: Set sdio_pending_processing default state to false.

---
 drivers/mmc/core/bus.c  | 7 +++++++
 drivers/mmc/core/sdio.c | 1 +
 2 files changed, 8 insertions(+)
drivers/mmc/core/bus.c +7 -0
index 58a60af..a475fe1 100644
@@ -364,6 +364,13 @@ int mmc_add_card(struct mmc_card *card)
 #endif
        card->dev.of_node = mmc_of_find_child_device(card->host, 0);
 
+       if (mmc_card_sdio(card)) {
+               ret = device_init_wakeup(&card->dev, true);
+               if (ret)
+                       pr_err("%s: %s: failed to init wakeup: %d\n",
+                               mmc_hostname(card->host), __func__, ret);
+       }
+
        device_enable_async_suspend(&card->dev);
 
        ret = device_add(&card->dev);
drivers/mmc/core/sdio.c +1 -1
index 25799ac..9502318 100644
@@ -1096,6 +1096,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
        mmc_release_host(host);
 
        host->pm_flags &= ~MMC_PM_KEEP_POWER;
+       host->pm_flags &= ~MMC_PM_WAKE_SDIO_IRQ;
        return err;
 }
 
--

2.7.4

#2 lore raw

Hi,
These patches will be further taken by Sarthak.

Thanks,
Satya

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, April 27, 2022 4:06 AM
To: quic_spathi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kamasali Satyanarayan (Consultant) (QUIC) <[email protected]>
Subject: Re: [PATCH V1] mmc: sdhci-msm: Add wakeup functionality support for sdio cards

Quoted 5 lines · Srinivasarao Pathipati

From: Sarthak Garg <[email protected]>

This adds external GPIO wakeup support to sdhci-msm driver for sdio cards.

There is not a single line changed in the sdhci-msm driver, so I am not sure what this is intended to fix.

I assume this is a downstream patch you want to upstream, which is a good thing that we all appreciate. However, before just posting a patch from downstream code, please have a look at the commit message and let it explain what and why you want to change things.

I am deferring to review this, until you post a version with a proper commit message. Sorry.

Kind regards
Uffe

Quoted 49 lines

Also enables clk gating only in system Suspend/Resume for SDIO card.

Also add the below fixes from 4.9 kernel :

c363224b: Fix wakeup functionality for SDIO 61fc5bf6: Remove flag MMC_PM_WAKE_SDIO_IRQ in mmc_resume_host
a7a2a82e: Set sdio_pending_processing default state to false.

---
 drivers/mmc/core/bus.c  | 7 +++++++
 drivers/mmc/core/sdio.c | 1 +
 2 files changed, 8 insertions(+)
drivers/mmc/core/bus.c index renamed from drivers/mmc/core/bus.c +0 -0

58a60af..a475fe1 100644

drivers/mmc/core/bus.c +7 -0
@@ -364,6 +364,13 @@ int mmc_add_card(struct mmc_card *card)  #endif
        card->dev.of_node = mmc_of_find_child_device(card->host, 0);
 
+       if (mmc_card_sdio(card)) {
+               ret = device_init_wakeup(&card->dev, true);
+               if (ret)
+                       pr_err("%s: %s: failed to init wakeup: %d\n",
+                               mmc_hostname(card->host), __func__, ret);
+       }
+
        device_enable_async_suspend(&card->dev);
 
        ret = device_add(&card->dev);
drivers/mmc/core/sdio.c index renamed from drivers/mmc/core/sdio.c +0 -0

25799ac..9502318 100644

drivers/mmc/core/sdio.c +1 -1
@@ -1096,6 +1096,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
        mmc_release_host(host);
 
        host->pm_flags &= ~MMC_PM_KEEP_POWER;
+       host->pm_flags &= ~MMC_PM_WAKE_SDIO_IRQ;
        return err;
 }
 
--

2.7.4

#3 lore raw

Hi ulf,

Thanks for the review.
Please find comments inline.

Thanks,
Sarthak

Quoted 18 lines · Kamasali Satyanarayan (Consultant) (QUIC)

Hi,
These patches will be further taken by Sarthak.

Thanks,
Satya

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, April 27, 2022 4:06 AM
To: quic_spathi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kamasali Satyanarayan (Consultant) (QUIC) <[email protected]>
Subject: Re: [PATCH V1] mmc: sdhci-msm: Add wakeup functionality support for sdio cards

Quoted 4 lines · Srinivasarao Pathipati

From: Sarthak Garg <[email protected]>

This adds external GPIO wakeup support to sdhci-msm driver for sdio cards.

Quoted 8 lines

There is not a single line changed in the sdhci-msm driver, so I am not sure what this is intended to fix.

I assume this is a downstream patch you want to upstream, which is a good thing that we all appreciate. However, before just posting a patch from downstream code, please have a look at the commit message and let it explain what and why you want to change things.

I am deferring to review this, until you post a version with a proper commit message. Sorry.

Kind regards
Uffe

This is our internal feature where our SDIO card makes use of external tlmm pin to wakeup the host from system suspend.
It has approx 200 lines of code changes in the sdhci-msm.c file which will create further confusions. For that feature we just need to initialize sdio card as a wakeup source and enable wakeup capability for that. Will post V2 patch for that .. please help review.

Quoted 49 lines
Quoted 49 lines

Also enables clk gating only in system Suspend/Resume for SDIO card.

Also add the below fixes from 4.9 kernel :

c363224b: Fix wakeup functionality for SDIO 61fc5bf6: Remove flag MMC_PM_WAKE_SDIO_IRQ in mmc_resume_host
a7a2a82e: Set sdio_pending_processing default state to false.

---
  drivers/mmc/core/bus.c  | 7 +++++++
  drivers/mmc/core/sdio.c | 1 +
  2 files changed, 8 insertions(+)
drivers/mmc/core/bus.c index renamed from drivers/mmc/core/bus.c +0 -0

58a60af..a475fe1 100644

drivers/mmc/core/bus.c +7 -0
@@ -364,6 +364,13 @@ int mmc_add_card(struct mmc_card *card)  #endif
         card->dev.of_node = mmc_of_find_child_device(card->host, 0);
 
+       if (mmc_card_sdio(card)) {
+               ret = device_init_wakeup(&card->dev, true);
+               if (ret)
+                       pr_err("%s: %s: failed to init wakeup: %d\n",
+                               mmc_hostname(card->host), __func__, ret);
+       }
+
         device_enable_async_suspend(&card->dev);
 
         ret = device_add(&card->dev);
drivers/mmc/core/sdio.c index renamed from drivers/mmc/core/sdio.c +0 -0

25799ac..9502318 100644

drivers/mmc/core/sdio.c +1 -1
@@ -1096,6 +1096,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
         mmc_release_host(host);
 
         host->pm_flags &= ~MMC_PM_KEEP_POWER;
+       host->pm_flags &= ~MMC_PM_WAKE_SDIO_IRQ;
         return err;
  }
 
--

2.7.4