Skip to contentSkip to conversation

mmc: sdhci-pxav3: don't disable clocks when we might get an interrupt

PATCH Adrian Hunter 2 participants 3 messages May 15, 2018 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Thomas Hebb

Currently, runtime_suspend() unconditionally disables the clock gates for the controller, which means that it's unable to receive interrupts generated by connected SDIO cards.

We currently get / put runtime pm with enable / disable of the SDIO IRQ (refer sdhci_enable_sdio_irq()) so are you sure this is needed?

Quoted 41 lines
---
 drivers/mmc/host/sdhci-pxav3.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-pxav3.c +10 -6
index a34434166ca7..59760f3cc1d7 100644
@@ -562,9 +562,11 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
 		mmc_retune_needed(host->mmc);
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	if (!sdhci_sdio_irq_enabled(host)) {
+		clk_disable_unprepare(pxa->clk_io);
+		if (!IS_ERR(pxa->clk_core))
+			clk_disable_unprepare(pxa->clk_core);
+	}
 
 	return 0;
 }
@@ -575,9 +577,11 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	if (!sdhci_sdio_irq_enabled(host)) {
+		clk_prepare_enable(pxa->clk_io);
+		if (!IS_ERR(pxa->clk_core))
+			clk_prepare_enable(pxa->clk_core);
+	}
 
 	return sdhci_runtime_resume_host(host);
 }
#2 lore raw

Hi,

Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Thomas Hebb

Currently, runtime_suspend() unconditionally disables the clock gates for the controller, which means that it's unable to receive interrupts generated by connected SDIO cards.

We currently get / put runtime pm with enable / disable of the SDIO IRQ (refer sdhci_enable_sdio_irq()) so are you sure this is needed?

You're correct; this patch is unnecessary. I wrote it before 923713b35745 ("mmc: sdhci: Disable runtime pm when the sdio_irq is enabled"), and it was needed then. Sorry for the noise.

FYI, sdhci-esdhc-imx still checks the IRQ in its suspend/resume functions. That's one of the things that misled me to think this patch was still relevant.

Quoted 42 lines
Quoted 41 lines
---
 drivers/mmc/host/sdhci-pxav3.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-pxav3.c +10 -6
index a34434166ca7..59760f3cc1d7 100644
@@ -562,9 +562,11 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
 		mmc_retune_needed(host->mmc);
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	if (!sdhci_sdio_irq_enabled(host)) {
+		clk_disable_unprepare(pxa->clk_io);
+		if (!IS_ERR(pxa->clk_core))
+			clk_disable_unprepare(pxa->clk_core);
+	}
 
 	return 0;
 }
@@ -575,9 +577,11 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	if (!sdhci_sdio_irq_enabled(host)) {
+		clk_prepare_enable(pxa->clk_io);
+		if (!IS_ERR(pxa->clk_core))
+			clk_prepare_enable(pxa->clk_core);
+	}
 
 	return sdhci_runtime_resume_host(host);
 }
#3 lore raw
Quoted 11 lines · Tom Hebb

Hi,

Quoted 7 lines · Adrian Hunter
Quoted 3 lines · Thomas Hebb

Currently, runtime_suspend() unconditionally disables the clock gates for the controller, which means that it's unable to receive interrupts generated by connected SDIO cards.

We currently get / put runtime pm with enable / disable of the SDIO IRQ (refer sdhci_enable_sdio_irq()) so are you sure this is needed?

Quoted 7 lines

You're correct; this patch is unnecessary. I wrote it before 923713b35745 ("mmc: sdhci: Disable runtime pm when the sdio_irq is enabled"), and it was needed then. Sorry for the noise.

FYI, sdhci-esdhc-imx still checks the IRQ in its suspend/resume functions. That's one of the things that misled me to think this patch was still relevant.

+ a few people that have worked on sdhci-esdhc-imx

Quoted 44 lines
Quoted 43 lines
Quoted 42 lines
---
 drivers/mmc/host/sdhci-pxav3.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-pxav3.c +10 -6
index a34434166ca7..59760f3cc1d7 100644
@@ -562,9 +562,11 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
 		mmc_retune_needed(host->mmc);
 
-	clk_disable_unprepare(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_disable_unprepare(pxa->clk_core);
+	if (!sdhci_sdio_irq_enabled(host)) {
+		clk_disable_unprepare(pxa->clk_io);
+		if (!IS_ERR(pxa->clk_core))
+			clk_disable_unprepare(pxa->clk_core);
+	}
 
 	return 0;
 }
@@ -575,9 +577,11 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
-	clk_prepare_enable(pxa->clk_io);
-	if (!IS_ERR(pxa->clk_core))
-		clk_prepare_enable(pxa->clk_core);
+	if (!sdhci_sdio_irq_enabled(host)) {
+		clk_prepare_enable(pxa->clk_io);
+		if (!IS_ERR(pxa->clk_core))
+			clk_prepare_enable(pxa->clk_core);
+	}
 
 	return sdhci_runtime_resume_host(host);
 }