From patchwork Tue Mar 26 16:06:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2339751 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B71013FC54 for ; Tue, 26 Mar 2013 16:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965736Ab3CZQG2 (ORCPT ); Tue, 26 Mar 2013 12:06:28 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:15306 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759842Ab3CZQG1 (ORCPT ); Tue, 26 Mar 2013 12:06:27 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MK900LQQZEP3C70@mailout2.samsung.com>; Wed, 27 Mar 2013 01:06:25 +0900 (KST) X-AuditID: cbfee61b-b7f076d0000034b6-7b-5151c7810541 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AE.DB.13494.187C1515; Wed, 27 Mar 2013 01:06:25 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MK9002D9ZE9JZ80@mmp1.samsung.com>; Wed, 27 Mar 2013 01:06:25 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, myungjoo.ham@samsung.com, dh09.lee@samsung.com, shaik.samsung@gmail.com, arun.kk@samsung.com, a.hajda@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [REVIEW PATCH 1/3] s5p-fimc: Use video entity for marking media pipeline as streaming Date: Tue, 26 Mar 2013 17:06:04 +0100 Message-id: <1364313966-18868-2-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1364313966-18868-1-git-send-email-s.nawrocki@samsung.com> References: <1364313966-18868-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t9jAd3G44GBBhtWy1rcWneO1eLjqdus FtfP21mcbXrDbtGzYSurxYzz+5gsbjeuYLM4/Kad1WLdzknsDpweO2fdZffo27KK0ePzJrkA 5igum5TUnMyy1CJ9uwSujL5381gLbslWPN39jKmB8ZREFyMnh4SAicSko0cYIWwxiQv31rN1 MXJxCAksYpRo3Tkdyulgkph37gQLSBWbgKFE79E+sA4RAXmJJ703wIqYBZ4wSvw5cYAJJCEs kCDxacNZNhCbRUBVor95HpjNK+AmceDRYuYuRg6gdQoScybZgIQ5BdwlNu9+yQoSFgIqWfPV YgIj7wJGhlWMoqkFyQXFSem5RnrFibnFpXnpesn5uZsYwSH1THoH46oGi0OMAhyMSjy8HGEB gUKsiWXFlbmHGCU4mJVEeAU3BgYK8aYkVlalFuXHF5XmpBYfYpTmYFES5z3Yah0oJJCeWJKa nZpakFoEk2Xi4JRqYGSrdZB5sUV10WKtTbku1gZGt/p0bb2O295SeTXvrXi/y8IjUbF3Dx8v q/nSk3jMS/y1RcwM65bbLFzPePpdPxzY+2yDJNOWl0XtOTI/m7P3z/6ipPbWw3CZVlLbP5fa 2fNN/qX6PXXWn88XlbNhnVf2pPrAHr20k0HrLJy9go3FNm5eULtijhJLcUaioRZzUXEiAH2r QIMlAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org It doesn't matter whether we start from the sensor of from the video node entity. Remove use of pipeline->subdevs array where possible, so we can partly drop dependency on struct fimc_pipeline in the fimc-lite module, which is also used by the exynos5-is driver. Also make sure we revert any media entity pipeline operations when vb2_streamon() function fails. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-fimc/fimc-capture.c | 27 +++++++++++++++--------- drivers/media/platform/s5p-fimc/fimc-lite.c | 9 ++++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c index 87b6842..257afc1 100644 --- a/drivers/media/platform/s5p-fimc/fimc-capture.c +++ b/drivers/media/platform/s5p-fimc/fimc-capture.c @@ -1230,36 +1230,43 @@ static int fimc_cap_streamon(struct file *file, void *priv, { struct fimc_dev *fimc = video_drvdata(file); struct fimc_pipeline *p = &fimc->pipeline; - struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR]; + struct fimc_vid_cap *vc = &fimc->vid_cap; + struct media_entity *entity = &vc->vfd.entity; int ret; if (fimc_capture_active(fimc)) return -EBUSY; - ret = media_entity_pipeline_start(&sd->entity, p->m_pipeline); + ret = media_entity_pipeline_start(entity, p->m_pipeline); if (ret < 0) return ret; - if (fimc->vid_cap.user_subdev_api) { + if (vc->user_subdev_api) { ret = fimc_pipeline_validate(fimc); - if (ret < 0) { - media_entity_pipeline_stop(&sd->entity); - return ret; - } + if (ret < 0) + goto err_p_stop; } - return vb2_streamon(&fimc->vid_cap.vbq, type); + + ret = vb2_streamon(&vc->vbq, type); + if (!ret) + return ret; + +err_p_stop: + media_entity_pipeline_stop(entity); + return ret; } static int fimc_cap_streamoff(struct file *file, void *priv, enum v4l2_buf_type type) { struct fimc_dev *fimc = video_drvdata(file); - struct v4l2_subdev *sd = fimc->pipeline.subdevs[IDX_SENSOR]; int ret; ret = vb2_streamoff(&fimc->vid_cap.vbq, type); + if (ret == 0) - media_entity_pipeline_stop(&sd->entity); + media_entity_pipeline_stop(&fimc->vid_cap.vfd.entity); + return ret; } diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c index 8ebefdb..40733e0 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite.c @@ -800,20 +800,20 @@ static int fimc_lite_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { struct fimc_lite *fimc = video_drvdata(file); - struct v4l2_subdev *sensor = fimc->pipeline.subdevs[IDX_SENSOR]; + struct media_entity *entity = &fimc->vfd.entity; struct fimc_pipeline *p = &fimc->pipeline; int ret; if (fimc_lite_active(fimc)) return -EBUSY; - ret = media_entity_pipeline_start(&sensor->entity, p->m_pipeline); + ret = media_entity_pipeline_start(entity, p->m_pipeline); if (ret < 0) return ret; ret = fimc_pipeline_validate(fimc); if (ret) { - media_entity_pipeline_stop(&sensor->entity); + media_entity_pipeline_stop(entity); return ret; } @@ -824,12 +824,11 @@ static int fimc_lite_streamoff(struct file *file, void *priv, enum v4l2_buf_type type) { struct fimc_lite *fimc = video_drvdata(file); - struct v4l2_subdev *sd = fimc->pipeline.subdevs[IDX_SENSOR]; int ret; ret = vb2_streamoff(&fimc->vb_queue, type); if (ret == 0) - media_entity_pipeline_stop(&sd->entity); + media_entity_pipeline_stop(&fimc->vfd.entity); return ret; }