Skip to content

add runtime suspend/resume support

[email protected] dmaengine imx lkml 3 versions – New

Get series with b4
b4 am [email protected] change-id 20260617-b4-edma-runtime-opt-2b14d269bcee

Versions newest first

  1. v8 Latest5 patches 0 repliesNew
  2. v74 patches 0 repliesSuperseded inferred link
  3. v65 patches 3 repliesSuperseded

Changes in v8 from the cover letter

- deleting clk_disable_unprepare(fsl_chan->clk) avoids a double-disable
warning, However, the clock stays on and won't be turned off until
driver removed, which increases power consumption for patch #1.
- add a new patch to prevent fsl_edma_alloc_chan_resources() from failing
when CONFIG_PM is enabled for patch #4.
- changed the pm_runtime_get_if_active() return value check from <= 0 to == 0
to account for the CONFIG_PM=n case for patch #5.
- remove reduntant pd_dev pm_runtime handler due to bind the dma channel
for patch #5.
- add the pm_runtime_get_if_active() check for fsl_edma3_err_check() for patch #5.
- add chan_masked check for fsl_edma3_or_err_handler, fsl_edma_tx_handler
and fsl_edma_err_handler for patch #5.
- add synchronize_irq() for txirq_16_3 for patch #5.
- remove the manual device_link_del() call to avoid use-after-free for patch #5.
- Link to v7: https://patch.msgid.link/[email protected]

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5dmaengine: fsl-edma: use devm_clk_get_optional_enabled() for channel clockdrivers/dma/fsl-edma-common.c drivers/dma/fsl-edma-common.h drivers/dma/fsl-edma-main.c+6 -170 replies
2/5dmaengine: fsl-edma: use devm_clk_get_optional() for DMA engine clockdrivers/dma/fsl-edma-common.h drivers/dma/fsl-edma-main.c+10 -130 replies
3/5dmaengine: fsl-edma: convert DMAMUX clock handling to bulk clock APIdrivers/dma/fsl-edma-common.h drivers/dma/fsl-edma-main.c+20 -230 replies
4/5dmaengine: mcf-edma: enable runtime PM for eDMA engine and channeldrivers/dma/mcf-edma-main.c+11 -00 replies
5/5dmaengine: fsl-edma: add runtime suspend/resume supportdrivers/dma/fsl-edma-common.c drivers/dma/fsl-edma-main.c+240 -470 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchFrank Li
1/5R-b
2/5R-b
3/5R-b
4/5
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/5] add runtime suspend/resume support

Clean up driver FLAGs and introduce runtime suspend and resume support for FSL eDMA.

---
Changes in v8:
- deleting clk_disable_unprepare(fsl_chan->clk) avoids a double-disable
warning, However, the clock stays on and won't be turned off until
driver removed, which increases power consumption for patch #1.
- add a new patch to prevent fsl_edma_alloc_chan_resources() from failing
when CONFIG_PM is enabled for patch #4.
- changed the pm_runtime_get_if_active() return value check from <= 0 to == 0
to account for the CONFIG_PM=n case for patch #5.
- remove reduntant pd_dev pm_runtime handler due to bind the dma channel
for patch #5.
- add the pm_runtime_get_if_active() check for fsl_edma3_err_check() for patch #5.
- add chan_masked check for fsl_edma3_or_err_handler, fsl_edma_tx_handler
and fsl_edma_err_handler for patch #5.
- add synchronize_irq() for txirq_16_3 for patch #5.
- remove the manual device_link_del() call to avoid use-after-free for patch #5.
- Link to v7: https://patch.msgid.link/[email protected]

Changes in V7:
- replace devm_clk_get_optional() with devm_clk_get_optional_enable() for
patch #1 and #2.
- replace devm_clk_get_optional() with devm_clk_bulk_get_optional_enable()
for patch #3.
- replace devm_clk_get_optional_enable() with devm_clk_get_optional() for patch #4.
- replace devm_clk_bulk_get_optional_enable() with devm_clk_bulk_get_optional() for patch #4.
- use PM_RUNTIME_ACQUIRE_IF_ENABLED()/PM_RUNTIME_ACQUIRE_ERR() guards to
replace pm_runtime_resume_and_get() and the manual error handling for both
the eDMA engine and per-channel devices.
- move dmaenginem_async_device_register() after runtime PM is enabled.
- move fsl_edma->drvdata->setup_irq() to the end of probe() and use dev_err_probe() on failure.
- check "irq > 0" instead of "irq" before synchronize_irq() in fsl_edma_chan_runtime_suspend().
- add fsl_chan txirq and errirq synchronize_irq() check in fsl_edma_chan_runtime_suspend().
- add comments explaining the pm_runtime_get_if_active() checks in the interrupt handlers.
- dropped patch #5 since this is a pre-existing issue that will be fixed in a separate patch.
- Link to v6: https://lore.kernel.org/r/[email protected]

