From patchwork Mon Apr 18 09:26:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 714561 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 p3I9RLiM002751 for ; Mon, 18 Apr 2011 09:27:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754112Ab1DRJ1K (ORCPT ); Mon, 18 Apr 2011 05:27:10 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:45192 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754143Ab1DRJ06 (ORCPT ); Mon, 18 Apr 2011 05:26:58 -0400 Received: from spt2.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LJU00KVXCWRE2@mailout1.w1.samsung.com>; Mon, 18 Apr 2011 10:26:52 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LJU009HHCWQA5@spt2.w1.samsung.com>; Mon, 18 Apr 2011 10:26:51 +0100 (BST) Received: from localhost.localdomain (davsrvsmtp01.bs.local [106.116.38.10]) by linux.samsung.com (Postfix) with ESMTP id 7B0B7270055; Mon, 18 Apr 2011 11:27:26 +0200 (CEST) Date: Mon, 18 Apr 2011 11:26:42 +0200 From: Marek Szyprowski Subject: [PATCH 5/7] v4l: s5p-fimc: add pm_runtime support In-reply-to: <1303118804-5575-1-git-send-email-m.szyprowski@samsung.com> To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Marek Szyprowski , Kyungmin Park , Andrzej Pietrasiwiecz , Sylwester Nawrocki , Arnd Bergmann , Kukjin Kim Message-id: <1303118804-5575-6-git-send-email-m.szyprowski@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.2.5 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT References: <1303118804-5575-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 18 Apr 2011 09:27:22 +0000 (UTC) This patch adds basic support for pm_runtime to s5p-fimc driver. PM runtime support is required to enable the driver on S5PV310 series with power domain driver enabled. Signed-off-by: Marek Szyprowski Signed-off-by: Kyungmin Park --- drivers/media/video/s5p-fimc/fimc-capture.c | 5 +++++ drivers/media/video/s5p-fimc/fimc-core.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 95f8b4e1..f697ed1 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -398,6 +399,8 @@ static int fimc_capture_open(struct file *file) if (fimc_m2m_active(fimc)) return -EBUSY; + pm_runtime_get_sync(&fimc->pdev->dev); + if (++fimc->vid_cap.refcnt == 1) { ret = fimc_isp_subdev_init(fimc, 0); if (ret) { @@ -428,6 +431,8 @@ static int fimc_capture_close(struct file *file) fimc_subdev_unregister(fimc); } + pm_runtime_put_sync(&fimc->pdev->dev); + return 0; } diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 6c919b3..ead5c0a 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1410,6 +1411,8 @@ static int fimc_m2m_open(struct file *file) if (fimc->vid_cap.refcnt > 0) return -EBUSY; + pm_runtime_get_sync(&fimc->pdev->dev); + fimc->m2m.refcnt++; set_bit(ST_OUTDMA_RUN, &fimc->state); @@ -1452,6 +1455,8 @@ static int fimc_m2m_release(struct file *file) if (--fimc->m2m.refcnt <= 0) clear_bit(ST_OUTDMA_RUN, &fimc->state); + pm_runtime_put_sync(&fimc->pdev->dev); + return 0; } @@ -1649,6 +1654,11 @@ static int fimc_probe(struct platform_device *pdev) goto err_req_region; } + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + pm_runtime_get_sync(&pdev->dev); + fimc->num_clocks = MAX_FIMC_CLOCKS - 1; /* Check if a video capture node needs to be registered. */ @@ -1706,6 +1716,8 @@ static int fimc_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s(): fimc-%d registered successfully\n", __func__, fimc->id); + pm_runtime_put_sync(&pdev->dev); + return 0; err_m2m: @@ -1740,6 +1752,8 @@ static int __devexit fimc_remove(struct platform_device *pdev) vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx); + pm_runtime_disable(&pdev->dev); + iounmap(fimc->regs); release_resource(fimc->regs_res); kfree(fimc->regs_res);