* [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls
@ 2016-03-29 7:31 Ulf Hansson
2016-03-29 7:31 ` [PATCH 2/8] mmc: mmci: " Ulf Hansson
` (7 more replies)
0 siblings, 8 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Ludovic Desroches
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/atmel-mci.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 9268c41..0ad8ef5 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1410,8 +1410,6 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
WARN_ON(slot->mrq);
dev_dbg(&host->pdev->dev, "MRQ: cmd %u\n", mrq->cmd->opcode);
- pm_runtime_get_sync(&host->pdev->dev);
-
/*
* We may "know" the card is gone even though there's still an
* electrical connection. If so, we really need to communicate
@@ -1442,8 +1440,6 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct atmel_mci *host = slot->host;
unsigned int i;
- pm_runtime_get_sync(&host->pdev->dev);
-
slot->sdc_reg &= ~ATMCI_SDCBUS_MASK;
switch (ios->bus_width) {
case MMC_BUS_WIDTH_1:
@@ -1576,8 +1572,6 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
break;
}
- pm_runtime_mark_last_busy(&host->pdev->dev);
- pm_runtime_put_autosuspend(&host->pdev->dev);
}
static int atmci_get_ro(struct mmc_host *mmc)
@@ -1669,9 +1663,6 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
spin_unlock(&host->lock);
mmc_request_done(prev_mmc, mrq);
spin_lock(&host->lock);
-
- pm_runtime_mark_last_busy(&host->pdev->dev);
- pm_runtime_put_autosuspend(&host->pdev->dev);
}
static void atmci_command_complete(struct atmel_mci *host,
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/8] mmc: mmci: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-03-29 7:31 ` [PATCH 3/8] mmc: mediatek: " Ulf Hansson
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Russell King
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/mmci.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 2e6c968..df990bb 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -226,16 +226,11 @@ static int mmci_card_busy(struct mmc_host *mmc)
unsigned long flags;
int busy = 0;
- pm_runtime_get_sync(mmc_dev(mmc));
-
spin_lock_irqsave(&host->lock, flags);
if (readl(host->base + MMCISTATUS) & MCI_ST_CARDBUSY)
busy = 1;
spin_unlock_irqrestore(&host->lock, flags);
- pm_runtime_mark_last_busy(mmc_dev(mmc));
- pm_runtime_put_autosuspend(mmc_dev(mmc));
-
return busy;
}
@@ -381,9 +376,6 @@ mmci_request_end(struct mmci_host *host, struct mmc_request *mrq)
host->cmd = NULL;
mmc_request_done(host->mmc, mrq);
-
- pm_runtime_mark_last_busy(mmc_dev(host->mmc));
- pm_runtime_put_autosuspend(mmc_dev(host->mmc));
}
static void mmci_set_mask1(struct mmci_host *host, unsigned int mask)
@@ -1290,8 +1282,6 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
return;
}
- pm_runtime_get_sync(mmc_dev(mmc));
-
spin_lock_irqsave(&host->lock, flags);
host->mrq = mrq;
@@ -1318,8 +1308,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
unsigned long flags;
int ret;
- pm_runtime_get_sync(mmc_dev(mmc));
-
if (host->plat->ios_handler &&
host->plat->ios_handler(mmc_dev(mmc), ios))
dev_err(mmc_dev(mmc), "platform ios_handler failed\n");
@@ -1414,9 +1402,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
mmci_reg_delay(host);
spin_unlock_irqrestore(&host->lock, flags);
-
- pm_runtime_mark_last_busy(mmc_dev(mmc));
- pm_runtime_put_autosuspend(mmc_dev(mmc));
}
static int mmci_get_cd(struct mmc_host *mmc)
@@ -1440,8 +1425,6 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
if (!IS_ERR(mmc->supply.vqmmc)) {
- pm_runtime_get_sync(mmc_dev(mmc));
-
switch (ios->signal_voltage) {
case MMC_SIGNAL_VOLTAGE_330:
ret = regulator_set_voltage(mmc->supply.vqmmc,
@@ -1459,9 +1442,6 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
if (ret)
dev_warn(mmc_dev(mmc), "Voltage switch failed\n");
-
- pm_runtime_mark_last_busy(mmc_dev(mmc));
- pm_runtime_put_autosuspend(mmc_dev(mmc));
}
return ret;
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/8] mmc: mediatek: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
2016-03-29 7:31 ` [PATCH 2/8] mmc: mmci: " Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-03-29 7:31 ` [PATCH 4/8] mmc: omap_hsmmc: " Ulf Hansson
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Chaotian Jing
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Cc: Chaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/mtk-sd.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index b17f30d..5642f71 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -736,9 +736,6 @@ static void msdc_request_done(struct msdc_host *host, struct mmc_request *mrq)
if (mrq->data)
msdc_unprepare_data(host, mrq);
mmc_request_done(host->mmc, mrq);
-
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
}
/* returns true if command is fully handled; returns false otherwise */
@@ -886,8 +883,6 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq)
WARN_ON(host->mrq);
host->mrq = mrq;
- pm_runtime_get_sync(host->dev);
-
if (mrq->data)
msdc_prepare_data(host, mrq);
@@ -1201,8 +1196,6 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct msdc_host *host = mmc_priv(mmc);
int ret;
- pm_runtime_get_sync(host->dev);
-
msdc_set_buswidth(host, ios->bus_width);
/* Suspend/Resume will do power off/on */
@@ -1214,7 +1207,7 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
ios->vdd);
if (ret) {
dev_err(host->dev, "Failed to set vmmc power!\n");
- goto end;
+ return;
}
}
break;
@@ -1242,10 +1235,6 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (host->mclk != ios->clock || host->timing != ios->timing)
msdc_set_mclk(host, ios->timing, ios->clock);
-
-end:
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
}
static u32 test_delay_bit(u32 delay, u32 bit)
@@ -1408,19 +1397,15 @@ static int msdc_execute_tuning(struct mmc_host *mmc, u32 opcode)
struct msdc_host *host = mmc_priv(mmc);
int ret;
- pm_runtime_get_sync(host->dev);
ret = msdc_tune_response(mmc, opcode);
if (ret == -EIO) {
dev_err(host->dev, "Tune response fail!\n");
- goto out;
+ return ret;
}
ret = msdc_tune_data(mmc, opcode);
if (ret == -EIO)
dev_err(host->dev, "Tune data fail!\n");
-out:
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/8] mmc: omap_hsmmc: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
2016-03-29 7:31 ` [PATCH 2/8] mmc: mmci: " Ulf Hansson
2016-03-29 7:31 ` [PATCH 3/8] mmc: mediatek: " Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-03-29 7:31 ` [PATCH 5/8] mmc: sdhci-acpi: " Ulf Hansson
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/omap_hsmmc.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f9ac3bb..835943a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -968,8 +968,6 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req
return;
host->mrq = NULL;
mmc_request_done(host->mmc, mrq);
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
}
/*
@@ -1250,7 +1248,6 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
int ret;
/* Disable the clocks */
- pm_runtime_put_sync(host->dev);
if (host->dbclk)
clk_disable_unprepare(host->dbclk);
@@ -1260,7 +1257,6 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
/* Turn the power ON with given VDD 1.8 or 3.0v */
if (!ret)
ret = omap_hsmmc_set_power(host->dev, 1, vdd);
- pm_runtime_get_sync(host->dev);
if (host->dbclk)
clk_prepare_enable(host->dbclk);
@@ -1368,8 +1364,6 @@ static void omap_hsmmc_dma_callback(void *param)
host->mrq = NULL;
mmc_request_done(host->mmc, mrq);
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
}
}
@@ -1602,7 +1596,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
BUG_ON(host->req_in_progress);
BUG_ON(host->dma_ch != -1);
- pm_runtime_get_sync(host->dev);
if (host->protect_card) {
if (host->reqs_blocked < 3) {
/*
@@ -1619,8 +1612,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
req->data->error = -EBADF;
req->cmd->retries = 0;
mmc_request_done(mmc, req);
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
return;
} else if (host->reqs_blocked)
host->reqs_blocked = 0;
@@ -1634,8 +1625,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
req->data->error = err;
host->mrq = NULL;
mmc_request_done(mmc, req);
- pm_runtime_mark_last_busy(host->dev);
- pm_runtime_put_autosuspend(host->dev);
return;
}
if (req->sbc && !(host->flags & AUTO_CMD23)) {
@@ -1653,8 +1642,6 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct omap_hsmmc_host *host = mmc_priv(mmc);
int do_send_init_stream = 0;
- pm_runtime_get_sync(host->dev);
-
if (ios->power_mode != host->power_mode) {
switch (ios->power_mode) {
case MMC_POWER_OFF:
@@ -1698,8 +1685,6 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
send_init_stream(host);
omap_hsmmc_set_bus_mode(host);
-
- pm_runtime_put_autosuspend(host->dev);
}
static int omap_hsmmc_get_cd(struct mmc_host *mmc)
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/8] mmc: sdhci-acpi: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
` (2 preceding siblings ...)
2016-03-29 7:31 ` [PATCH 4/8] mmc: omap_hsmmc: " Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-03-29 7:31 ` [PATCH 6/8] mmc: sdhci-pci: " Ulf Hansson
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Adrian Hunter
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/sdhci-acpi.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 6839e41..1ed8ea6 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -126,8 +126,6 @@ static int bxt_get_cd(struct mmc_host *mmc)
if (!gpio_cd)
return 0;
- pm_runtime_get_sync(mmc->parent);
-
spin_lock_irqsave(&host->lock, flags);
if (host->flags & SDHCI_DEVICE_DEAD)
@@ -137,9 +135,6 @@ static int bxt_get_cd(struct mmc_host *mmc)
out:
spin_unlock_irqrestore(&host->lock, flags);
- pm_runtime_mark_last_busy(mmc->parent);
- pm_runtime_put_autosuspend(mmc->parent);
-
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/8] mmc: sdhci-pci: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
` (3 preceding siblings ...)
2016-03-29 7:31 ` [PATCH 5/8] mmc: sdhci-acpi: " Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-03-29 7:31 ` [PATCH 7/8] mmc: sdhci: " Ulf Hansson
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Adrian Hunter
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/sdhci-pci-core.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 62aa5d0..8dfe721 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -340,8 +340,6 @@ static int bxt_get_cd(struct mmc_host *mmc)
if (!gpio_cd)
return 0;
- pm_runtime_get_sync(mmc->parent);
-
spin_lock_irqsave(&host->lock, flags);
if (host->flags & SDHCI_DEVICE_DEAD)
@@ -351,9 +349,6 @@ static int bxt_get_cd(struct mmc_host *mmc)
out:
spin_unlock_irqrestore(&host->lock, flags);
- pm_runtime_mark_last_busy(mmc->parent);
- pm_runtime_put_autosuspend(mmc->parent);
-
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/8] mmc: sdhci: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
` (4 preceding siblings ...)
2016-03-29 7:31 ` [PATCH 6/8] mmc: sdhci-pci: " Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-04-01 7:46 ` Adrian Hunter
2016-03-29 7:31 ` [PATCH 8/8] mmc: tmio: " Ulf Hansson
2016-03-29 15:03 ` [PATCH 1/8] mmc: atmel-mci: " Ludovic Desroches
7 siblings, 1 reply; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Adrian Hunter
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Moreover as SDHCI have its own wrapper functions for runtime PM these
becomes superfluous, so let's remove them as well.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/sdhci.c | 56 ++++++------------------------------------------
1 file changed, 7 insertions(+), 49 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 8670f16..4bb9bfd 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -56,19 +56,9 @@ static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);
static int sdhci_do_get_cd(struct sdhci_host *host);
#ifdef CONFIG_PM
-static int sdhci_runtime_pm_get(struct sdhci_host *host);
-static int sdhci_runtime_pm_put(struct sdhci_host *host);
static void sdhci_runtime_pm_bus_on(struct sdhci_host *host);
static void sdhci_runtime_pm_bus_off(struct sdhci_host *host);
#else
-static inline int sdhci_runtime_pm_get(struct sdhci_host *host)
-{
- return 0;
-}
-static inline int sdhci_runtime_pm_put(struct sdhci_host *host)
-{
- return 0;
-}
static void sdhci_runtime_pm_bus_on(struct sdhci_host *host)
{
}
@@ -1298,8 +1288,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
host = mmc_priv(mmc);
- sdhci_runtime_pm_get(host);
-
/* Firstly check card presence */
present = mmc->ops->get_cd(mmc);
@@ -1546,9 +1534,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct sdhci_host *host = mmc_priv(mmc);
- sdhci_runtime_pm_get(host);
sdhci_do_set_ios(host, ios);
- sdhci_runtime_pm_put(host);
}
static int sdhci_do_get_cd(struct sdhci_host *host)
@@ -1580,12 +1566,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
static int sdhci_get_cd(struct mmc_host *mmc)
{
struct sdhci_host *host = mmc_priv(mmc);
- int ret;
- sdhci_runtime_pm_get(host);
- ret = sdhci_do_get_cd(host);
- sdhci_runtime_pm_put(host);
- return ret;
+ return sdhci_do_get_cd(host);
}
static int sdhci_check_ro(struct sdhci_host *host)
@@ -1641,12 +1623,8 @@ static void sdhci_hw_reset(struct mmc_host *mmc)
static int sdhci_get_ro(struct mmc_host *mmc)
{
struct sdhci_host *host = mmc_priv(mmc);
- int ret;
- sdhci_runtime_pm_get(host);
- ret = sdhci_do_get_ro(host);
- sdhci_runtime_pm_put(host);
- return ret;
+ return sdhci_do_get_ro(host);
}
static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
@@ -1668,7 +1646,7 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
struct sdhci_host *host = mmc_priv(mmc);
unsigned long flags;
- sdhci_runtime_pm_get(host);
+ pm_runtime_get_sync(mmc_dev(mmc));
spin_lock_irqsave(&host->lock, flags);
if (enable)
@@ -1679,7 +1657,8 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
sdhci_enable_sdio_irq_nolock(host, enable);
spin_unlock_irqrestore(&host->lock, flags);
- sdhci_runtime_pm_put(host);
+ pm_runtime_mark_last_busy(mmc_dev(mmc));
+ pm_runtime_put_autosuspend(mmc_dev(mmc));
}
static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
@@ -1777,14 +1756,11 @@ static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,
struct mmc_ios *ios)
{
struct sdhci_host *host = mmc_priv(mmc);
- int err;
if (host->version < SDHCI_SPEC_300)
return 0;
- sdhci_runtime_pm_get(host);
- err = sdhci_do_start_signal_voltage_switch(host, ios);
- sdhci_runtime_pm_put(host);
- return err;
+
+ return sdhci_do_start_signal_voltage_switch(host, ios);
}
static int sdhci_card_busy(struct mmc_host *mmc)
@@ -1792,10 +1768,8 @@ static int sdhci_card_busy(struct mmc_host *mmc)
struct sdhci_host *host = mmc_priv(mmc);
u32 present_state;
- sdhci_runtime_pm_get(host);
/* Check whether DAT[3:0] is 0000 */
present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
- sdhci_runtime_pm_put(host);
return !(present_state & SDHCI_DATA_LVL_MASK);
}
@@ -1822,7 +1796,6 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
unsigned int tuning_count = 0;
bool hs400_tuning;
- sdhci_runtime_pm_get(host);
spin_lock_irqsave(&host->lock, flags);
hs400_tuning = host->flags & SDHCI_HS400_TUNING;
@@ -1870,7 +1843,6 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
if (host->ops->platform_execute_tuning) {
spin_unlock_irqrestore(&host->lock, flags);
err = host->ops->platform_execute_tuning(host, opcode);
- sdhci_runtime_pm_put(host);
return err;
}
@@ -2002,8 +1974,6 @@ out:
sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
out_unlock:
spin_unlock_irqrestore(&host->lock, flags);
- sdhci_runtime_pm_put(host);
-
return err;
}
@@ -2201,7 +2171,6 @@ static void sdhci_tasklet_finish(unsigned long param)
spin_unlock_irqrestore(&host->lock, flags);
mmc_request_done(host->mmc, mrq);
- sdhci_runtime_pm_put(host);
}
static void sdhci_timeout_timer(unsigned long data)
@@ -2682,17 +2651,6 @@ int sdhci_resume_host(struct sdhci_host *host)
EXPORT_SYMBOL_GPL(sdhci_resume_host);
-static int sdhci_runtime_pm_get(struct sdhci_host *host)
-{
- return pm_runtime_get_sync(host->mmc->parent);
-}
-
-static int sdhci_runtime_pm_put(struct sdhci_host *host)
-{
- pm_runtime_mark_last_busy(host->mmc->parent);
- return pm_runtime_put_autosuspend(host->mmc->parent);
-}
-
static void sdhci_runtime_pm_bus_on(struct sdhci_host *host)
{
if (host->bus_on)
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 8/8] mmc: tmio: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
` (5 preceding siblings ...)
2016-03-29 7:31 ` [PATCH 7/8] mmc: sdhci: " Ulf Hansson
@ 2016-03-29 7:31 ` Ulf Hansson
2016-03-29 15:03 ` [PATCH 1/8] mmc: atmel-mci: " Ludovic Desroches
7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-03-29 7:31 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson; +Cc: Ian Molton
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.
Cc: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/mmc/host/tmio_mmc_pio.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 03f6e74..d822299 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -264,9 +264,6 @@ static void tmio_mmc_reset_work(struct work_struct *work)
tmio_mmc_abort_dma(host);
mmc_request_done(host->mmc, mrq);
-
- pm_runtime_mark_last_busy(mmc_dev(host->mmc));
- pm_runtime_put_autosuspend(mmc_dev(host->mmc));
}
/* called with host->lock held, interrupts disabled */
@@ -296,9 +293,6 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
tmio_mmc_abort_dma(host);
mmc_request_done(host->mmc, mrq);
-
- pm_runtime_mark_last_busy(mmc_dev(host->mmc));
- pm_runtime_put_autosuspend(mmc_dev(host->mmc));
}
static void tmio_mmc_done_work(struct work_struct *work)
@@ -812,8 +806,6 @@ static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
spin_unlock_irqrestore(&host->lock, flags);
- pm_runtime_get_sync(mmc_dev(mmc));
-
if (mrq->data) {
ret = tmio_mmc_start_data(host, mrq->data);
if (ret)
@@ -832,9 +824,6 @@ fail:
host->mrq = NULL;
mrq->cmd->error = ret;
mmc_request_done(mmc, mrq);
-
- pm_runtime_mark_last_busy(mmc_dev(mmc));
- pm_runtime_put_autosuspend(mmc_dev(mmc));
}
static int tmio_mmc_clk_update(struct tmio_mmc_host *host)
@@ -925,8 +914,6 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct device *dev = &host->pdev->dev;
unsigned long flags;
- pm_runtime_get_sync(mmc_dev(mmc));
-
mutex_lock(&host->ios_lock);
spin_lock_irqsave(&host->lock, flags);
@@ -983,9 +970,6 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->clk_cache = ios->clock;
mutex_unlock(&host->ios_lock);
-
- pm_runtime_mark_last_busy(mmc_dev(mmc));
- pm_runtime_put_autosuspend(mmc_dev(mmc));
}
static int tmio_mmc_get_ro(struct mmc_host *mmc)
@@ -996,11 +980,8 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc)
if (ret >= 0)
return ret;
- pm_runtime_get_sync(mmc_dev(mmc));
ret = !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
- pm_runtime_mark_last_busy(mmc_dev(mmc));
- pm_runtime_put_autosuspend(mmc_dev(mmc));
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
` (6 preceding siblings ...)
2016-03-29 7:31 ` [PATCH 8/8] mmc: tmio: " Ulf Hansson
@ 2016-03-29 15:03 ` Ludovic Desroches
7 siblings, 0 replies; 13+ messages in thread
From: Ludovic Desroches @ 2016-03-29 15:03 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Ludovic Desroches
On Tue, Mar 29, 2016 at 09:31:06AM +0200, Ulf Hansson wrote:
> Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
> devices"), made some calls to the runtime PM API from the driver
> redundant. Especially those which deals with runtime PM reference
> counting, so let's remove them.
>
> Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> ---
> drivers/mmc/host/atmel-mci.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 9268c41..0ad8ef5 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -1410,8 +1410,6 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
> WARN_ON(slot->mrq);
> dev_dbg(&host->pdev->dev, "MRQ: cmd %u\n", mrq->cmd->opcode);
>
> - pm_runtime_get_sync(&host->pdev->dev);
> -
> /*
> * We may "know" the card is gone even though there's still an
> * electrical connection. If so, we really need to communicate
> @@ -1442,8 +1440,6 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> struct atmel_mci *host = slot->host;
> unsigned int i;
>
> - pm_runtime_get_sync(&host->pdev->dev);
> -
> slot->sdc_reg &= ~ATMCI_SDCBUS_MASK;
> switch (ios->bus_width) {
> case MMC_BUS_WIDTH_1:
> @@ -1576,8 +1572,6 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> break;
> }
>
> - pm_runtime_mark_last_busy(&host->pdev->dev);
> - pm_runtime_put_autosuspend(&host->pdev->dev);
> }
>
> static int atmci_get_ro(struct mmc_host *mmc)
> @@ -1669,9 +1663,6 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
> spin_unlock(&host->lock);
> mmc_request_done(prev_mmc, mrq);
> spin_lock(&host->lock);
> -
> - pm_runtime_mark_last_busy(&host->pdev->dev);
> - pm_runtime_put_autosuspend(&host->pdev->dev);
> }
>
> static void atmci_command_complete(struct atmel_mci *host,
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 7/8] mmc: sdhci: Remove redundant runtime PM calls
2016-03-29 7:31 ` [PATCH 7/8] mmc: sdhci: " Ulf Hansson
@ 2016-04-01 7:46 ` Adrian Hunter
2016-04-01 9:46 ` Ulf Hansson
0 siblings, 1 reply; 13+ messages in thread
From: Adrian Hunter @ 2016-04-01 7:46 UTC (permalink / raw)
To: Ulf Hansson, linux-mmc
On 29/03/16 10:31, Ulf Hansson wrote:
> Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
> devices"), made some calls to the runtime PM API from the driver
> redundant. Especially those which deals with runtime PM reference
> counting, so let's remove them.
>
> Moreover as SDHCI have its own wrapper functions for runtime PM these
> becomes superfluous, so let's remove them as well.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Looks good, but I have one comment below.
> ---
> drivers/mmc/host/sdhci.c | 56 ++++++------------------------------------------
> 1 file changed, 7 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 8670f16..4bb9bfd 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -56,19 +56,9 @@ static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);
> static int sdhci_do_get_cd(struct sdhci_host *host);
>
> #ifdef CONFIG_PM
> -static int sdhci_runtime_pm_get(struct sdhci_host *host);
> -static int sdhci_runtime_pm_put(struct sdhci_host *host);
> static void sdhci_runtime_pm_bus_on(struct sdhci_host *host);
> static void sdhci_runtime_pm_bus_off(struct sdhci_host *host);
> #else
> -static inline int sdhci_runtime_pm_get(struct sdhci_host *host)
> -{
> - return 0;
> -}
> -static inline int sdhci_runtime_pm_put(struct sdhci_host *host)
> -{
> - return 0;
> -}
> static void sdhci_runtime_pm_bus_on(struct sdhci_host *host)
> {
> }
> @@ -1298,8 +1288,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>
> host = mmc_priv(mmc);
>
> - sdhci_runtime_pm_get(host);
> -
> /* Firstly check card presence */
> present = mmc->ops->get_cd(mmc);
>
> @@ -1546,9 +1534,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> {
> struct sdhci_host *host = mmc_priv(mmc);
>
> - sdhci_runtime_pm_get(host);
> sdhci_do_set_ios(host, ios);
> - sdhci_runtime_pm_put(host);
> }
>
> static int sdhci_do_get_cd(struct sdhci_host *host)
> @@ -1580,12 +1566,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host)
> static int sdhci_get_cd(struct mmc_host *mmc)
> {
> struct sdhci_host *host = mmc_priv(mmc);
> - int ret;
>
> - sdhci_runtime_pm_get(host);
> - ret = sdhci_do_get_cd(host);
> - sdhci_runtime_pm_put(host);
> - return ret;
> + return sdhci_do_get_cd(host);
> }
>
> static int sdhci_check_ro(struct sdhci_host *host)
> @@ -1641,12 +1623,8 @@ static void sdhci_hw_reset(struct mmc_host *mmc)
> static int sdhci_get_ro(struct mmc_host *mmc)
> {
> struct sdhci_host *host = mmc_priv(mmc);
> - int ret;
>
> - sdhci_runtime_pm_get(host);
> - ret = sdhci_do_get_ro(host);
> - sdhci_runtime_pm_put(host);
> - return ret;
> + return sdhci_do_get_ro(host);
> }
>
> static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
> @@ -1668,7 +1646,7 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
> struct sdhci_host *host = mmc_priv(mmc);
> unsigned long flags;
>
> - sdhci_runtime_pm_get(host);
> + pm_runtime_get_sync(mmc_dev(mmc));
Why can't this be moved into the core as well? At the least, there should
be a comment here and explanation in the commit message.
>
> spin_lock_irqsave(&host->lock, flags);
> if (enable)
> @@ -1679,7 +1657,8 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
> sdhci_enable_sdio_irq_nolock(host, enable);
> spin_unlock_irqrestore(&host->lock, flags);
>
> - sdhci_runtime_pm_put(host);
> + pm_runtime_mark_last_busy(mmc_dev(mmc));
> + pm_runtime_put_autosuspend(mmc_dev(mmc));
> }
>
> static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
> @@ -1777,14 +1756,11 @@ static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,
> struct mmc_ios *ios)
> {
> struct sdhci_host *host = mmc_priv(mmc);
> - int err;
>
> if (host->version < SDHCI_SPEC_300)
> return 0;
> - sdhci_runtime_pm_get(host);
> - err = sdhci_do_start_signal_voltage_switch(host, ios);
> - sdhci_runtime_pm_put(host);
> - return err;
> +
> + return sdhci_do_start_signal_voltage_switch(host, ios);
> }
>
> static int sdhci_card_busy(struct mmc_host *mmc)
> @@ -1792,10 +1768,8 @@ static int sdhci_card_busy(struct mmc_host *mmc)
> struct sdhci_host *host = mmc_priv(mmc);
> u32 present_state;
>
> - sdhci_runtime_pm_get(host);
> /* Check whether DAT[3:0] is 0000 */
> present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
> - sdhci_runtime_pm_put(host);
>
> return !(present_state & SDHCI_DATA_LVL_MASK);
> }
> @@ -1822,7 +1796,6 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
> unsigned int tuning_count = 0;
> bool hs400_tuning;
>
> - sdhci_runtime_pm_get(host);
> spin_lock_irqsave(&host->lock, flags);
>
> hs400_tuning = host->flags & SDHCI_HS400_TUNING;
> @@ -1870,7 +1843,6 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
> if (host->ops->platform_execute_tuning) {
> spin_unlock_irqrestore(&host->lock, flags);
> err = host->ops->platform_execute_tuning(host, opcode);
> - sdhci_runtime_pm_put(host);
> return err;
> }
>
> @@ -2002,8 +1974,6 @@ out:
> sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
> out_unlock:
> spin_unlock_irqrestore(&host->lock, flags);
> - sdhci_runtime_pm_put(host);
> -
> return err;
> }
>
> @@ -2201,7 +2171,6 @@ static void sdhci_tasklet_finish(unsigned long param)
> spin_unlock_irqrestore(&host->lock, flags);
>
> mmc_request_done(host->mmc, mrq);
> - sdhci_runtime_pm_put(host);
> }
>
> static void sdhci_timeout_timer(unsigned long data)
> @@ -2682,17 +2651,6 @@ int sdhci_resume_host(struct sdhci_host *host)
>
> EXPORT_SYMBOL_GPL(sdhci_resume_host);
>
> -static int sdhci_runtime_pm_get(struct sdhci_host *host)
> -{
> - return pm_runtime_get_sync(host->mmc->parent);
> -}
> -
> -static int sdhci_runtime_pm_put(struct sdhci_host *host)
> -{
> - pm_runtime_mark_last_busy(host->mmc->parent);
> - return pm_runtime_put_autosuspend(host->mmc->parent);
> -}
> -
> static void sdhci_runtime_pm_bus_on(struct sdhci_host *host)
> {
> if (host->bus_on)
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 7/8] mmc: sdhci: Remove redundant runtime PM calls
2016-04-01 7:46 ` Adrian Hunter
@ 2016-04-01 9:46 ` Ulf Hansson
2016-04-05 11:40 ` Adrian Hunter
0 siblings, 1 reply; 13+ messages in thread
From: Ulf Hansson @ 2016-04-01 9:46 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mmc
On 1 April 2016 at 09:46, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 29/03/16 10:31, Ulf Hansson wrote:
>> Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
>> devices"), made some calls to the runtime PM API from the driver
>> redundant. Especially those which deals with runtime PM reference
>> counting, so let's remove them.
>>
>> Moreover as SDHCI have its own wrapper functions for runtime PM these
>> becomes superfluous, so let's remove them as well.
>>
>> Cc: Adrian Hunter <adrian.hunter@intel.com>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Looks good, but I have one comment below.
>
[...]
>>
>> static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
>> @@ -1668,7 +1646,7 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
>> struct sdhci_host *host = mmc_priv(mmc);
>> unsigned long flags;
>>
>> - sdhci_runtime_pm_get(host);
>> + pm_runtime_get_sync(mmc_dev(mmc));
>
> Why can't this be moved into the core as well? At the least, there should
> be a comment here and explanation in the commit message.
That's indeed a very good question! :-)
SDHCI is a special case for how a host driver deals with SDIO IRQs as
it's the only user of MMC_CAP2_SDIO_IRQ_NOTHREAD.
It means it has its own SDIO IRQ thread (threaded IRQ) which will
invoke sdio_run_irqs() to consume a received SDIO IRQ. Other host
drivers are using the mmc_signal_sdio_irq() API to deal with this,
which behaves a bit different.
The sdio_run_irqs() API claims the host (mmc_claim|release_host())
before it starts to consume the SDIO IRQ. This triggers the host to be
runtime resumed before the host ops ->enable_sdio_irq() gets called.
So, actually it means it *should* be safe to remove
pm_runtime_get|put() in it's current form from within
sdhci_enable_sdio_irq()...
Although, I wonder how SDHCI can allow to have SDIO IRQs enabled
without *keeping* the host runtime resumed, because I fail to see that
any wakeups are being configured when the host becomes runtime
suspended. I may be missing something, but what do you think?
[...]
Kind regards
Uffe
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 7/8] mmc: sdhci: Remove redundant runtime PM calls
2016-04-01 9:46 ` Ulf Hansson
@ 2016-04-05 11:40 ` Adrian Hunter
2016-04-05 14:38 ` Ulf Hansson
0 siblings, 1 reply; 13+ messages in thread
From: Adrian Hunter @ 2016-04-05 11:40 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc
On 01/04/16 12:46, Ulf Hansson wrote:
> On 1 April 2016 at 09:46, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 29/03/16 10:31, Ulf Hansson wrote:
>>> Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
>>> devices"), made some calls to the runtime PM API from the driver
>>> redundant. Especially those which deals with runtime PM reference
>>> counting, so let's remove them.
>>>
>>> Moreover as SDHCI have its own wrapper functions for runtime PM these
>>> becomes superfluous, so let's remove them as well.
>>>
>>> Cc: Adrian Hunter <adrian.hunter@intel.com>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>
>> Looks good, but I have one comment below.
>>
>
> [...]
>
>>>
>>> static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
>>> @@ -1668,7 +1646,7 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
>>> struct sdhci_host *host = mmc_priv(mmc);
>>> unsigned long flags;
>>>
>>> - sdhci_runtime_pm_get(host);
>>> + pm_runtime_get_sync(mmc_dev(mmc));
>>
>> Why can't this be moved into the core as well? At the least, there should
>> be a comment here and explanation in the commit message.
>
> That's indeed a very good question! :-)
>
> SDHCI is a special case for how a host driver deals with SDIO IRQs as
> it's the only user of MMC_CAP2_SDIO_IRQ_NOTHREAD.
>
> It means it has its own SDIO IRQ thread (threaded IRQ) which will
> invoke sdio_run_irqs() to consume a received SDIO IRQ. Other host
> drivers are using the mmc_signal_sdio_irq() API to deal with this,
> which behaves a bit different.
>
> The sdio_run_irqs() API claims the host (mmc_claim|release_host())
> before it starts to consume the SDIO IRQ. This triggers the host to be
> runtime resumed before the host ops ->enable_sdio_irq() gets called.
> So, actually it means it *should* be safe to remove
> pm_runtime_get|put() in it's current form from within
> sdhci_enable_sdio_irq()...
Sorry for slow reply.
Yes it looks safe. Please remove it.
>
> Although, I wonder how SDHCI can allow to have SDIO IRQs enabled
> without *keeping* the host runtime resumed, because I fail to see that
> any wakeups are being configured when the host becomes runtime
> suspended. I may be missing something, but what do you think?
As you probably know, it was done by Russell King, for the sdhci_esdhc-imx
driver by the look of it. The clocks are left on during runtime suspend iff
the SDIO IRQ is enabled, and IIRC it says the registers are accessible. I
would not expect any wakeups would need to be configured because the system
is not asleep. I don't know exactly what Russell was aiming for, but one
advantage is that the host controller will go to a lower power state (clocks
off) when the SDIO IRQ is not enabled.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 7/8] mmc: sdhci: Remove redundant runtime PM calls
2016-04-05 11:40 ` Adrian Hunter
@ 2016-04-05 14:38 ` Ulf Hansson
0 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-04-05 14:38 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mmc
[...]
>>
>>>>
>>>> static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
>>>> @@ -1668,7 +1646,7 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
>>>> struct sdhci_host *host = mmc_priv(mmc);
>>>> unsigned long flags;
>>>>
>>>> - sdhci_runtime_pm_get(host);
>>>> + pm_runtime_get_sync(mmc_dev(mmc));
>>>
>>> Why can't this be moved into the core as well? At the least, there should
>>> be a comment here and explanation in the commit message.
>>
>> That's indeed a very good question! :-)
>>
>> SDHCI is a special case for how a host driver deals with SDIO IRQs as
>> it's the only user of MMC_CAP2_SDIO_IRQ_NOTHREAD.
>>
>> It means it has its own SDIO IRQ thread (threaded IRQ) which will
>> invoke sdio_run_irqs() to consume a received SDIO IRQ. Other host
>> drivers are using the mmc_signal_sdio_irq() API to deal with this,
>> which behaves a bit different.
>>
>> The sdio_run_irqs() API claims the host (mmc_claim|release_host())
>> before it starts to consume the SDIO IRQ. This triggers the host to be
>> runtime resumed before the host ops ->enable_sdio_irq() gets called.
>> So, actually it means it *should* be safe to remove
>> pm_runtime_get|put() in it's current form from within
>> sdhci_enable_sdio_irq()...
>
> Sorry for slow reply.
>
> Yes it looks safe. Please remove it.
Okay, v2 is on its way. Thanks!
>
>>
>> Although, I wonder how SDHCI can allow to have SDIO IRQs enabled
>> without *keeping* the host runtime resumed, because I fail to see that
>> any wakeups are being configured when the host becomes runtime
>> suspended. I may be missing something, but what do you think?
>
> As you probably know, it was done by Russell King, for the sdhci_esdhc-imx
> driver by the look of it. The clocks are left on during runtime suspend iff
> the SDIO IRQ is enabled, and IIRC it says the registers are accessible. I
> would not expect any wakeups would need to be configured because the system
> is not asleep. I don't know exactly what Russell was aiming for, but one
> advantage is that the host controller will go to a lower power state (clocks
> off) when the SDIO IRQ is not enabled.
My interpretation of how runtime PM should be deployed, it's s that a
device shall not process data in the runtime suspend state. To do
that, it first needs to be runtime resumed. I think this conforms to
what the runtime PM documentation also recommends in section 2, Device
Runtime PM Callbacks.
Moreover I think it's an SoC specific detail whether a driver *can*
access a device's registers in the runtime suspend state (thus it
shouldn't do it). Especially, devices may reside in a PM domain, which
could enter a retention state, because all its devices are runtime
suspended. Typically for an ARM SoC is that devices looses their
register's context in such retention state.
Regarding remote wake-ups, if the device supports it, this could be
configured to trigger the device to be runtime resumed to allow it to
start process data again. Typically it means the wake-up IRQ handler
should call pm_runtime_resume() (or similar) to wake up the device
(and its potential PM domain).
In the MMC/SD/SDIO case, the relevant wake-ups settings concerns card
detect IRQ and the SDIO IRQ.
For runtime PM deployment; if SDIO IRQ is enabled but no remote
wake-up is supported, I think runtime PM suspend must be prevented.
Either via returning -EBUSY from the ->runtime_suspend() callback or
by increasing the runtime PM usage count.
The similar applies to card detect IRQ regarding runtime PM deployment.
For system PM, there is a few additional parameters to consider. In
some cases we might not care about wake-ups but in some other we do,
MMC_PM_WAKE_SDIO_IRQ is one of these cases.
I guess I should spend some time documenting this for MMC. :-)
Kind regards
Uffe
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-04-05 14:38 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29 7:31 [PATCH 1/8] mmc: atmel-mci: Remove redundant runtime PM calls Ulf Hansson
2016-03-29 7:31 ` [PATCH 2/8] mmc: mmci: " Ulf Hansson
2016-03-29 7:31 ` [PATCH 3/8] mmc: mediatek: " Ulf Hansson
2016-03-29 7:31 ` [PATCH 4/8] mmc: omap_hsmmc: " Ulf Hansson
2016-03-29 7:31 ` [PATCH 5/8] mmc: sdhci-acpi: " Ulf Hansson
2016-03-29 7:31 ` [PATCH 6/8] mmc: sdhci-pci: " Ulf Hansson
2016-03-29 7:31 ` [PATCH 7/8] mmc: sdhci: " Ulf Hansson
2016-04-01 7:46 ` Adrian Hunter
2016-04-01 9:46 ` Ulf Hansson
2016-04-05 11:40 ` Adrian Hunter
2016-04-05 14:38 ` Ulf Hansson
2016-03-29 7:31 ` [PATCH 8/8] mmc: tmio: " Ulf Hansson
2016-03-29 15:03 ` [PATCH 1/8] mmc: atmel-mci: " Ludovic Desroches
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.