]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mmc: core: Introduce MMC_CAP_SYNC_RUNTIME_PM
authorUlf Hansson <ulf.hansson@linaro.org>
Fri, 11 Jan 2019 08:30:00 +0000 (09:30 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
BugLink: https://bugs.launchpad.net/bugs/1811337
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>
(cherry picked from commit 7d5ef512575663695cf85f3aeb985a0aeb03e364)
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/mmc/core/core.c
include/linux/mmc/host.h

index af194640dbc63984e08ba1d47f65327687c5fb60..c36299d71e79173c4528567dbbac6e048d36e696 100644 (file)
@@ -1088,7 +1088,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 b36723e8e99b766d43daa0e2088449080af2159c..07aa01f5d8bd5ed31ddff7525c175419e6ab6f1c 100644 (file)
@@ -323,7 +323,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 */