diff options
| author | Krishna Konda <kkonda@codeaurora.org> | 2015-06-29 19:20:05 -0700 |
|---|---|---|
| committer | Subhash Jadavani <subhashj@codeaurora.org> | 2016-05-31 15:26:55 -0700 |
| commit | 62c8dce6e1b42fe6ee356550a3092ca2db90ec22 (patch) | |
| tree | bda69d7554abc5abcf0bcd1e50f4bb0b70440d97 /drivers/mmc/core | |
| parent | b6c1c166809f7141efb13c2805027f189a75597a (diff) | |
mmc: core: Update PON based on the system state
As per eMMC specification, the PON (Power Off Notification)
must be sent by host to the card before turning off the power.
This will allow card to prepare itself for the power off and
may even reduce the initialization of eMMC upon next boot-up.
Send long PON during system power off and send short PON during
system reboot to reduce the reboot latency.
Change-Id: If4188b8b80aaa0e6c4e00e1807aa9589d5e7efdb
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
[subhashj@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'drivers/mmc/core')
| -rw-r--r-- | drivers/mmc/core/mmc.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index b0353f88f990..7ce9d3c01226 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1431,10 +1431,7 @@ static int mmc_reboot_notify(struct notifier_block *notify_block, struct mmc_card *card = container_of( notify_block, struct mmc_card, reboot_notify); - if (event != SYS_RESTART) - card->issue_long_pon = true; - else - card->issue_long_pon = false; + card->pon_type = (event != SYS_RESTART) ? MMC_LONG_PON : MMC_SHRT_PON; return NOTIFY_OK; } @@ -2255,19 +2252,24 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type) return err; } -int mmc_send_long_pon(struct mmc_card *card) +int mmc_send_pon(struct mmc_card *card) { int err = 0; struct mmc_host *host = card->host; + if (!mmc_can_poweroff_notify(card)) + goto out; + mmc_claim_host(host); - if (card->issue_long_pon && mmc_can_poweroff_notify(card)) { + if (card->pon_type & MMC_LONG_PON) err = mmc_poweroff_notify(host->card, EXT_CSD_POWER_OFF_LONG); - if (err) - pr_warning("%s: error %d sending Long PON", - mmc_hostname(host), err); - } + else if (card->pon_type & MMC_SHRT_PON) + err = mmc_poweroff_notify(host->card, EXT_CSD_POWER_OFF_SHORT); + if (err) + pr_warn("%s: error %d sending PON type %u", + mmc_hostname(host), err, card->pon_type); mmc_release_host(host); +out: return err; } |
