From patchwork Thu Feb 22 11:31:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 204712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp195120dyb; Thu, 22 Feb 2024 03:47:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV71Dk2UEh+Kf36OF+LTPiPSlpwvQpYEtlsDJ+cZuTDhT/isX73IEyx5RES79hV1edWgRG7ePjkr2zkuQ92V//wQo8MHA== X-Google-Smtp-Source: AGHT+IFtQRch1IglAV+fK6S/w8rIkY1w8L3fkT2CklX88JJGA0Ydn/jKcOGg0Rx0aPwke4q2Eywd X-Received: by 2002:a17:906:cb96:b0:a3e:97d4:256b with SMTP id mf22-20020a170906cb9600b00a3e97d4256bmr6997956ejb.10.1708602467115; Thu, 22 Feb 2024 03:47:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708602467; cv=pass; d=google.com; s=arc-20160816; b=YhG9i5lZx2IfyhoKB1SvjF1c6AUQLO6PAQugGB2jdwVoYUK4bFOS16aDduvgtmCMmn Jbur8m9dEMiG5iNmv0lk5V5Y0Rl6mKRIwFjcJZD5rXJeIWRvXSw+jy2vxryv/p5baOA5 /0qNBAxrPlQzEeD69Dgq1J7JS5vphWFs7y3jw2TUQ2Ooy+VQ5l8y2QOX4tIHOQ+JZxuS TC+RPs4UbHXhvSlp5u/OaogbgKXHYQYkv+DJCvqwK+zQxvfikfUQ3/nwtGgduxjznJJm rfAhMjtU8zcuwyFQbVSifbk5DASfBdqHTCLQs8GH+O9WlELWwlFLigFuOVI1FPwO+KHH 4goA== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76431-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qw39-20020a1709066a2700b00a3e9a48cd38si3851712ejc.0.2024.02.22.03.47.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:47:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76431-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76431-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 42C061F28EE1 for ; Thu, 22 Feb 2024 11:38:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 116BD56466; Thu, 22 Feb 2024 11:33:57 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791599540460854630 X-GMAIL-MSGID: 1791599540460854630 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 = {