msm: msm_sdcc: defer device resume until next transfer request comes
If SDCC device runtime status was RPM_RESUMED before system suspend
happens, during next system resume SDCC will also be resumed
synchronously. As SDCC resume is happening as part of system resume
path and it may take around 150ms to resume for SDCC slot which have
SD card connected. As this resume latency is too high, it may impact
overall system resume time and can effect the user experience.
This change makes sure that during system suspend, device runtime
status gets set to RPM_SUSPENDED. So when system resume happens,
SDCC resume can be skipped which means SDCC resume is deferred
until next SDCC transfer request comes in.
CRs-fixed: 344459
Change-Id: I579030b3759fee2c566ab06daad10ff4dd4c0085
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index c4613ba..65a11d5 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -5060,8 +5060,23 @@
if (host->plat->status_irq)
disable_irq(host->plat->status_irq);
- if (!pm_runtime_suspended(dev))
- rc = msmsdcc_runtime_suspend(dev);
+ if (!pm_runtime_suspended(dev)) {
+ if (!(mmc->card && mmc_card_sdio(mmc->card))) {
+ /*
+ * decrement power.usage_counter if it's
+ * not zero earlier
+ */
+ pm_runtime_put_noidle(dev);
+ rc = pm_runtime_suspend(dev);
+ }
+
+ /*
+ * if device runtime PM status is still not suspended
+ * then perform suspend here.
+ */
+ if (!pm_runtime_suspended(dev))
+ rc = msmsdcc_runtime_suspend(dev);
+ }
return rc;
}