[PATCH v3 15/18] dmaengine: ste_dma40: Use power domain for LCLA SRAM
Frank Li
Frank.li at oss.nxp.com
Mon Sep 21 09:36:09 PDT 2026
On Mon, Sep 21, 2026 at 12:48:21AM +0200, Linus Walleij wrote:
> Replace the LCLA ESRAM regulator with runtime PM.
>
> Use the SRAM device that owns the ESRAM34 power domain.
>
> Hold that domain while DMA transfers are active. The DMA controller is
> runtime PM IRQ-safe, so keep taking explicit LCLA runtime PM references
> from the descriptor preparation path instead of relying on a runtime PM
> device link from the atomic transfer path.
>
> Add a stateless device link so system PM keeps the DMA controller ordered
> after the LCLA SRAM supplier.
>
> Suggested-by: Frank Li <Frank.li at oss.nxp.com>
> Assisted-by: LLM
> Signed-off-by: Linus Walleij <linusw at kernel.org>
> ---
> drivers/dma/ste_dma40.c | 130 ++++++++++++++++++++++++++++++++----------------
> 1 file changed, 88 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
> index eda3f91741ed..2841af5b160b 100644
> --- a/drivers/dma/ste_dma40.c
> +++ b/drivers/dma/ste_dma40.c
> @@ -21,8 +21,8 @@
> #include <linux/of.h>
> #include <linux/of_address.h>
> #include <linux/of_dma.h>
> +#include <linux/of_platform.h>
> #include <linux/amba/bus.h>
> -#include <linux/regulator/consumer.h>
>
> #include "dmaengine.h"
> #include "ste_dma40.h"
> @@ -383,6 +383,7 @@ struct d40_lli_pool {
> * @node: List entry.
> * @is_in_client_list: true if the client owns this descriptor.
> * @cyclic: true if this is a cyclic job
> + * @lcla_pm_active: LCLA SRAM power domain is held for this descriptor.
> *
> * This descriptor is used for both logical and physical transfers.
> */
> @@ -402,6 +403,7 @@ struct d40_desc {
>
> bool is_in_client_list;
> bool cyclic;
> + bool lcla_pm_active;
> };
>
> /**
> @@ -571,7 +573,8 @@ struct d40_gen_dmac {
> * to phy_chans entries.
> * @plat_data: Pointer to provided platform_data which is the driver
> * configuration.
> - * @lcpa_regulator: Pointer to hold the regulator for the esram bank for lcla.
> + * @lcla_dev: SRAM device for the ESRAM bank used by LCLA.
> + * @lcla_link: Device link to keep system PM ordered against LCLA.
> * @phy_res: Vector containing all physical channels.
> * @lcla_pool: lcla pool settings and data.
> * @lcpa_base: The virtual mapped address of LCPA.
> @@ -606,7 +609,8 @@ struct d40_base {
> struct d40_chan **lookup_log_chans;
> struct d40_chan **lookup_phy_chans;
> struct stedma40_platform_data *plat_data;
> - struct regulator *lcpa_regulator;
> + struct device *lcla_dev;
> + struct device_link *lcla_link;
> /* Physical half channels */
> struct d40_phy_res *phy_res;
> struct d40_lcla_pool lcla_pool;
> @@ -628,6 +632,36 @@ static struct device *chan2dev(struct d40_chan *d40c)
> return &d40c->chan.dev->device;
> }
>
> +static void d40_transfer_runtime_get(struct d40_base *base)
> +{
> + pm_runtime_get_sync(base->dev);
should use pm_runtime_resume_and_get() also? avoid need call
pm_runtime_put_noidle() to maintance ref count.
pm_runtime_get_sync() many return failure, why needn't check return value
here.
Frank
> +}
> +
> +static int d40_lcla_runtime_get(struct d40_base *base)
> +{
> + if (!base->lcla_dev)
> + return 0;
> +
> + return pm_runtime_resume_and_get(base->lcla_dev);
> +}
> +
More information about the linux-arm-kernel
mailing list