[PATCH V1 1/2] mmc: core: Define new vendor ops to enable internal features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Define new ops to let vendor enable internal features in
mmc_suspend/resume paths like partial init feature.

Signed-off-by: Sarthak Garg <quic_sartgarg@xxxxxxxxxxx>
---
 drivers/mmc/core/mmc.c   | 13 ++++++++++---
 include/linux/mmc/host.h |  4 ++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 89cd48fcec79..32386e4644df 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2112,9 +2112,11 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
 	    ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend ||
 	     (host->caps2 & MMC_CAP2_FULL_PWR_CYCLE_IN_SUSPEND)))
 		err = mmc_poweroff_notify(host->card, notify_type);
-	else if (mmc_can_sleep(host->card))
+	else if (mmc_can_sleep(host->card)) {
+		if (host->ops->cache_card_properties)
+			host->ops->cache_card_properties(host);
 		err = mmc_sleep(host);
-	else if (!mmc_host_is_spi(host))
+	} else if (!mmc_host_is_spi(host))
 		err = mmc_deselect_cards(host);
 
 	if (!err) {
@@ -2149,6 +2151,7 @@ static int mmc_suspend(struct mmc_host *host)
 static int _mmc_resume(struct mmc_host *host)
 {
 	int err = 0;
+	bool partial_init_success = false;
 
 	mmc_claim_host(host);
 
@@ -2156,7 +2159,11 @@ static int _mmc_resume(struct mmc_host *host)
 		goto out;
 
 	mmc_power_up(host, host->card->ocr);
-	err = mmc_init_card(host, host->card->ocr, host->card);
+
+	if (host->ops->partial_init_card)
+		partial_init_success = host->ops->partial_init_card(host);
+	if (!partial_init_success)
+		err = mmc_init_card(host, host->card->ocr, host->card);
 	mmc_card_clr_suspended(host->card);
 
 out:
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 461d1543893b..0a796a34b83d 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -212,6 +212,10 @@ struct mmc_host_ops {
 
 	/* Initialize an SD express card, mandatory for MMC_CAP2_SD_EXP. */
 	int	(*init_sd_express)(struct mmc_host *host, struct mmc_ios *ios);
+
+	void	(*cache_card_properties)(struct mmc_host *host);
+	bool	(*partial_init_card)(struct mmc_host *host);
+
 };
 
 struct mmc_cqe_ops {
-- 
2.17.1




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux