diff options
author | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-12-13 11:01:11 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-19 19:00:58 -0500 |
commit | 2cd976c46472e34460349ed43a217e34f90bad55 (patch) | |
tree | b3dc1b537ee5c99f565ea1b5ba4fc571f3f7525e /drivers/mmc/host/mmci.c | |
parent | 48fa700388bec2ba79e9c8cc087f39c800a6fff5 (diff) |
ARM: 7223/1: mmc: mmci: Fixup use of runtime PM and use autosuspend
Added use of runtime PM autosuspend feature, with a fixed
timeout of 50 ms. This will prevent adding a latency,
although very minor, for _every_ request.
Moreover the runtime_get_sync is now also used in set_ios and
suspend since the runtime resourses are needed here as well.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r-- | drivers/mmc/host/mmci.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 544995b3cb95..6a21fc0bf3d8 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -178,8 +178,10 @@ mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) | |||
178 | host->mrq = NULL; | 178 | host->mrq = NULL; |
179 | host->cmd = NULL; | 179 | host->cmd = NULL; |
180 | 180 | ||
181 | pm_runtime_put(mmc_dev(host->mmc)); | ||
182 | mmc_request_done(host->mmc, mrq); | 181 | mmc_request_done(host->mmc, mrq); |
182 | |||
183 | pm_runtime_mark_last_busy(mmc_dev(host->mmc)); | ||
184 | pm_runtime_put_autosuspend(mmc_dev(host->mmc)); | ||
183 | } | 185 | } |
184 | 186 | ||
185 | static void mmci_set_mask1(struct mmci_host *host, unsigned int mask) | 187 | static void mmci_set_mask1(struct mmci_host *host, unsigned int mask) |
@@ -1026,6 +1028,8 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1026 | unsigned long flags; | 1028 | unsigned long flags; |
1027 | int ret; | 1029 | int ret; |
1028 | 1030 | ||
1031 | pm_runtime_get_sync(mmc_dev(mmc)); | ||
1032 | |||
1029 | if (host->plat->ios_handler && | 1033 | if (host->plat->ios_handler && |
1030 | host->plat->ios_handler(mmc_dev(mmc), ios)) | 1034 | host->plat->ios_handler(mmc_dev(mmc), ios)) |
1031 | dev_err(mmc_dev(mmc), "platform ios_handler failed\n"); | 1035 | dev_err(mmc_dev(mmc), "platform ios_handler failed\n"); |
@@ -1046,7 +1050,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1046 | * power should be rare so we print an error | 1050 | * power should be rare so we print an error |
1047 | * and return here. | 1051 | * and return here. |
1048 | */ | 1052 | */ |
1049 | return; | 1053 | goto out; |
1050 | } | 1054 | } |
1051 | } | 1055 | } |
1052 | /* | 1056 | /* |
@@ -1100,6 +1104,10 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1100 | } | 1104 | } |
1101 | 1105 | ||
1102 | spin_unlock_irqrestore(&host->lock, flags); | 1106 | spin_unlock_irqrestore(&host->lock, flags); |
1107 | |||
1108 | out: | ||
1109 | pm_runtime_mark_last_busy(mmc_dev(mmc)); | ||
1110 | pm_runtime_put_autosuspend(mmc_dev(mmc)); | ||
1103 | } | 1111 | } |
1104 | 1112 | ||
1105 | static int mmci_get_ro(struct mmc_host *mmc) | 1113 | static int mmci_get_ro(struct mmc_host *mmc) |
@@ -1372,6 +1380,8 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1372 | 1380 | ||
1373 | mmci_dma_setup(host); | 1381 | mmci_dma_setup(host); |
1374 | 1382 | ||
1383 | pm_runtime_set_autosuspend_delay(&dev->dev, 50); | ||
1384 | pm_runtime_use_autosuspend(&dev->dev); | ||
1375 | pm_runtime_put(&dev->dev); | 1385 | pm_runtime_put(&dev->dev); |
1376 | 1386 | ||
1377 | mmc_add_host(mmc); | 1387 | mmc_add_host(mmc); |
@@ -1467,8 +1477,10 @@ static int mmci_suspend(struct device *dev) | |||
1467 | struct mmci_host *host = mmc_priv(mmc); | 1477 | struct mmci_host *host = mmc_priv(mmc); |
1468 | 1478 | ||
1469 | ret = mmc_suspend_host(mmc); | 1479 | ret = mmc_suspend_host(mmc); |
1470 | if (ret == 0) | 1480 | if (ret == 0) { |
1481 | pm_runtime_get_sync(dev); | ||
1471 | writel(0, host->base + MMCIMASK0); | 1482 | writel(0, host->base + MMCIMASK0); |
1483 | } | ||
1472 | } | 1484 | } |
1473 | 1485 | ||
1474 | return ret; | 1486 | return ret; |
@@ -1484,6 +1496,7 @@ static int mmci_resume(struct device *dev) | |||
1484 | struct mmci_host *host = mmc_priv(mmc); | 1496 | struct mmci_host *host = mmc_priv(mmc); |
1485 | 1497 | ||
1486 | writel(MCI_IRQENABLE, host->base + MMCIMASK0); | 1498 | writel(MCI_IRQENABLE, host->base + MMCIMASK0); |
1499 | pm_runtime_put(dev); | ||
1487 | 1500 | ||
1488 | ret = mmc_resume_host(mmc); | 1501 | ret = mmc_resume_host(mmc); |
1489 | } | 1502 | } |