From 94096bd1d99a30a46aae580ec1aba7493f166061 Mon Sep 17 00:00:00 2001 From: Sayali Lokhande Date: Thu, 24 Jun 2021 11:53:03 +0530 Subject: [PATCH] mmc: core: Fix mmc sleep/awake functionality Currently as part of mmc suspend and resume, we are using different api's to check support for cmd5 (sleep/awake), which results in suspend sending cmd5 for sleep, while in resume it's always going for full init instead of sending cmd5 for awake. Fix this by using same api in both suspend and resume paths so that partial init functionality is actually utilized. Change-Id: Ia84b7790fe00f1f24a63d6dc509646ebcbd4d3ef Signed-off-by: Sayali Lokhande --- drivers/mmc/core/mmc.c | 15 ++------------- include/linux/mmc/host.h | 1 - 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 8e099cdc0ff3..ad03f882f5a7 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -2094,17 +2094,6 @@ static int mmc_can_sleep(struct mmc_card *card) return (card && card->ext_csd.rev >= 3); } -static int mmc_can_sleepawake(struct mmc_host *host) -{ -#if defined(CONFIG_SDC_QTI) - return host && (host->caps2 & MMC_CAP2_SLEEP_AWAKE) && host->card && - (host->card->ext_csd.rev >= 3); -#else - return host && host->card && (host->card->ext_csd.rev >= 3); -#endif - -} - static int mmc_sleepawake(struct mmc_host *host, bool sleep) { struct mmc_command cmd = {}; @@ -2329,7 +2318,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) if (mmc_can_poweroff_notify(host->card) && ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend)) err = mmc_poweroff_notify(host->card, notify_type); - if (mmc_can_sleepawake(host)) { + if (mmc_can_sleep(host->card)) { #if defined(CONFIG_SDC_QTI) memcpy(&host->cached_ios, &host->ios, sizeof(host->cached_ios)); #endif @@ -2441,7 +2430,7 @@ static int _mmc_resume(struct mmc_host *host) mmc_log_string(host, "Enter\n"); mmc_power_up(host, host->card->ocr); - if (mmc_can_sleepawake(host)) { + if (mmc_can_sleep(host->card)) { err = mmc_sleepawake(host, false); if (!err) err = mmc_partial_init(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 304714c89438..b52e203c9494 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -479,7 +479,6 @@ struct mmc_host { #define MMC_CAP2_CRYPTO (1 << 27) /* Host supports inline encryption */ #if defined(CONFIG_SDC_QTI) #define MMC_CAP2_CLK_SCALE (1 << 28) /* Allow dynamic clk scaling */ -#define MMC_CAP2_SLEEP_AWAKE (1 << 29) /* Use Sleep/Awake (CMD5) */ #endif int fixed_drv_type; /* fixed driver type for non-removable media */