From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24ABCC52D7C for ; Fri, 23 Aug 2024 12:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZYl8Kx/cU6C1FNAlVdJDk1qz6TdeOTesqwW0wqSBQtE=; b=NePbwKIEuW+0o4P26S9fk9Ovkm Suc4+cBMefkeMi9puEDcRfiIecLAtj2eR//FawXiwf1bat7WOfDF9jDdxmiiIOxatmO6p1oNxWsI7 oqeAMdDyzYKPor0USB7tGfFjHGZbiH8PpfOF43aEBePA+Bz2u05HTnD/X6v2N7Ua2MdOl8774R11g 0gE7nw5vUKNayt9swn0CLgzvV6QeH75Tbq8Hws+a5Czzag1CDNC9fek/PEW90+wILBSWmvQzUYx9A Y8kfrU0fhPFb2S++bXRDswMgW8xM0vrE5IippN+vMZkRtfxfkO7+D9BR+BGNHT+0duHHdbW38dIxT Th1FsGHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shSzE-0000000Gchp-25br; Fri, 23 Aug 2024 12:01:48 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shSyR-0000000GcQQ-0DYT for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 12:01:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1724414459; x=1755950459; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=zE6JwXga1hToBEut5TxRw4ysd3nAAB29rvqujAOt11k=; b=bj+hxM0waY+FxLgsR4RrqXy7cZM/9JJ4uu1x66TNVqeFcauB22NEaDq8 yLLXTtUwBtcHZhddRKN72RrNKarGW8tGucUWZl4sOiwgg/SZjowyJmKRh mqKKiR7fslLrexaj4NGUEGFg/V/Yb8dba6pAIJ8YYzDB6h3qayxdfqDv8 5XpeQd+8wO7FFlkq9U7lPbGZv5dy1UTSAfVZqZMey8s24Zuy1tFDdXH9E 2zCiPDZ4LSeegKs9NexqesMIBHPsorm7LpYx9M078P3uhCJAbwZL235z5 3U5Zyyoh+FvTblGQ6dDeoB6JWDYw34dXhmppGEMPAuK8vBuOoIbm8A5lH w==; X-CSE-ConnectionGUID: KWwyA0NBRzO+vNq7XEnCpw== X-CSE-MsgGUID: GqZHtg4dREmSm3J/70wCIQ== X-IronPort-AV: E=Sophos;i="6.10,170,1719903600"; d="scan'208";a="31490812" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Aug 2024 05:00:57 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 23 Aug 2024 05:00:53 -0700 Received: from [10.159.224.217] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 23 Aug 2024 05:00:51 -0700 Message-ID: <2bfd8efc-b52b-46c0-a43f-7acccfbee4f5@microchip.com> Date: Fri, 23 Aug 2024 14:01:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/6] dma:at_hdmac:Use devm_clk_get_enabled() helpers To: Liao Yuanhong , CC: , , References: <20240823101933.9517-1-liaoyuanhong@vivo.com> <20240823101933.9517-2-liaoyuanhong@vivo.com> Content-Language: en-US, fr-FR From: Nicolas Ferre Organization: microchip In-Reply-To: <20240823101933.9517-2-liaoyuanhong@vivo.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_050059_207177_5DEAF030 X-CRM114-Status: GOOD ( 18.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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 > >