aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-11-18 06:17:56 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-11-27 11:13:08 -0500
commitb816ccc5c01fb7fe1fb001ff7aa5aa7e5a8aa76b (patch)
treeab81c47bf870da01f8dbd4812b9a613c3ca48422 /drivers/dma
parentae43b3289186480f81c78bb63d788a85a3631f47 (diff)
ARM: 8206/1: dmaengine: pl330: Add PM sleep support
Add system suspend/resume capabilities to the pl330 driver so the amba bus clock could be also unprepared to conserve energy. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/pl330.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 39ea8d436b81..2d324f780719 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2627,6 +2627,46 @@ static int pl330_dma_device_slave_caps(struct dma_chan *dchan,
2627 return 0; 2627 return 0;
2628} 2628}
2629 2629
2630/*
2631 * Runtime PM callbacks are provided by amba/bus.c driver.
2632 *
2633 * It is assumed here that IRQ safe runtime PM is chosen in probe and amba
2634 * bus driver will only disable/enable the clock in runtime PM callbacks.
2635 */
2636static int __maybe_unused pl330_suspend(struct device *dev)
2637{
2638 struct amba_device *pcdev = to_amba_device(dev);
2639
2640 pm_runtime_disable(dev);
2641
2642 if (!pm_runtime_status_suspended(dev)) {
2643 /* amba did not disable the clock */
2644 amba_pclk_disable(pcdev);
2645 }
2646 amba_pclk_unprepare(pcdev);
2647
2648 return 0;
2649}
2650
2651static int __maybe_unused pl330_resume(struct device *dev)
2652{
2653 struct amba_device *pcdev = to_amba_device(dev);
2654 int ret;
2655
2656 ret = amba_pclk_prepare(pcdev);
2657 if (ret)
2658 return ret;
2659
2660 if (!pm_runtime_status_suspended(dev))
2661 ret = amba_pclk_enable(pcdev);
2662
2663 pm_runtime_enable(dev);
2664
2665 return ret;
2666}
2667
2668static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume);
2669
2630static int 2670static int
2631pl330_probe(struct amba_device *adev, const struct amba_id *id) 2671pl330_probe(struct amba_device *adev, const struct amba_id *id)
2632{ 2672{
@@ -2852,6 +2892,7 @@ static struct amba_driver pl330_driver = {
2852 .drv = { 2892 .drv = {
2853 .owner = THIS_MODULE, 2893 .owner = THIS_MODULE,
2854 .name = "dma-pl330", 2894 .name = "dma-pl330",
2895 .pm = &pl330_pm,
2855 }, 2896 },
2856 .id_table = pl330_ids, 2897 .id_table = pl330_ids,
2857 .probe = pl330_probe, 2898 .probe = pl330_probe,