]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mmc: core: Introduce MMC_CAP_SYNC_RUNTIME_PM
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 31 May 2018 09:40:38 +0000 (11:40 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 17 Dec 2018 07:26:24 +0000 (08:26 +0100)
To allow mmc host drivers to inform the mmc core about rather using
pm_runtime_put_sync_suspend() instead of pm_runtime_put_autosuspend(),
let's introduce MMC_CAP_SYNC_RUNTIME_PM.

This is especially useful for those mmc host drivers that don't benefit
from using the runtime PM autosuspend feature. Typically this is those that
relies on parent devices to power the card via runtime PM, like some USB
host drivers for example.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
drivers/mmc/core/core.c
include/linux/mmc/host.h

index d3085f70e9a43963231d479b97ab921bd651a52e..5bd58b95d318ea2b86b4a784244bbbf65a3dfca2 100644 (file)
@@ -887,7 +887,10 @@ void mmc_release_host(struct mmc_host *host)
                spin_unlock_irqrestore(&host->lock, flags);
                wake_up(&host->wq);
                pm_runtime_mark_last_busy(mmc_dev(host));
-               pm_runtime_put_autosuspend(mmc_dev(host));
+               if (host->caps & MMC_CAP_SYNC_RUNTIME_PM)
+                       pm_runtime_put_sync_suspend(mmc_dev(host));
+               else
+                       pm_runtime_put_autosuspend(mmc_dev(host));
        }
 }
 EXPORT_SYMBOL(mmc_release_host);
index 2709c94d9d867c2b969c38fca9dd6657f9c072e7..4d35ff36ceffa7aa5daaa8b42e2d9a3a0e3bf84d 100644 (file)
@@ -334,7 +334,7 @@ struct mmc_host {
 #define MMC_CAP_UHS            (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | \
                                 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
                                 MMC_CAP_UHS_DDR50)
-/* (1 << 21) is free for reuse */
+#define MMC_CAP_SYNC_RUNTIME_PM        (1 << 21)       /* Synced runtime PM suspends. */
 #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 */