From patchwork Thu Nov 3 16:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 15008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp639021wru; Thu, 3 Nov 2022 09:36:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qgAj65YDrinlIbvvoS8JeEPADm5CfRSVCl5AQ8OxlNJAHppvA6szwHe30FjPUotvngKdL X-Received: by 2002:a17:907:2c72:b0:7a4:a4b4:9fcb with SMTP id ib18-20020a1709072c7200b007a4a4b49fcbmr29977309ejc.403.1667493362365; Thu, 03 Nov 2022 09:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667493362; cv=none; d=google.com; s=arc-20160816; b=Q+WcY+EBX0xekwh3mck1RLbe/tpiEkTClsOCRxBA6m48xOO8FJLU7OFnpwGS7rpruu lByf8v+ppAcjgMsJNhcTaGc5eLBgPNKUHAIuuFhiyeJ9MFTIYD2OTjVyCFr7onEGyLGI 1VSB8N4A6hQNwDXBW8ASf8E46Rv1+I7boLNJy3adai66K7erAFsYGjr5IUGv1mHcA7vG wumUy+ALdxU7tlua/9trVYyohTs+wWuIF0srxZ20pSwa7YgYHYguQsS1KMXsVS570B4l dqSLtiXiECMiA8M/NZCDYqeRWouwB+LTeIQGFTad6Ob4Hcmy3yPRA+j0TksMhnq+vbM6 fp0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=in7uetC4h5WySD5rMh6Pq2uXdKtNked87BK2BfLbx8Q=; b=ddlvlJF5IascaUHD07Xv3C4pD7q1cUc3an2w8HDjhY3wE0+nmPhw5Yaid8RD+ySamh HQbxVYEHM97kSZkAjZah5ntc31RGF1djBwKTd0YuCAHKY2G07PaUnLu8KvmaZOytA2vm tMcIDiD90FuawRbFh2Mkj+d7J80HRdrsIBSCmpOyPOt3dYDjvyuPSU0uhSkVXZnfp9fe FNkALC5N/J5mdyu7kbhGt5B505q3DxIL2Y45UbLytJbu4NhfZiULSdZ6WjzOJvav48PT R7aB3oP+A13BTiUaVK2g/VJXK03rol5z8/MOb1Wmr5BQcoChOayblbo2eyCTfOYoVv20 epnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bzVs7SoX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19-20020a170906c15300b007a087ccd275si1560653ejc.384.2022.11.03.09.35.38; Thu, 03 Nov 2022 09:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bzVs7SoX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232415AbiKCQdb (ORCPT + 99 others); Thu, 3 Nov 2022 12:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiKCQcM (ORCPT ); Thu, 3 Nov 2022 12:32:12 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9280CF12; Thu, 3 Nov 2022 09:32:10 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7D723240007; Thu, 3 Nov 2022 16:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1667493129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=in7uetC4h5WySD5rMh6Pq2uXdKtNked87BK2BfLbx8Q=; b=bzVs7SoXQt8RVIsA3hRbJOjlKZW2m5pidNhyhjSV7tICLEqlWLsubnjPpWd2D857Hq9vep A3aLyADFA6z+uPFKIXEvAOs2HEriZTu2CAkqHuQSs8wJSvi/rVg63hSg0Za2WfOKHVcMmn DU2bgHF6NCuJcGaToZd3/PKRPVceqoAgnV/BRs4yYly+N+fjRxW1Dc1ERL7OHmoQK/XHxg jt3WtV/uUYjsqQrqprZ/nQJ3mUJBeQ7Pk4oSrqfgen4Oo8Jynm/d4HOmAS2ghKI2QMFYNS hRvGH+P/3zRoVF03l15V7iSzFuiyahnA1AJXKcl/mLujyHw3UfGXKL6SLjCBtw== From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Cc: Yong Deng , Paul Kocialkowski , Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: [PATCH v7 20/28] media: sun6i-csi: Get bridge subdev directly in capture stream ops Date: Thu, 3 Nov 2022 17:31:05 +0100 Message-Id: <20221103163113.245462-21-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221103163113.245462-1-paul.kocialkowski@bootlin.com> References: <20221103163113.245462-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748493519942067803?= X-GMAIL-MSGID: =?utf-8?q?1748493519942067803?= The remote subdev connected to the capture video device is always our bridge, so get the bridge subdev directly instead of using a dedicated helper (which is removed by this commit). Signed-off-by: Paul Kocialkowski Acked-by: Jernej Skrabec --- .../sunxi/sun6i-csi/sun6i_csi_capture.c | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c index 35a30fcbad98..e59a219ca480 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c @@ -42,22 +42,6 @@ void sun6i_csi_capture_format(struct sun6i_csi_device *csi_dev, *field = csi_dev->capture.format.fmt.pix.field; } -static struct v4l2_subdev * -sun6i_csi_capture_remote_subdev(struct sun6i_csi_capture *capture, u32 *pad) -{ - struct media_pad *remote; - - remote = media_pad_remote_pad_first(&video->pad); - - if (!remote || !is_media_entity_v4l2_subdev(remote->entity)) - return NULL; - - if (pad) - *pad = remote->index; - - return media_entity_to_v4l2_subdev(remote->entity); -} - /* Format */ static const struct sun6i_csi_capture_format sun6i_csi_capture_formats[] = { @@ -822,8 +806,8 @@ static int sun6i_csi_capture_start_streaming(struct vb2_queue *queue, struct sun6i_csi_capture *capture = &csi_dev->capture; struct sun6i_csi_capture_state *state = &capture->state; struct video_device *video_dev = &capture->video_dev; + struct v4l2_subdev *subdev = &csi_dev->bridge.subdev; struct device *dev = csi_dev->dev; - struct v4l2_subdev *subdev; int ret; state->sequence = 0; @@ -832,12 +816,6 @@ static int sun6i_csi_capture_start_streaming(struct vb2_queue *queue, if (ret < 0) goto error_state; - subdev = sun6i_csi_capture_remote_subdev(capture, NULL); - if (!subdev) { - ret = -EINVAL; - goto error_media_pipeline; - } - /* PM */ ret = pm_runtime_resume_and_get(dev); @@ -886,12 +864,10 @@ static void sun6i_csi_capture_stop_streaming(struct vb2_queue *queue) { struct sun6i_csi_device *csi_dev = vb2_get_drv_priv(queue); struct sun6i_csi_capture *capture = &csi_dev->capture; + struct v4l2_subdev *subdev = &csi_dev->bridge.subdev; struct device *dev = csi_dev->dev; - struct v4l2_subdev *subdev; - subdev = sun6i_csi_capture_remote_subdev(capture, NULL); - if (subdev) - v4l2_subdev_call(subdev, video, s_stream, 0); + v4l2_subdev_call(subdev, video, s_stream, 0); sun6i_csi_capture_disable(csi_dev); sun6i_csi_capture_irq_disable(csi_dev);