diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-07-08 07:22:18 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-07-21 18:28:38 -0400 |
commit | 4a256b5fc028e6dad0fd1b59745f743ee528c944 (patch) | |
tree | 1c2c17ccb80051c16ee9e16ea74194bd69fac72f | |
parent | 79ee031ff6fd23a1a2a4f783cfc3421885304ce3 (diff) |
DMA: Rework dw_dmac suspend_late()/resume_early()
This patch reworks platform driver power management code
for dw_dmac from legacy late/early callbacks to dev_pm_ops.
The callbacks are converted for CONFIG_SUSPEND like this:
suspend_late() -> suspend_noirq()
resume_early() -> resume_noirq()
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r-- | drivers/dma/dw_dmac.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 98c9a847bf51..933c143b6a74 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -1399,8 +1399,9 @@ static void dw_shutdown(struct platform_device *pdev) | |||
1399 | clk_disable(dw->clk); | 1399 | clk_disable(dw->clk); |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | static int dw_suspend_late(struct platform_device *pdev, pm_message_t mesg) | 1402 | static int dw_suspend_noirq(struct device *dev) |
1403 | { | 1403 | { |
1404 | struct platform_device *pdev = to_platform_device(dev); | ||
1404 | struct dw_dma *dw = platform_get_drvdata(pdev); | 1405 | struct dw_dma *dw = platform_get_drvdata(pdev); |
1405 | 1406 | ||
1406 | dw_dma_off(platform_get_drvdata(pdev)); | 1407 | dw_dma_off(platform_get_drvdata(pdev)); |
@@ -1408,23 +1409,27 @@ static int dw_suspend_late(struct platform_device *pdev, pm_message_t mesg) | |||
1408 | return 0; | 1409 | return 0; |
1409 | } | 1410 | } |
1410 | 1411 | ||
1411 | static int dw_resume_early(struct platform_device *pdev) | 1412 | static int dw_resume_noirq(struct device *dev) |
1412 | { | 1413 | { |
1414 | struct platform_device *pdev = to_platform_device(dev); | ||
1413 | struct dw_dma *dw = platform_get_drvdata(pdev); | 1415 | struct dw_dma *dw = platform_get_drvdata(pdev); |
1414 | 1416 | ||
1415 | clk_enable(dw->clk); | 1417 | clk_enable(dw->clk); |
1416 | dma_writel(dw, CFG, DW_CFG_DMA_EN); | 1418 | dma_writel(dw, CFG, DW_CFG_DMA_EN); |
1417 | return 0; | 1419 | return 0; |
1418 | |||
1419 | } | 1420 | } |
1420 | 1421 | ||
1422 | static struct dev_pm_ops dw_dev_pm_ops = { | ||
1423 | .suspend_noirq = dw_suspend_noirq, | ||
1424 | .resume_noirq = dw_resume_noirq, | ||
1425 | }; | ||
1426 | |||
1421 | static struct platform_driver dw_driver = { | 1427 | static struct platform_driver dw_driver = { |
1422 | .remove = __exit_p(dw_remove), | 1428 | .remove = __exit_p(dw_remove), |
1423 | .shutdown = dw_shutdown, | 1429 | .shutdown = dw_shutdown, |
1424 | .suspend_late = dw_suspend_late, | ||
1425 | .resume_early = dw_resume_early, | ||
1426 | .driver = { | 1430 | .driver = { |
1427 | .name = "dw_dmac", | 1431 | .name = "dw_dmac", |
1432 | .pm = &dw_dev_pm_ops, | ||
1428 | }, | 1433 | }, |
1429 | }; | 1434 | }; |
1430 | 1435 | ||