From nobody Sat Jun 27 16:15:51 2026 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012055.outbound.protection.outlook.com [40.93.195.55]) (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 361893CDBAA; Mon, 8 Jun 2026 14:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.195.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928953; cv=fail; b=k9m0r9gDULX31D17aFRAi3VB3EhAFd43LP9aUoWH6ndY3pVhFqWyXlLWRfEMIUg1KYgEfekzU5pl72BnU3hHwrbjISUCPH9c6Bp1oP4y/vRUFI0KX/UoVGWsBxjeYhM2nVB0MfZyDtt98gAqcl1OJChJvExM6rcxI0gskpm08TA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928953; c=relaxed/simple; bh=ihIjYekTERBLXDwYon1aMsAPVM1SpXG3A+jrxK+6bnc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P45oS2//A11lAnM4/jruBZrndbAn3KK2L/pRevQ9FeDCyDQq4QlM+rZ1it7zBm8hVsIo59pnIVzSNvepNh7iRqxCCkBjWGrbKjOrd/tZXhDia50uYqh/kZsH1RTHwY5Q8Ow+uzT86eu8QOLwD076Mx0Nqgs0LntnEqtWhorKPDg= ARC-Authentication-Results: i=2; 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=LG6/RmwI; arc=fail smtp.client-ip=40.93.195.55 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="LG6/RmwI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=khcfsyuBMDTptQzsZ2bHcF//16hVbwZdoV/Ydz+MlJBcwWY0e4T9o9ld+4SOUTBK781/g9c/cv0uoGx2x5WK12uJ5dM9MuMdnIBZ4WHG8NogU0J3djwdRlUGqhDQWdOFxQCRitXZAU1yA4TZGXlY6jOGfsJlZpvT6OuCWTz1ioy0UtOHWtxd01yBLx36WZj3vl7jWfrFoD/gV6V7N8bZmtJk3kDujRvUzMR3i1uwpwiyI/UU41zfbRf3qc2LO64H5L+CXwLht+22JYLbOiV40/W7aVYSJqOTwu3vUoDfw3GAaiEelDnTbC5PBa/PR1QXqvB9Vb3Enm6W8jPNSJldxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5nsypIxkl3wh1TwYFLY4riDZ82BhRN8v+O6aZOPmQkE=; b=A3bhHb5MLyatbV3VdMI1DkQRw2+Juq+GwUNolaQQSQ7Z49Mumj5MesXl4LYzRDboLDOOGWtSUiZ6XUDK4PU/0A4O2gVrz/ZZwTvG0p6k5Jum+fV5warI9zeSgs94vGYNXZxbPfDn8h5c6EC5aiYIJ/IYfLQWi8Oim9x9Zi3DWCkCW7FvLKd1XDZECiOlKSrnjtlOHugbENNrlVEQBKpiEN3D/plWyI8P/iqs3E/RE/HYRFot797C6KvpfurqhDoZRlW/kG3IFyHVAXSI75e9IJwF5jHJmMSzPBq1m7qO0X5FSbe/aRNsfhuyViVrsjfJ1Ta3hLso+hxGqNEvAg8+Lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.194) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5nsypIxkl3wh1TwYFLY4riDZ82BhRN8v+O6aZOPmQkE=; b=LG6/RmwI8BqEn/Kan1nL6tNZXBKsOtwLHPGSewA5MPXkmedTsQiSoQuKnxkO9QpQoOHgExUbmlznCStmZPWc8TpePOSdEeExh/rAosZwk/V1tgfihmo0mWMq+Oaf/EYC1X2v4hBweY0cqJUMHIM2elkOuFuKOZxuCPkuTj1ZdP8= Received: from SA9PR03CA0002.namprd03.prod.outlook.com (2603:10b6:806:20::7) by SA2PR10MB4521.namprd10.prod.outlook.com (2603:10b6:806:117::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.13; Mon, 8 Jun 2026 14:29:10 +0000 Received: from SN1PEPF0002BA4C.namprd03.prod.outlook.com (2603:10b6:806:20:cafe::72) by SA9PR03CA0002.outlook.office365.com (2603:10b6:806:20::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.92.13 via Frontend Transport; Mon, 8 Jun 2026 14:29:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.23.194) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.194 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.194; helo=lewvzet200.ext.ti.com; pr=C Received: from lewvzet200.ext.ti.com (198.47.23.194) by SN1PEPF0002BA4C.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.7 via Frontend Transport; Mon, 8 Jun 2026 14:29:09 +0000 Received: from DLEE212.ent.ti.com (157.170.170.114) by lewvzet200.ext.ti.com (10.4.14.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:09 -0500 Received: from DLEE200.ent.ti.com (157.170.170.75) by DLEE212.ent.ti.com (157.170.170.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:09 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE200.ent.ti.com (157.170.170.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37 via Frontend Transport; Mon, 8 Jun 2026 09:29:09 -0500 Received: from ws.dhcp.ti.com (ws.dhcp.ti.com [172.24.233.149]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 658ET2bD3251356; Mon, 8 Jun 2026 09:29:06 -0500 From: Rishikesh Donadkar To: CC: , , , , , , , , Subject: [PATCH 1/4] media: i2c: ds90ub960: Enable CSI TX1 port Date: Mon, 8 Jun 2026 19:58:58 +0530 Message-ID: <20260608142901.3971821-2-r-donadkar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260608142901.3971821-1-r-donadkar@ti.com> References: <20260608142901.3971821-1-r-donadkar@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4C:EE_|SA2PR10MB4521:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a6f9849-1b00-4ac5-e4f7-08dec56a4de9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|82310400026|376014|3023799007|56012099006|6133799003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: hkAk14MdyhpEUbM0Tw6kXcxS1xlDNN/GlAWOuQW4QIa62ajy1XlRJakaS+868xynaCay3HG9a+1NowxWlgNrFwQycWpfy17aEi40fVuyKBmstvh9vUGC2+ZcV+pAn/uT70YV0j3+tpKqoJcLE0YHTLTMDgRpl0u2n3jFqY4Veh6yqJkJl8HJ2tA8K6kIJ0A+3wj+bEgtSkjo/d+koHf+iNBVbSIi5mXjhLwCbqNT3dzcjjHqYfYyZFObD2ePDfw+yf8IAbKu0fRe/+JipQ6dKM3n5Uxg8mILqNmFFzgf5nFLPKZW8PP2w9VXg4yJkHiTFoE2QQ8P/sLXOXJhSMx+62RArwgLhcdigGlk+iV25YpaFbFV18jtXEHiB0oUrNVlJZrP07xGtPhUaF2D58ZS34DE2ZB9x3sI6f1jhg0Vg8P38GJnHKcQlGKaZRRoXDHA6S+VsII01nEEkDDzx5vl9hOVq/lSFADs7w9fKaZGBbg7GQoEOkI1BpQGpSR6Vgymo82FSKRLme4R3yJ6xXdSiUYcpqGD0ks59UZHE1CxrB6wRZ1HxLgrFvEhjEGYFz8cBWSYXn9Gz7wce+z4TEZ9GF/smwvtsheNIme983KeRfTAly5DDEzFsWA9kY0k3+Rw88aTU8IEFSgour2NzdBKzJJB3lMdVVfuV/Or1dAJOCBOOmK4rj0t4T/HtmT8J9kCyjs8zYugyvtjvVq8v0kKM7nhY2i1bgtRmJLJb9GPPNs= X-Forefront-Antispam-Report: CIP:198.47.23.194;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet200.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(82310400026)(376014)(3023799007)(56012099006)(6133799003)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: enGb601N5W/sV6ZHazaLoyNY1IIqwpBDupEL1lQQfDpc9rxYOo7+ldO0bbxHWRlwNrCQSir5ZBF7aYa5sCJIprrb/Kt0uuAhLUENPDE4oOMK6l1btzjX3AfmmNcOzz9eiQeGQCE/W6La3/ZX0prgw1F6u92ZTXtGqLf0NKb6GCYIQbI34c8UdMj2oGKi4TpixNU0gJWfv8L1pQ33WtazVg7UiDybdMyYCfdZF14bUC12/fi4qraZauwKbD9i/cI+l/UhaVF9+iDrguI8rXLfZfwBriPK+UemZKjFUKcizY8fmrmavVi6ZnqhFWQ9E8LhOr64AqFCmlIgyDYzua4tmllezAxnloGAeGzztyy6iS63DVJHoCUeZIxNSrKqNg+uGUUvDZBD0kpGpPs4QyOB3oOuME46Kh9zxbsYbUxTr/H6bKYHjuGvpb/lCKy/imPk X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2026 14:29:09.6891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a6f9849-1b00-4ac5-e4f7-08dec56a4de9 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.194];Helo=[lewvzet200.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002BA4C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4521 Content-Type: text/plain; charset="utf-8" From: Yemike Abhilash Chandra The DS90UB960 chip has two CSI-2 transmit ports (TX0 and TX1), but the current driver implementation only utilizes TX0. To enable TX1 as the active output port, the I2C Bidirectional Control Channel (BCC) mapping in the RX_PORT_CTL register must be configured to use I2C Slave Port 1. This patch adds a new function, ub960_parse_active_ports(), which is called during driver initialization to scan the device tree and identify which RX and TX ports are enabled. The function creates bitmasks representing the active ports and uses these masks to correctly configure the RX_PORT_CTL register, ensuring proper port routing for whichever TX port is in use. DS90UB960 data sheet: https://www.ti.com/lit/ds/symlink/ds90ub960-q1.pdf Signed-off-by: Yemike Abhilash Chandra Co-developed-by: Rishikesh Donadkar Signed-off-by: Rishikesh Donadkar --- drivers/media/i2c/ds90ub960.c | 46 ++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 15a9797b47ac..653dc7a4eee5 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -26,6 +26,7 @@ * - i2c-atr could be made embeddable instead of allocatable. */ =20 +#include #include #include #include @@ -76,6 +77,8 @@ =20 #define UB960_NUM_BC_GPIOS 4 =20 +#define UB960_CSI_TX0 BIT(4) + /* * Register map * @@ -114,6 +117,7 @@ #define UB960_SR_SCL_HIGH_TIME 0x0a #define UB960_SR_SCL_LOW_TIME 0x0b #define UB960_SR_RX_PORT_CTL 0x0c +#define UB960_SR_RX_PORT_CTL_BCC_MAP GENMASK(7, 4) #define UB960_SR_IO_CTL 0x0d #define UB960_SR_GPIO_PIN_STS 0x0e #define UB960_SR_GPIO_INPUT_CTL 0x0f @@ -589,6 +593,9 @@ struct ub960_data { u32 tx_data_rate; /* Nominal data rate (Gb/s) */ s64 tx_link_freq[1]; =20 + u8 rx_mask; + u8 tx_mask; + struct i2c_atr *atr; =20 struct { @@ -2538,7 +2545,18 @@ static int ub960_init_rx_ports_ub960(struct ub960_da= ta *priv) struct device *dev =3D &priv->client->dev; unsigned int port_lock_mask; unsigned int port_mask; - int ret; + u8 enabled_rxports_mask; + u8 enabled_rxports; + int ret =3D 0; + + /* Configure I2C interface for RX ports */ + enabled_rxports_mask =3D FIELD_PREP(UB960_SR_RX_PORT_CTL_BCC_MAP, priv->r= x_mask); + enabled_rxports =3D (priv->tx_mask & UB960_CSI_TX0) ? 0x00 : enabled_rxp= orts_mask; + + ret =3D ub960_update_bits(priv, UB960_SR_RX_PORT_CTL, enabled_rxports_mas= k, + enabled_rxports, &ret); + if (ret) + return ret; =20 for_each_active_rxport(priv, it) { ret =3D ub960_init_rx_port_ub960(priv, it.rxport); @@ -4789,6 +4807,30 @@ static int ub960_parse_dt_txports(struct ub960_data = *priv) return 0; } =20 +static void ub960_parse_active_ports(struct ub960_data *priv) +{ + struct device *dev =3D &priv->client->dev; + int nport; + + priv->rx_mask =3D 0; + priv->tx_mask =3D 0; + + for (nport =3D 0; nport < priv->hw_data->num_rxports + priv->hw_data->num= _txports; nport++) { + struct fwnode_handle *ep_fwnode; + + ep_fwnode =3D fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), nport, 0,= 0); + if (!ep_fwnode) + continue; + + if (nport < priv->hw_data->num_rxports) + priv->rx_mask |=3D BIT(nport); + else + priv->tx_mask |=3D BIT(nport); + + fwnode_handle_put(ep_fwnode); + } +} + static int ub960_parse_dt(struct ub960_data *priv) { int ret; @@ -5162,6 +5204,8 @@ static int ub960_probe(struct i2c_client *client) if (ret) goto err_mutex_destroy; =20 + ub960_parse_active_ports(priv); + ret =3D ub960_parse_dt(priv); if (ret) goto err_disable_core_hw; --=20 2.34.1 From nobody Sat Jun 27 16:15:51 2026 Received: from PH0PR06CU001.outbound.protection.outlook.com (mail-westus3azon11011025.outbound.protection.outlook.com [40.107.208.25]) (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 66B9637FF68; Mon, 8 Jun 2026 14:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.208.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928968; cv=fail; b=Qx71JfV+mVzZEjA2/7wcsknBt7kTusKu2dWuQoVyU5td/RNZ/wpyks/pl4Lk2RxpMtQjMjlBvbm4yMTiPXeDvQjWAUF9uxpulCTNg9HloNUGJOjmcy9CxV1N6j34HMxBFiU+1Pdb443DcNz/6moAvEVXReAtaf7kDI3AcveWyjk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928968; c=relaxed/simple; bh=RgPLQ6gZiGDw6556ZdPlmli+vKVhsC0j7DZEq07NIPw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H3WPSgM2sg0r6vx+sfJfRaOhxMuoQaxmYNOgPpbngyUCL8vPkDiW6FJb4xos+mgrFQ03rHkd29RytK5eC4mGew4I2sTQL1XtA3mIWo5jEZ3jLJ1GRCC5TrdB+1Ex1ag1+KTrfUqeMDUKgQ1MBhk8uIzkOuyk2pslIWfVjRo/vzI= ARC-Authentication-Results: i=2; 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=ipzCPyBp; arc=fail smtp.client-ip=40.107.208.25 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ipzCPyBp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Yd+ElaoHXuwH1mifhxIOw5wn2kgKYh1l8gQaHFFcEd/7iPzYD3lzNQAYHrkgLhUmkxzYhRxhRjnVO3t8q5fzTvvuD0YSzTfV+UW431HtuzK4y3KbgcsGpxmbSdU3ldDe3/1u/vYntjf5gntW6K6UMRDIdsZ+Mm3v4EBQmKjEIaDYBxFVI03MeghpTjudhCDyznnHDk/uxmghcXTWTLWxM0jEM5pRvuD/71WQda9WK7OmXYA8QwaVcHaJ+h+YDLW8LrF+KioSYCzGYZIi6XKSQQhsW0enhuDWodLXGL4Xyg4b72isjX+sGQ+dZ5IMTKWUIckWyOB9q3baa6mEVYUt2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iHMcjeXfs/NzVuRr6EPGEpO7ZC+CEWFE6+Q8tARMUFk=; b=nflWsFBvXct91zSrH8E0U3hTX7d9yARtJEyu4FCcgRtmGeYrTDjvYMwazbJDX5ngRZy9sZA9ZgTO0T4KgYhQAnuonKEs1onBaLWMoeQXX6SDX/Nrv2IYyPMGdlRhvbT0pa8Kg0wNtIFB4qcb33MwhBeXvPfHX6SAUqDmUUURADYicixtWvWF5Ow4gah75xqf7iClzSv8/Wnw0CO77I23YomR/Csq/iwJCp2G6nPVyk7QSp2GsFrsaLwTmctUaAmwGI9w51vTOC4Xa1CQVklzPcLIj3nV8ae5XeKXe5F0T8RNeqKEcXBaFzajrMvrNiPGfTOeRMwINGZLNOcjDrewjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.194) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iHMcjeXfs/NzVuRr6EPGEpO7ZC+CEWFE6+Q8tARMUFk=; b=ipzCPyBpwJVEyKr4NVsScXIPuPgInGweawyVGGqyrD2HN7lhp8DKB8Oa4HpoSdib6ZmuWFNHCkWoVRXhl9vhe3ESxVKxj+z4uCzYz5trNiZYKnsX31CdUnox406u6GVIJFSZNpjUeUc+F66fp8+nmmfINHq3NyTzB1qPs8Mh1r0= Received: from PH0PR07CA0059.namprd07.prod.outlook.com (2603:10b6:510:e::34) by IA3PR10MB8346.namprd10.prod.outlook.com (2603:10b6:208:578::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.13; Mon, 8 Jun 2026 14:29:24 +0000 Received: from SN1PEPF0002BA4F.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::9a) by PH0PR07CA0059.outlook.office365.com (2603:10b6:510:e::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.32 via Frontend Transport; Mon, 8 Jun 2026 14:29:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.23.194) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.194 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.194; helo=lewvzet200.ext.ti.com; pr=C Received: from lewvzet200.ext.ti.com (198.47.23.194) by SN1PEPF0002BA4F.mail.protection.outlook.com (10.167.242.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.7 via Frontend Transport; Mon, 8 Jun 2026 14:29:23 +0000 Received: from DLEE207.ent.ti.com (157.170.170.95) by lewvzet200.ext.ti.com (10.4.14.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:12 -0500 Received: from DLEE209.ent.ti.com (157.170.170.98) by DLEE207.ent.ti.com (157.170.170.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:12 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE209.ent.ti.com (157.170.170.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37 via Frontend Transport; Mon, 8 Jun 2026 09:29:12 -0500 Received: from ws.dhcp.ti.com (ws.dhcp.ti.com [172.24.233.149]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 658ET2bE3251356; Mon, 8 Jun 2026 09:29:09 -0500 From: Rishikesh Donadkar To: CC: , , , , , , , , Subject: [PATCH 2/4] media: i2c: ds90ub960: Support multi-channel sensors Date: Mon, 8 Jun 2026 19:58:59 +0530 Message-ID: <20260608142901.3971821-3-r-donadkar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260608142901.3971821-1-r-donadkar@ti.com> References: <20260608142901.3971821-1-r-donadkar@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4F:EE_|IA3PR10MB8346:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f6ca5b3-7d9c-447b-ed54-08dec56a566b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700016|3023799007|56012099006|5023799004|18002099003|22082099003|6133799003; X-Microsoft-Antispam-Message-Info: 5NWCt85cG2HpHxJl5fD7m0SdowFw+s/a+OJn4sUhRDEASmEQjy22906TSKN9Xkn2hnB8/hnNEw2Di6MUOaZ5nzXA8gLoyX85Xsw4d6YVcIT/oEFjHm8su3NtZoJ/6Cd14V/gKRCSJUAw+9fJjNblAv9t4nS6HnsF62b9UiWMQryzmEsbQgcxC67It0JOXsHENzviCLkRZPIxyvkDau0gLGdBjIZ7UYsSeN7AwdBbqgQ/kaiWiAL13O0Xs5TNXTUtH+uAxpoSfGfoITxDo805SLHY7nXapVxk8Wh7/ZXGCnbjY7aUSPtx7RJgkwLVorcRIGDJw1oJ85Y4K2vuGvdzdn0cZM7U2kLsOERAYaW0QvgyDSFOIikgCyeYi/IKlJPdqKU2DmZJZpYmd5DN4j3EsG9UyA/A9HshB/Ne86iGBwrS9/Es4ZIQBTBFJxOsfip9BScMN6ShpGIN6WvB9Sfd45TwKS8NCPi+67Jm3u0N3/ONJLlyIbMd6AdH0bZxnr9XO3FchR/A6caJ8IjhHdiKZ9IRfDp4p4Njeq7deUZKr4DBvBsOpBQ5BJpsJUF2fYAouLoiy+9VGVKwYwQudBkf3q47CHoEIaO8r4o9smeRNqoUSIQ+n2OKU2AD28Fk3BksPrfsrerrBjXkKPaqFFK3EK3FpFSQwR3Re0iSEh3nR4I1rulRyps8+pWuJ1MdwJunxpqPvmzuKF/AySbYq6UZDg4B0jGn490rWIGECDvxUao= X-Forefront-Antispam-Report: CIP:198.47.23.194;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet200.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700016)(3023799007)(56012099006)(5023799004)(18002099003)(22082099003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5c0Q6YX8xnrL4uE4yRggze3DaUQ6oPkv5IJj8tN/7uNn9yzNgsH6FrEpc25tzMswNVb397fC4R7pg2npLTqARVFIpQuXe0bDvNcEL423/0gWvZR1/7ek53FlrGhJOIzIRESouaAOB44lI4MEQ+CYhRiAteDsMozKcspAzx+6bd+qX4hRryNRzFZQYPKWmOXsco41Ny9cyeNEOBYgojFHsRPxzV4kAAPo9D92yYc7tNKjP77icoRkaxReS2uDAcBEEUXgBTVTzZusxC5GdBkA9v4qmkiUZvIM1zgFYuE+Q3iHPEC7Xq4UKjikECSslix6L6eQMAG7+Y5T6/FTZ5froGkpwpPlM4sfvl8qTl2FL2cVhUObGkhye1ACHbfVwUd7TGdn8do3SZxbh11Z5QnmK+L1i4oON4DY/3relNFYAInp8DKlHJbqMYBmF8fpe3FK X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2026 14:29:23.9571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f6ca5b3-7d9c-447b-ed54-08dec56a566b X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.194];Helo=[lewvzet200.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002BA4F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR10MB8346 Content-Type: text/plain; charset="utf-8" From: Jai Luthra Before this, the deserializer would ignore the virtual channel (VC) ID set in the incoming CSI packets, and set the ID to the RX port number in the outgoing packets. This was done to support multiple single-channel cameras, all sending packets with the same default VC ID =3D 0. Now we check which (and how many) channels are under use on any incoming FPDLink port, and map it to available channels on the outgoing CSI port. Signed-off-by: Jai Luthra Signed-off-by: Rishikesh Donadkar --- drivers/media/i2c/ds90ub960.c | 165 +++++++++++++++++----------------- 1 file changed, 81 insertions(+), 84 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 653dc7a4eee5..506b436fe50c 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -72,6 +72,7 @@ #define UB960_MAX_RX_NPORTS 4 #define UB960_MAX_TX_NPORTS 2 #define UB960_MAX_NPORTS (UB960_MAX_RX_NPORTS + UB960_MAX_TX_NPORTS) +#define UB960_MAX_VC 4 =20 #define UB960_MAX_PORT_ALIASES 8 =20 @@ -3471,40 +3472,76 @@ static int ub960_rxport_handle_events(struct ub960_= data *priv, u8 nport) */ =20 /* - * The current implementation only supports a simple VC mapping, where all= VCs - * from a one RX port will be mapped to the same VC. Also, the hardware - * dictates that all streams from an RX port must go to a single TX port. + * Map incoming streams with different virtual channels from 1-4 sensors to + * unique VCs on CSI TX0. Sensors using multiple VCs will work, but due to + * limited total channels (4) this will reduce the total number of sensors= that + * can work simultaneously. * - * This function decides the target VC numbers for each RX port with a sim= ple - * algorithm, so that for each TX port, we get VC numbers starting from 0, - * and counting up. + * The current implementation is limited to using a single CSI TX port + * at a time (either TX0 or TX1 and not both simultaneously), + * as that is the most common HW configuration found on boards with DS90UB= 960. + * For using both CSI TX0 & TX1 the below method will need significant cha= nges. * - * E.g. if all four RX ports are in use, of which the first two go to the - * first TX port and the secont two go to the second TX port, we would get - * the following VCs for the four RX ports: 0, 1, 0, 1. - * - * TODO: implement a more sophisticated VC mapping. As the driver cannot k= now - * what VCs the sinks expect (say, an FPGA with hardcoded VC routing), this - * probably needs to be somehow configurable. Device tree? */ -static void ub960_get_vc_maps(struct ub960_data *priv, - struct v4l2_subdev_state *state, u8 *vc) +static void ub960_get_vc_maps(struct ub960_data *priv, u8 *vc_map) { - u8 cur_vc[UB960_MAX_TX_NPORTS] =3D {}; - struct v4l2_subdev_route *route; - u8 handled_mask =3D 0; + struct device *dev =3D &priv->client->dev; + u8 nport, available_vc =3D 0; =20 - for_each_active_route(&state->routing, route) { - unsigned int rx, tx; + for (nport =3D 0; + nport < priv->hw_data->num_rxports && priv->rxports[nport]; + ++nport) { + struct v4l2_mbus_frame_desc source_fd; + bool used_vc[UB960_MAX_VC] =3D {false}; + u8 vc, cur_vc =3D available_vc; + int j, ret; + u8 map; =20 - rx =3D ub960_pad_to_port(priv, route->sink_pad); - if (BIT(rx) & handled_mask) + ret =3D v4l2_subdev_call(priv->rxports[nport]->source.sd, pad, + get_frame_desc, + priv->rxports[nport]->source.pad, + &source_fd); + /* Mark channels used in source in used_vc[] */ + if (!ret) { + for (j =3D 0; j < source_fd.num_entries; ++j) { + u8 source_vc =3D source_fd.entry[j].bus.csi2.vc; + + if (source_vc < UB960_MAX_VC) + used_vc[source_vc] =3D true; + } + } else if (ret =3D=3D -ENOIOCTLCMD) { + /* assume VC=3D0 is used if sensor driver doesn't provide info */ + used_vc[0] =3D true; + } else { continue; + } =20 - tx =3D ub960_pad_to_port(priv, route->source_pad); + /* Start with all channels mapped to first free output */ + map =3D (cur_vc << 6) | (cur_vc << 4) | (cur_vc << 2) | + (cur_vc << 0); =20 - vc[rx] =3D cur_vc[tx]++; - handled_mask |=3D BIT(rx); + /* Map actually used to channels to distinct free outputs */ + for (vc =3D 0; vc < UB960_MAX_VC; ++vc) { + if (used_vc[vc]) { + map &=3D ~(0x03 << (2 * vc)); + map |=3D (cur_vc << (2 * vc)); + ++cur_vc; + } + } + + /* Don't enable port if we ran out of available channels */ + if (cur_vc > UB960_MAX_VC) { + dev_err(dev, + "No VCs available for RX port %d\n", + nport); + continue; + } + + /* Enable port and update map */ + vc_map[nport] =3D map; + available_vc =3D cur_vc; + dev_dbg(dev, "%s: VC map for port %d is 0x%02x", + __func__, nport, map); } } =20 @@ -3552,45 +3589,6 @@ static int ub960_disable_rx_port(struct ub960_data *= priv, unsigned int nport) UB960_SR_FWD_CTL1_PORT_DIS(nport), NULL); } =20 -/* - * The driver only supports using a single VC for each source. This functi= on - * checks that each source only provides streams using a single VC. - */ -static int ub960_validate_stream_vcs(struct ub960_data *priv) -{ - for_each_active_rxport(priv, it) { - struct v4l2_mbus_frame_desc desc; - int ret; - u8 vc; - - ret =3D v4l2_subdev_call(it.rxport->source.sd, pad, - get_frame_desc, it.rxport->source.pad, - &desc); - if (ret) - return ret; - - if (desc.type !=3D V4L2_MBUS_FRAME_DESC_TYPE_CSI2) - continue; - - if (desc.num_entries =3D=3D 0) - continue; - - vc =3D desc.entry[0].bus.csi2.vc; - - for (unsigned int i =3D 1; i < desc.num_entries; i++) { - if (vc =3D=3D desc.entry[i].bus.csi2.vc) - continue; - - dev_err(&priv->client->dev, - "rx%u: source with multiple virtual-channels is not supported\n", - it.nport); - return -ENODEV; - } - } - - return 0; -} - static int ub960_configure_ports_for_streaming(struct ub960_data *priv, struct v4l2_subdev_state *state) { @@ -3606,11 +3604,7 @@ static int ub960_configure_ports_for_streaming(struc= t ub960_data *priv, struct v4l2_subdev_route *route; int ret; =20 - ret =3D ub960_validate_stream_vcs(priv); - if (ret) - return ret; - - ub960_get_vc_maps(priv, state, vc_map); + ub960_get_vc_maps(priv, vc_map); =20 for_each_active_route(&state->routing, route) { struct ub960_rxport *rxport; @@ -3676,16 +3670,14 @@ static int ub960_configure_ports_for_streaming(stru= ct ub960_data *priv, for_each_active_rxport(priv, it) { unsigned long nport =3D it.nport; =20 - u8 vc =3D vc_map[nport]; - if (rx_data[nport].num_streams =3D=3D 0) continue; =20 switch (it.rxport->rx_mode) { case RXPORT_MODE_RAW10: ub960_rxport_write(priv, nport, UB960_RR_RAW10_ID, - rx_data[nport].pixel_dt | (vc << UB960_RR_RAW10_ID_VC_SHIFT), - &ret); + rx_data[nport].pixel_dt | (nport << UB960_RR_RAW10_ID_VC_SHIFT), + &ret); =20 ub960_rxport_write(priv, nport, UB960_RR_RAW_EMBED_DTYPE, @@ -3701,15 +3693,10 @@ static int ub960_configure_ports_for_streaming(stru= ct ub960_data *priv, =20 case RXPORT_MODE_CSI2_SYNC: case RXPORT_MODE_CSI2_NONSYNC: - if (priv->hw_data->chip_type =3D=3D UB960 || - priv->hw_data->chip_type =3D=3D UB954) { - /* Map all VCs from this port to the same VC */ - ub960_rxport_write(priv, nport, UB960_RR_CSI_VC_MAP, - (vc << UB960_RR_CSI_VC_MAP_SHIFT(3)) | - (vc << UB960_RR_CSI_VC_MAP_SHIFT(2)) | - (vc << UB960_RR_CSI_VC_MAP_SHIFT(1)) | - (vc << UB960_RR_CSI_VC_MAP_SHIFT(0)), - &ret); + if (priv->hw_data->chip_type =3D=3D UB960) { + ub960_rxport_write(priv, nport, + UB960_RR_CSI_VC_MAP, + vc_map[nport], &ret); } else { unsigned int i; =20 @@ -3965,6 +3952,11 @@ static int ub960_set_routing(struct v4l2_subdev *sd, return _ub960_set_routing(sd, state, routing); } =20 +static inline u8 ub960_get_output_vc(u8 map, u8 input_vc) +{ + return (map >> (2 * input_vc)) & 0x03; +} + static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_frame_desc *fd) { @@ -3982,7 +3974,7 @@ static int ub960_get_frame_desc(struct v4l2_subdev *s= d, unsigned int pad, =20 state =3D v4l2_subdev_lock_and_get_active_state(&priv->sd); =20 - ub960_get_vc_maps(priv, state, vc_map); + ub960_get_vc_maps(priv, vc_map); =20 for_each_active_route(&state->routing, route) { struct v4l2_mbus_frame_desc_entry *source_entry =3D NULL; @@ -4025,7 +4017,12 @@ static int ub960_get_frame_desc(struct v4l2_subdev *= sd, unsigned int pad, fd->entry[fd->num_entries].length =3D source_entry->length; fd->entry[fd->num_entries].pixelcode =3D source_entry->pixelcode; =20 - fd->entry[fd->num_entries].bus.csi2.vc =3D vc_map[nport]; + fd->entry[fd->num_entries].bus.csi2.vc =3D + ub960_get_output_vc(vc_map[nport], + source_entry->bus.csi2.vc); + dev_dbg(dev, "Mapping sink %d/%d to output VC %d", + route->sink_pad, route->sink_stream, + fd->entry[fd->num_entries].bus.csi2.vc); =20 if (source_fd.type =3D=3D V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { fd->entry[fd->num_entries].bus.csi2.dt =3D --=20 2.34.1 From nobody Sat Jun 27 16:15:51 2026 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010061.outbound.protection.outlook.com [52.101.61.61]) (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 C92413D34A0; Mon, 8 Jun 2026 14:29:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.61.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928986; cv=fail; b=OmH7E72UYlljANhITXEnEY4HYBxndwPbc9La5bGmXpBovBA0a3dYXb5guInyZ/4ySDrtBfRS+opH54pjiXuqdAn/ET/pEkm+chxpkCCCIj1BC1iTEhQMBfYrpoCfMKxhRamCZvWIZk0ohWFwPldAmxUiVsWzYf4jRFRfRJDFwqs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928986; c=relaxed/simple; bh=HTcM6ceHX6mGXMCxszD3xmeewFTn0Bbt6ccD7CWVV6o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ERVLgXdKg+Rrst95lEIkUeLKLZnafh4GuZqNmFcZq6mPH+5QJFfrIYA1wS8Z0kTs336IvcDjYPJfT+DAXAyMastmkeqnyGnvkOhW3wkA0dfYqQD1b1nIyUpeHuCHodmwSjUmVEU1ybMNUcP3UejH0QyEs3Wskp6qXikIuxi9QVk= ARC-Authentication-Results: i=2; 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=aw7ihUU+; arc=fail smtp.client-ip=52.101.61.61 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="aw7ihUU+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qo3QXq6FE/3Lt+LJMAtP5ESbnFdN8WZ8DOWjuNDqyzg2B6IejB1FRziAEz0T1+lMqrV2tHrT46BYMlRiJzKogrwJN79TR4HYMBHc3R+s2/JRmRoLSgsaa+XGjfZLYa9zO+nz3/xpYNiUSTFL6vCkymsXPMAFP7gMijgRCx39pclQQOZMa/RisCpSsVz12GLODa8b4CPesi+PKPEVt75D8No7lCgg2MdnP2ufgc0YB+cOc0ndZTqkV9/c9nL914wpGxeXSa38r+jNyLUrdSHl1B3Nm2NQkHGzY0wKkCbLCBLUbNwxmocNEBoFCpNKrKzkISuUfgtiPosR4Q0K8Rj5vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NiEtezLjnatAOWpbKGyaLEs6qfumHQmjWBWe+C97FN4=; b=kLwG2vyjwhAskR4x9y2PZ19I5KD6c0ds4+NCc5SQEmgrX3xpuE8Z7eAr/I1NK52AMRnQlpqaZ97xGgNvXkPx3ZKqs5vnPOSRQQz7I8XRAsXuZ7blEOkK5G+a7DTn2jSszpRKGBuMIyhsv0HbzKegKXSc1yC/KnLsLthO2lyp8gPiOVlBSisIbeEtKKIEeDjDhGmg4/qhNlmLsjizUYN3kUuG+az2dUM1fwzz3qtMZgaG+OC/CiGCZp79eYAZoMtl9uknBIzLE6x3fRTHjzb5xmJQ6qdOgcwBaK50Dcts6HYGtPe13XjYWINXP9D8ud3ukjgiJvH/G9FJPpqV0ogqBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.21.194) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NiEtezLjnatAOWpbKGyaLEs6qfumHQmjWBWe+C97FN4=; b=aw7ihUU+U7+yzQSy0xKFXG4Zt/qNHxzDtFieLreigqArl7aE4ivWTZbSMMNm2twCziU7p4dJil0umR+Eog1zejLmG3JZLTWgNbdJm2nMK44MYMTNhqO979mHgoBPPgoBhMCt5Z7em6vNLrSrIHqWXIgaevnhjYBGm7srCdveEFA= Received: from SJ0PR13CA0141.namprd13.prod.outlook.com (2603:10b6:a03:2c6::26) by MW6PR10MB7613.namprd10.prod.outlook.com (2603:10b6:303:23b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.13; Mon, 8 Jun 2026 14:29:42 +0000 Received: from MW1PEPF0001615A.namprd21.prod.outlook.com (2603:10b6:a03:2c6:cafe::f7) by SJ0PR13CA0141.outlook.office365.com (2603:10b6:a03:2c6::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.9 via Frontend Transport; Mon, 8 Jun 2026 14:29:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.21.194) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.21.194 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.21.194; helo=flwvzet200.ext.ti.com; pr=C Received: from flwvzet200.ext.ti.com (198.47.21.194) by MW1PEPF0001615A.mail.protection.outlook.com (10.167.249.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.1 via Frontend Transport; Mon, 8 Jun 2026 14:29:40 +0000 Received: from DFLE207.ent.ti.com (10.64.6.65) by flwvzet200.ext.ti.com (10.248.192.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:16 -0500 Received: from DFLE211.ent.ti.com (10.64.6.69) by DFLE207.ent.ti.com (10.64.6.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:15 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DFLE211.ent.ti.com (10.64.6.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37 via Frontend Transport; Mon, 8 Jun 2026 09:29:15 -0500 Received: from ws.dhcp.ti.com (ws.dhcp.ti.com [172.24.233.149]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 658ET2bF3251356; Mon, 8 Jun 2026 09:29:12 -0500 From: Rishikesh Donadkar To: CC: , , , , , , , , Subject: [PATCH 3/4] media: i2c: ds90ub960: Fix VC mapping when ports skipped Date: Mon, 8 Jun 2026 19:59:00 +0530 Message-ID: <20260608142901.3971821-4-r-donadkar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260608142901.3971821-1-r-donadkar@ti.com> References: <20260608142901.3971821-1-r-donadkar@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW1PEPF0001615A:EE_|MW6PR10MB7613:EE_ X-MS-Office365-Filtering-Correlation-Id: f36f2842-9274-48b8-2b4b-08dec56a609a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|82310400026|376014|56012099006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: V1HiuQGdodBtf4mqtytRe0ruXGzyoimtPp72Z5Z8FHKsBWW2CNORTCZGG/k3eLSUn9gcG8nBV0c+SQQUPbelnygHZfKxnhvqORt/rAFIhOSProQ8eAcTYyrMfQIcLDxbGjtgm2hDpHukUP64MuJOdv1zXhfNyIz2tj3nLc3FwV/H0yaM/b6QWywIB6ZmOiBbvIvk/TmdHJPEygvuEsxBZA/Lu3pJ7zwtYqzWqgyU3jPf0/a3RrCgiCXg8NyC33YSaWrFpZnrqhy9xIWn+Dd4LJAXtptujRIgNKGNLn/U314S+DSXT0vKvgROsqhpY+wAQ7Y5a5hxN1VgVEf/AtHaEaY5KV7Z3b5cSJZjzwtHLRy4hNmVRC8H4a/L7DbbWeKV+wXOc6f5wttEyQBFegjnuduB5FgqXL4tl4Dos7Nqt8pw96so2BtfQqw9zyw+G74Ep3xlSAW7BQWL5D5feaFVgQEJpOWtQm63ZVEB2DZPhv86uAJCiBw3fMczRpgpW3g2BT8H7UgO6C1In+Sk6yHxJmKYj7lE40niKyqlAdba84g6mKazk8Ktrzh71NdEQfD8Mx7KDnP7zX1IbxG8o+WQ5H8c8eoC+dG8d0WIt+lIfNeoyfF+FJ9HZq2vjK4Pn+KICn3g0fqEdbnFGaUHykKF8xET2f7yoX4vbytC3IJwsg4lfYsxuBt9Kd8bQM6CHGt84rAGfd9tDERyVmwcxaCoONTqJmIKNpvHFHwb3dfb7bk= X-Forefront-Antispam-Report: CIP:198.47.21.194;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:flwvzet200.ext.ti.com;PTR:ErrorRetry;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(82310400026)(376014)(56012099006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HufYLQdC5tliztusS5XJIZ/NtRx8wr67y/S3RIc116LwHedZAtY0yUTCX0IxMXMnrfpRBs72KbF1Xq7JDFs1h7hQGcIj3LTMqAW/2kYEEC9C++arV7QHyfyLm5wRpVb2ULOWWgVmHs+uIHr0+TlM2e1gjeY8racZdOsUvqbiyHAuMnXlh5XqxUW6Ip1A3xBdIrkKLcQK2m5hUYH3FISZoLkNTPA35kqQX6aQb792dJ+u8GmebLnK2FZPKc+lja0eRBIWrgiwMFoclA5ddKTW+46PdtMQqwfENni3lGNeTQFfRIYiLavc32FP6ZIQB593CsNeUT+Rg9u//M8SQU40T7df2ixx8Nlq5wKPqjNWZcM0H/Yr0tS65UkB4TjbS5cVhiLj0cHVmvH6xH3I+xlweRoKzdejR2pl2EF+ziqemIF/qPMrbGOGn4S4SQiGRNwL X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2026 14:29:40.9850 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f36f2842-9274-48b8-2b4b-08dec56a609a X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.21.194];Helo=[flwvzet200.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: MW1PEPF0001615A.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR10MB7613 Content-Type: text/plain; charset="utf-8" From: Jai Luthra Currently the for loop that maps virtual channels from RX to TX ports terminates at the first unconnected RX port. Fix that by instead continuing to scan the remaining ports. Signed-off-by: Jai Luthra Signed-off-by: Rishikesh Donadkar --- drivers/media/i2c/ds90ub960.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 506b436fe50c..d1597659639f 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -3488,15 +3488,16 @@ static void ub960_get_vc_maps(struct ub960_data *pr= iv, u8 *vc_map) struct device *dev =3D &priv->client->dev; u8 nport, available_vc =3D 0; =20 - for (nport =3D 0; - nport < priv->hw_data->num_rxports && priv->rxports[nport]; - ++nport) { + for (nport =3D 0; nport < priv->hw_data->num_rxports; ++nport) { struct v4l2_mbus_frame_desc source_fd; bool used_vc[UB960_MAX_VC] =3D {false}; u8 vc, cur_vc =3D available_vc; int j, ret; u8 map; =20 + if (!priv->rxports[nport]) + continue; + ret =3D v4l2_subdev_call(priv->rxports[nport]->source.sd, pad, get_frame_desc, priv->rxports[nport]->source.pad, --=20 2.34.1 From nobody Sat Jun 27 16:15:51 2026 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012054.outbound.protection.outlook.com [52.101.53.54]) (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 4116737FF68; Mon, 8 Jun 2026 14:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.53.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928974; cv=fail; b=JseUDDyFgkjJrgfTEoAwNAXgrNO10g20oVdXtWCYieY6M4NeDUDxlqkCrTWN0BW/dInbACFt6Zl+6XqooKhOwRIpZKwdRVq5cC1NDpqv1w30o12VFejDKf0uYn5fZm33yQ4+dvEfae3s6JzEnnh328pfD6z/KcVjDQfy7oI3+TI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780928974; c=relaxed/simple; bh=wo9vhR5S6W706pOoyuvcFyIuF24EwWctqIej28klBsM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HyYiG96KZhmguUGGnAJB9ElHTvBMxSAfFwr6mM8LdaPg8sLoTPAAp8wqCiJTKhqdF6YIB6oDbFEs7I8D5sRJtoanUL3TV/e3W2hOkYjoyFYEza8T8vlSxWtolw9jer9lC0MxXJW/o1sGcagmWM0HSXmQ6ZMxOswzS4wwjt2IPJg= ARC-Authentication-Results: i=2; 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=mcn8afRC; arc=fail smtp.client-ip=52.101.53.54 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="mcn8afRC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u5FGZ4MxVGLtbXXs+9guDNZTAtKnAMJoq7chQtmLMJXJ2z9EJeR1dI+nI/JYnDU2x8x5bkJ2PDEgm5O4nBLY0wrwYjQrZhIPLbhu5nFSnqk7QVyT6cscrr8nYQbf0lLDHk7/PHSFRG/TlBdlV3Tk5H7ZpQjYleXNaomPqU26E9AykkjL2jBTtppOKYaDhFzyeDCQqlpsorM74a+OrZ+6a9Fp3EX61jEjU0k3BeTp8dIsgwPNhbGdzJUx9Ho3j/NpUJfcge641ZbS/bfG24fy7s0aTAjnf+TcEtnUaYo1/WKrl1YSpmfXkcgxtJY8Qe5BiZiC6dnfD0ZSShvjPYrryQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K3BAkhJwcGh2xQQYrNdxndiS4A7K2siYNxRukpXrxyY=; b=u8XCgu8+8bN3U9NUaBioUzyB9IWXKJ9JK7XG81scqDoLYxcnLH668agsgjs7RtizvNvY/WzU/EdUtlqmTd8v+lpIC1n5eoU5naKCTxmSp5mRnKo4EjF9997I2ozF3t4w1gsJimgdWc8DmnwvS1pYtT/ZFnBCMEUJiYG9DHHrNgHyutC1aIVKPzyUDn5VzLlD4iTkvDSIyEdtflgRECgDbGPxTxfm8s5FD3YzEUFCDIIbMzHODhwrSaHN8Ld+RCRA7Z+Cn0ALj+iLsN7aKQA3kczx3l3CqjjVoU9EyEf5L8ntle1E4TsfJ5ODOOTmvN3UWT4QfGHsLJt7nAIlJ3lXJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.195) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K3BAkhJwcGh2xQQYrNdxndiS4A7K2siYNxRukpXrxyY=; b=mcn8afRCSnQDTZMi6x3/U1ili5kX38CypPYcS3fNuJyhriU+dGWUXk2bPQkCr0V3U2uZtEGe+AxNFjoqPq+aH7flIXfO9k9K9WGdby3XGaW5NcYd9h+HKOglywI0xqdWQJQtsdi21yyJKG1lS4CtUl1eD1HACduPCtapc+FhYTo= Received: from SA1PR05CA0014.namprd05.prod.outlook.com (2603:10b6:806:2d2::23) by CY5PR10MB6214.namprd10.prod.outlook.com (2603:10b6:930:31::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.13; Mon, 8 Jun 2026 14:29:28 +0000 Received: from SA2PEPF00003AEB.namprd02.prod.outlook.com (2603:10b6:806:2d2:cafe::67) by SA1PR05CA0014.outlook.office365.com (2603:10b6:806:2d2::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.113.9 via Frontend Transport; Mon, 8 Jun 2026 14:29:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.23.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.195; helo=lewvzet201.ext.ti.com; pr=C Received: from lewvzet201.ext.ti.com (198.47.23.195) by SA2PEPF00003AEB.mail.protection.outlook.com (10.167.248.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.7 via Frontend Transport; Mon, 8 Jun 2026 14:29:28 +0000 Received: from DLEE211.ent.ti.com (157.170.170.113) by lewvzet201.ext.ti.com (10.4.14.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:19 -0500 Received: from DLEE206.ent.ti.com (157.170.170.90) by DLEE211.ent.ti.com (157.170.170.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Mon, 8 Jun 2026 09:29:19 -0500 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE206.ent.ti.com (157.170.170.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37 via Frontend Transport; Mon, 8 Jun 2026 09:29:18 -0500 Received: from ws.dhcp.ti.com (ws.dhcp.ti.com [172.24.233.149]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 658ET2bG3251356; Mon, 8 Jun 2026 09:29:16 -0500 From: Rishikesh Donadkar To: CC: , , , , , , , , Subject: [PATCH 4/4] media: i2c: ds90ub960: Use VC mapping specific to ub9702 Date: Mon, 8 Jun 2026 19:59:01 +0530 Message-ID: <20260608142901.3971821-5-r-donadkar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260608142901.3971821-1-r-donadkar@ti.com> References: <20260608142901.3971821-1-r-donadkar@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AEB:EE_|CY5PR10MB6214:EE_ X-MS-Office365-Filtering-Correlation-Id: 95b536e6-b211-47bf-e99c-08dec56a5931 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700016|1800799024|82310400026|5023799004|56012099006|6133799003|18002099003|22082099003|3023799007; X-Microsoft-Antispam-Message-Info: n/E+5HRQYOOnznmXHNT6VBmCo3dvUxCLeJGWd4AQiwKI56C11ZaRw0rP2aLO7ubVNuq3MPoi0NUIE36CWPBYKEGJ6SP5xKVsiJoiVVogBD6K5eSLZtooPLh1VmpEyd81isSU3hZ31UCkrOyobKvzxgy4JH9jiySiZytV6NTe0JWDUFY3G/BeattlIUK32tDdPMF3x9OiPVkr5+iDEMtNksvheFuspkNV6lq/E2Nb1HGnOcW9ZTTPIBEuq+6lU5KiM90odfbUpTjUCgtcti9w5hGpwt01Y7dD+GDy8jj4ST8C56jH3eqx3jXgDys0YAwOylXsNTKSUFMtgzGGXGaQbDPtswjpgYETx3zCKgOYoKeuMRWWc117LCxEBAvy5d9eEZKWnxuo0zfiSs4RnbBEpVSnMwDSi7POZHaandjMcv6tTm9NJWFVNebJpvhcQI8RbMVAFWdA/9C39qhloUyaVpyxfOw9K0mN+jJBduk9Rc/hQlg0QxBZCvKktoCYKhYR/vegmiOhFoQvCGCemE7hnWfuBRIy2N9h8fY8+WC+f3dEXAROkM6t7Tp2Oyf2sfkTb6G1bTkOn72Pux5jdqJChbCBsR2E6oO7WHz1PjojQ/Jbm77Ea8rU8gsk+pUWNkDCYJz74lI4CkRiENgnZ4Di0soA9G9qqLhmI0kbB/mQCC6cWWY+r/k0PjulD6bQ9vSHPQvFR4kdh3qvAosAtP2rPTiMo2RLqS3Tn8aN5uPWIlA= X-Forefront-Antispam-Report: CIP:198.47.23.195;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet201.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700016)(1800799024)(82310400026)(5023799004)(56012099006)(6133799003)(18002099003)(22082099003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EPbVtecc7qQv4Oof9xT2MJVgEjRXhnsy5xNrk61sPujKRzwIekt8raameKr6H+iqto+7uHTHylpMIXgnGhDjIwiEExDtzqEluGtx54JVIQ6LTBbmoeRlIAUJ2E4VuOe5N6cgBBcPi+0j51NAErnDVUVI6DsezB4sGKZaizQoODllqA205DTGcUc7gWdn+MuMxrrc16cqtPOBrEQOO8uME0RXPujsTFUSg/+fJZB6JEwSlQktHseJ2x7kvTrWxxMxwoKBHBswNxlvx+s3vVF5n2ALkUxA6PSKtIHLl2pbpo2GnrDmBHmB98L58QJxfp9mbfUUY2G7uDewvhJUwhaHVAzVL8/0AGq1MKZo32ytR61yGS8AhtJIAejSc4oR/QSak6f9gQceot6YT1CYmvKAqsOZfx7aEU83MN3yPtG1ZptBLUQwGH8INw9fROMUE5m7 X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2026 14:29:28.6043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95b536e6-b211-47bf-e99c-08dec56a5931 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.195];Helo=[lewvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AEB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6214 Content-Type: text/plain; charset="utf-8" Add a dedicated virtual channel mapping for ub9702 deserializers which require different VC configuration compared to ub960. Update the configuration logic to select the appropriate map based on the deserializer type. Signed-off-by: Rishikesh Donadkar --- drivers/media/i2c/ds90ub960.c | 44 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index d1597659639f..9ce6d9e6e3e8 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -3482,7 +3482,18 @@ static int ub960_rxport_handle_events(struct ub960_d= ata *priv, u8 nport) * as that is the most common HW configuration found on boards with DS90UB= 960. * For using both CSI TX0 & TX1 the below method will need significant cha= nges. * + * VC mapping differs between ub960 and ub9702 deserializers: + * For ub960: + * - Each VC uses 2 bits in the mapping register + * - Supports up to 4 virtual channels (VC0-VC3) + * For ub9702: + * - Each VC uses 4 bits in the mapping register + * - Currently uses only 2 virtual channels (VC0, VC1) + * + * The mapping registers determine which output VC a given input VC + * will be mapped to when forwarding data from the deserializer. */ + static void ub960_get_vc_maps(struct ub960_data *priv, u8 *vc_map) { struct device *dev =3D &priv->client->dev; @@ -3518,14 +3529,26 @@ static void ub960_get_vc_maps(struct ub960_data *pr= iv, u8 *vc_map) } =20 /* Start with all channels mapped to first free output */ - map =3D (cur_vc << 6) | (cur_vc << 4) | (cur_vc << 2) | - (cur_vc << 0); + + if (priv->hw_data->chip_type =3D=3D UB960) { + map =3D (cur_vc << 6) | (cur_vc << 4) | (cur_vc << 2) | + (cur_vc << 0); + } else { + map =3D (cur_vc << 4) | (cur_vc << 0); + } =20 /* Map actually used to channels to distinct free outputs */ for (vc =3D 0; vc < UB960_MAX_VC; ++vc) { if (used_vc[vc]) { - map &=3D ~(0x03 << (2 * vc)); - map |=3D (cur_vc << (2 * vc)); + if (priv->hw_data->chip_type =3D=3D UB960) { + /* For ub960: 2 bits per VC */ + map &=3D ~(0x03 << (2 * vc)); + map |=3D (cur_vc << (2 * vc)); + } else { + /* For ub9702: 4 bits per VC */ + map &=3D ~(0x0f << (4 * vc)); + map |=3D (cur_vc << (4 * vc)); + } ++cur_vc; } } @@ -3705,8 +3728,7 @@ static int ub960_configure_ports_for_streaming(struct= ub960_data *priv, for (i =3D 0; i < 8; i++) ub960_rxport_write(priv, nport, UB9702_RR_VC_ID_MAP(i), - (nport << 4) | nport, - &ret); + vc_map[nport], &ret); } =20 break; @@ -4018,9 +4040,13 @@ static int ub960_get_frame_desc(struct v4l2_subdev *= sd, unsigned int pad, fd->entry[fd->num_entries].length =3D source_entry->length; fd->entry[fd->num_entries].pixelcode =3D source_entry->pixelcode; =20 - fd->entry[fd->num_entries].bus.csi2.vc =3D - ub960_get_output_vc(vc_map[nport], - source_entry->bus.csi2.vc); + if (priv->hw_data->chip_type =3D=3D UB960) + fd->entry[fd->num_entries].bus.csi2.vc =3D + (vc_map[nport] >> (2 * source_entry->bus.csi2.vc)) & 0x03; + else + fd->entry[fd->num_entries].bus.csi2.vc =3D + (vc_map[nport] >> (4 * source_entry->bus.csi2.vc)) & 0x0f; + dev_dbg(dev, "Mapping sink %d/%d to output VC %d", route->sink_pad, route->sink_stream, fd->entry[fd->num_entries].bus.csi2.vc); --=20 2.34.1