From: Kamal Dasu <kamal.dasu@broadcom.com>
To: linux-mmc@vger.kernel.org, Ulf Hansson <ulfh@kernel.org>
Cc: Ulf Hansson <ulf.hansson@oss.qualcomm.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kamal Dasu <kamal.dasu@broadcom.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Oleksij Rempel <o.rempel@pengutronix.de>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
Shawn Lin <shawn.lin@linux.dev>,
Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH v12 3/6] mmc: core: Add option to keep an eMMC powered on at system suspend
Date: Wed, 11 Nov 2026 14:44:23 -0500 [thread overview]
Message-ID: <20261111194426.1652644-4-kamal.dasu@broadcom.com> (raw)
In-Reply-To: <20261111194426.1652644-1-kamal.dasu@broadcom.com>
From: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
The DT property keep-power-in-suspend, allows us to specify whether the
platform is capable of keeping the power to the card during system suspend.
Up until now, this has been restricted to be used for SDIO cards only, but
let's add the initial support to allow this for eMMC too.
Signed-off-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
---
drivers/mmc/core/mmc.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index a02b04938e1a..c936272bcd81 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -38,6 +38,7 @@ enum mmc_poweroff_type {
MMC_POWEROFF_SHUTDOWN,
MMC_POWEROFF_UNDERVOLTAGE,
MMC_POWEROFF_UNBIND,
+ MMC_NO_POWEROFF_SUSPEND,
};
static const unsigned int tran_exp[] = {
@@ -2157,6 +2158,15 @@ static int _mmc_suspend(struct mmc_host *host, enum mmc_poweroff_type pm_type)
goto out;
}
+ if (pm_type == MMC_NO_POWEROFF_SUSPEND) {
+ if (host->retune_period) {
+ mmc_retune_timer_stop(host);
+ mmc_retune_needed(host);
+ }
+ mmc_card_set_suspended(host->card);
+ goto out;
+ }
+
if (mmc_card_can_poweroff_notify(host->card) &&
mmc_host_can_poweroff_notify(host, pm_type))
err = mmc_poweroff_notify(host->card, notify_type);
@@ -2193,9 +2203,15 @@ static void mmc_remove(struct mmc_host *host)
*/
static int mmc_suspend(struct mmc_host *host)
{
+ enum mmc_poweroff_type pm_type = MMC_POWEROFF_SUSPEND;
int err;
- err = _mmc_suspend(host, MMC_POWEROFF_SUSPEND);
+ if (mmc_card_keep_power(host)) {
+ pm_runtime_resume(&host->card->dev);
+ pm_type = MMC_NO_POWEROFF_SUSPEND;
+ }
+
+ err = _mmc_suspend(host, pm_type);
if (!err) {
pm_runtime_disable(&host->card->dev);
pm_runtime_set_suspended(&host->card->dev);
@@ -2260,7 +2276,13 @@ static int mmc_shutdown(struct mmc_host *host)
*/
static int mmc_resume(struct mmc_host *host)
{
+ if (mmc_card_keep_power(host)) {
+ pm_runtime_set_active(&host->card->dev);
+ mmc_card_clr_suspended(host->card);
+ }
+
pm_runtime_enable(&host->card->dev);
+ host->pm_flags &= ~MMC_PM_KEEP_POWER;
return 0;
}
next prev parent reply other threads:[~2026-11-11 19:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 19:44 [PATCH v12 0/6] mmc: core: Keep the card powered across suspend when firmware needs it live Kamal Dasu
2026-11-11 19:44 ` [PATCH v12 1/6] dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO Kamal Dasu
2026-11-11 19:44 ` [PATCH v12 2/6] dt-bindings: mmc: Add reset-card-at-resume property Kamal Dasu
2026-11-11 19:44 ` Kamal Dasu [this message]
2026-11-11 19:44 ` [PATCH v12 4/6] mmc: core: Split sdio_set_host_pm_flags() Kamal Dasu
2026-11-11 19:44 ` [PATCH v12 5/6] mmc: core: Move and split reset functions for eMMC Kamal Dasu
2026-11-11 19:44 ` [PATCH v12 6/6] mmc: core: Add support for resetting an eMMC at system resume Kamal Dasu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261111194426.1652644-4-kamal.dasu@broadcom.com \
--to=kamal.dasu@broadcom.com \
--cc=adrian.hunter@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=robh@kernel.org \
--cc=shawn.lin@linux.dev \
--cc=shawn.lin@rock-chips.com \
--cc=ulf.hansson@oss.qualcomm.com \
--cc=ulfh@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®