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

mmc: dw_mmc: add runtime PM callback

This patch add dw_mci_runtime_suspend/resume interfaces
and expose it to dw_mci variant driver to support runtime
PM.

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
e9ed8835 70562644

+33 -3
+30 -2
drivers/mmc/host/dw_mmc.c
··· 3267 3267 3268 3268 3269 3269 3270 - #ifdef CONFIG_PM_SLEEP 3270 + #ifdef CONFIG_PM 3271 3271 /* 3272 3272 * TODO: we should probably disable the clock to the card in the suspend path. 3273 3273 */ ··· 3325 3325 return 0; 3326 3326 } 3327 3327 EXPORT_SYMBOL(dw_mci_resume); 3328 - #endif /* CONFIG_PM_SLEEP */ 3328 + 3329 + int dw_mci_runtime_suspend(struct device *dev) 3330 + { 3331 + int err = 0; 3332 + struct dw_mci *host = dev_get_drvdata(dev); 3333 + 3334 + err = dw_mci_suspend(host); 3335 + if (err) 3336 + return err; 3337 + 3338 + clk_disable_unprepare(host->ciu_clk); 3339 + 3340 + return err; 3341 + } 3342 + EXPORT_SYMBOL(dw_mci_runtime_suspend); 3343 + 3344 + int dw_mci_runtime_resume(struct device *dev) 3345 + { 3346 + int ret = 0; 3347 + struct dw_mci *host = dev_get_drvdata(dev); 3348 + 3349 + ret = clk_prepare_enable(host->ciu_clk); 3350 + if (ret) 3351 + return ret; 3352 + 3353 + return dw_mci_resume(host); 3354 + } 3355 + EXPORT_SYMBOL(dw_mci_runtime_resume); 3356 + #endif /* CONFIG_PM */ 3329 3357 3330 3358 static int __init dw_mci_init(void) 3331 3359 {
+3 -1
drivers/mmc/host/dw_mmc.h
··· 234 234 235 235 extern int dw_mci_probe(struct dw_mci *host); 236 236 extern void dw_mci_remove(struct dw_mci *host); 237 - #ifdef CONFIG_PM_SLEEP 237 + #ifdef CONFIG_PM 238 238 extern int dw_mci_suspend(struct dw_mci *host); 239 239 extern int dw_mci_resume(struct dw_mci *host); 240 + extern int dw_mci_runtime_suspend(struct device *device); 241 + extern int dw_mci_runtime_resume(struct device *device); 240 242 #endif 241 243 242 244 /**