Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: dw_mmc-k3: deploy runtime PM facilities

Let's migrate it to use runtime PM and remove the system
PM callback from this driver. With this patch, it could
handle system PM properly and could also use runtime PM
if we enable it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Shawn Lin and committed by
Ulf Hansson
2c8ae20e 1f5c51d7

+9 -30
+9 -30
drivers/mmc/host/dw_mmc-k3.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/of_address.h> 17 17 #include <linux/platform_device.h> 18 + #include <linux/pm_runtime.h> 18 19 #include <linux/regmap.h> 19 20 #include <linux/regulator/consumer.h> 20 21 ··· 163 162 return dw_mci_pltfm_register(pdev, drv_data); 164 163 } 165 164 166 - #ifdef CONFIG_PM_SLEEP 167 - static int dw_mci_k3_suspend(struct device *dev) 168 - { 169 - struct dw_mci *host = dev_get_drvdata(dev); 170 - int ret; 171 - 172 - ret = dw_mci_suspend(host); 173 - if (!ret) 174 - clk_disable_unprepare(host->ciu_clk); 175 - 176 - return ret; 177 - } 178 - 179 - static int dw_mci_k3_resume(struct device *dev) 180 - { 181 - struct dw_mci *host = dev_get_drvdata(dev); 182 - int ret; 183 - 184 - ret = clk_prepare_enable(host->ciu_clk); 185 - if (ret) { 186 - dev_err(host->dev, "failed to enable ciu clock\n"); 187 - return ret; 188 - } 189 - 190 - return dw_mci_resume(host); 191 - } 192 - #endif /* CONFIG_PM_SLEEP */ 193 - 194 - static SIMPLE_DEV_PM_OPS(dw_mci_k3_pmops, dw_mci_k3_suspend, dw_mci_k3_resume); 165 + static const struct dev_pm_ops dw_mci_k3_dev_pm_ops = { 166 + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 167 + pm_runtime_force_resume) 168 + SET_RUNTIME_PM_OPS(dw_mci_runtime_suspend, 169 + dw_mci_runtime_resume, 170 + NULL) 171 + }; 195 172 196 173 static struct platform_driver dw_mci_k3_pltfm_driver = { 197 174 .probe = dw_mci_k3_probe, ··· 177 198 .driver = { 178 199 .name = "dwmmc_k3", 179 200 .of_match_table = dw_mci_k3_match, 180 - .pm = &dw_mci_k3_pmops, 201 + .pm = &dw_mci_k3_dev_pm_ops, 181 202 }, 182 203 }; 183 204