From patchwork Mon Jul 4 17:55:02 2011 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: 942872 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p64Hu8o1016682 for ; Mon, 4 Jul 2011 17:56:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758559Ab1GDR4V (ORCPT ); Mon, 4 Jul 2011 13:56:21 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:43518 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758483Ab1GDRzp (ORCPT ); Mon, 4 Jul 2011 13:55:45 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from eu_spt1 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0LNT00KE8LSTOG10@mailout3.w1.samsung.com>; Mon, 04 Jul 2011 18:55:42 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LNT00I1ALSTU9@spt1.w1.samsung.com>; Mon, 04 Jul 2011 18:55:41 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 67A7F27006A; Mon, 04 Jul 2011 19:56:15 +0200 (CEST) Date: Mon, 04 Jul 2011 19:55:02 +0200 From: Sylwester Nawrocki Subject: [PATCH v3 11/19] s5p-fimc: Add media operations in the capture entity driver In-reply-to: <1309802110-16682-1-git-send-email-s.nawrocki@samsung.com> To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: m.szyprowski@samsung.com, kyungmin.park@samsung.com, s.nawrocki@samsung.com, sw0312.kim@samsung.com, riverful.kim@samsung.com Message-id: <1309802110-16682-12-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.2.5 References: <1309802110-16682-1-git-send-email-s.nawrocki@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, 04 Jul 2011 17:56:36 +0000 (UTC) Add the link_setup handler for the camera capture video node. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/video/s5p-fimc/fimc-capture.c | 32 +++++++++++++++++++++++++++ drivers/media/video/s5p-fimc/fimc-core.h | 2 + 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index b193b7e..7c6c420 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -650,6 +650,37 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = { .vidioc_g_input = fimc_cap_g_input, }; +/* Media operations */ +static int fimc_link_setup(struct media_entity *entity, + const struct media_pad *local, + const struct media_pad *remote, u32 flags) +{ + struct video_device *vd = media_entity_to_video_device(entity); + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(remote->entity); + struct fimc_dev *fimc = video_get_drvdata(vd); + + if (WARN_ON(fimc == NULL)) + return 0; + + dbg("%s --> %s, flags: 0x%x. input: 0x%x", + local->entity->name, remote->entity->name, flags, + fimc->vid_cap.input); + + if (flags & MEDIA_LNK_FL_ENABLED) { + if (fimc->vid_cap.input != 0) + return -EBUSY; + fimc->vid_cap.input = sd->grp_id; + return 0; + } + + fimc->vid_cap.input = 0; + return 0; +} + +static const struct media_entity_operations fimc_media_ops = { + .link_setup = fimc_link_setup, +}; + /* fimc->lock must be already initialized */ int fimc_register_capture_device(struct fimc_dev *fimc, struct v4l2_device *v4l2_dev) @@ -724,6 +755,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc, if (ret) goto err_ent; + vfd->entity.ops = &fimc_media_ops; vfd->ctrl_handler = &ctx->ctrl_handler; ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); if (ret) { diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index 3606369..86288c8 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h @@ -305,6 +305,7 @@ struct fimc_m2m_device { * @reqbufs_count: the number of buffers requested in REQBUFS ioctl * @input_index: input (camera sensor) index * @refcnt: driver's private reference counter + * @input: capture input type, grp_id of attached subdev * @vid_dev_compat: true to enable full pipeline setup in the driver */ struct fimc_vid_cap { @@ -323,6 +324,7 @@ struct fimc_vid_cap { unsigned int reqbufs_count; int input_index; int refcnt; + u32 input; bool vid_dev_compat; };