From patchwork Wed Oct 17 04:12:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inderpal Singh X-Patchwork-Id: 12282 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7274723F6F for ; Wed, 17 Oct 2012 04:12:41 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id EACC4A182A6 for ; Wed, 17 Oct 2012 04:12:40 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so10765571iej.11 for ; Tue, 16 Oct 2012 21:12:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=lSzHqCzdJnAnLRfIA1u2zgoJl4F5oII66gjfDUjyAa8=; b=b8WEfTYImfZ/rcRskd6dMxgcFC4v2JJcs8SOgxuAwbp5RzAkbanbGRvYNWzQDz1IMa 5iBKwfj0ZYiM/Oiad5bmW/xrgTEi+47GyG+2IQ0QTQ2CteA6Yn/TDdYw/cg/61zQo9ds 3llMIVAgAnh0fmjOwF8V3yEyZUBJ8ZbLE2cgeHiS4PpsErkRHPeWh2XaChmFgesGNEro bY9aWVf5w1dG6rgEnvlgzo5BFIEKiO5dcHUv05J6vYN0OeZ/gJy4ywYcbXe9Lk3MXUR4 6Q56J5g90JYcAlkyScqgdAtorma88qKx2HAOTXlJciDLSFuYDkkNHYggQ8verAlUSVnS hpPw== Received: by 10.43.7.132 with SMTP id oo4mr13453543icb.6.1350447160121; Tue, 16 Oct 2012 21:12:40 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp834766igt; Tue, 16 Oct 2012 21:12:39 -0700 (PDT) Received: by 10.68.209.136 with SMTP id mm8mr52365181pbc.146.1350447158905; Tue, 16 Oct 2012 21:12:38 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id rr1si29500273pbc.98.2012.10.16.21.12.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Oct 2012 21:12:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) client-ip=209.85.220.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) smtp.mail=inderpal.singh@linaro.org Received: by mail-pa0-f50.google.com with SMTP id hz11so7358342pad.37 for ; Tue, 16 Oct 2012 21:12:38 -0700 (PDT) Received: by 10.66.80.65 with SMTP id p1mr47274167pax.20.1350447158040; Tue, 16 Oct 2012 21:12:38 -0700 (PDT) Received: from inder-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPS id it5sm11830336pbc.10.2012.10.16.21.12.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Oct 2012 21:12:37 -0700 (PDT) From: Inderpal Singh To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jassisinghbrar@gmail.com, vinod.koul@intel.com, boojin.kim@samsung.com, kgene.kim@samsung.com, patches@linaro.org Subject: [PATCH] DMA: PL330: Add runtime pm support Date: Wed, 17 Oct 2012 09:42:31 +0530 Message-Id: <1350447151-16737-1-git-send-email-inderpal.singh@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmh29wM1VjoomZfEDgeKLQNpFWaXfqPRdMssMryhLxYJYYQ7GY2iHQZ0iKwRnbN7zc1AVwn At the pl330's probe point the device is already in runtime resume state. Hence to manage the device with runtime, the probe should do pm_runtime_put and remove should do pm_runtime_get to balance with probe. And in between, the device is being get/put at alloc_chan_resources and free_chan_resources. Signed-off-by: Inderpal Singh --- This patch is based on slave-dma's next branch and on top of the clean up patches at [1]. [1] https://lkml.org/lkml/2012/10/5/169 drivers/dma/pl330.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 2ee1538..5ae19ea 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "dmaengine.h" #define PL330_MAX_CHAN 8 @@ -2384,6 +2385,8 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) struct dma_pl330_dmac *pdmac = pch->dmac; unsigned long flags; + pm_runtime_get_sync(pdmac->ddma.dev); + spin_lock_irqsave(&pch->lock, flags); dma_cookie_init(chan); @@ -2392,6 +2395,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) pch->pl330_chid = pl330_request_channel(&pdmac->pif); if (!pch->pl330_chid) { spin_unlock_irqrestore(&pch->lock, flags); + pm_runtime_put(pdmac->ddma.dev); return -ENOMEM; } @@ -2470,6 +2474,8 @@ static void pl330_free_chan_resources(struct dma_chan *chan) list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool); spin_unlock_irqrestore(&pch->lock, flags); + + pm_runtime_put(pch->dmac->ddma.dev); } static enum dma_status @@ -2974,6 +2980,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pi->pcfg.data_bus_width / 8, pi->pcfg.num_chan, pi->pcfg.num_peri, pi->pcfg.num_events); + pm_runtime_put(pd->dev); + return 0; probe_err5: @@ -3017,6 +3025,8 @@ static int __devexit pl330_remove(struct amba_device *adev) return -EBUSY; } + pm_runtime_get(pdmac->ddma.dev); + dma_async_device_unregister(&pdmac->ddma); amba_set_drvdata(adev, NULL);