From: Michael Trimarchi <michael@amarulasolutions.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>, linux-mmc@vger.kernel.org
Subject: [PATCH] mmc: sdhci-esdhc-imx: Enable/Disable mmc clock during runtime suspend
Date: Thu, 21 Dec 2017 14:22:26 +0100 [thread overview]
Message-ID: <1513862546-20221-1-git-send-email-michael@amarulasolutions.com> (raw)
mmc clock can be stopped during runtime suspend and restart during runtime
resume. This let us know to not have any clock running and this reduce
the EMI of the device when the bus is not in use
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 7123ef9..9a5e96f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -196,6 +196,7 @@ struct pltfm_imx_data {
struct clk *clk_ipg;
struct clk *clk_ahb;
struct clk *clk_per;
+ unsigned int actual_clock;
enum {
NO_CMD_PENDING, /* no multiblock command pending*/
MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */
@@ -1346,6 +1347,9 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
ret = sdhci_runtime_suspend_host(host);
+ imx_data->actual_clock = host->mmc->actual_clock;
+ esdhc_pltfm_set_clock(host, 0);
+
if (!sdhci_sdio_irq_enabled(host)) {
clk_disable_unprepare(imx_data->clk_per);
clk_disable_unprepare(imx_data->clk_ipg);
@@ -1366,6 +1370,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
clk_prepare_enable(imx_data->clk_ipg);
}
clk_prepare_enable(imx_data->clk_ahb);
+ esdhc_pltfm_set_clock(host, imx_data->actual_clock);
return sdhci_runtime_resume_host(host);
}
--
2.7.4
next reply other threads:[~2017-12-21 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 13:22 Michael Trimarchi [this message]
2017-12-21 14:43 ` [PATCH] mmc: sdhci-esdhc-imx: Enable/Disable mmc clock during runtime suspend Michael Nazzareno Trimarchi
2018-01-03 16:26 ` Ulf Hansson
2018-01-03 16:38 ` Michael Nazzareno Trimarchi
2018-01-03 16:56 ` Ulf Hansson
2018-01-03 16:58 ` Michael Nazzareno Trimarchi
2018-01-03 17:26 ` Michael Nazzareno Trimarchi
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=1513862546-20221-1-git-send-email-michael@amarulasolutions.com \
--to=michael@amarulasolutions.com \
--cc=adrian.hunter@intel.com \
--cc=linux-mmc@vger.kernel.org \
--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