]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
dmaengine: zynqmp_dma: Sync runtime pm changes with mainline
authorKedareswara rao Appana <appana.durga.rao@xilinx.com>
Mon, 18 Dec 2017 07:45:47 +0000 (13:15 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 15 Mar 2018 14:19:11 +0000 (15:19 +0100)
This patch sync's the runtime pm changes with
mainline changes.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/dma/xilinx/zynqmp_dma.c

index 382a57f500e63f5462ea24f8850037a1f47d7e4b..fe27656c452362e5343a432999bbba20ba4f7cd4 100644 (file)
@@ -1158,22 +1158,16 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
                return PTR_ERR(zdev->clk_apb);
        }
 
-       ret = clk_prepare_enable(zdev->clk_main);
-       if (ret) {
-               dev_err(&pdev->dev, "Unable to enable main clock.\n");
-               return ret;
-       }
-
-       ret = clk_prepare_enable(zdev->clk_apb);
-       if (ret) {
-               dev_err(&pdev->dev, "Unable to enable apb clock.\n");
-               goto err_disable_clk;
-       }
-
        platform_set_drvdata(pdev, zdev);
        pm_runtime_set_autosuspend_delay(zdev->dev, ZDMA_PM_TIMEOUT);
        pm_runtime_use_autosuspend(zdev->dev);
        pm_runtime_enable(zdev->dev);
+       pm_runtime_get_sync(zdev->dev);
+       if (!pm_runtime_enabled(zdev->dev)) {
+               ret = zynqmp_dma_runtime_resume(zdev->dev);
+               if (ret)
+                       return ret;
+       }
 
        ret = zynqmp_dma_chan_probe(zdev, pdev);
        if (ret) {
@@ -1201,13 +1195,12 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
 
        return 0;
 
-err_disable_clk:
-       clk_disable_unprepare(zdev->clk_main);
-err_disable_pm:
-       clk_disable_unprepare(zdev->clk_apb);
-       pm_runtime_disable(zdev->dev);
 free_chan_resources:
        zynqmp_dma_chan_remove(zdev->chan);
+err_disable_pm:
+       if (!pm_runtime_enabled(zdev->dev))
+               zynqmp_dma_runtime_suspend(zdev->dev);
+       pm_runtime_disable(zdev->dev);
        return ret;
 }
 
@@ -1226,8 +1219,8 @@ static int zynqmp_dma_remove(struct platform_device *pdev)
 
        zynqmp_dma_chan_remove(zdev->chan);
        pm_runtime_disable(zdev->dev);
-       clk_disable_unprepare(zdev->clk_apb);
-       clk_disable_unprepare(zdev->clk_main);
+       if (!pm_runtime_enabled(zdev->dev))
+               zynqmp_dma_runtime_suspend(zdev->dev);
 
        return 0;
 }