From patchwork Wed Apr 15 01:30:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Helen Koike X-Patchwork-Id: 11489593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B186914B4 for ; Wed, 15 Apr 2020 01:31:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9025C20737 for ; Wed, 15 Apr 2020 01:31:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Kp8XbXHp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9025C20737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z5zYHNEm2AS3wqre/r+68Um5vuy4/GY7BzhoQLIIdwY=; b=Kp8XbXHpOJl4yd S+MMe5uYOqG4SHuPSOHPnWe5IgRzJlMPPG7ccDb7kTtpjv6kViUZgOauMij/f3ETk4w1aDV5QM1zt R6bGCOU/8Bj46HiTiy4HkxPOw6cco0IEyLhaZeHRqpakQCyTq0oemwRrnBTHNbFWKWkJk/w8h5tJw lfLlOy0ISHH1AO2qZYcXIYxS/kif38vEZ7rwxpku5jQFoYeHFWz5RVBDGst9ITxIMBHBIxM5IYYx0 UTVimb/zirQGbAa8Lo43N1M9Qman3KmYX6W/OZBM9UIT6AeUXLMbm2UTTbh3c0IgDRNsvITt4girq fMIOXHqkBqABWZ/d/a7w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOWtS-0004OF-Kv; Wed, 15 Apr 2020 01:31:10 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOWtP-0004KR-J4 for linux-rockchip@lists.infradead.org; Wed, 15 Apr 2020 01:31:09 +0000 Received: from floko.floko.floko (unknown [IPv6:2804:431:e7cc:79a2:b6f7:4033:5775:cc3a]) (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 E81B52A1C5B; Wed, 15 Apr 2020 02:31:03 +0100 (BST) From: Helen Koike To: linux-media@vger.kernel.org Subject: [PATCH v3 3/4] media: staging: rkisp1: use v4l2_pipeline_stream_{enable, disable} helpers Date: Tue, 14 Apr 2020 22:30:43 -0300 Message-Id: <20200415013044.1778572-4-helen.koike@collabora.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200415013044.1778572-1-helen.koike@collabora.com> References: <20200415013044.1778572-1-helen.koike@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200414_183107_770802_C58C9021 X-CRM114-Status: GOOD ( 13.38 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mchehab@kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Helen Koike , hans.verkuil@cisco.com, skhan@linuxfoundation.org, niklas.soderlund@ragnatech.se, kernel@collabora.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Use v4l2_pipeline_stream_{enable,disable} to call .s_stream() subdevice callbacks through the pipeline. Tested by streaming on Scarlet Chromebook. Signed-off-by: Helen Koike Reviewed-by: Niklas Söderlund --- Changes in v3: - rebase on top of new helpers prototypes Changes in v2: - rebase on top of new helpers prototypes drivers/staging/media/rkisp1/rkisp1-capture.c | 76 +------------------ 1 file changed, 3 insertions(+), 73 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-capture.c b/drivers/staging/media/rkisp1/rkisp1-capture.c index 24fe6a7888aa4..a18f1668e3563 100644 --- a/drivers/staging/media/rkisp1/rkisp1-capture.c +++ b/drivers/staging/media/rkisp1/rkisp1-capture.c @@ -838,71 +838,6 @@ static void rkisp1_return_all_buffers(struct rkisp1_capture *cap, spin_unlock_irqrestore(&cap->buf.lock, flags); } -/* - * rkisp1_pipeline_sink_walk - Walk through the pipeline and call cb - * @from: entity at which to start pipeline walk - * @until: entity at which to stop pipeline walk - * - * Walk the entities chain starting at the pipeline video node and stop - * all subdevices in the chain. - * - * If the until argument isn't NULL, stop the pipeline walk when reaching the - * until entity. This is used to disable a partially started pipeline due to a - * subdev start error. - */ -static int rkisp1_pipeline_sink_walk(struct media_entity *from, - struct media_entity *until, - int (*cb)(struct media_entity *from, - struct media_entity *curr)) -{ - struct media_entity *entity = from; - struct media_pad *pad; - unsigned int i; - int ret; - - while (1) { - pad = NULL; - /* Find remote source pad */ - for (i = 0; i < entity->num_pads; i++) { - struct media_pad *spad = &entity->pads[i]; - - if (!(spad->flags & MEDIA_PAD_FL_SINK)) - continue; - pad = media_entity_remote_pad(spad); - if (pad && is_media_entity_v4l2_subdev(pad->entity)) - break; - } - if (!pad || !is_media_entity_v4l2_subdev(pad->entity)) - break; - - entity = pad->entity; - if (entity == until) - break; - - ret = cb(from, entity); - if (ret) - return ret; - } - - return 0; -} - -static int rkisp1_pipeline_disable_cb(struct media_entity *from, - struct media_entity *curr) -{ - struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(curr); - - return v4l2_subdev_call(sd, video, s_stream, false); -} - -static int rkisp1_pipeline_enable_cb(struct media_entity *from, - struct media_entity *curr) -{ - struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(curr); - - return v4l2_subdev_call(sd, video, s_stream, true); -} - static void rkisp1_stream_stop(struct rkisp1_capture *cap) { int ret; @@ -929,11 +864,7 @@ static void rkisp1_vb2_stop_streaming(struct vb2_queue *queue) rkisp1_stream_stop(cap); media_pipeline_stop(&node->vdev.entity); - ret = rkisp1_pipeline_sink_walk(&node->vdev.entity, NULL, - rkisp1_pipeline_disable_cb); - if (ret) - dev_err(rkisp1->dev, - "pipeline stream-off failed error:%d\n", ret); + v4l2_pipeline_stream_disable(&node->vdev, &cap->rkisp1->pipe); rkisp1_return_all_buffers(cap, VB2_BUF_STATE_ERROR); @@ -1005,8 +936,7 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) rkisp1_stream_start(cap); /* start sub-devices */ - ret = rkisp1_pipeline_sink_walk(entity, NULL, - rkisp1_pipeline_enable_cb); + ret = v4l2_pipeline_stream_enable(&cap->vnode.vdev, &cap->rkisp1->pipe); if (ret) goto err_stop_stream; @@ -1019,7 +949,7 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) return 0; err_pipe_disable: - rkisp1_pipeline_sink_walk(entity, NULL, rkisp1_pipeline_disable_cb); + v4l2_pipeline_stream_disable(&cap->vnode.vdev, &cap->rkisp1->pipe); err_stop_stream: rkisp1_stream_stop(cap); v4l2_pipeline_pm_put(entity);