Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp279502rdb; Thu, 22 Feb 2024 03:37:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWVtqDKZsJkzy8Wma77obvrlnw11ytWv91vFglvv8hYPUEmidEz6iyLVA+bX59WWTNvLNiGYQH5W/5svb4pOIyDXgM976mkzdn66fv54w== X-Google-Smtp-Source: AGHT+IFs4U1Ur6G2odoepBYoEenDgD/JL7FGFT3TInAxdJ2WZomcOq5l5+vP5yjCHcSeT/e9057M X-Received: by 2002:a17:90a:c912:b0:299:275c:6031 with SMTP id v18-20020a17090ac91200b00299275c6031mr17113460pjt.2.1708601858564; Thu, 22 Feb 2024 03:37:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708601858; cv=pass; d=google.com; s=arc-20160816; b=Sw1il24cob80tsUvtY5+NYtqSWGiKjOo8YdS2cSjt1Za+pFnbz4cD1Q+eXc4j4X/cv 35WivwOB4lm43hTTPaJ+qINJ/i4U0sdtc+etK9Oaex4ZZErH0w+VntpvT5RqrRDFpFOI rE05lcJ/B2ayK9ADj/SCYxuJ4yEO6X4B5R2K1KL56oDvbBG4/4nv1uWmGeJZSNQiJHz7 dN9J/P4JA6NpQYWajGU6JPbGzrZqIvYejYVc6UJhi9z8i3pkwvUYZHPxNQkLozqhME/K K3hq7CE4VUqrgnmEJPviw8vx+in4U0VWqZppRrfvBDs23l1qadfVZskw1tqzjdMVcJ6T zgPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=IIFOD7uZml1cZMulax2MAWAdhtL2PDteL/pS7c8c1vg=; fh=7Ze5xPQXuwRxFNHD2ILqwMPZ5wjg3PcSuREjIh8VhDo=; b=xg/Eb/BKAiLtmpzfZmfQIeJ/AjBVFF+8FH6ZmrKFuB71NAG2N2zxxQXkc47XnvNuWy FU4XXewNHy2rVoXz2mg0vp20gBKX5wLZsQwrWBsDvpMWoMEe9McT/n+nsX57eERVAeVV 7TYITE653UqDSAFI4L2CiH0ORBkrmnE0+h950KIo9V5EZ6FNk3d9FhDWWROF3Uma6or8 WmOU3LK/vPBEVqwU9d64/0HL5XkA2RWrMmhAs/9OybHEqyH5HH6Gck8g7crQ5oqo93g1 cZl13FnnmuBRLkKVI+hJBcOkHMB9wegECTpQgEB4zP8OWzcmSjG3i3wGmdxzJad2a+Nj m0jA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=BmrmLF48; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-76426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e9-20020a17090a804900b0029a38eabbe5si1847562pjw.94.2024.02.22.03.37.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:37:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=BmrmLF48; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-76426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DE244B238CB for ; Thu, 22 Feb 2024 11:36:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EC7C5103C; Thu, 22 Feb 2024 11:33:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="BmrmLF48" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFB8E4F211; Thu, 22 Feb 2024 11:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601624; cv=none; b=si0rI4W/YO5l2MInnY++S2j5FTmVZktCZ6bOW6+9gG4BI66KMKdtg91+VKrK6psaHG0muJCJi/xYRNccmSXWYI5KmPwB+BCsqTP/u+eOqeO6jNFuU3iOzRDd5p+6AEIEpXHKbQpztx+lVK1gkD09513TgMvIkLywtzFfAq2pwkE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601624; c=relaxed/simple; bh=Na3FxDoFmJwKP2/Z+thurEhYoJ1q8QJrM9yU72Ifm1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=D62ht26OeX17n7Unh3tsWurhQZ9HfCqiDzD4OnZgHfrIWNlcJOXNqTcXI5j7Q6q2neL2t8PG/PKgZSsW62sTM+GZVg7+/JQK9ma1LWVAu3xlx4qd4VdImnaPmyJ8UkdOR4u7IODWFndvCE7EK8kkTbaEunf7UOxH5GSosATHNhg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=BmrmLF48; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXUlt018090; Thu, 22 Feb 2024 05:33:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1708601610; bh=IIFOD7uZml1cZMulax2MAWAdhtL2PDteL/pS7c8c1vg=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=BmrmLF48vcqVdT/ofpJwNIkxU+/ZO2A9IQIBp/tyiyidCR8PIPoeQ32ThbUtZKc40 QnLjJ3rYGNGcDsdYByOMZeL7L1jlj/pCF/RXP+8e8VSUNzz6LYYysqzorkjPoBU/0j SHJ3FYLBRL6X4Ef4ec28CMGn4r8G7YTvv5pXxqnU= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41MBXUYo007860 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2024 05:33:30 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 22 Feb 2024 05:33:30 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 22 Feb 2024 05:33:30 -0600 Received: from localhost (jluthra.dhcp.ti.com [172.24.227.217]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXTYO128794; Thu, 22 Feb 2024 05:33:29 -0600 From: Jai Luthra Date: Thu, 22 Feb 2024 17:01:29 +0530 Subject: [PATCH RFC 13/21] media: cadence: csi2rx: Use new enable stream APIs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240222-multistream-v1-13-1837ed916eeb@ti.com> References: <20240222-multistream-v1-0-1837ed916eeb@ti.com> In-Reply-To: <20240222-multistream-v1-0-1837ed916eeb@ti.com> To: Tomi Valkeinen , Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Vaishnav Achath , Maxime Ripard , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , Vignesh Raghavendra , Aradhya Bhatia , Devarsh Thakkar , Changhuang Liang , Jack Zhu , Julien Massot , Jayshri Pawar , Jai Luthra X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2442; i=j-luthra@ti.com; h=from:subject:message-id; bh=Na3FxDoFmJwKP2/Z+thurEhYoJ1q8QJrM9yU72Ifm1A=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBl1zDm2nXX6+ZXmetmJ7ki72+WsjqiulUvHkFgP 7xWNQ1geB2JAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZdcw5gAKCRBD3pH5JJpx RcT2D/4rgzQuq3zQkIoE4qSuyAw/GfQ5cFCro98zAa2VhMJO/n0wTwFbWUo/VPzWURWzKXhjpzp 5xD0K2Qqbos8K2JkTF03EiQopJQqmW9wc90Nm2tLAS3YV5ew6dQZEzozANRhAwno18bgLsEPLwU rsUJiTq5QXoPXsr1P69BaQTb4eK3WrQxZ2XUrX0oSkKu3TUjSRIPDgzz0wt/UqI75waW1dE43mK Z1ieDwTK5LsoAk+zx5/zP4ci7mz1sz+uDkKPF+DidedAvnExGYEL/W+La5118U0FZASGrWpn2WA ttIyVbXuBzwVnZVlfTp1p1vEPZtrZKdRAaeMUGMlukh7TY++9dy8KsYQZtvAAXzPj7Vf3BXollu YdzGgDiKLi+CFkmEyi5SpBMvVv1NQM0ofoPcRDXBE/47iJXSCETF2ZlDx3VGMOOOkt70paChXCO wyZQWr8Y+9i0d90C0rEuXc8G6Sizeib/kf/qlgbYH6/E9m+9+vzCrAueicMQ78peTk6iQaSy8vj 6aKF6WZUcm5Kt4STi1kItSQkFWGGe4h5BumBZhIDGpEcyAU4evBkWFB0/K5ORhRI+9luCOKvI15 f1m0fFtFMC3UzXHjYfUDBNRNKSi2XMDuxqzAsQniShysnw4bnANlpoZtGlBjUm4mc3cWmxJjTdP 8Oa6AczAV9QRhiQ== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 The enable_streams() API in v4l2 supports passing a bitmask to enable each pad/stream combination individually on any media subdev instead of doing s_stream(1) to start all streams on the subdev at once. This API is implemented by ds90ub960 driver (FPDLink deser) and thus the caller (cdns-csi2x) is required to use it. For now we only enable stream0. Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 989924dba9a9..bac341881e41 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -226,10 +226,18 @@ static int csi2rx_configure_ext_dphy(struct csi2rx_priv *csi2rx) static int csi2rx_start(struct csi2rx_priv *csi2rx) { unsigned int i; + struct media_pad *remote_pad; unsigned long lanes_used = 0; u32 reg; int ret; + remote_pad = media_pad_remote_pad_first(&csi2rx->pads[CSI2RX_PAD_SINK]); + if (!remote_pad) { + dev_err(csi2rx->dev, + "Failed to find connected source\n"); + return -ENODEV; + } + ret = clk_prepare_enable(csi2rx->p_clk); if (ret) return ret; @@ -313,7 +321,8 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) reset_control_deassert(csi2rx->sys_rst); - ret = v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, true); + ret = v4l2_subdev_enable_streams(csi2rx->source_subdev, + remote_pad->index, BIT(0)); if (ret) goto err_disable_sysclk; @@ -341,6 +350,7 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) static void csi2rx_stop(struct csi2rx_priv *csi2rx) { + struct media_pad *remote_pad; unsigned int i; u32 val; int ret; @@ -369,8 +379,12 @@ static void csi2rx_stop(struct csi2rx_priv *csi2rx) reset_control_assert(csi2rx->p_rst); clk_disable_unprepare(csi2rx->p_clk); - if (v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, false)) + remote_pad = media_pad_remote_pad_first(&csi2rx->pads[CSI2RX_PAD_SINK]); + if (!remote_pad || + v4l2_subdev_disable_streams(csi2rx->source_subdev, + remote_pad->index, BIT(0))) { dev_warn(csi2rx->dev, "Couldn't disable our subdev\n"); + } if (csi2rx->dphy) { writel(0, csi2rx->base + CSI2RX_DPHY_LANE_CTRL_REG); -- 2.43.0