Message ID | 20210922110453.25122-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | dmaengine: sh: rz-dmac: Add DMA clock handling | expand |
Hi Biju, On Wed, Sep 22, 2021 at 1:17 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > Currently, DMA clocks are turned on by the bootloader. > This patch adds support for DMA clock handling so that > the driver manages the DMA clocks. > > Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC") > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Thanks for your patch! > --- a/drivers/dma/sh/rz-dmac.c > +++ b/drivers/dma/sh/rz-dmac.c > @@ -18,6 +18,7 @@ > #include <linux/of_dma.h> > #include <linux/of_platform.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/slab.h> > #include <linux/spinlock.h> > > @@ -872,6 +873,9 @@ static int rz_dmac_probe(struct platform_device *pdev) > /* Initialize the channels. */ > INIT_LIST_HEAD(&dmac->engine.channels); > > + pm_runtime_enable(&pdev->dev); > + pm_runtime_resume_and_get(&pdev->dev); I know this cannot fail in the real world, but I think you should handle failure here, else the junior janitor crowd will send a follow-up patch adding such handling... > + > for (i = 0; i < dmac->n_channels; i++) { > ret = rz_dmac_chan_probe(dmac, &dmac->channels[i], i); > if (ret < 0) > @@ -925,6 +929,9 @@ static int rz_dmac_probe(struct platform_device *pdev) > channel->lmdesc.base_dma); > } > > + pm_runtime_put(&pdev->dev); > + pm_runtime_disable(&pdev->dev); > + > return ret; > } > > @@ -943,6 +950,8 @@ static int rz_dmac_remove(struct platform_device *pdev) > } > of_dma_controller_free(pdev->dev.of_node); > dma_async_device_unregister(&dmac->engine); > + pm_runtime_put(&pdev->dev); > + pm_runtime_disable(&pdev->dev); > > return 0; > } Regardless: Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert
Hi Geert, Thanks for the feedback. > Subject: Re: [PATCH] dmaengine: sh: rz-dmac: Add DMA clock handling > > Hi Biju, > > On Wed, Sep 22, 2021 at 1:17 PM Biju Das <biju.das.jz@bp.renesas.com> > wrote: > > Currently, DMA clocks are turned on by the bootloader. > > This patch adds support for DMA clock handling so that the driver > > manages the DMA clocks. > > > > Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC") > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Thanks for your patch! > > > --- a/drivers/dma/sh/rz-dmac.c > > +++ b/drivers/dma/sh/rz-dmac.c > > @@ -18,6 +18,7 @@ > > #include <linux/of_dma.h> > > #include <linux/of_platform.h> > > #include <linux/platform_device.h> > > +#include <linux/pm_runtime.h> > > #include <linux/slab.h> > > #include <linux/spinlock.h> > > > > @@ -872,6 +873,9 @@ static int rz_dmac_probe(struct platform_device > *pdev) > > /* Initialize the channels. */ > > INIT_LIST_HEAD(&dmac->engine.channels); > > > > + pm_runtime_enable(&pdev->dev); > > + pm_runtime_resume_and_get(&pdev->dev); > > I know this cannot fail in the real world, but I think you should handle > failure here, else the junior janitor crowd will send a follow-up patch > adding such handling... OK. Will handle the failure in next version. Regards, Biju > > > + > > for (i = 0; i < dmac->n_channels; i++) { > > ret = rz_dmac_chan_probe(dmac, &dmac->channels[i], i); > > if (ret < 0) > > @@ -925,6 +929,9 @@ static int rz_dmac_probe(struct platform_device > *pdev) > > channel->lmdesc.base_dma); > > } > > > > + pm_runtime_put(&pdev->dev); > > + pm_runtime_disable(&pdev->dev); > > + > > return ret; > > } > > > > @@ -943,6 +950,8 @@ static int rz_dmac_remove(struct platform_device > *pdev) > > } > > of_dma_controller_free(pdev->dev.of_node); > > dma_async_device_unregister(&dmac->engine); > > + pm_runtime_put(&pdev->dev); > > + pm_runtime_disable(&pdev->dev); > > > > return 0; > > } > > Regardless: > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux- > m68k.org > > In personal conversations with technical people, I call myself a hacker. > But when I'm talking to journalists I just say "programmer" or something > like that. > -- Linus Torvalds
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index f9f30cbeccbe..52a1419370d7 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -18,6 +18,7 @@ #include <linux/of_dma.h> #include <linux/of_platform.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/spinlock.h> @@ -872,6 +873,9 @@ static int rz_dmac_probe(struct platform_device *pdev) /* Initialize the channels. */ INIT_LIST_HEAD(&dmac->engine.channels); + pm_runtime_enable(&pdev->dev); + pm_runtime_resume_and_get(&pdev->dev); + for (i = 0; i < dmac->n_channels; i++) { ret = rz_dmac_chan_probe(dmac, &dmac->channels[i], i); if (ret < 0) @@ -925,6 +929,9 @@ static int rz_dmac_probe(struct platform_device *pdev) channel->lmdesc.base_dma); } + pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); + return ret; } @@ -943,6 +950,8 @@ static int rz_dmac_remove(struct platform_device *pdev) } of_dma_controller_free(pdev->dev.of_node); dma_async_device_unregister(&dmac->engine); + pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); return 0; }
Currently, DMA clocks are turned on by the bootloader. This patch adds support for DMA clock handling so that the driver manages the DMA clocks. Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC") Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/dma/sh/rz-dmac.c | 9 +++++++++ 1 file changed, 9 insertions(+)