[PATCH v8 4/5] dmaengine: mcf-edma: enable runtime PM for eDMA engine and channel
From: Joy Zou
Date: Wed Nov 25 2026 - 05:55:17 EST
The common fsl_edma_alloc_chan_resources() implementation
supports runtime PM and relies on it when allocating channel
resources.
Enable runtime PM for the eDMA engine and its channel devices
to ensure that runtime PM operations work correctly when
CONFIG_PM is enabled.
This patch has only been build-tested.
Signed-off-by: Joy Zou <joy.zou@xxxxxxxxxxx>
---
Changes in v8:
- Add a new patch to prevent fsl_edma_alloc_chan_resources()
from failing when CONFIG_PM is enabled.
---
drivers/dma/mcf-edma-main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
index 9e1c6400c77b..b1b94639d4cc 100644
--- a/drivers/dma/mcf-edma-main.c
+++ b/drivers/dma/mcf-edma-main.c
@@ -8,6 +8,7 @@
#include <linux/dmaengine.h>
#include <linux/platform_device.h>
#include <linux/platform_data/dma-mcf-edma.h>
+#include <linux/pm_runtime.h>
#include "fsl-edma-common.h"
@@ -192,7 +193,9 @@ static int mcf_edma_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&mcf_edma->dma_dev.channels);
for (i = 0; i < mcf_edma->n_chans; i++) {
struct fsl_edma_chan *mcf_chan = &mcf_edma->chans[i];
+ struct device *chan_dev;
+ chan_dev = &mcf_chan->vchan.chan.dev->device;
mcf_chan->edma = mcf_edma;
mcf_chan->srcid = i;
mcf_chan->dma_dir = DMA_NONE;
@@ -201,6 +204,10 @@ static int mcf_edma_probe(struct platform_device *pdev)
mcf_chan->tcd = mcf_edma->membase + EDMA_TCD
+ i * sizeof(struct fsl_edma_hw_tcd);
edma_write_tcdreg(mcf_chan, cpu_to_le32(0), csr);
+ ret = devm_pm_runtime_enable(chan_dev);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "Can't enable eDMA channel PM runtime!\n");
}
iowrite32(~0, regs->inth);
@@ -240,6 +247,10 @@ static int mcf_edma_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mcf_edma);
+ ret = devm_pm_runtime_enable(&pdev->dev);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "Can't enable eDMA engine PM runtime!\n");
+
ret = dma_async_device_register(&mcf_edma->dma_dev);
if (ret) {
dev_err(&pdev->dev,
--
2.34.1