From patchwork Thu Feb 22 11:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 204702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp190442dyb; Thu, 22 Feb 2024 03:37:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUoIazGOZgCFhMb8LeajBSmQtnZdi+edqtkkQ4v1smSn8lOqn1aQVKo6MCpRJ9FFVCj7YQVNiJwnxcXV8mkricxxdxFAg== X-Google-Smtp-Source: AGHT+IH6IOt73YBlQ3DqWCh2qExz0804LWIG2JFzN0LLHrPGIKVcvJiUbYVZkGf6bkLNN670+cYv X-Received: by 2002:a0c:dc88:0:b0:68f:47e2:c617 with SMTP id n8-20020a0cdc88000000b0068f47e2c617mr15668919qvk.36.1708601843544; Thu, 22 Feb 2024 03:37:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708601843; cv=pass; d=google.com; s=arc-20160816; b=y8dTw4WKQEsSuODhyXDDfwU99i9cQN2EHimdJhFLlv8AC6Dr32h25rGwgzW+B5udWp 8EiFcwQA8u9JWPOnbyYKXyl7LHnVTAAk59sbmUfCFEHlQyyrRZlS+odgVwi5cDuHKRhH k3mSUW7Fl42dXLn5o9grakEEm93aDon6AtXyoN5eJhNo3QBT5YBxE16SlkpS5McwGq73 xB/otHNDJmztcyWNcYAzCu7R6OdsQrSsSDvXL9WAqpdfef89YjHm4Tqr7vWsbxNLIB+B mAgVKQQgHLGBNgXtjauhogGs4aXUG3m68HIVVgc8ipxlnXxQsJ2fqVcTi57Xezu41hT7 WKGQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76426-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r4-20020a0562140c4400b0068fbd79ccfcsi878164qvj.139.2024.02.22.03.37.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:37:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76426-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76426-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 955A21C2251A for ; Thu, 22 Feb 2024 11:37:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBBF7535C2; Thu, 22 Feb 2024 11:33:47 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791598886581740386 X-GMAIL-MSGID: 1791598886581740386 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);