浏览代码

mmc: sdhci-esdhc-imx: Enable/Disable mmc clock during runtime suspend

mmc clock can be stopped during runtime suspend and restart during runtime
resume if the sdio irq is not enabled. Stop sdio clock reduce EMI of
the device when the bus is not in use.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Michael Trimarchi 7 年之前
父节点
当前提交
3602785b34
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      drivers/mmc/host/sdhci-esdhc-imx.c

+ 4 - 0
drivers/mmc/host/sdhci-esdhc-imx.c

@@ -193,6 +193,7 @@ struct pltfm_imx_data {
 	struct clk *clk_ipg;
 	struct clk *clk_ipg;
 	struct clk *clk_ahb;
 	struct clk *clk_ahb;
 	struct clk *clk_per;
 	struct clk *clk_per;
+	unsigned int actual_clock;
 	enum {
 	enum {
 		NO_CMD_PENDING,      /* no multiblock command pending */
 		NO_CMD_PENDING,      /* no multiblock command pending */
 		MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */
 		MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */
@@ -1396,6 +1397,8 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
 		mmc_retune_needed(host->mmc);
 		mmc_retune_needed(host->mmc);
 
 
 	if (!sdhci_sdio_irq_enabled(host)) {
 	if (!sdhci_sdio_irq_enabled(host)) {
+		imx_data->actual_clock = host->mmc->actual_clock;
+		esdhc_pltfm_set_clock(host, 0);
 		clk_disable_unprepare(imx_data->clk_per);
 		clk_disable_unprepare(imx_data->clk_per);
 		clk_disable_unprepare(imx_data->clk_ipg);
 		clk_disable_unprepare(imx_data->clk_ipg);
 	}
 	}
@@ -1422,6 +1425,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
 		err = clk_prepare_enable(imx_data->clk_ipg);
 		err = clk_prepare_enable(imx_data->clk_ipg);
 		if (err)
 		if (err)
 			goto disable_per_clk;
 			goto disable_per_clk;
+		esdhc_pltfm_set_clock(host, imx_data->actual_clock);
 	}
 	}
 
 
 	err = sdhci_runtime_resume_host(host);
 	err = sdhci_runtime_resume_host(host);