linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Liao Yuanhong <liaoyuanhong@vivo.com>, <vkoul@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/6] dma:at_hdmac:Use devm_clk_get_enabled() helpers
Date: Fri, 23 Aug 2024 14:01:15 +0200	[thread overview]
Message-ID: <2bfd8efc-b52b-46c0-a43f-7acccfbee4f5@microchip.com> (raw)
In-Reply-To: <20240823101933.9517-2-liaoyuanhong@vivo.com>

On 23/08/2024 at 12:19, Liao Yuanhong wrote:
> Use devm_clk_get_enabled() instead of clk functions in at_hdmac.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>

With this patch, you remove the possibility to stop the clock during a 
suspend/resume cycle: why avoid to gain power during... low power phases?

NACK.

Regards,
   Nicolas

> ---
>   drivers/dma/at_hdmac.c | 22 +++++-----------------
>   1 file changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 40052d1bd0b5..b1e10541cb12 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -337,7 +337,6 @@ static inline u8 convert_buswidth(enum dma_slave_buswidth addr_width)
>    * struct at_dma - internal representation of an Atmel HDMA Controller
>    * @dma_device: dmaengine dma_device object members
>    * @regs: memory mapped register base
> - * @clk: dma controller clock
>    * @save_imr: interrupt mask register that is saved on suspend/resume cycle
>    * @all_chan_mask: all channels availlable in a mask
>    * @lli_pool: hw lli table
> @@ -347,7 +346,6 @@ static inline u8 convert_buswidth(enum dma_slave_buswidth addr_width)
>   struct at_dma {
>          struct dma_device       dma_device;
>          void __iomem            *regs;
> -       struct clk              *clk;
>          u32                     save_imr;
> 
>          u8                      all_chan_mask;
> @@ -1942,6 +1940,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>          int                     err;
>          int                     i;
>          const struct at_dma_platform_data *plat_dat;
> +       struct clk      *clk;
> 
>          /* setup platform data for each SoC */
>          dma_cap_set(DMA_MEMCPY, at91sam9rl_config.cap_mask);
> @@ -1975,20 +1974,16 @@ static int __init at_dma_probe(struct platform_device *pdev)
>          atdma->dma_device.cap_mask = plat_dat->cap_mask;
>          atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
> 
> -       atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
> -       if (IS_ERR(atdma->clk))
> -               return PTR_ERR(atdma->clk);
> -
> -       err = clk_prepare_enable(atdma->clk);
> -       if (err)
> -               return err;
> +       clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
> +       if (IS_ERR(clk))
> +               return PTR_ERR(clk);
> 
>          /* force dma off, just in case */
>          at_dma_off(atdma);
> 
>          err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
>          if (err)
> -               goto err_irq;
> +               return err;
> 
>          platform_set_drvdata(pdev, atdma);
> 
> @@ -2105,8 +2100,6 @@ static int __init at_dma_probe(struct platform_device *pdev)
>          dma_pool_destroy(atdma->lli_pool);
>   err_desc_pool_create:
>          free_irq(platform_get_irq(pdev, 0), atdma);
> -err_irq:
> -       clk_disable_unprepare(atdma->clk);
>          return err;
>   }
> 
> @@ -2130,8 +2123,6 @@ static void at_dma_remove(struct platform_device *pdev)
>                  atc_disable_chan_irq(atdma, chan->chan_id);
>                  list_del(&chan->device_node);
>          }
> -
> -       clk_disable_unprepare(atdma->clk);
>   }
> 
>   static void at_dma_shutdown(struct platform_device *pdev)
> @@ -2139,7 +2130,6 @@ static void at_dma_shutdown(struct platform_device *pdev)
>          struct at_dma   *atdma = platform_get_drvdata(pdev);
> 
>          at_dma_off(platform_get_drvdata(pdev));
> -       clk_disable_unprepare(atdma->clk);
>   }
> 
>   static int at_dma_prepare(struct device *dev)
> @@ -2194,7 +2184,6 @@ static int at_dma_suspend_noirq(struct device *dev)
> 
>          /* disable DMA controller */
>          at_dma_off(atdma);
> -       clk_disable_unprepare(atdma->clk);
>          return 0;
>   }
> 
> @@ -2223,7 +2212,6 @@ static int at_dma_resume_noirq(struct device *dev)
>          struct dma_chan *chan, *_chan;
> 
>          /* bring back DMA controller */
> -       clk_prepare_enable(atdma->clk);
>          dma_writel(atdma, EN, AT_DMA_ENABLE);
> 
>          /* clear any pending interrupt */
> --
> 2.25.1
> 
> 



  parent reply	other threads:[~2024-08-23 12:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23 10:19 [PATCH 0/6] dma:Use devm_clk_get_enabled() helpers Liao Yuanhong
2024-08-23 10:19 ` [PATCH 1/6] dma:at_hdmac:Use " Liao Yuanhong
2024-08-23 11:58   ` Jonathan Cameron
2024-08-23 12:01   ` Nicolas Ferre [this message]
2024-08-23 10:19 ` [PATCH 2/6] dma:dma-jz4780:Use " Liao Yuanhong
2024-08-23 12:01   ` Jonathan Cameron
2024-08-23 10:19 ` [PATCH 3/6] dma:imx-dma:Use " Liao Yuanhong
2024-08-23 12:07   ` Jonathan Cameron
2024-08-26 12:21   ` [PATCH v2 " Liao Yuanhong
2024-08-28 13:00     ` Vinod Koul
2024-08-23 10:19 ` [PATCH 4/6] dma:imx-sdma:Use " Liao Yuanhong
2024-08-23 12:08   ` Jonathan Cameron
2024-08-26 19:27     ` Frank Li
2024-08-28  8:52   ` [PATCH v2 " Liao Yuanhong
2024-08-23 10:19 ` [PATCH 5/6] dma:milbeaut-hdmac:Use " Liao Yuanhong
2024-08-23 12:09   ` Jonathan Cameron
2024-08-23 10:19 ` [PATCH 6/6] dma:uniphier-mdmac:Use " Liao Yuanhong
2024-08-23 12:10   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bfd8efc-b52b-46c0-a43f-7acccfbee4f5@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=liaoyuanhong@vivo.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).