From patchwork Thu Aug 4 05:19:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh KUMAR X-Patchwork-Id: 1033872 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p745KpIu006237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 4 Aug 2011 05:21:12 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QoqMN-0001A1-7c; Thu, 04 Aug 2011 05:20:43 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QoqMM-0000Qh-Oa; Thu, 04 Aug 2011 05:20:42 +0000 Received: from eu1sys200aog106.obsmtp.com ([207.126.144.121]) by canuck.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1QoqMI-0000QN-QP for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2011 05:20:39 +0000 Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKTjosFcLpL11yaTw8W6euaCybvkEkyWY6@postini.com; Thu, 04 Aug 2011 05:20:38 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 29438D8; Thu, 4 Aug 2011 05:20:00 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas1.st.com [10.80.176.8]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E7438B8F; Thu, 4 Aug 2011 05:19:59 +0000 (GMT) Received: from [10.199.16.92] (10.199.16.92) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.2.234.1; Thu, 4 Aug 2011 13:19:59 +0800 Message-ID: <4E3A2BFC.3070907@st.com> Date: Thu, 4 Aug 2011 10:49:56 +0530 From: viresh kumar User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: Russell King - ARM Linux Subject: Re: [PATCH V2 08/20] dmaengine/amba-pl08x: support runtime PM References: <20110803123953.GB23953@n2100.arm.linux.org.uk> In-Reply-To: <20110803123953.GB23953@n2100.arm.linux.org.uk> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110804_012039_103935_3577EE67 X-CRM114-Status: GOOD ( 31.03 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.121 listed in list.dnswl.org] Cc: Pratyush ANAND , Rajeev KUMAR , Armando VISCONTI , Bhupesh SHARMA , "vinod.koul@intel.com" , "linus.walleij@linaro.org" , "linux-kernel@vger.kernel.org" , Vipin KUMAR , Shiraz HASHIM , Amit VIRDI , Vipul Kumar SAMAR , "viresh.linux@gmail.com" , Deepak SIKRI , "dan.j.williams@intel.com" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 04 Aug 2011 05:21:12 +0000 (UTC) On 08/03/2011 06:09 PM, Russell King - ARM Linux wrote: > On Mon, Aug 01, 2011 at 03:07:18PM +0530, Viresh Kumar wrote: >> Insert notifiers for the runtime PM API. With this the runtime PM layer kicks in >> to action where used. This will also handle enabling/disabling of interface >> clock (Code will be added in amba/bus.c by Russell King). > > I don't think this is correct... Sorry, but i couldn't get this comment completely. Mentioning clock stuff here is incorrect or mentioning about your code? Or both? Or something else? >> + pm_runtime_resume(&pl08x->adev->dev); > > Shouldn't this be pm_runtime_get_sync() ? >> + pm_runtime_suspend(&pl08x->adev->dev); > > And pm_runtime_put() ? >> + pm_runtime_suspend(&adev->dev); > > And pm_runtime_put() ? I have already fixed above in V3. > Lastly, we may want to make this even tighter to the actual period that > the DMA is being used, rather than just the period that a driver has > been allocated a channel. I'd rather have it done that way now (and > tested) so that we achieve maximal effect from runtime PM, rather than > having something which needs to be revisited again. > > IOW, if this is worth doing, then its worth doing properly first time. Correct. What about this one: --- drivers/dma/amba-pl08x.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 3fbaf0e..24353df 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -84,6 +84,7 @@ #include #include #include +#include #include #include #include @@ -405,6 +406,7 @@ pl08x_get_phy_channel(struct pl08x_driver_data *pl08x, return NULL; } + pm_runtime_get_sync(&pl08x->adev->dev); return ch; } @@ -418,6 +420,8 @@ static inline void pl08x_put_phy_channel(struct pl08x_driver_data *pl08x, /* Stop the channel and clear its interrupts */ pl08x_terminate_phy_chan(pl08x, ch); + pm_runtime_put(&pl08x->adev->dev); + /* Mark it as free */ ch->serving = NULL; spin_unlock_irqrestore(&ch->lock, flags); @@ -1855,6 +1859,9 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) goto out_no_pl08x; } + pm_runtime_set_active(&adev->dev); + pm_runtime_enable(&adev->dev); + /* Initialize memcpy engine */ dma_cap_set(DMA_MEMCPY, pl08x->memcpy.cap_mask); pl08x->memcpy.dev = &adev->dev; @@ -1993,6 +2000,8 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) dev_info(&pl08x->adev->dev, "DMA: PL%03x rev%u at 0x%08llx irq %d\n", amba_part(adev), amba_rev(adev), (unsigned long long)adev->res.start, adev->irq[0]); + + pm_runtime_put(&adev->dev); return 0; out_no_slave_reg: @@ -2011,6 +2020,9 @@ out_no_ioremap: dma_pool_destroy(pl08x->pool); out_no_lli_pool: out_no_platdata: + pm_runtime_put(&adev->dev); + pm_runtime_disable(&adev->dev); + kfree(pl08x); out_no_pl08x: amba_release_regions(adev);