Changes in V6:
- add synchronize_irq() before disabling the channel clock in fsl_edma_chan_runtime_suspend() per AI review comments.
- add pm_runtime_get_if_active() in interrupt handlers to ensure registers can be accessed correctly per AI review comments.
- remove manual fsl_edma3_detach_pd() call when device_link_add() fails. The devres framework will handle cleanup automatically on probe failure per AI review comments.
- clear fsl_chan->pd_dev_link after freeing the device link to prevent potential use-after-free issues per AI review comments..
- move fsl_edma->drvdata->setup_irq() atfer edma engine pm_runtime_resume_and_get().
- replace devm_clk_bulk_get_optional_enable() with devm_clk_get_optional()
and clk_bulk_prepare_enable() in order to use runtime PM for power
management later.
- replace devm_clk_get_optional_enable() with devm_clk_get_optional()
and devm_clk_prepare_enable() in order to use runtime PM for power
management later for patch #1 and #2.
- add new patch #5 fix use-after-free issue per AI review comments.
- modify the commit message for patch #1,#2 and #3.
- add Reviewed-by tag for patch #1,#2 and #3.
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in V5:
- add three new patches, two of which replace devm_clk_get_enabled() with devm_clk_get_optional_enabled(), and the other convert to clk bulk API.
- remove unnecessary flags FSL_EDMA_DRV_HAS_CHCLK and FSL_EDMA_DRV_HAS_DMACLK.
- remove redundant clk_disable_unprepare() due to the pm_runtime_put_sync_suspend() added.
- use devm_pm_runtime_enable() to replace pm_runtime_enable() and add return value check.
- add return value check for pm_runtime_get_sync().
- replace pm_runtime_get_sync() with pm_runtime_resume_and_get().
- replace DMAMUX clock handling with bulk clock API for edma engine runtime suspend/resume.
- remove dev_pm_domain_detach() when device_link_add() fail because the fsl_edma3_detach_pd() also call dev_pm_domain_detach().
- remove device_link_add() DL_FLAG_RPM_ACTIVE flag and pm_runtime_put_sync_suspend().
- add clk_bulk_disable_unprepare() for clk_prepare_enable() fail in fsl_edma_runtime_resume().
- remove the extra space before RUNTIME_PM_OPS.
- add skip channel comments for system suspend.
- add clk_disable_unprepare() for dmaclk at the end of probe function.
- add clk_bulk_disable_unprepare() for muxclk at the end of probe function.
- Link to v4: https://lore.kernel.org/imx/[email protected]/

Changes for V4:
- fix a typo dmaegnine/dmaengine in the subject.
- Link to v3: https://lore.kernel.org/imx/[email protected]/

Changes for V3:
- rebased onto commit 8f21d9da4670 ("Add linux-next specific files for 20250911") to align with latest changes.
- Remove pm_runtime_dont_use_autosuspend() from fsl_edma3_detach_pd(). because the autosuspend is not used.
- Move some edma channel registers initialization after the chan_dev pm_runtime_enable().
- Add clk_prepare_enable() return check in fsl_edma_runtime_resume.
- Add flag FSL_EDMA_DRV_HAS_DMACLK check in fsl_edma_runtime_resume/suspend().
- Link to v2: https://lore.kernel.org/imx/[email protected]/

Changes for V2:
- drop ret from fsl_edma_chan_runtime_suspend().
- drop ret from fsl_edma_chan_runtime_resume() and return clk_prepare_enable().
- add review tag
- Link to v1: https://lore.kernel.org/imx/[email protected]/

To: Frank Li <[email protected]>
To: Vinod Koul <[email protected]>
To: Joe Hattori <[email protected]>
Cc: Frank Li <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Joy Zou (5):
dmaengine: fsl-edma: use devm_clk_get_optional_enabled() for channel clock
dmaengine: fsl-edma: use devm_clk_get_optional() for DMA engine clock
dmaengine: fsl-edma: convert DMAMUX clock handling to bulk clock API
dmaengine: mcf-edma: enable runtime PM for eDMA engine and channel
dmaengine: fsl-edma: add runtime suspend/resume support

 drivers/dma/fsl-edma-common.c |  14 +-
 drivers/dma/fsl-edma-common.h |   4 +-
 drivers/dma/fsl-edma-main.c   | 340 ++++++++++++++++++++++++++++++++----------
 drivers/dma/mcf-edma-main.c   |  11 ++
 4 files changed, 278 insertions(+), 91 deletions(-)

---
base-commit: 2637bdec0535a2044cd830eba9a79363651d9043
change-id: 20260811-b4-edma-runtime-opt-mo-0d19aeeb5dbe

Best regards,

Signature · 1 line
Joy Zou <[email protected]>