From patchwork Mon Mar 11 19:00:19 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: 2249931 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 2B890DF5B1 for ; Mon, 11 Mar 2013 19:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754446Ab3CKTBE (ORCPT ); Mon, 11 Mar 2013 15:01:04 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:57325 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754427Ab3CKTBC (ORCPT ); Mon, 11 Mar 2013 15:01:02 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJI00MNVFHIVX60@mailout4.samsung.com>; Tue, 12 Mar 2013 04:01:01 +0900 (KST) X-AuditID: cbfee61a-b7fa86d0000045ae-79-513e29ed35b7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 95.FF.17838.DE92E315; Tue, 12 Mar 2013 04:01:01 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJI00F2XFGXUP00@mmp2.samsung.com>; Tue, 12 Mar 2013 04:01:00 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, myungjoo.ham@samsung.com, shaik.samsung@gmail.com, arun.kk@samsung.com, a.hajda@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH RFC 04/11] s5p-fimc: Update graph traversal for entities with multiple source pads Date: Mon, 11 Mar 2013 20:00:19 +0100 Message-id: <1363028426-2771-5-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1363028426-2771-1-git-send-email-s.nawrocki@samsung.com> References: <1363028426-2771-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e+xoO5bTbtAg+4jEha31p1jtfh46jar xdmmN+wWPRu2slrMOL+PyeJ24wo2i8Nv2lkt1u2cxO7A4bFz1l12j74tqxg9Pm+SC2CO4rJJ Sc3JLEst0rdL4MqY8auPuaBLsOJEU3gD4x3eLkZODgkBE4m+iZdYIGwxiQv31rN1MXJxCAlM Z5SYd+8QE0hCSKCDSeLs8zIQm03AUKL3aB8jiC0iIC/xpPcGWAOzwDlGiTc3XrOCJIQFUiQW X+8FaubgYBFQlVi7TBUkzCvgKnGwuR8sLCGgIDFnkg1ImFPATWLNkwVsEKtcJX78PMM+gZF3 ASPDKkbR1ILkguKk9FxDveLE3OLSvHS95PzcTYzgMHomtYNxZYPFIUYBDkYlHl7Fb7aBQqyJ ZcWVuYcYJTiYlUR4V26yCRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOe6DVOlBIID2xJDU7NbUg tQgmy8TBKdXAyKCqFp8Xqfw0rN0x7IzRT6lQ/313Ovr3Oc2LcF5lqsXp7jJvjvjNR9Mvlbqc ndU65YmIw84tH9nj2/KOKD4SiF7PmiWYe347c1bqyxiP02btfB/WvTJ1vGx/SSdO9zSLMldD RKS65zKz6REs77guTzh6b293Zu6Oj0x9u5Wv5Tz8YPmvo4tDiaU4I9FQi7moOBEASpJOCh8C AAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We cannot assume that the passed entity the fimc_pipeline_prepare() function is supposed to start the media graph traversal from will always have its sink pad at pad index 0. Find the starting media entity's sink pad by iterating over its all pads and checking the pad flags. This ensures proper handling of FIMC, FIMC-LITE and FIMC-IS-ISP subdevs that have more than one sink and one source pad. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-fimc/fimc-mdevice.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index 19cd628..0a7c95b 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c @@ -47,7 +47,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, static void fimc_pipeline_prepare(struct fimc_pipeline *p, struct media_entity *me) { - struct media_pad *pad = &me->pads[0]; struct v4l2_subdev *sd; int i; @@ -55,15 +54,21 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, p->subdevs[i] = NULL; while (1) { - if (!(pad->flags & MEDIA_PAD_FL_SINK)) - break; + struct media_pad *pad = NULL; + + /* Find remote source pad */ + for (i = 0; i < me->num_pads; i++) { + struct media_pad *spad = &me->pads[i]; + if (!(spad->flags & MEDIA_PAD_FL_SINK)) + continue; + pad = media_entity_remote_source(spad); + if (pad) + break; + } - /* source pad */ - pad = media_entity_remote_source(pad); if (pad == NULL || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV) break; - sd = media_entity_to_v4l2_subdev(pad->entity); switch (sd->grp_id) { @@ -84,8 +89,9 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, pr_warn("%s: Unknown subdev grp_id: %#x\n", __func__, sd->grp_id); } - /* sink pad */ - pad = &sd->entity.pads[0]; + me = &sd->entity; + if (me->num_pads == 1) + break; } }