From fedeff5024a71e57bf8915a7a2d272224d4bd8ce Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Wed, 30 Oct 2019 09:54:58 +0800 Subject: [PATCH] mmc: dw_mmc-rockchip: Fix native sdmmc deep resume failure Native sdmmc does not use rpm, but we set pm_runtime_force_suspend() and pm_runtime_force_resume() for sleep PM. pm_runtime_force_*() will check rpm status, so that the it doesn't call the resume callback if we didn't increase its usage count. Another drive-by fix is to de-init rpm once when rpm is used. Change-Id: Id7ea1ca95c684fb51867fb87c66f8998fc0758a3 Signed-off-by: Shawn Lin --- drivers/mmc/host/dw_mmc-rockchip.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c index 7fd9361004c7..7ce7a3cc95a8 100644 --- a/drivers/mmc/host/dw_mmc-rockchip.c +++ b/drivers/mmc/host/dw_mmc-rockchip.c @@ -357,8 +357,13 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev) match = of_match_node(dw_mci_rockchip_match, pdev->dev.of_node); drv_data = match->data; + /* + * increase rpm usage count in order to make + * pm_runtime_force_resume calls rpm resume callback + */ + pm_runtime_get_noresume(&pdev->dev); + if (use_rpm) { - pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 50); @@ -367,8 +372,10 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev) ret = dw_mci_pltfm_register(pdev, drv_data); if (ret) { - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); + if (use_rpm) { + pm_runtime_disable(&pdev->dev); + pm_runtime_set_suspended(&pdev->dev); + } pm_runtime_put_noidle(&pdev->dev); return ret; }