Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp279805rdb; Thu, 22 Feb 2024 03:38:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWILyPZGwt+Z629V7s40+Rm6SiUL0tU/e8VVdR7k7snpzEaG0Cnz/VZxIpcLSl1oIohB++v+Y1UFCqsic8K/fqyMQKGYh3Q+0GR9LDaJQ== X-Google-Smtp-Source: AGHT+IFRsS/1F3d8C3fnoViqIsAYe7GpaZw3/EJFsV95A0wlcAWqAdn/zR0Kv8IN3biHrd77P0Pi X-Received: by 2002:a0c:db0c:0:b0:68f:9957:5c4d with SMTP id d12-20020a0cdb0c000000b0068f99575c4dmr6103835qvk.21.1708601907357; Thu, 22 Feb 2024 03:38:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708601907; cv=pass; d=google.com; s=arc-20160816; b=UmTnR2PzWwnwUsbYw3X8LOuzg7xb6/lmthaDo30pgdPpV0VnJ5Nul9POMiVL1ypq6z pGWwLhP05nBPhpCw7KQsRQlV4Pob/N5VJXt1n2xg5Pd/ISBt8GZAvni2QpRG7S25gdc+ +18cKLr0Di/20VYsx+PoSyjRiAO5AZe2izIBGHyMZOwi7DPXVESnKA0E2MqND7CK94W3 42lofPUxCJIpCbHqg/y9YsTjzIrbLcDc7AbNBrUDcv+NIxTJ1aLqJEoVs0ZToSt2x0BH YxSjAWJRI69uBEiE9vb2yZksT/x2Nfu0LQ9h279v2vOZA16KwGieKKmpjMGTDupnCwyG N8MA== 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=07yIeWWliUpA8c0qdo5yfrxhS/SYHwPJZKzuICs0MDk=; fh=7Ze5xPQXuwRxFNHD2ILqwMPZ5wjg3PcSuREjIh8VhDo=; b=DRD/ml9j+j2bHLW0Hb92NAW+QIdXAZq2ok9WdCZixc1T4EB368SXSLr7DThCpqxCaG dn8iKomD5xgwxxAFT1slHrCZCAxA/LgVMMYfj5Nm/9Cm8x7KJdFlL9REj+/aJOxlIHeZ ExsP7Gad6QYoFbHamMCkNK0uHG5WhHcXwAQqguVD4+eDLcu/rT8M2mt9PDufAW0+InaX etw/PWWvCVmilcykX8AswaHo8N3KFb7kwulQ9kiLFsdY6w2wv6AI/faipQ9PS4st2cqz nyR73Rc+GFky8UHZSUhWG7wAEzdyYNzvsR0vK00sDxlGQUhSJU/4dboDxrYI8ooqmY5G Bqpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GGY8q2v0; 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-76431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ey3-20020a0562140b6300b0068f44f8d47csi12975564qvb.45.2024.02.22.03.38.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:38:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GGY8q2v0; 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-76431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76431-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1D18B1C22F88 for ; Thu, 22 Feb 2024 11:38:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FA0846B91; Thu, 22 Feb 2024 11:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="GGY8q2v0" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 E1FB655C06; Thu, 22 Feb 2024 11:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601633; cv=none; b=jZ9mUwUjj6KEhHHzNbfeLv+g3L2gAQIqqopm+AJU4pge2Q+1kfZ5LrgQGEWOIcl7OTw2JKr80MaywUSXoNK8rTFnKw6Wve/3vkaIom1HUk2MZoFYVeItCBK5jEmvRRcFX7WeCroHeyeqHTP4wMA3lE/xwo7k5Ks0JbAVlpZ2j6Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601633; c=relaxed/simple; bh=H/EkA7/3egmQtAVJ8kpXMhqh9m1rOR7HNqmR3Y2RSMQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=d8YmUMwbfaKKKeVLjjbG7sQyofVmC3vZAlqgh7noZln12yH+mJuMmGNEOGiDJhJ4MB30/Bxf1FfTKGIUp9Ef6Ffc1YOL9x/UUwo2aESi6lEdMBvR637vijrtyo6tJC7Q98i0RCegf/Pm6SXAPKWJgcyw5Weq5X1b9gnodYBsmOg= 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=GGY8q2v0; arc=none smtp.client-ip=198.47.23.249 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 fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXcBr112384; Thu, 22 Feb 2024 05:33:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1708601618; bh=07yIeWWliUpA8c0qdo5yfrxhS/SYHwPJZKzuICs0MDk=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=GGY8q2v0GGG2TdAxW9e0rG32J/zPqicZB+4+qFFiW9SkrEoFIJgEHqBC3PU8Mnt2Q n1/oXVGZ3ud1xPKG0/96j8ZgI2vjf04AG/BPCzgS6Gm+OBHSWFK7BxRB3S/gasVW9I GDkdFcxBC3Urit6919wnDIexCd2B/OzziyowjJBw= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41MBXcca057410 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2024 05:33:38 -0600 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE115.ent.ti.com (10.64.6.36) 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:38 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE108.ent.ti.com (10.64.6.29) 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:38 -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 41MBXbdV128904; Thu, 22 Feb 2024 05:33:37 -0600 From: Jai Luthra Date: Thu, 22 Feb 2024 17:01:33 +0530 Subject: [PATCH RFC 17/21] SQUASH: media: cadence: csi2rx: Filter streams in get_frame_desc 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-17-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=2358; i=j-luthra@ti.com; h=from:subject:message-id; bh=H/EkA7/3egmQtAVJ8kpXMhqh9m1rOR7HNqmR3Y2RSMQ=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBl1zDqTSsc0XQfJv7yVhejPfmWz4ruBmlilBj4D RflUnBmTN2JAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZdcw6gAKCRBD3pH5JJpx RfMOD/wNoVMPKXlSXaKalMd1CChxqUuP4eilv37zylz9WI4RyefaWDUee+qinGlvXiedd013HV8 1LJs0krP7tOoB+X9XMG7znBKcgfxQUru3h2FM+AZ/DMHs9dWRKAP6Zsv1IouC71qSh4TwmorwJd nFMhXjHWq6YWIVInl8fsKNtl8/SSDth1AhoEkjQSZ1u53jFxyX56og38chxG1j4c3RWqkgN2MAn 4YfskgTHc03KdYjbRsB3bijc8yoGsUT5GNtg2du4FnsGdRR8RGFX4g20dHCgfspy6s50Qnh/m1w ajUbnTf/uvjEfmEB6ad0uyPfup5oGRAKF4WDJQp1KSkRW43kpcOU0qahPPXztZ+hcuGjnV5H1Qt 1nFNjwgePaITBeDcHDcIrkhvo5dlOWDys5B4i1ui/TyRBmHFUy1bryK6znl/22XHn1hZrS8bPYS gMIvgRTYJcnn9VkTg0YgEGCKpV8ZOdnPou/ncDArYGtst18cZ1Yr9B+hxnVyqNFF1JpnJeewT/Z oOM9JeOzJQKMoOHzzzH+VAcycOJhezpVB2B2ZD0TDGKNgRNb9oSCuuhTDBTMPqyNtsOrXOQoAg9 AUWUn9jSvYOQrMFDK5wp3cKTx0+PHk5dcN/emMeXont7Ogu1ySS3LSup5NHhlM72EfzPB8tC06U v/3T11rpsxwTkzQ== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 With routing and stream-aware APIs support in place, make sure to propagate frame descriptor information for only the subset of streams that are routed to the particular source pad. Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 50 +++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index f96638b9f252..a0ccdf72a3b2 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -670,8 +670,56 @@ static int csi2rx_get_frame_desc(struct v4l2_subdev *subdev, unsigned int pad, struct v4l2_mbus_frame_desc *fd) { struct csi2rx_priv *csi2rx = v4l2_subdev_to_csi2rx(subdev); + struct v4l2_mbus_frame_desc source_fd = {0}; + struct v4l2_subdev_route *route; + struct v4l2_subdev_state *state; + int ret; + + ret = csi2rx_get_frame_desc_from_source(csi2rx, &source_fd); + if (ret) + return ret; + + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; + + state = v4l2_subdev_lock_and_get_active_state(subdev); + + for_each_active_route(&state->routing, route) { + struct v4l2_mbus_frame_desc_entry *source_entry = NULL; + unsigned int i; + + if (route->source_pad != pad) + continue; + + for (i = 0; i < source_fd.num_entries; i++) { + if (source_fd.entry[i].stream == route->sink_stream) { + source_entry = &source_fd.entry[i]; + break; + } + } + + if (!source_entry) { + dev_err(csi2rx->dev, + "Failed to find stream from source frame desc\n"); + ret = -EPIPE; + goto err_missing_stream; + } - return csi2rx_get_frame_desc_from_source(csi2rx, fd); + fd->entry[fd->num_entries].stream = route->source_stream; + fd->entry[fd->num_entries].flags = source_entry->flags; + fd->entry[fd->num_entries].length = source_entry->length; + fd->entry[fd->num_entries].pixelcode = source_entry->pixelcode; + fd->entry[fd->num_entries].bus.csi2.vc = + source_entry->bus.csi2.vc; + fd->entry[fd->num_entries].bus.csi2.dt = + source_entry->bus.csi2.dt; + + fd->num_entries++; + } + +err_missing_stream: + v4l2_subdev_unlock_state(state); + + return ret; } static const struct v4l2_subdev_pad_ops csi2rx_pad_ops = { -- 2.43.0