]> Pileus Git - ~andy/linux/commitdiff
mmc: core: Add MMC_CAP_RUNTIME_RESUME to resume at runtime_resume
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 10 Oct 2013 15:22:23 +0000 (17:22 +0200)
committerChris Ball <cjb@laptop.org>
Thu, 31 Oct 2013 00:28:43 +0000 (20:28 -0400)
In some environments it is to prefer to postpone the resume of the card
device until runtime_resume is being carried out, since it will mean a
signficant decrease of the total system resume time.

The reason of the decreased resume time is simply because of the actual
re-initalization of the card, which typically takes hundreds of
milliseconds, is performed outside the resume sequence and wont thus
affect it.

For removable card, the detect work tries to re-detect the card to make
sure it is still present, as a part of that sequence the card will also
be runtime_resumed and thus also fully resumed.

For a non-removable card, typically a mmc blk request will trigger a
runtime_resume and thus fully resume the card. This also means the
first request will likely suffer from an inital latency since the
re-initialization of the card needs to be performed.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c
include/linux/mmc/host.h

index 7f5dc26865de7b31932e362f97308c0d4d81d71e..f631f5a9bf7948b848754cc3ba475619c957a79b 100644 (file)
@@ -1577,11 +1577,13 @@ static int mmc_shutdown(struct mmc_host *host)
  */
 static int mmc_resume(struct mmc_host *host)
 {
-       int err;
+       int err = 0;
 
-       err = _mmc_resume(host);
-       pm_runtime_set_active(&host->card->dev);
-       pm_runtime_mark_last_busy(&host->card->dev);
+       if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) {
+               err = _mmc_resume(host);
+               pm_runtime_set_active(&host->card->dev);
+               pm_runtime_mark_last_busy(&host->card->dev);
+       }
        pm_runtime_enable(&host->card->dev);
 
        return err;
@@ -1612,7 +1614,7 @@ static int mmc_runtime_resume(struct mmc_host *host)
 {
        int err;
 
-       if (!(host->caps & MMC_CAP_AGGRESSIVE_PM))
+       if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME)))
                return 0;
 
        err = _mmc_resume(host);
index 447fa8e9f322f805907b65042a04a721053a9534..6f42050b7ccc6d829d6b58ece04b1177e73cbe80 100644 (file)
@@ -1139,11 +1139,13 @@ out:
  */
 static int mmc_sd_resume(struct mmc_host *host)
 {
-       int err;
+       int err = 0;
 
-       err = _mmc_sd_resume(host);
-       pm_runtime_set_active(&host->card->dev);
-       pm_runtime_mark_last_busy(&host->card->dev);
+       if (!(host->caps & MMC_CAP_RUNTIME_RESUME)) {
+               err = _mmc_sd_resume(host);
+               pm_runtime_set_active(&host->card->dev);
+               pm_runtime_mark_last_busy(&host->card->dev);
+       }
        pm_runtime_enable(&host->card->dev);
 
        return err;
@@ -1174,7 +1176,7 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
 {
        int err;
 
-       if (!(host->caps & MMC_CAP_AGGRESSIVE_PM))
+       if (!(host->caps & (MMC_CAP_AGGRESSIVE_PM | MMC_CAP_RUNTIME_RESUME)))
                return 0;
 
        err = _mmc_sd_resume(host);
index f18669e15d4db87894fd9d726ea70a4ace7c7614..99f5709ac343df3d6c5b7bbda636eeeb42c4e14c 100644 (file)
@@ -254,6 +254,7 @@ struct mmc_host {
 #define MMC_CAP_UHS_SDR50      (1 << 17)       /* Host supports UHS SDR50 mode */
 #define MMC_CAP_UHS_SDR104     (1 << 18)       /* Host supports UHS SDR104 mode */
 #define MMC_CAP_UHS_DDR50      (1 << 19)       /* Host supports UHS DDR50 mode */
+#define MMC_CAP_RUNTIME_RESUME (1 << 20)       /* Resume at runtime_resume. */
 #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 */