From nobody Fri Sep 25 07:22:57 2026 Received: from PNYPR01CU001.outbound.protection.outlook.com (mail-centralindiaazon11020137.outbound.protection.outlook.com [52.101.225.137]) (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 89C5B4B1295; Tue, 15 Sep 2026 12:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.225.137 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474573; cv=fail; b=X1RAR9BdLu1f8mZWYhXaROB1gxgtwrHxCZJUG4ER5Wi91jEkSPkBfAHHGUIp+MJXmxxVkiEAXhe26PS/9dA6NravCJcJc3JsBuDB4m3L4a5EYCHIx5xt7eg1qN5mXgGF4Xkaw8kEOwWrBEFexjw914QUlfK/eEa6Py5R+DCz15Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474573; c=relaxed/simple; bh=QjpjWW/2C1YL+uway5ZUXspwvgsIxFAGq1BrGGt3+Yc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=iRv9BmBuNkd81+o6daCirTlFGX/51EuikfKrJ8oWZNgDf8HznSwTdXisNr2ewxIOBP87F9FjoP+9JXtc9dv43I+sWOOSu3dGMu8s35aYygVkmr5k0n9NTpy79kNp4ncR3AEQUIldhhh2LqDKMbLTxA6CuAbn/E53WctvTPyLb1o= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com; spf=pass smtp.mailfrom=ebytelogic.com; arc=fail smtp.client-ip=52.101.225.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ebytelogic.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uT1xjkI4GrXKUPIgE34TvpOx27jvsJ5HMaq5V4h9jQ+XdbIwdoKhXEvzkc8q4Zdw2rMEiSqythDL9GvDzhPV6mI93swuUTCpbRSATmT2DQ8DhCsF93EVVpmqR+1ikNeZOBrrX9Q6sisX6fVRrR4fmjNIy8q6SzqLkjJJrLyd5gmbnPc+A84nSONI4HwNXHSqzqzV5yoHHXwW9lw95uUXEVUj0G4n4exs7rFX1aw5BcX17Tn4kJbSaH1DLW4CopJ33TmcQNfGSVQ++d8mvZ+Afg+igOGnWf0n6Hl1d863XNTJCyuTIZfCUuEeWaGCXnYIIjVUUuQEXW4tb5Jsxbs7hg== 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=GGOzZ7G/Y9kVLYYGQts4Dr4auTQ6HFf9F5WS7m12lKY=; b=GXCAQkp8kPHqNrIYtdelYyl3G5jPEEWb8+UB2IC5xhiju06IKiigsP55o+z2JOZNluRkNnkLPYE4ejAliGi7+39oVKXatAiz6dQffuNyrVTSattKtUlolWkX9PXoRrEAD3FmggRPoP1r5E33PAmKPebCPzGeQDuNwfTaiRVmem/0llCw0ieSLe7eOasVUqOPDAOV2jfJiBM52DfyQzxN8nOHsufrLJh9WXPHRgso4PAeayrToNWpslhLuRnkgygR4br3VX/TTnANn9GpETxXmDM63fwa2fUF1aUWMLpIAc5Ki9EtafDoV2WGgDzKfNLWBYo6jDk3dbCfoK7ow1ilvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ebytelogic.com; dmarc=pass action=none header.from=ebytelogic.com; dkim=pass header.d=ebytelogic.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ebytelogic.com; Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) by MAUP287MB4525.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:18c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.13; Tue, 15 Sep 2026 12:16:09 +0000 Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e]) by PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e%6]) with mapi id 15.21.0406.012; Tue, 15 Sep 2026 12:16:09 +0000 From: Hitesh Patel To: linux-media@vger.kernel.org Cc: Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , Mauro Carvalho Chehab , Gjorgji Rosikopulos , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ravi@ebytelogic.com, Hitesh Patel Subject: [PATCH v2 1/5] media: qcom: camss: vfe-17x: Fix write master buffer done being dropped Date: Tue, 15 Sep 2026 17:45:53 +0530 Message-ID: <20260915121557.20910-2-hitesh@ebytelogic.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260915121557.20910-1-hitesh@ebytelogic.com> References: <20260914133416.1030231-1-hitesh@ebytelogic.com> <20260915121557.20910-1-hitesh@ebytelogic.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PN5P287CA0038.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:25f::10) To PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN3PPF28092842E:EE_|MAUP287MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: 714a4880-ed62-444f-4ce7-08df13231fcc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|10070799003|376014|52116014|1800799024|56012099006|5023799004|4143699003|10067099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: fSjLnE4+KU6eigu3Ow2uKop+BRbR4VvpjGJkbDd5m+Z49+T2JmWa/j1kB5FP7+Gd+1MVCizar9UcMTEmgJ7XKuI9Scg1rl8EeKTVABLLCV6RCdoqwq05EReI5wST10mDmdfKpKs8yziorJRZzJQaeo3q/gV11u10S8JdWvXGdZ4FTa2egpmFetVUwfBmCarAmQqkJUrftc97KqPZ0LjFqlh4OzQq8rbqVwH5kXijJV2dBFJTHCYooXdrWuOY8Nsq1M0mXPOgkG1Dt27Cj+6Zw+sHjkS641DDkabTsgRZrudy6P4fr5Ps+X11FtrmYX0Ub8l8DlLKb/dh8jSeT/h9XUcAuXr9dRaNX9CW7sdw1L+XuO8j9WDGbmpfPWqBxL5OEMXvAO2lt3tJzIGeOEg1ekoC4WlhvVZ+zKkCyHULBJUzMO7fFrNixneYKIPhHstoLPnuSUCS5K0J/WxQ7J6+vdnzP7TF7/UCJnzX+qjrcQMDVniRjqudg3CRQFeV+ccPw3sO8hAL0DhoI+Z7fbPAIXY3KbHFz0XM1mZXPP5ChdclEdhzItPS8BE9GrzfX2sRFnSpWsnRhwsuYXHTOiEwM33xRRUUQ88jv9H7q80+FDDPKqY7lot5ZO7RV99BVrAPUw8D2PLbcbRA6jJrhpB+fUvo3c7UVWGbjgNzLAMt7w8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(10070799003)(376014)(52116014)(1800799024)(56012099006)(5023799004)(4143699003)(10067099003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-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Rnv1ak70No3AhTKsiv4UyoQYOUbFwofdi+1x2crzUOq3rfkLz0Sv+TGzV?= X-MS-Exchange-AntiSpam-MessageData-1: enaCIes8j9xvsw== X-OriginatorOrg: ebytelogic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 714a4880-ed62-444f-4ce7-08df13231fcc X-MS-Exchange-CrossTenant-AuthSource: PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2026 12:16:08.9353 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 13bdb17c-4ae8-490c-90c1-ec8121ef96ee X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gD7aMrTm9DkpEtVsoYcLvGX5YTNAAMviYJtchsqbooPgonDn4MxJ0OvBETtSg5MMDIafFi4RhwoRxjxMwFghJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAUP287MB4525 Content-Type: text/plain; charset="utf-8" The VFE 17x interrupt handler reads and clears the bus status registers on every interrupt, but only acts on the per write master BUF_DONE bits when bit 9 of IRQ_STATUS_0 is set as well. Bit 9 is the ping-pong flag of image master 1. It has nothing to do with the other write masters, and it is not guaranteed to be set in the same interrupt in which a write master reports a completed buffer. The bus status is read-to-clear. When a buffer done arrives while bit 9 is not set, the handler clears the status and never calls wm_done() for it. The buffer stays queued in the driver and the video node never receives that frame. With one RDI streaming this is rare. With two RDIs streaming on the same VFE, for instance two virtual channels demultiplexed by the CSID, the interrupt rate doubles and one of the two lines loses buffer done events continuously. Act on the bus status alone, as the other gen2 VFE handlers do. Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Ti= tan 170") Signed-off-by: Hitesh Patel --- drivers/media/platform/qcom/camss/camss-vfe-17x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-17x.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-17x.c index e5ee7e717..c011f64f6 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-17x.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-17x.c @@ -364,9 +364,8 @@ static irqreturn_t vfe_isr(int irq, void *dev) vfe->isr_ops.comp_done(vfe, i); =20 for (wm =3D 0; wm < MSM_VFE_IMAGE_MASTERS_NUM; wm++) - if (status0 & BIT(9)) - if (vfe_bus_status[1] & STATUS1_WM_CLIENT_BUF_DONE(wm)) - vfe->isr_ops.wm_done(vfe, wm); + if (vfe_bus_status[1] & STATUS1_WM_CLIENT_BUF_DONE(wm)) + vfe->isr_ops.wm_done(vfe, wm); =20 return IRQ_HANDLED; } --=20 2.43.0 From nobody Fri Sep 25 07:22:57 2026 Received: from MA0PR01CU009.outbound.protection.outlook.com (mail-southindiaazon11020107.outbound.protection.outlook.com [52.101.227.107]) (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 085F438C438; Tue, 15 Sep 2026 12:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.227.107 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474578; cv=fail; b=WsK2MrQkqo25+Lf/I24L8y/XGrk7csjIjqbXDjxyZCcH8QMoeku/v6LzxatI05Yt1TUcGLUL74bYrBsKj22uxFUUr0qyOO1R312ZbZKXI9qmPMNN0taJlbSgum3xvG/DNDrboStMNsIh3eGLbZUW75rH4W6YX8qGWNe0T6FAb74= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474578; c=relaxed/simple; bh=akeis8KcEPS4xkH4bKlycx02iU4oCWlCSz30X76m+zo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=NnUf7QkTNrYy5fw8oHFHoPsgjGN5wJtQUlD3mK1NZZzLg5k2nPgnJ8/a7gYJoJGSVQ7RMXuB3yPFmDpo+6+smoMxIsbdPHwExCqL14adBiwPsKQHNdbLe9jEfmlfCRGoM/veeRONv+GdjHmG7Vi11I6+501x+RMNLKDhl9PgSF8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com; spf=pass smtp.mailfrom=ebytelogic.com; arc=fail smtp.client-ip=52.101.227.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ebytelogic.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a6RKi9JnDQiQw5PFO+JtLrwuBEkeE4pMDgGs7wAcpCO7a9VaMGm51KHvZBSoYxORPJEfeZPl8KT7uUvy2E9nf6zl3kIkUZgGqXSaAZc9ivqNNmx3pyR0im+7DLV6yQoQGM2au1BciaxMEx4T1gM9L3YL5mayjPUBhfclaLj/QTlys1TyfPkdala3gN48Yo+xqYWed3Amv/ZiCmWInKn6M2NuCtjkTAz7o9OEJAOJY0f3pzoUt2ENJAoSrc6mfu4X8bkrlKDcaUDG/LMDuOt1YTRdWD/tiBi3rQhPP3sMcn6qv93w2f3ylSgJ1WZGcNhVo3+JaxFaIS9aHaByphilXg== 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=agxyBsDJSdDneuA688UO/4gcEmIFDtUbuK6cNU0m9W0=; b=Z718/h2+FRB28jXtqeNbcFjoEM++FNXSrj4GXrdrqfUawoaWnq/Lbd4dt/cFxHILJmAgsQ0SC5+ePzBQ0oOlyuH/8HozIza8+EP5D89z3byQaA3V9gRdCPQB98JVo6QXJmmWCjiae5QH/zJGmNzxERNdhj4xUzqIHAyNLkpzgJOGQCG+6/C//7u+HqFZ9K4RFokTc3tOSgyR4NDRE2teGb+AoFVcOqAGI72zu7npLwRCPErG54pR6+XIjLdkzkdhcLPeOkVfrRiRuA3hOwxb6nuEdHgIaZPJfMgyEBhtrYfbsgaVgg6YQGDUXVW17mdaNKEqdBk3iUFoEQGvzF5SNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ebytelogic.com; dmarc=pass action=none header.from=ebytelogic.com; dkim=pass header.d=ebytelogic.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ebytelogic.com; Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) by MAUP287MB4525.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:18c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.13; Tue, 15 Sep 2026 12:16:12 +0000 Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e]) by PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e%6]) with mapi id 15.21.0406.012; Tue, 15 Sep 2026 12:16:12 +0000 From: Hitesh Patel To: linux-media@vger.kernel.org Cc: Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , Mauro Carvalho Chehab , Gjorgji Rosikopulos , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ravi@ebytelogic.com, Hitesh Patel Subject: [PATCH v2 2/5] media: qcom: camss: vfe-17x: Fix write master selection for RDI lines Date: Tue, 15 Sep 2026 17:45:54 +0530 Message-ID: <20260915121557.20910-3-hitesh@ebytelogic.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260915121557.20910-1-hitesh@ebytelogic.com> References: <20260914133416.1030231-1-hitesh@ebytelogic.com> <20260915121557.20910-1-hitesh@ebytelogic.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PN5P287CA0038.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:25f::10) To PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN3PPF28092842E:EE_|MAUP287MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: 74ebf801-000f-48d2-e1f8-08df132321ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|10070799003|376014|52116014|1800799024|56012099006|4143699003|3023799007|10067099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: uv9XXCnMWzI3MsM0dtHJmOKrKTxLwqOCgvwCnx3D0xpsamXYAtRjiyp73fnHrOHHEmsYEFi1W7lELs7itAtJZU71FJ0WqbPxe1QM3aPw6w0jZMN6dqenoVXkr4ZaLn7AU8cYKjyOXWa/YfcvF3UwoSI9Atq4tpO8A7weylCSnX7E7QCEJHUWt1BPXfUOafx9kMwzagq9r/FZe+5ZwSaTbcGiy2tBMU/pHdQ8RyMVG7xxG+7WgejwZoYuRMFU0J6jOYLAOykSM2H+AJSwbJh4V+EIVG89EbErc/nhG5910J5ei+GxIe8zQ7hkN3uS4U3r8kKRpzGzD38yEdYIZmrwQVzPCvOxrlkAXqmbTumy+U+ys5S0qgGwSlcOiQSOTneuGkhPwIAcmmHliOx3CdF1TsmJPfcILJZTrzjcg0zxZ5IqTepM3Q7o/9WyZZUPsEzkGZc/lPEkGn1cQ3TnT+kFzCHpR4Lepwf+0I8YWWDhvMoruCjf5hAphvm7FDiKD8WHRC1jEh9uJWlaIkAfGJaUS2Wl940lM+syeURTRRz46bgec/pT8mDIOm51bFCbKilYKCKSSCUmhSY8ZJZcIj6bnFGrgHM6EGNUAv5KPpZnQRVRoqRwTD9INeXhxUmMMBKVzY689CnE5wVjs3QkgDsueCSP43Is7VXAyugty+EJCsY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(10070799003)(376014)(52116014)(1800799024)(56012099006)(4143699003)(3023799007)(10067099003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xIIGSke+EcKypwOwMTm8mehC/wa634mpL3RfSOZxjFB1/qfSxsyagsUdemen?= =?us-ascii?Q?Te6e4LnHGbc/me+uact11D1cPONIJ0Wlfk2LrUpZoRQqZZi0hRdxVnLO/yLJ?= =?us-ascii?Q?JGlO0j7hlEZMoGgizgAQLWyXEA6goRhcMY/sdK6ZOh9DPugOypyzWXT8SY9K?= =?us-ascii?Q?QnThDFFH/xsAVa8dvAyxdhOgdpNGOzKP21/T5sfNIb6p9dvdyGTAYAN5MK0t?= =?us-ascii?Q?0ob5GiAd2ZMAc3++WYTJeMRe+hHkgv9aeVzLAy2+HtSHbkcosN6UZGndnj4R?= =?us-ascii?Q?MILXYKQDFeu/EisnuChnLxIsghx6UleFyGvnH0AzVFVS7ySdlIx8NCjS1HFb?= =?us-ascii?Q?mJUhgB7IEMEZSpcXfoil8KlQVo/hY5IA8keslhnYhJynudb12WzyRlgW8tCH?= =?us-ascii?Q?jltTgny/E53tLdH+75NHqbYAfuNL9oR+b4xInaoeZXLmP7MRVs2W88i3+3/1?= =?us-ascii?Q?YjJc5jc04MAkp0PtB46qI7SODFb8QSsNxRP7z8BMVGb0XV6QdtJ5Bsd/NdK4?= =?us-ascii?Q?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=?us-ascii?Q?geHYKQPidtaySkA0mEClEqfDolQKA4x7OL8xb7oFDHKxmvF54lcNAOixFZT/?= =?us-ascii?Q?pS95s/hLduCZMQLLRNZhBwJBoySZ3MupgQlTo5OnRbyfhhnDV+iA3apqjOkp?= =?us-ascii?Q?TK+uIR3bNf/duYKEEBrR5abhO6Ky1vPMBnpx71YnIl3MxSrcdzWvvRDGKYgn?= =?us-ascii?Q?HUZafmU/JJI5s4gCMlNhHB9hLV8gI+5WQKPsbDj8BPmyVNaEhfq+tfPgrnZ/?= =?us-ascii?Q?C36WmQjN6jhHvdkEeJ0o8XAtHQiBz5Uxp+3SKAKy6HsqM8Ykfb7FVChOEIso?= =?us-ascii?Q?sW7wZZInGemG0UuqHZaifMpDIAJ4V0FkDL9Z2ugt3tx+lwqS+UiUXGeCBYPj?= X-MS-Exchange-AntiSpam-MessageData-1: bRi6WeVrx4vcTg== X-OriginatorOrg: ebytelogic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74ebf801-000f-48d2-e1f8-08df132321ac X-MS-Exchange-CrossTenant-AuthSource: PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2026 12:16:12.2397 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 13bdb17c-4ae8-490c-90c1-ec8121ef96ee X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U/PXYxc1rZIgVn1vjtJz322q8BTNiXUXZnCLJW/hyrc0tWrO8ksc/PSNZ4G0kyL9ejLkg4I0AnhvLq5d3DdpSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAUP287MB4525 Content-Type: text/plain; charset="utf-8" On the gen2 VFE bus there is no crossbar between the RDI paths and the bus write masters: RDI n is served by write master n. The common vfe_get_output_v2() reflects this by mapping line->id to write master line->id, and every gen2 VFE except 17x uses it. The 17x code kept its own vfe_get_output(), which reserves whichever write master is free first. That happens to be the right one as long as a single line streams and it is RDI0. As soon as two lines of the same VFE stream, for instance two virtual channels demultiplexed by the CSID to RDI0 and RDI1, the second line to start is given the write master of the other RDI. Both write masters are then programmed with the buffer address and frame size of the wrong line. The frames are truncated to the smaller of the two buffers and the SMMU faults on the larger one. Use vfe_get_output_v2() on 17x like the other gen2 VFEs and drop the duplicate. This also removes an error path that released output->wm_idx[0] before it had been assigned. The gen1 VFEs are not affected: they have a bus crossbar and any write master can serve any line, so vfe_reserve_wm() is correct there. Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Ti= tan 170") Signed-off-by: Hitesh Patel --- .../media/platform/qcom/camss/camss-vfe-17x.c | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-17x.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-17x.c index c011f64f6..62c240535 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-17x.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-17x.c @@ -382,45 +382,6 @@ static int vfe_halt(struct vfe_device *vfe) return 0; } =20 -static int vfe_get_output(struct vfe_line *line) -{ - struct vfe_device *vfe =3D to_vfe(line); - struct vfe_output *output; - unsigned long flags; - int wm_idx; - - spin_lock_irqsave(&vfe->output_lock, flags); - - output =3D &line->output; - if (output->state > VFE_OUTPUT_RESERVED) { - dev_err(vfe->camss->dev, "Output is running\n"); - goto error; - } - - output->wm_num =3D 1; - - wm_idx =3D vfe_reserve_wm(vfe, line->id); - if (wm_idx < 0) { - dev_err(vfe->camss->dev, "Can not reserve wm\n"); - goto error_get_wm; - } - output->wm_idx[0] =3D wm_idx; - - output->drop_update_idx =3D 0; - - spin_unlock_irqrestore(&vfe->output_lock, flags); - - return 0; - -error_get_wm: - vfe_release_wm(vfe, output->wm_idx[0]); - output->state =3D VFE_OUTPUT_OFF; -error: - spin_unlock_irqrestore(&vfe->output_lock, flags); - - return -EINVAL; -} - /* * vfe_enable - Enable streaming on VFE line * @line: VFE line @@ -441,7 +402,7 @@ static int vfe_enable(struct vfe_line *line) =20 mutex_unlock(&vfe->stream_lock); =20 - ret =3D vfe_get_output(line); + ret =3D vfe_get_output_v2(line); if (ret < 0) goto error_get_output; =20 --=20 2.43.0 From nobody Fri Sep 25 07:22:57 2026 Received: from MA0PR01CU009.outbound.protection.outlook.com (mail-southindiaazon11020107.outbound.protection.outlook.com [52.101.227.107]) (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 C348A4CC271; Tue, 15 Sep 2026 12:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.227.107 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474580; cv=fail; b=sB7IjfcUS58+0pf3rXkQD9ekij3iBhYJcZb/1lN18ZSq1+wzfbkX2ShR01tptjLk4YJHbPC/v0GGSx9Hi49bWNOKWu8tjSKdt1mxh1g8zcrkqwKM3dEum6i/5SzOeyY+j9DnGgpKugMzlr4zIlV38JsVJAtXnxPg4vtt0EUTcQ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474580; c=relaxed/simple; bh=7TD/70lop+79R0e+ufkT//Aoe6SfkolZUHa+I/pkCmc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=cz3270h0xWktH9CEaGXSyF+r/qhtegQJUXCIjvNhbtJacij1TZIvrNWt5PrG7zgF7L0p0EEDhPnF2SBG+reKTZBlG9aJ9EZ190V+xMvQCuRUsbpBRzxoTGY7t3jQ8NMlC5X4ciTGDOFSkZeedhvNfimWpq29EzRADS6Y+gmi+hA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com; spf=pass smtp.mailfrom=ebytelogic.com; arc=fail smtp.client-ip=52.101.227.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ebytelogic.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wJhx1PnVUQ5WFSxOcRVMfUv6Zs+oh4CyIIqQNn/i3Ub5vbxRjbMSTqb9LcfUPCkrbJJ/XtR4dbzJnSkjK7sTtubCMryohfoRNMrL0pmisfCGFaM73daYa0vxtKa6qjmwp7XFKtYsCZfnWAptj/iS5lV6+sAAJagvVyBxJTh8mk6vOTNg78PKXyX3uZLqa99AytrLCZ2xxtPcecwvaXwWXjeq18vCdcDkVwFHsTD3elJAUPDH49ZPKSjE83Mz+lcZ2miYvaiOqPLStsgGrHIEtD2WXRXgVdaOeX/Clde653qpDAT4SZl4FVIqpALU/u9bhNOW0G4yCKa3gFcSXKqqww== 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=b0UOVOlNC+KGK4JyPZ4xfHf4A0mMmYwK1yPJhvrix7k=; b=jv9mA2O3sw5dkhKsbHXMQRPrSYYNwUPd9WguG48Dx5EcbawMI/k80wzBtyH51Iq4ZM7tERuTfwuF+vfNoNx0oPLiNYi0FMJfw7T/r5AWHdyk6yn7G303HpZDsWWtjCseSRmzQ+CQSNXifz2xCdZIPjiSSKbiwzypyfxsuzuVgdW49OVjGFHKlJd/8rwAi97LfYAxSdzavzCqqdawsrEPNWpHelgTxjyIGg97cv/aW/pz3FCPuFo8XcoCfB0M+YNnqqETxqt5NeX5CEHYnwBIk70+6/4d7+y/UROApJpAZybiWC0msXp0D+M1jY4Ph+RlkTt7Aggdni7foBQIJE8Zaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ebytelogic.com; dmarc=pass action=none header.from=ebytelogic.com; dkim=pass header.d=ebytelogic.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ebytelogic.com; Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) by MAUP287MB4525.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:18c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.13; Tue, 15 Sep 2026 12:16:15 +0000 Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e]) by PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e%6]) with mapi id 15.21.0406.012; Tue, 15 Sep 2026 12:16:15 +0000 From: Hitesh Patel To: linux-media@vger.kernel.org Cc: Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , Mauro Carvalho Chehab , Gjorgji Rosikopulos , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ravi@ebytelogic.com, Hitesh Patel Subject: [PATCH v2 3/5] media: qcom: camss: vfe: Fix VFE reset while another line is streaming Date: Tue, 15 Sep 2026 17:45:55 +0530 Message-ID: <20260915121557.20910-4-hitesh@ebytelogic.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260915121557.20910-1-hitesh@ebytelogic.com> References: <20260914133416.1030231-1-hitesh@ebytelogic.com> <20260915121557.20910-1-hitesh@ebytelogic.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PN5P287CA0038.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:25f::10) To PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN3PPF28092842E:EE_|MAUP287MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: 794b9c5c-8988-4b44-1e25-08df1323238b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|10070799003|376014|52116014|1800799024|56012099006|5023799004|4143699003|3023799007|10067099003|6133799003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: oNPe64U/uM/K+8xy8zgPz9gI3e63Rv5CGL4VVLQtdwqZuSWG4yUQesW1UWOtvbEwANfhexiTiiK6+40hEPuIhMw6BYjztO46mZ54jkhA4NFkGu9drWMeRlpPs4PZDj1h340FoQ+FtIfjmh6uanVlfsFUeRWVuUCIK7Z/vTZqVjEXuvW3SciOtnMHad+qwzXFnmvD9xKprfoiZ8tQnaNyNXZPBJTMTzUGmnX6w7D91bEXeiLJgaIh7Ewm1gb6kF0x+AlXPGegafnO2d3YN8EGON+owd8ROGVzTvzUtNDQ59TnpjXoMADvEmeniJet5XdSOBeuJTE0bdd0R3VqRCZhYLRwQMG7bj9E+9BBBBo2nBwQkZFjwQztxUMKBkIIskZkpsMOI29o9gekuHqNy/no0UQf9K6gaAg1Bha+LwxV0i6LUxf4ci9ldsWz5OF6EU80UBENxvJZNNhYPaoc4Yt56Nfd2n5Xk93WBs6vKMQnSKyQPJEGGLCQQrLuEpFDFPChf+gyHU7ik1jBeTBUCEgUZbNokGlmcP4WXpQo4eko0XGvhUIdc2Dln2OcW0lh/OJzy5GxfyGugzAQherWel5CDSlEZZrKQFSQ7YXTquGKxdXWpw5qWu+7TXpYkCrfDwzYp4wgLW5QDDOlmfUoKoublMRMrj7oW6GV2WsrmUn+lY0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(10070799003)(376014)(52116014)(1800799024)(56012099006)(5023799004)(4143699003)(3023799007)(10067099003)(6133799003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?l+5aIDm63PxF4TdeSP7u+wdqA1e82EYYZNgkGRDQqSDHORFkPv7kChCCnEni?= =?us-ascii?Q?jEEUtbdBqdJX4Nifn71qCET1haS232fyxIrsseHrZd39HmVTzqCLOHAOZvRY?= =?us-ascii?Q?hhNqOujgpzqPvx2KpJJ9aNg1bVAYXD/fBTb8mpT00XXI11KMuJlI95m7Cz/7?= =?us-ascii?Q?q8WLV/SE9PwCTHnyQuyDd807ice9bQ4FwfR/h+axxvJXaTtcnOvcucoaHOsi?= =?us-ascii?Q?j6umaCOoYOXVqXuf1IqAeXITL6z8JCaZQKvAspgtisJUFRaFc0qp/VPFvDAE?= =?us-ascii?Q?hryOjyTfbxOURKEnfv1w1gYGgu3wVFpgDigHclMIAWZxBwBGqnHF3TEa6O4j?= =?us-ascii?Q?qDjtH31aGelgUWZ80VZos9XECt+AyYcyxfWARqZippmyerK26avUip7CCx3e?= =?us-ascii?Q?tl5pZ7U2s2noLuWFKChjbqoyEYqLL2tKYuNtOCNv/Vju0I6BrOL8qDoNwxpa?= =?us-ascii?Q?dXKMVCpYjzWRme945JUpC/pYvkPVueMql1kDLKJ7+yaktv3FOXjgAbmUru42?= =?us-ascii?Q?jb69Xd8mABL3Sw73ipiBCoaHrKMNU36EwfDWOJuFlG1qgA9/6ft3C9hak6Id?= =?us-ascii?Q?MJhAhVre+G4JEwkbRNM8OTnB2X3BeWBz05nYkQIN75BMYtNFZe53obqIWug6?= =?us-ascii?Q?+KgUQjvKGLCK5YNiSLOZAssoMLzQSaABjnQew7KCnh+brBnleWfjr/884l73?= =?us-ascii?Q?K27dAwcdN1hPQbMoSMOYAk+ZsGVSWgxlGMhT+p1EKMyGux+RebRKYiTmw1cE?= =?us-ascii?Q?xTTIpvQIfEjxMBfAaQuk9yPwA+q2urCGWHC8WEzG1e8A6ks4HPXS2KdJ+WS6?= =?us-ascii?Q?F7bDcLOH40kNDXladMeSTC54sVsYhM0zcV4btot4Eele6vmf8w+lzbcOYvtq?= =?us-ascii?Q?ZierqWu2bEQPG591ThIxvEd4O0s/3xtPXo0a74h8lrP8Xzo8WR50NxZbyeG7?= =?us-ascii?Q?iOYBTOPyqtmLKMY5X+aKlCW38C9nW3KmmcR73imK2koyXybpdIsuk5eT9LMI?= =?us-ascii?Q?2sW5twu5PyvVFRISCo5xGF1/X6xxTiXWBCo2xP9XiN2QVR95OYAbg69f/tJY?= =?us-ascii?Q?Vr4kdJgdRujwRi++j3Wq382NpJOQpsuqEWwEOFMcZen9zmxBFTiOabaNVHzG?= =?us-ascii?Q?40NPLlapeYtgUafBn+QW1A4MMdWw8v+EaCZFZD4oLtwr8ciPi++9nQW8qyNv?= =?us-ascii?Q?h5q26dlngHaAOKj3YlTK4QTGbDAVvt2noDtYXGObJm47EIG8CBEjoA2seQau?= =?us-ascii?Q?bTvRyFQc3xif71PyIvf4h3eZaVQhfGlUP6NqIksJTXKMyrtVc+3sqRHCmnn/?= =?us-ascii?Q?E/PFZdhjxxK3t5UURYKnp5hFL1lDqWWZorsopYzZC894PbI4F64zEeoiquwQ?= =?us-ascii?Q?j5s9FriuFsqjYqVmHILiYSnId8MGbL5QbFAhc0g8cnWGpuNCfsd5rI1XAfF8?= =?us-ascii?Q?5BC3+EJaMXl4H/0lXc1852fWtAHqOcRQ5x4toyzL73VO+mpuYiAsMM/8wvsl?= =?us-ascii?Q?XBMS8L5mXmbeI3Fp2QJQjbfi6SVlJA3ChFT/KITwRtO2laXq2UUTANcoeEgs?= =?us-ascii?Q?p5JeX30GRRrTPQW1TZjx6bd50ILq4QAmQJkwxva7p6Rsutux7rFxr6j3GvTm?= =?us-ascii?Q?fxo5/H4r9fGH/CRzH+dvv2oB+4K+Zu8vVQD/lef33rfclVt8as8QrTpYw/Z+?= =?us-ascii?Q?PcPRFHuD3tUwcTLBpDeejTgu+R3WH4S2FwiRmbRBfeCDhnBS9mZ4HWRguPqm?= =?us-ascii?Q?bOJ/P/80/D5hBmDvbvMeAm6ve9DbB2B+uzAYY4inUIH1gfHmB1xDZK+voiFu?= X-MS-Exchange-AntiSpam-MessageData-1: 4za1mL2CunGhNw== X-OriginatorOrg: ebytelogic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 794b9c5c-8988-4b44-1e25-08df1323238b X-MS-Exchange-CrossTenant-AuthSource: PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2026 12:16:15.1773 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 13bdb17c-4ae8-490c-90c1-ec8121ef96ee X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LuzHiw2pbdv6HuAad9cUSfAm+UcDDuZEBzL1AJHK//zU5W2shTBSGYna7L/W/vQlR2VbPO4HNP9mcDLk/IWenw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAUP287MB4525 Content-Type: text/plain; charset="utf-8" vfe_disable_output() stops the write masters of the line being disabled and then resets the whole VFE. The reset is not limited to that line. When two lines of one VFE stream at the same time, which is the case whenever a CSID demultiplexes several virtual channels to different RDIs, stopping the first line resets the VFE underneath the second line. The second line's write master configuration is wiped, the buffers it had in flight are never completed, and the VFE is left in a state in which the next global reset is not acknowledged. Stopping or restarting the second line then fails with: VFE reset timeout Only reset the VFE when the line being disabled is the last one streaming, which vfe->stream_count already tracks. Stopping the line's write masters is enough to quiesce that line on its own. With a single line streaming, the reset happens exactly as before. Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Ti= tan 170") Signed-off-by: Hitesh Patel --- drivers/media/platform/qcom/camss/camss-vfe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 319d19158..9cdf26671 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -814,6 +814,7 @@ static int vfe_disable_output(struct vfe_line *line) struct vfe_output *output =3D &line->output; unsigned long flags; unsigned int i; + bool last; =20 spin_lock_irqsave(&vfe->output_lock, flags); for (i =3D 0; i < output->wm_num; i++) @@ -821,6 +822,13 @@ static int vfe_disable_output(struct vfe_line *line) output->gen2.active_num =3D 0; spin_unlock_irqrestore(&vfe->output_lock, flags); =20 + mutex_lock(&vfe->stream_lock); + last =3D vfe->stream_count =3D=3D 1; + mutex_unlock(&vfe->stream_lock); + + if (!last) + return 0; + return vfe_reset(vfe); } =20 --=20 2.43.0 From nobody Fri Sep 25 07:22:57 2026 Received: from MA0PR01CU009.outbound.protection.outlook.com (mail-southindiaazon11020107.outbound.protection.outlook.com [52.101.227.107]) (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 C41BF4CC628; Tue, 15 Sep 2026 12:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.227.107 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474582; cv=fail; b=k0UKClFAS4iSZ4YuZXyxS45QAkbdsIUvVimL8fgOJIOv3xjCfP241XqmVg9fC8m53c/8Tu8YEAiDcyiHjBjoWunOxdCmyzf/kLz3DWBhrEc0r9dLKy/a/74oGEW3FzNFbgyOaX697KmMuTqFnKxbLF62RLdRvEhz8uHWUv/9EN4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474582; c=relaxed/simple; bh=MYrhuMX3TyzD+dzhFjAGnN5JtEg8d4/KudanZgPstQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=YkLtWUoOV7tt2CAysdmvfEes1GYgzZUJX01BlDQFwbqPubRgkry4F4pf++NtbR/K2wbJwytWqPmMS+ZaVGpMmEmUjhGadv/98oMZj1v2ZtKB+ZFY3DMNBMRirevkUYdcQOrozIM7/hSWq/ZY6SwN4Y5NIDHf+1qx8upf21Xl1zI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com; spf=pass smtp.mailfrom=ebytelogic.com; arc=fail smtp.client-ip=52.101.227.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ebytelogic.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zAQcBJ5J5X73bZFQl4yrH2VIKWBgsyulAE5ObkCxwvSQGAGMJw/6A6IZ1pNm48aJz69sPfUjin74vx8H+xnltT7e6DU+OU5M0na7TOT/KbfIy+mWa2Xw/WibIf3Ht6whlTDJ6n3mnjsSX9vysC0stbVmNmhxbmz3fwX4V5pkKM7SoNJmUfMo6TfIE1ucw4WFx1zkeLhm7D8fCeCk1SssXXiU3j8sQ1yc5R46ABf0AXsGSvZVNszncB57vZ1/XXfKLJaiTiZa0BqwPP1zxehYBZn27bDsO3w1MF530i7N3pe18z3nG3qcUwUBrb11dNV2hOlARCtiKZmIFekBZgvrDw== 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=Qp8UCCjTYtdraO9q6doxWP2hCkFU1J5Ft5eGYi8MfXY=; b=VhdObfulH38uxBz+5QFZs4P4qYoCg+FP4zyR+3PQm8+x+PGd3C5n86UN4lKjytj3OvRyGzVSEESKlzHTt2TfhgtW2OByIaIqm5awWIZFdIZ3ySUcY+TDCGAYD/iu8tihlhXEFAieFHgJVg5C5LoqvYOjek4EAFcCc4CbTSEIZm+UaDLbfHZjbqD4qVRl8fvp4AYQyRSbzzzGGpzW8wqFHg/qstvFQX5+nOTN8wnbBrpLytcbAmo6vl8Lctq6OlWSSPD1cQlUina1iw66qZDTeXubPFalwziQiAD/CJy9dxh7k/CIH5T7Xx7zSaQz5sCcAzaI6fcsUzZpHTagFPVrMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ebytelogic.com; dmarc=pass action=none header.from=ebytelogic.com; dkim=pass header.d=ebytelogic.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ebytelogic.com; Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) by MAUP287MB4525.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:18c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.13; Tue, 15 Sep 2026 12:16:17 +0000 Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e]) by PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e%6]) with mapi id 15.21.0406.012; Tue, 15 Sep 2026 12:16:17 +0000 From: Hitesh Patel To: linux-media@vger.kernel.org Cc: Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , Mauro Carvalho Chehab , Gjorgji Rosikopulos , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ravi@ebytelogic.com, Hitesh Patel Subject: [PATCH v2 4/5] media: qcom: camss: Take the link frequency from the CSI-2 transmitter Date: Tue, 15 Sep 2026 17:45:56 +0530 Message-ID: <20260915121557.20910-5-hitesh@ebytelogic.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260915121557.20910-1-hitesh@ebytelogic.com> References: <20260914133416.1030231-1-hitesh@ebytelogic.com> <20260915121557.20910-1-hitesh@ebytelogic.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PN5P287CA0038.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:25f::10) To PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN3PPF28092842E:EE_|MAUP287MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: 146c854c-6562-4151-f1d9-08df132324f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|10070799003|376014|52116014|1800799024|56012099006|4143699003|3023799007|10067099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: Lm0vAXtQS3ilq15eLgAqVaZi/Mthuam0hb7WP+paqPZXF5zZ3ZDSaX31tPs7N7Fs4Ok8xU9jxeFS6YJndaZQMiSYLO3gu6P1aFgDNMXNf2bOdgefYqbrqTRkRhhfEp9Ymt9M/vL4OBJsrXqM0d3blMLjo8dJ9/8BmPHm847i39lZWEuWYqiVcRNGGN5jwWFr7sd8is02a7jSMn932s4Cq5fZ2wxh0awzWROm28wi7rlFEQozR9TGsCxhGqTkFEAU/pqrq/stq8P3JosbTO3rG67Fsi3YGf4u7CSO1dzQWNayxvNfgm240Y0vHQ6LkHW+p+rTK8jFrghdTWBQ10KOhZLf6myauEdKI4qpmOtbtw0qc7gM04CNiOkc6IODHJYrT/YpehefpCL5bDmFO0a/Gz8aHNnU2puPOpKEuwNDBGbYqa/LIXv6mzuSQstXmawupbLDjtZw8vZV3xjusHJyC8PhAG2o1kFY8gjtZ4dvL1xTCjZQMd+P2dgM6wjXPlKvVym5+FYQ+ga9+U8Vq+QIn4Zj9csFwrDJbLtDZKqkViU3KfycKhN9jC9TiIeTfu4Ur0PL+DQ6Jr9GF/bPfWPY096trExtQwaNRyVHOicemftCaj4DLwWnf9Fd0ybE8NU49ujFcWmdgiGjzDpijB38I+6LeDm7TxLLMEviJQbz8Hs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(10070799003)(376014)(52116014)(1800799024)(56012099006)(4143699003)(3023799007)(10067099003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?j2CF+V0ITz2P2yza5N8LY/a01tCoSTKbDJg68zq8zjlhJg+8+FGEwm8S7fnw?= =?us-ascii?Q?BEt3Njz/xX1mhrOaU4IuI2NV/SqkRATpCrJQP7yjyV5gurrrwU1YfRz0tnL0?= =?us-ascii?Q?GGj2D9yrdOri1jntMjQFT/lDRZJpL0HfM4WnmpZMvh2cLuGMOptNf45MB8TO?= =?us-ascii?Q?Ib9xnbYJQRdBlo1LFKbnhNsEZrXAJVgTqjoufYWoQzhE20f0KXenUkq+nhrG?= =?us-ascii?Q?H5876vUPYppnsK5zindE2g/lTS6IAE25egNR6FCJR+URmoB3hJemVHupIr21?= =?us-ascii?Q?Jfj4ZFPK/ENT6JyZAGy3ksBb3Bm7x1nSt6gyUxcyUo/Upi9FVNoM74aV8292?= =?us-ascii?Q?TWFA53qHo4dWgmjJwXFGvO1DDlifxdwMSLHt+tuknndYONQ7AGs7pe4jNvfV?= =?us-ascii?Q?ikpe2dgniyfzVnEG+VCMdAGewckgsM/BA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FoqT+qJ9o2so99kKz8IDjsXHJl78nizn0GbZ3StfWH0ALcjBIYGxaY?= =?us-ascii?Q?nvved8/yUCwdljypfFFlZlVq3gSffwRy3aA0MEEjoqoT9Sqh71lljo0cRCgR?= =?us-ascii?Q?zo48eIpzHEFElHLLW1N/9EDrH1NUK+rfHHFCas9X/hr/vA0jBb4gvgh4nRhI?= =?us-ascii?Q?kC0Om3coKOw0dSNc8AqGRXAtbrdTgxZrXhKSwPrHWOm0GylY95NvAhe/wcL+?= =?us-ascii?Q?bSzrQBbO8c4H4DbtJB01Ir8Jh0pnfTQUAfmRHJwSLk5r0+aYg+QtQA5O0eWb?= =?us-ascii?Q?seoGlGeQ3HfrzUUuAkk8kKj7hJGOM96UHZLz6rRspa8hpd6WNyLtdDYCF78v?= =?us-ascii?Q?RKXrY1sTszWxxaC5Q0TS9mU+9mfGbHeC5Y5AM7cReCXjmggC0nvC1ZQMnQFn?= =?us-ascii?Q?HDbfbD3J77eYrL14uLi6Y9bjkiaNogSuSFyKcE+0VO5gELQCjr+Qow+0X+P+?= X-MS-Exchange-AntiSpam-MessageData-1: YjRCQRLRihpQ0g== X-OriginatorOrg: ebytelogic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 146c854c-6562-4151-f1d9-08df132324f5 X-MS-Exchange-CrossTenant-AuthSource: PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2026 12:16:17.6788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 13bdb17c-4ae8-490c-90c1-ec8121ef96ee X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6txycUw976sNpbgIRRaOs5IqYQ7CssaW1HS5bIjvaXPHo7nZ9v0DQxtQGD0Nkmmuggl1q/7WA4pHjpDS5ARSuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAUP287MB4525 Content-Type: text/plain; charset="utf-8" camss_get_link_freq() walks the pipeline up to an entity with the MEDIA_ENT_F_CAM_SENSOR function and reads the link frequency there. The CSIPHY settle count and the CSID clock are then derived from it. The frequency the receiver has to be programmed for is the one on the CSI-2 bus, which belongs to whatever drives that bus. When the sensor is wired straight to the CSIPHY that is the sensor, and the walk gives the right answer. When a CSI-2 to CSI-2 bridge sits in between, such as a GMSL or FPD-Link deserializer, the bridge re-times the data onto its own output at its own rate: it may aggregate several sensors onto one link, forward one sensor at a different rate, or generate a test pattern with no sensor at all. The sensor's rate is then not what arrives at the SoC, and the CSIPHY does not lock. The walk can also fail before reaching a sensor. A deserializer has one sink pad per serial link and the walk always follows pad 0; a sensor attached to any other link is never found and streaming is refused with "Cannot get CSI2 transmitter's link frequency". Stop the walk at the first entity that is not a CAMSS receiver, i.e. at the external subdev feeding the CSIPHY, and ask that pad with v4l2_get_link_freq(). The helper queries the transmitter through .get_mbus_config first and falls back to its V4L2_CID_LINK_FREQ and V4L2_CID_PIXEL_RATE controls, so a bridge and a bare sensor are both handled by the standard mechanism. For a sensor connected directly to a CSIPHY the transmitter is the sensor, so the pad found and the value returned do not change. camss_find_sensor_pad() is kept for camss_get_pixel_clock() and the frame skip query, which do want the sensor. Signed-off-by: Hitesh Patel --- drivers/media/platform/qcom/camss/camss.c | 70 +++++++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 2123f6388..61e98b017 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -4619,24 +4619,82 @@ struct media_pad *camss_find_sensor_pad(struct medi= a_entity *entity) } } =20 +/* + * camss_is_receiver_subdev - Test whether a subdev is a CAMSS CSI-2 recei= ver + * @camss: CAMSS device + * @sd: Subdevice to test + * + * Return true for a CSIPHY or CSID belonging to @camss, false for anything + * else, in particular for the external subdev transmitting to them. + */ +static bool camss_is_receiver_subdev(struct camss *camss, + struct v4l2_subdev *sd) +{ + unsigned int i; + + for (i =3D 0; i < camss->res->csiphy_num; i++) + if (sd =3D=3D &camss->csiphy[i].subdev) + return true; + + for (i =3D 0; i < camss->res->csid_num; i++) + if (sd =3D=3D &camss->csid[i].subdev) + return true; + + return false; +} + +/* + * camss_find_transmitter_pad - Find the pad of the CSI-2 transmitter + * @entity: Media entity in the current pipeline + * + * Walk the pipeline upstream through the CAMSS receiver subdevs and retur= n the + * source pad of the first entity that is not one of them: the CSI-2 + * transmitter driving the SoC. + * + * Return a pointer to the transmitter media pad or NULL if not found + */ +static struct media_pad *camss_find_transmitter_pad(struct media_entity *e= ntity) +{ + struct camss *camss =3D container_of(entity->graph_obj.mdev, + struct camss, media_dev); + struct v4l2_subdev *sd; + struct media_pad *pad; + + while (1) { + pad =3D &entity->pads[0]; + if (!(pad->flags & MEDIA_PAD_FL_SINK)) + return NULL; + + pad =3D media_pad_remote_pad_first(pad); + if (!pad || !is_media_entity_v4l2_subdev(pad->entity)) + return NULL; + + entity =3D pad->entity; + sd =3D media_entity_to_v4l2_subdev(entity); + + if (!camss_is_receiver_subdev(camss, sd)) + return pad; + } +} + /** - * camss_get_link_freq - Get link frequency from sensor + * camss_get_link_freq - Get link frequency from the CSI-2 transmitter * @entity: Media entity in the current pipeline * @bpp: Number of bits per pixel for the current format - * @lanes: Number of lanes in the link to the sensor + * @lanes: Number of lanes in the link to the transmitter * * Return link frequency on success or a negative error code otherwise */ s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp, unsigned int lanes) { - struct media_pad *sensor_pad; + struct media_pad *tx_pad; =20 - sensor_pad =3D camss_find_sensor_pad(entity); - if (!sensor_pad) + tx_pad =3D camss_find_transmitter_pad(entity); + if (!tx_pad) return -ENODEV; =20 - return v4l2_get_link_freq(sensor_pad, bpp, 2 * lanes); + return v4l2_get_link_freq(tx_pad, bpp, 2 * lanes); } =20 /* --=20 2.43.0 From nobody Fri Sep 25 07:22:57 2026 Received: from MA0PR01CU009.outbound.protection.outlook.com (mail-southindiaazon11020107.outbound.protection.outlook.com [52.101.227.107]) (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 E73644CC630; Tue, 15 Sep 2026 12:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.227.107 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474584; cv=fail; b=deRQ2Mq5pEBju4aa5XaoUwFsE0UMA1PiLj0g5H+kBg15MwoHq8q+ExzBIDOrzFVzCwyCGvCOeMRaKg/AMO9VW/Tbxpl3WQsigXVt1wkkjTjk5wA+8Qz4uizOlDGJM2S3FqcY0VInBbr6iEcFttV5GIST0GlnvA8sZfwHNtuv5A0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789474584; c=relaxed/simple; bh=dxjeigxeTrYJHze7nbr4BmcyEf9/t0Mrjv5Xbww/5+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mcHuuYrY5DEwSfdmVVhrjtqqgaGoIbixE/tWIuyGqQ0qvArlbS3A7PVRgRmh710BhCnnp9b/KBSA6mO9W9yJJZ2lrl1T3C315p/88+hJY3EiVwtUtECDeyqjjoig0JAl1neSYoqvWE3IwzWYhrsN+2TVPkzGPWjjHle4sawauZ8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com; spf=pass smtp.mailfrom=ebytelogic.com; arc=fail smtp.client-ip=52.101.227.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ebytelogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ebytelogic.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tcPiPOCNb+7kTwNStks3DZn9j46XtnN3sLrLFYrGmGFhBSnGV4FuD2G2A8ExEITRADKUioFd/OqUAB+ZNbXh3cKAMVdeqUDMt1zbeTz1Q3PZyulGaBSuG6dDKMfzRgruoyaxQu8x72gtueXvsa7tONoFUlJzN3nfzPXkh+rFe6tKedJST4ue6Mv2+R6dDCLUuui6Bn5mbOdFAIDusrYJH8+pepX4IhFB5UX3/Ihl8NqdQG5OXUPJaErJ2v/1NS8TBd2lpDYSj8gk3y77h+JxUPkUvss0c4D4Wm1+ygFIJwSNyypQD4h8qYih68ZF0Lw+J4Oo48OctVHQK8Zu0RYj9w== 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=jzDst+SsTYCmjY87Nk5hn9KbdCrqfazXCsr8HD5DnGc=; b=YjJkXRfrQVq2jOe9R4KS8dddCiQ/2HJ48ph9mLyFP3MJU340FyzE2MI/fNhLg8//nJMnLUGX7a69EuQ9sGldSc+/+0ARhyG+jwURjjwj8j6q6j8ymoykdAhNlf68P6stIzkm5I3xlzGihYPtaS6JKi1El4M+k3IDsRZqaQWFEN6ZDzGY0Lvs1qZM04Tv19G5oNppta6PqLWTQsvcO8WgTfv5ogfwFq8dgRsLWJiBPJgSAY9g6NuryKJVDdC5qhWUE6+/0bep6n7XDMJiko1bZtVAXMsMwT66YYAJqjEaj7QaVmuX5WO9+vf+Rwdzx3wM65nfe+bWnDB5PCmLVVsaxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ebytelogic.com; dmarc=pass action=none header.from=ebytelogic.com; dkim=pass header.d=ebytelogic.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ebytelogic.com; Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) by MAUP287MB4525.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:18c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.13; Tue, 15 Sep 2026 12:16:20 +0000 Received: from PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e]) by PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM ([fe80::df75:6e8c:7def:a08e%6]) with mapi id 15.21.0406.012; Tue, 15 Sep 2026 12:16:20 +0000 From: Hitesh Patel To: linux-media@vger.kernel.org Cc: Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , Mauro Carvalho Chehab , Gjorgji Rosikopulos , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ravi@ebytelogic.com, Hitesh Patel Subject: [PATCH v2 5/5] media: qcom: camss: Create the source to CSIPHY link per endpoint Date: Tue, 15 Sep 2026 17:45:57 +0530 Message-ID: <20260915121557.20910-6-hitesh@ebytelogic.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260915121557.20910-1-hitesh@ebytelogic.com> References: <20260914133416.1030231-1-hitesh@ebytelogic.com> <20260915121557.20910-1-hitesh@ebytelogic.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: PN5P287CA0038.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:25f::10) To PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::97) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN3PPF28092842E:EE_|MAUP287MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: 0898397d-415b-4956-8b48-08df1323267b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|10070799003|376014|52116014|1800799024|56012099006|4143699003|3023799007|10067099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: mHVGYanKr3NUzEN/9rcdcVCoeNPbF8b329vUy519y8ENDfXkXvXdJMBOJ2HQ110wzDcpsMJQo+juyX1ZiOjEQlK+qt4ItlWtH8M03LDS6nmW/WaY8EL9dApsP/cadwtw/bbn7nee9C3FjNbDarL94/p7QYlA5cU7b5sVwXi1oYydb8fVe8s2GUY41mrPV+HQhd4wh539vHGJ0DjwEoXXMDiteCCwVz6mJlD86Tk+XDzibb+oSofd7Sr1/4fJgH5kLVsrAjkqDw2uGEFzqHalyydjCEEp6z62KkYk+boqo0Kka683eu1By09aXhmkcCHqCCnEfSLEO7u9imwHUyVd/wAcURoEqdr3wJzZltmaQf76qjXmGao2nPG8bIWr8xT0lSuZEYfSwmnT+salWFNH+kaddEjbSC6TOcXH6ENiSUcZTeYIWuMqz8mRU0Y3L/njFkVCC+41eGJWmMDOW3POFeq+Qk/BVTplTdiByrUiwYMINZo9ZJvyoHhngTLYxFIGEbKMxv5VUXKygHZFSl9GjmBZePeGz6dG3SEY3cEC/WNPdJ50SfAozgpQgics2G+xxKtI4MaqcFM50zS+Weapn0UgLP/KC12kFbLlwMwB8eFdNOMku6h7sCCbBE/SBydaeTC1GXQqVpkV0hK1BmMGoQp+/PrPT+VRC3G0gO0t9O0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(10070799003)(376014)(52116014)(1800799024)(56012099006)(4143699003)(3023799007)(10067099003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?97MMtu3b+eoMp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q?RNVWaSOAZmDxAUWA+llV295mBl6AuWjzTzeNOArBHPbsVWEqhCWYZdm6fbEO?= X-MS-Exchange-AntiSpam-MessageData-1: dKLbynluZG1rfQ== X-OriginatorOrg: ebytelogic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0898397d-415b-4956-8b48-08df1323267b X-MS-Exchange-CrossTenant-AuthSource: PN3PPF28092842E.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2026 12:16:20.2027 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 13bdb17c-4ae8-490c-90c1-ec8121ef96ee X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DXLvTx3xM8F2V8LFy4JcN8tjO5bO25ksD76CEMfEUD/d0LyHYuNRJK8PzTsxKyiOdO80ahlR2R5ty33CtUgXag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAUP287MB4525 Content-Type: text/plain; charset="utf-8" The link from the external CSI-2 transmitter to the CSIPHY is created in the notifier .complete() callback by walking every registered subdev, reading the CSIPHY it was bound to from sd->host_priv and linking the subdev's first source pad to that CSIPHY. This assumes one transmitter feeds exactly one CSIPHY. A GMSL deserializer such as the MAX9296A has two independent CSI-2 output ports which, on the RB3 Gen2 vision mezzanine, are wired to two different SoC CSIPHYs. The same subdev is then bound once per CAMSS port endpoint, the second .bound() overwrites host_priv, and .complete() creates a single link from source pad 0 to the last CSIPHY. The second output port is left with no link at all, so a second camera can never be routed to the SoC. Move the link creation into .bound(), where both the endpoint and the CSIPHY are known, and resolve the transmitter's source pad from the endpoint fwnode with media_entity_get_fwnode_pad(). Each endpoint then gets its own link between the right source pad and the right CSIPHY. For a subdev that does not implement .get_fwnode_pad, media_entity_get_fwnode_pad() falls back to the first pad matching the requested direction, which is exactly what the .complete() loop did, so ordinary single-output sensors keep the same link as before. Reviewed-by: Bryan O'Donoghue Signed-off-by: Hitesh Patel --- drivers/media/platform/qcom/camss/camss.c | 51 ++++++++--------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 61e98b017..6932211a0 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -5231,49 +5231,34 @@ static int camss_subdev_notifier_bound(struct v4l2_= async_notifier *async, container_of(asd, struct camss_async_subdev, asd); u8 id =3D csd->interface.csiphy_id; struct csiphy_device *csiphy =3D &camss->csiphy[id]; + struct media_entity *input =3D &csiphy->subdev.entity; + struct media_entity *sensor =3D &subdev->entity; + int pad, ret; =20 csiphy->cfg.csi2 =3D &csd->interface.csi2; subdev->host_priv =3D csiphy; =20 + pad =3D media_entity_get_fwnode_pad(sensor, asd->match.fwnode, + MEDIA_PAD_FL_SOURCE); + if (pad < 0) { + dev_err(camss->dev, "No source pad in external entity %s: %d\n", + sensor->name, pad); + return pad; + } + + ret =3D media_create_pad_link(sensor, pad, input, MSM_CSIPHY_PAD_SINK, + MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED); + if (ret < 0) { + camss_link_err(camss, sensor->name, input->name, ret); + return ret; + } + return 0; } =20 static int camss_subdev_notifier_complete(struct v4l2_async_notifier *asyn= c) { struct camss *camss =3D container_of(async, struct camss, notifier); - struct v4l2_device *v4l2_dev =3D &camss->v4l2_dev; - struct v4l2_subdev *sd; - - list_for_each_entry(sd, &v4l2_dev->subdevs, list) { - struct csiphy_device *csiphy =3D sd->host_priv; - struct media_entity *input, *sensor; - unsigned int i; - int ret; - - if (!csiphy) - continue; - - input =3D &csiphy->subdev.entity; - sensor =3D &sd->entity; - - for (i =3D 0; i < sensor->num_pads; i++) { - if (sensor->pads[i].flags & MEDIA_PAD_FL_SOURCE) - break; - } - if (i =3D=3D sensor->num_pads) { - dev_err(camss->dev, - "No source pad in external entity\n"); - return -EINVAL; - } - - ret =3D media_create_pad_link(sensor, i, input, - MSM_CSIPHY_PAD_SINK, - MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED); - if (ret < 0) { - camss_link_err(camss, sensor->name, input->name, ret); - return ret; - } - } =20 return v4l2_device_register_subdev_nodes(&camss->v4l2_dev); } --=20 2.43.0