From patchwork Wed Nov 24 12:51:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjugk manjugk X-Patchwork-Id: 353011 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAOCr4Cm023720 for ; Wed, 24 Nov 2010 12:53:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187Ab0KXMxJ (ORCPT ); Wed, 24 Nov 2010 07:53:09 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:50349 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753998Ab0KXMxJ (ORCPT ); Wed, 24 Nov 2010 07:53:09 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id oAOCr56f021485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2010 06:53:05 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id oAOCr3ed010951; Wed, 24 Nov 2010 06:53:03 -0600 (CST) Received: from localhost (glpp-machine.apr.dhcp.ti.com [172.24.137.105]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id oAOCr0f25707; Wed, 24 Nov 2010 06:53:00 -0600 (CST) From: "G, Manjunath Kondaiah" To: linux-omap@vger.kernel.org Cc: "G, Manjunath Kondaiah" , linux-arm-kernel@lists.infradead.org, Kevin Hilman , Tony Lindgren , Santosh Shilimkar , Benoit Cousson Subject: [PATCH v5 14/14] OMAP: PM: DMA: Enable runtime pm Date: Wed, 24 Nov 2010 18:21:50 +0530 Message-Id: <1290603110-14119-15-git-send-email-manjugk@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1290603110-14119-1-git-send-email-manjugk@ti.com> References: <1290603110-14119-1-git-send-email-manjugk@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 24 Nov 2010 12:53:11 +0000 (UTC) diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index a859c70..527ebfc 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -302,6 +303,7 @@ int omap_request_dma(int dev_id, const char *dev_name, unsigned long flags; struct omap_dma_lch *chan; + pm_runtime_get_sync(&pd->dev); spin_lock_irqsave(&dma_chan_lock, flags); for (ch = 0; ch < dma_chan_count; ch++) { if (free_ch == -1 && dma_chan[ch].dev_id == -1) { @@ -312,6 +314,7 @@ int omap_request_dma(int dev_id, const char *dev_name, } if (free_ch == -1) { spin_unlock_irqrestore(&dma_chan_lock, flags); + pm_runtime_put(&pd->dev); return -EBUSY; } chan = dma_chan + free_ch; @@ -403,6 +406,7 @@ void omap_free_dma(int lch) omap_clear_dma(lch); p->clear_sglist_mode(lch); } + pm_runtime_put(&pd->dev); spin_lock_irqsave(&dma_chan_lock, flags); dma_chan[lch].dev_id = -1; dma_chan[lch].next_lch = -1; @@ -734,6 +738,9 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev) dma_chan = d->chan; enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; + pm_runtime_enable(&pd->dev); + pm_runtime_get_sync(&pd->dev); + spin_lock_init(&dma_chan_lock); for (ch = 0; ch < dma_chan_count; ch++) { unsigned long flags; @@ -760,6 +767,14 @@ static int __devinit omap_system_dma_probe(struct platform_device *pdev) dma_chan[1].dev_id = 1; } p->show_dma_caps(); + + /* + * Note: If dma channels are reserved through boot paramters, + * then dma device is always enabled. + */ + if (!omap_dma_reserve_channels) + pm_runtime_put(&pd->dev); + return 0; }