Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4484477imb; Wed, 6 Mar 2019 14:46:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxoe0doZstF1+VxjgQXg4TMakFogIlgfq8/CpgXyls5BD0L/6w7v1nCOP2Gg1CbDUJGLxaS X-Received: by 2002:a65:50c8:: with SMTP id s8mr1441163pgp.308.1551912381719; Wed, 06 Mar 2019 14:46:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551912381; cv=none; d=google.com; s=arc-20160816; b=ej43aUJCYQPEaG3W0F1/J3NK7d90fSVFTqAyVdYagWe9tZSNj6lgF8wUetQRNcodAS WMlDLA5rjT2UKi1nM80toZ9gvoiRtz6Y+MBXP6ALyDnnyN1Z2G6pbSb6RUn+modF1nkW R0tVQPi+tCchzIZDZlheICGik2mKTtYATi3e0PsU8XsrGaa+BHNsBW+f+1Jec05UuUN2 Dcg2lgZG21Ozbqsin7gEfYiCYohKFwxB0RFsPlN2Vi9HzbFGe/pb9pqn49eBPwjo7DE7 8GbG/p05STphXdBrbdF1UFenorSmBpA89Ut6KLpMBlGrvsCU38HeKpWcBaLgyLdZXwvR 2p0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HIdxhNw5gNm1mtEbwZA6LPRNcf3xKCK5v60D3mF8/J4=; b=hZgsAUjVXnIS9uNFDUvOMiyAqKvDwSLQsbIcJLz2yB8U0rbSHzkmS449JjjpneJJht 1qhzupEJa3AtwTKBZGZvl+T1YLQtT5xBJj5Eosyr4mZdvVTw5xYDFvJhtL67xIEiTb7V TTeFcJOpvrMi5lma8EClikZ7rHNEExhyqUftz5i+fz4up2AXr+kXyoh2UM0cW2uoP7w6 rajymLQEnvTVYNPYaGF7XmKG+W/C7D/8v5cVgZaCrleLV+QN7hbE6wFlpRcVWlBdvHNz x9wTzsJxYYx8k93kzcqgCXE9rIyq1yw1yk9P184c+zQ+xHGW+b8zjfRs+2pbBhesgLzP Utkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si2596217pfn.106.2019.03.06.14.46.06; Wed, 06 Mar 2019 14:46:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbfCFWoA (ORCPT + 99 others); Wed, 6 Mar 2019 17:44:00 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60884 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfCFWoA (ORCPT ); Wed, 6 Mar 2019 17:44:00 -0500 Received: from localhost.localdomain (unknown [IPv6:2804:431:9719:798c:6bb0:a97a:4a09:e6d8]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: koike) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7232E28036E; Wed, 6 Mar 2019 22:43:49 +0000 (GMT) From: Helen Koike To: linux-media@vger.kernel.org Cc: lucmaga@gmail.com, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com, Hans Verkuil , kernel@collabora.com Subject: [PATCH 7/8] media: vimc: stream: init/terminate the first entity Date: Wed, 6 Mar 2019 19:42:43 -0300 Message-Id: <20190306224244.21070-8-helen.koike@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190306224244.21070-1-helen.koike@collabora.com> References: <20190306224244.21070-1-helen.koike@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The s_stream callback was not being called for the first entity in the stream pipeline array. Instead of verifying the type of the node (video or subdevice) and calling s_stream from the second entity in the pipeline, do this process for all the entities in the pipeline for consistency. The previous code was not a problem because the first entity is a video device and not a subdevice, but this patch prepares vimc to allow setting some configuration in the entity before calling s_stream. Signed-off-by: Helen Koike --- drivers/media/platform/vimc/vimc-streamer.c | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c index b7c1fdef5f0d..5a3bda62fbc8 100644 --- a/drivers/media/platform/vimc/vimc-streamer.c +++ b/drivers/media/platform/vimc/vimc-streamer.c @@ -46,19 +46,18 @@ static struct media_entity *vimc_get_source_entity(struct media_entity *ent) */ static void vimc_streamer_pipeline_terminate(struct vimc_stream *stream) { - struct media_entity *entity; + struct vimc_ent_device *ved; struct v4l2_subdev *sd; while (stream->pipe_size) { stream->pipe_size--; - entity = stream->ved_pipeline[stream->pipe_size]->ent; - entity = vimc_get_source_entity(entity); + ved = stream->ved_pipeline[stream->pipe_size]; stream->ved_pipeline[stream->pipe_size] = NULL; - if (!is_media_entity_v4l2_subdev(entity)) + if (!is_media_entity_v4l2_subdev(ved->ent)) continue; - sd = media_entity_to_v4l2_subdev(entity); + sd = media_entity_to_v4l2_subdev(ved->ent); v4l2_subdev_call(sd, video, s_stream, 0); } } @@ -89,18 +88,24 @@ static int vimc_streamer_pipeline_init(struct vimc_stream *stream, } stream->ved_pipeline[stream->pipe_size++] = ved; + if (is_media_entity_v4l2_subdev(ved->ent)) { + sd = media_entity_to_v4l2_subdev(ved->ent); + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret && ret != -ENOIOCTLCMD) { + pr_err("subdev_call error %s\n", ved->ent->name); + vimc_streamer_pipeline_terminate(stream); + return ret; + } + } + entity = vimc_get_source_entity(ved->ent); /* Check if the end of the pipeline was reached*/ if (!entity) return 0; + /* Get the next device in the pipeline */ if (is_media_entity_v4l2_subdev(entity)) { sd = media_entity_to_v4l2_subdev(entity); - ret = v4l2_subdev_call(sd, video, s_stream, 1); - if (ret && ret != -ENOIOCTLCMD) { - vimc_streamer_pipeline_terminate(stream); - return ret; - } ved = v4l2_get_subdevdata(sd); } else { vdev = container_of(entity, -- 2.20.1