From patchwork Tue Mar 26 17:29:45 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: 2341811 Return-Path: X-Original-To: patchwork-linux-media@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 A72C7400E6 for ; Tue, 26 Mar 2013 17:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753382Ab3CZRac (ORCPT ); Tue, 26 Mar 2013 13:30:32 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:53845 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753163Ab3CZRaS (ORCPT ); Tue, 26 Mar 2013 13:30:18 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKA00D1B3AAT340@mailout1.samsung.com>; Wed, 27 Mar 2013 02:30:18 +0900 (KST) X-AuditID: cbfee61b-b7f076d0000034b6-d4-5151db29757b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 81.67.13494.92BD1515; Wed, 27 Mar 2013 02:30:18 +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 <0MKA004BH39YZW90@mmp1.samsung.com>; Wed, 27 Mar 2013 02:30:17 +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: [PATCH v2 03/10] s5p-fimc: Update graph traversal for entities with multiple source pads Date: Tue, 26 Mar 2013 18:29:45 +0100 Message-id: <1364318992-20562-4-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1364318992-20562-1-git-send-email-s.nawrocki@samsung.com> References: <1364318992-20562-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t9jAV2t24GBBt+WsVrcWneO1eLjqdus FtfP21mcbXrDbtGzYSurxYzz+5gsbjeuYLM4/Kad1WLdzknsDpweO2fdZffo27KK0ePzJrkA 5igum5TUnMyy1CJ9uwSujElTnrMXtAhXLH5xkL2BcQ5/FyMnh4SAicSTx4/ZIGwxiQv31gPZ XBxCAosYJVZP3MMK4XQwSfTMOskCUsUmYCjRe7SPEcQWEZCXeNJ7A6yDWeAJo8SfEweYQBLC AskS22/tYwWxWQRUJQ7/aASyOTh4BdwkPp3KATElBBQk5kyyAangFHCXWH7jCNh4IaCK5w1b 2CYw8i5gZFjFKJpakFxQnJSea6RXnJhbXJqXrpecn7uJERxSz6R3MK5qsDjEKMDBqMTDyxEW ECjEmlhWXJl7iFGCg1lJhFdwY2CgEG9KYmVValF+fFFpTmrxIUZpDhYlcd6DrdaBQgLpiSWp 2ampBalFMFkmDk6pBkaHc/krNGbpOemV//zn9OKZlHP52yKljHOHhP4rC86ZGHbuef+9i78i a4Omf/rb86IzsexZnUvpLv8HuRJz5ZMSL15nj7wbV9Gz6OHHpp8K/QZ7HrL8ObSxwlyio4Pf WXDti8zm3MlGK02lL1v/lWT/rSgwrUB0q8jEhlnvj/Dc8Tfn9TJ02q/EUpyRaKjFXFScCABP CVl+JQIAAA== 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 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index b689166..abd3ad3 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c @@ -40,14 +40,13 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, bool on); /** * fimc_pipeline_prepare - update pipeline information with subdevice pointers - * @fimc: fimc device terminating the pipeline + * @me: media entity terminating the pipeline * * Caller holds the graph mutex. */ 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; } }