From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
linux-pm <linux-pm@vger.kernel.org>,
linux-acpi <linux-acpi@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: [PATCH RFC 1/4] mmc: sdio: Keep card runtime resumed while adding function devices
Date: Fri, 21 Apr 2017 13:08:05 +0300 [thread overview]
Message-ID: <1492769288-7474-2-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1492769288-7474-1-git-send-email-adrian.hunter@intel.com>
Drivers core will runtime suspend a device with no driver. That means the
SDIO card will be runtime suspended as soon as it is added. It is then
runtime resumed to add each function. That is entirely pointless, so add
pm runtime get/put to keep the SDIO card runtime resumed until the function
devices have been added.
This also benefits the hibernation use-case whereby we want to avoid the
SDIO reset that is done as part of runtime resume. In that case, the SDIO
card state is preserved at boot time by avoiding loading any function
drivers before restoring the hibernation image.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/sdio.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index fae732c870a9..97bedde0610c 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1110,6 +1110,8 @@ int mmc_attach_sdio(struct mmc_host *host)
if (err)
goto remove;
+ pm_runtime_get_noresume(&card->dev);
+
/*
* Enable runtime PM for this card
*/
@@ -1129,7 +1131,7 @@ int mmc_attach_sdio(struct mmc_host *host)
for (i = 0; i < funcs; i++, card->sdio_funcs++) {
err = sdio_init_func(host->card, i + 1);
if (err)
- goto remove;
+ goto remove_get;
/*
* Enable Runtime PM for this func (if supported)
@@ -1156,6 +1158,10 @@ int mmc_attach_sdio(struct mmc_host *host)
}
mmc_claim_host(host);
+
+ if (host->caps & MMC_CAP_POWER_OFF_CARD)
+ pm_runtime_put(&card->dev);
+
return 0;
@@ -1163,6 +1169,9 @@ int mmc_attach_sdio(struct mmc_host *host)
/* Remove without lock if the device has been added. */
mmc_sdio_remove(host);
mmc_claim_host(host);
+remove_get:
+ if (host->caps & MMC_CAP_POWER_OFF_CARD)
+ pm_runtime_put(&card->dev);
remove:
/* And with lock if it hasn't been added. */
mmc_release_host(host);
--
1.9.1
next prev parent reply other threads:[~2017-04-21 10:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 10:08 [PATCH RFC 0/4] mmc: sdio: To support hibernation add capability to skip SDIO reset at scan Adrian Hunter
2017-04-21 10:08 ` Adrian Hunter [this message]
2017-04-24 21:03 ` [PATCH RFC 1/4] mmc: sdio: Keep card runtime resumed while adding function devices Ulf Hansson
2017-04-25 6:41 ` Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 2/4] mmc: sdio: Add capability to skip SDIO reset at scan Adrian Hunter
2017-04-24 20:33 ` Ulf Hansson
2017-04-25 6:21 ` Adrian Hunter
2017-04-25 7:52 ` Ulf Hansson
2017-04-25 7:57 ` Adrian Hunter
2017-04-25 10:46 ` Ulf Hansson
2017-04-25 11:20 ` Adrian Hunter
2017-04-25 12:24 ` Ulf Hansson
2017-04-25 12:45 ` Adrian Hunter
2017-04-25 18:51 ` Grygorii Strashko
2017-04-25 19:11 ` Adrian Hunter
2017-04-21 10:08 ` [PATCH RFC 3/4] mmc: sdhci-acpi: Set MMC_CAP2_NO_SDIO_RESET if child has wake from S4 (hibernate) Adrian Hunter
2017-04-24 21:52 ` Rafael J. Wysocki
2017-04-25 7:28 ` Adrian Hunter
2017-04-25 11:05 ` Rafael J. Wysocki
2017-04-21 10:08 ` [PATCH RFC 4/4] mmc: sdhci-pci: " Adrian Hunter
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=1492769288-7474-2-git-send-email-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=ulf.hansson@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).