diff options
author | Dong Aisheng <aisheng.dong@nxp.com> | 2017-11-30 21:10:18 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:29:36 +0800 |
commit | 282bafaaa645555e9a892f96f1963466b7408083 (patch) | |
tree | 97a64736ecce36f465082a8e971add168560fe69 /drivers/mmc/host/sdhci-esdhc-imx.c | |
parent | db36faf4d3878a5de8806e198e0407f1e2ef983e (diff) |
MLK-17074-7 mmc: sdhci-esdhc-imx: make sure clock is disabled during suspend
make sure clock is disabled during suspend
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Diffstat (limited to 'drivers/mmc/host/sdhci-esdhc-imx.c')
-rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index f3592fdd27e7..e9cc7c3b31db 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1618,9 +1618,7 @@ static int sdhci_esdhc_suspend(struct device *dev) struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); int ret; -#ifdef CONFIG_PM - pm_runtime_get_sync(host->mmc->parent); -#endif + pm_runtime_get_sync(dev); if (host->mmc->caps2 & MMC_CAP2_CQE) { ret = cqhci_suspend(host->mmc); @@ -1641,14 +1639,34 @@ static int sdhci_esdhc_suspend(struct device *dev) pinctrl_pm_select_sleep_state(dev); + if (!sdhci_sdio_irq_enabled(host)) { + clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_ipg); + } + clk_disable_unprepare(imx_data->clk_ahb); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + return ret; } static int sdhci_esdhc_resume(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); int ret; + if (!sdhci_sdio_irq_enabled(host)) { + clk_prepare_enable(imx_data->clk_per); + clk_prepare_enable(imx_data->clk_ipg); + } + clk_prepare_enable(imx_data->clk_ahb); + + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + pinctrl_pm_select_default_state(dev); /* re-initialize hw state in case it's lost in low power mode */ @@ -1661,10 +1679,8 @@ static int sdhci_esdhc_resume(struct device *dev) if (host->mmc->caps2 & MMC_CAP2_CQE) ret = cqhci_resume(host->mmc); -#ifdef CONFIG_PM - pm_runtime_mark_last_busy(host->mmc->parent); - pm_runtime_put_autosuspend(host->mmc->parent); -#endif + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); return ret; } |