From nobody Sat Feb 7 07:25:56 2026 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010035.outbound.protection.outlook.com [52.101.69.35]) (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 86545369228; Fri, 23 Jan 2026 09:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.35 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160987; cv=fail; b=WA9BGY4woEe/P5Ak4CTv6jT+4i3eBBRDtR8GQUigo9QEAdFLXOHB6Zgjp62V0P7FL39yb7ZUMEbEZSOkaQHV8L6+/PdOIh4mE+jLQOa9wRk2SWfpNqIyIFFEcWaipCMiNvrC6Egb9NwiHGaj+xQ1/G2Gs1001CtiuIneMKwv7xo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160987; c=relaxed/simple; bh=CQpod46MwEI/xAy58JYFl2KhxV+iz5zTR3j4GJLz8mI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=kaLDUyYBq86XcJTcPxcjNGiMXitpFUJW1YCMHySxyEpVunpVCfYdaQtpY9qGy7JgcVQbTYFojCuJdhUjJbQ61+tiyZRR3TErP0qN80R0+KCDk3tn+SHsBxYNZw9DttVCnzYLXhJJkEox6eG/MokPK7xh5Ra8SFIGFNojVA5JwO0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=gdBWD+s0; arc=fail smtp.client-ip=52.101.69.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="gdBWD+s0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rTTFmEHYGf3kun28mNGqTMB67EobSk9j7zhTQo6lUQHCLZFkrUN6lg5xMpvphfSia1AA7L17Zgmq2KEaerPOVIiNVNEPJPKh3mW4AGNIK7yBX/9nZkrJ9ksXfAH9MHR17h86NMsv8viEbiE7fMfsHGAKpGUNjss6pyRC/06iDZVPGQAJNajAo2wZ5pztqPS15RK+t60YyXpGIv+S82vstnbOL7r+Zey4Zx/8xbrHJ4ZSYf/qowvOXLEJX1Rwd1H4vcuqmTfvx6XlpAJ98fQvT0sk/TGGI1iDf6Nf1y5wLvHKWTWY/XgFgGPTpCnqPgToPl09uZdUee9CIxetuzkKtg== 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=36Q1i6D4wAM8lvTM0CIMp0LiB0E2rvwOfEtpz0d71YY=; b=y+dATlH35VvxouKJYnfp89c+5eVMoELJ/BFE2U4otdb/atSZjEF9ONjJotS9VRGuDSLtlC16TMQKOX0n8EpJ72656is/vfLQxn+niYfmMhr5KUfhORL/4PAEr2y2dmpVol8HXaq4++mraJ807hqmMqZgjwrYxJ+ZBP8ZBPCGSiQKm78pE+kQAbS9MTLDyZL5lpAFM+hsISPnipz+Na2TLvsh1j4q6GkbvCfdkgso4FCg4mjWQHR9VrWH+UgTWD0yHjtVmWOdFfzZScpmrnbW4d/EaPVolWqm+2wTPs6cdGF9WcMAPnglsKb5y9c3+ZVxe+zGaJHm8SPz5LvFySCG7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=36Q1i6D4wAM8lvTM0CIMp0LiB0E2rvwOfEtpz0d71YY=; b=gdBWD+s0W3/P8xRlXTisENvIWwcNd7QyVcgbxxnd4QDq6ViOl2qgEurbiaR+cGKMj9GCuBl2HPJurHct3Xh/s674H5lWXepUKl+cu+Hgq5yo6a3zBOu+dx0krR56r7v3j6qE+uKeJUT8XViFJC711CEg1fyGffysAWZwSXiP9rCClXMPRcGCNkj+IjAD0+ygUOyxL5gP3FDZapamdnK9t6hNvZ4WoCmMnJht7/VKWbcZB3saR7xOK2KiMUGhLEyazEkj1NkOSgJV0dhv6xlhdRchq0YIz+lSJslwj5WudB1t2EPiJrwNoMasyytK5NoVN9/Ksd6lIZLo9E5AP8EItw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AS8PR04MB9080.eurprd04.prod.outlook.com (2603:10a6:20b:447::16) by DBBPR04MB7612.eurprd04.prod.outlook.com (2603:10a6:10:202::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.10; Fri, 23 Jan 2026 09:36:12 +0000 Received: from AS8PR04MB9080.eurprd04.prod.outlook.com ([fe80::92c2:2e03:bf99:68eb]) by AS8PR04MB9080.eurprd04.prod.outlook.com ([fe80::92c2:2e03:bf99:68eb%6]) with mapi id 15.20.9542.010; Fri, 23 Jan 2026 09:36:12 +0000 From: Guoniu Zhou Date: Fri, 23 Jan 2026 17:35:17 +0800 Subject: [PATCH v5 1/2] media: dt-bindings: Add CSI Pixel Formatter DT bindings Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260123-csi_formatter-v5-1-d5b803f867bf@nxp.com> References: <20260123-csi_formatter-v5-0-d5b803f867bf@nxp.com> In-Reply-To: <20260123-csi_formatter-v5-0-d5b803f867bf@nxp.com> To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Laurent Pinchart , Frank Li Cc: imx@lists.linux.dev, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Frank Li , Krzysztof Kozlowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769160965; l=2884; i=guoniu.zhou@nxp.com; s=20250815; h=from:subject:message-id; bh=nH6NEgl59OPi9EkQLhW3K3B+dXPHxx3jMyor6yV6qDE=; b=Eos9y4dJG6+0Ul0UYrIPNCTtmxeNeu55SZ6wElGX0GKSdUoICvtcow0bAdfCezX5dNnFRFUe4 SjFKKwJO4UrDRsoCo2VGgieqBadYn7CVrg7h//qae6BYebgjcPBKcT+ X-Developer-Key: i=guoniu.zhou@nxp.com; a=ed25519; pk=MM+/XICg5S78/gs+f9wtGP6yIvkyjTdZwfaxXeu5rlo= X-ClientProxiedBy: SI2PR02CA0017.apcprd02.prod.outlook.com (2603:1096:4:194::17) To AS8PR04MB9080.eurprd04.prod.outlook.com (2603:10a6:20b:447::16) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9080:EE_|DBBPR04MB7612:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d642f69-b405-4d7a-fbb9-08de5a62d895 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|19092799006|52116014|376014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?aE9naGQrNFc0TjhlWlpCbkpuQzJKcWh3eFM0OEFuZGgvdDZCNjJtMUJFU1Ri?= =?utf-8?B?R0hUZ0czVkFnNncrOG44Mm41a0dOUXlJQnJEd0JTdnJObUZVTzZUQXpsVnZD?= =?utf-8?B?dXh3TWxyYnFJYmZJbW5lZVBDWXYyeEFMYkRpMll0VmhyeXQ5Vk9jTVVqUHp2?= =?utf-8?B?Y3huY2pnNWxiTHZZeWxXeXNLUE44aEFVa21wSy9VY3JxOEpCbzdkV0lQcVhi?= =?utf-8?B?RWl1OEhpNnVSdG00Wkx4S0ljbzA0UXpzeUxLaDBqV2wxeDVObVlobFlSeGpq?= =?utf-8?B?SlhwV0VnUjBVMUdzYSsySHlFMW55Yk9wODh6YjkzRStIK29EK1l0b1p1UU5H?= =?utf-8?B?S2pJeEdNR0E2UEhyRGxpQ2pMOFBVUjFjaE0rZ0RaTUlBa1JZd1BrcllyOVlS?= =?utf-8?B?OXE1M293ZHdWUWdQSitEb20xcVlrTVYyeWtncVpqczl2bHdoTDh2TGxVcWxa?= =?utf-8?B?dHNxREdYaHRjTmJiaUxPNnVaUlMyTjA3amFsU0xHeGxOVWtzSzZCUkhYTFRj?= =?utf-8?B?UTVpZDM1UU91Z3FGdnRPKzd0K2NvRTVOU25zellMbm02WFFmckZweS9DY1ND?= =?utf-8?B?TjlqWTFXb0Q1NnU1M3dKeHNNMW1CYU9oUG1XQ29MVzM2am1lVEdFa2ZETXFS?= =?utf-8?B?OGtENU9sMlppRjd1bmhQNWM1alEzUWw5UEo5SGZqSEswZ09sVmhKbTBHSkh2?= =?utf-8?B?NStjYVJwYmFYYXZZSi9MS2tWd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sZUdzV0RPWUQrcjYrSVVQS25TTkFVOWEwcDBPMGdsL1ZBakFv?= =?utf-8?B?WWdwMHhNeWhTWVV2MWl3Z1k3K2RHWDJ5SW82ZGwvdUJSNk9MbGQwK2hOY2JZ?= =?utf-8?B?azJvUjBnNTBsNlZqaFZYVHZ0STJjQXBsQVZKZkxVdnN3YkxmNkp5N2dIemxq?= =?utf-8?B?dXpKcTdDaWlyTEMzSUs4ekpweGo3d1BZNjJBb2s3aFkzbGxBT0pJRnJqdlFk?= =?utf-8?B?QWdycHRHVHd0T2t5R1o1cTd1bmN2dnplQlFJdU5IenVJVzhNYmNGcnk5aVVW?= =?utf-8?B?am5CUUU4SVljOGViRy9TdmZ1YXFzWG4ySlc5ZVRVSGx3aHBKVS9wK2ZEbHZp?= =?utf-8?B?ZjNqZ2loczJRWDU2WStDWm1lRm85YTMwZzNSOHFHM0dPbWZGMmdITyt1N09T?= =?utf-8?B?bDR2MGY1TlArVElMbDJOSXU4NWVrNU9aemh4UndEaTQwS295VlRFTmRRQzhv?= =?utf-8?B?ZTQ5bFl4NU9EK2xPdU0wZE9HT0pIYS9xWVFoSTNMRndBQkVESzhnN1FCa3ZL?= =?utf-8?B?RUE9PQ==?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9080.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(19092799006)(52116014)(376014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RlpYN0ROZy9PUysrNENDTjlkMzU3OW5UYWVFVHBHcVF6YVgvVWg0LzdPV0tL?= =?utf-8?B?dG95c1kwNjRzanpWc0N4c0FCSEswN292MGJXQzlMMGRTeEJLZ1BPM2JqYTdu?= =?utf-8?B?QWpPOUlBRlF3aWdsMElleHZMT1lQ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?utf-8?B?dm0vVlBWVFRhL25ZVGE0S2RTWGt4aTEyWDJSK1l1Sm9objdCZ2txMnoxMUha?= =?utf-8?B?ZldKdDZQeFFvekhaMHhyM1dIcXljNG11SDRoUnpNRUx4eUlHVjlNc1ZPUGVB?= =?utf-8?B?WmxCa0Y0anlzem56eGlzSlNXSHY4Yk1wbXpxOFdxTEoydWFIWnA3NkJrcEtx?= =?utf-8?B?U3poZ21TcWRmZFVwaGhLclJCZmxmeE1UcVdXS2tIR2lHc3phVEZKUnovbml2?= =?utf-8?B?NmY0TWhVcDBvcFBQcWk0TlBWMVdBcUt2THhtUlF5TmZndVhNU0VHaVZBNHB2?= =?utf-8?B?Sk10a0c3cmVCWFlhc3FZTnloTDl5dW42WlJ5eUtHN1VGejlXQndGeVdDbEFz?= =?utf-8?B?eU0wWFh4N2IrcUNScTd5T1hwYnZqeWs3YUFWamlqT0F5VEdRa2Uvdz09?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d642f69-b405-4d7a-fbb9-08de5a62d895 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9080.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2026 09:36:12.1693 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ayP0mNFY70LeI9x6HgRhDZBvnS5DWaWRnAP+fkLHdikA58DcMw82HI4xzs8l1DYfX1KZP2HBnhGNMBlW1rEMuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7612 From: Guoniu Zhou The i.MX9 CSI pixel formatting module uses packet info, pixel and non-pixel data from the CSI-2 host controller and reformat them to match Pixel Link(PL) definition. Reviewed-by: Frank Li Reviewed-by: Krzysztof Kozlowski Signed-off-by: Guoniu Zhou --- .../bindings/media/fsl,imx9-csi-formatter.yaml | 87 ++++++++++++++++++= ++++ 1 file changed, 87 insertions(+) diff --git a/Documentation/devicetree/bindings/media/fsl,imx9-csi-formatter= .yaml b/Documentation/devicetree/bindings/media/fsl,imx9-csi-formatter.yaml new file mode 100644 index 0000000000000000000000000000000000000000..774d37d2b987a679f0bb6378897= a6dd196ea4f13 --- /dev/null +++ b/Documentation/devicetree/bindings/media/fsl,imx9-csi-formatter.yaml @@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/fsl,imx9-csi-formatter.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: i.MX9 CSI Pixel Formatter + +maintainers: + - Guoniu Zhou + +description: + The CSI pixel formatting module uses packet info, pixel and non-pixel + data from the CSI-2 host controller and reformat them to match Pixel + Link(PL) definition. + +properties: + compatible: + const: fsl,imx9-csi-formatter + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + power-domains: + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: MIPI CSI-2 RX IDI interface + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Pixel Link Interface + +required: + - compatible + - reg + - clocks + - power-domains + - ports + +additionalProperties: false + +examples: + - | + #include + + formatter@20 { + compatible =3D "fsl,imx9-csi-formatter"; + reg =3D <0x20 0x100>; + clocks =3D <&cameramix_csr IMX95_CLK_CAMBLK_CSI2_FOR0>; + power-domains =3D <&scmi_devpd 3>; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + + endpoint { + remote-endpoint =3D <&mipi_csi_0_out>; + }; + }; + + port@1 { + reg =3D <1>; + + endpoint { + remote-endpoint =3D <&isi_in_2>; + }; + }; + }; + }; --=20 2.34.1 From nobody Sat Feb 7 07:25:56 2026 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010035.outbound.protection.outlook.com [52.101.69.35]) (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 4D2D4366058; Fri, 23 Jan 2026 09:36:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.35 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160995; cv=fail; b=QgYcl2fkX8zshD8CYRKFbS5WJf3bycknsKow3aREdwbtXcgPnHgyNxS/gpgI7m/VI3pxZ+xbhifBDBFzUcgDJD1AXYqZOGgiqgmd0ONEws3pF0DOLYHxGRAO3FUFwa1BxegzjsOHdI67oSLlYChm/90f2VWCLvN93QfA2umvWBU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160995; c=relaxed/simple; bh=5qTD38pJX/x9/XabpoR284Z1+zUs8Gjt7IbDZbcEBE8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=hyAJS4rvHhrehFhoFJ6VClYbsCQnOb44liPWZWyF//Kqfdke3obzLsdpyKv7fsxKm4At6VmbGUa+PH7LPtsaHNDHur3e8uVQGCacqI5X8iDbTUIf/7JjcQQTWMKr4dfX+v+go3ugsSWzLi5lUVI/nF7NIohU2/WauhU134cc5+I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=vB0q2N7M; arc=fail smtp.client-ip=52.101.69.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="vB0q2N7M" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qIYiBkel78B8PP0tzNq1zOU7Qm205/xOsqHfFWATuhrhprKANSAkzE2JeyU6D5InwlpHeeu1DRnpF40FRZByLDr5KvtVe9MPM9JTzZ5ZaqhQqxdsUUQ7Dbn1zRFoH2mrxxf7IEtgRuPFEt48uLmpoCR//DGcTAp+7/r7mN9O459hqPUTPUQZ+QAt4YzTKI/Y72c0RS5azhBaNWRbJJl9A8w4+zz+dDiE4w+/C8ANAkZm4IBmgdzCRg7py+haazpP+po7z9UYJhBrluGDpBQCHaRVPHAT8dyJMRMO8afND+8DAKLjnZxl8lD+mYNhZ4Tka2bAJQgRx6BCSzFOgLvVhg== 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=+ncoUJUqNnEX/QtGJ5Ml/kLf86SggJnss8Z0g9iF8QQ=; b=yRYtgU8cd0I0kk/ei/y7eXuiPpz4yOkC0Gw1JmnSM4O5nZM3LlAHp2QQ7t0dhTzSOYRY2T4IkQmyPtpyEzeZXI3pX0fYNQUIFjNrlIO9xMRgdW6VwypKOLyLtsMT9B3JHY36cknTMRB3uMIgiIta/P9k6XErPAqBE/AS1X7+8ujdF/BQCv/Pg+c3OroHm32/icKCQ/tZRGNUr3ptTZQA3+t973ATXNX80ALqg2N+MUCLdCGUSgAst8INp+2zy8YSpuC6GF4Pl9ZMcxUyqXJB5l91UG2yJfx3IUMUfjLDvuXsJhaJ2CRe9stWz3z2oNr4enlcq4PZ9bET8A2TntKm2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+ncoUJUqNnEX/QtGJ5Ml/kLf86SggJnss8Z0g9iF8QQ=; b=vB0q2N7MrYmKZULjtfuYyzTLqVKAPOAqJVLLUiz5O6W5FZRRgS1iv8W7kMVkCyfcEEKMVj7IQu9Jy4FvFXWLQKnKi2TSgxgbWMd7y8f6JaPtf4MSBDApE0o6M/55UkY8TY3WL6UcFOUeucjJnjVY6lN7UuZ6ED8fcIkCEHJ0nX8xZnU1YhFHtt7w25NkUe153dFEQm4xE3+7Oh3H1TFoa5s5TRxxE+Dn98nH8so5bc3GI9gR3WQM+D3RvXrzx6qxIXAWFDngkeOYcdWL6udsvlrf4JlaZ0yITaS/0uR2YQKzfqo8pFU0rirPNxn/HkQdkKAeBpIUO+sKmDIg2nV6qQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AS8PR04MB9080.eurprd04.prod.outlook.com (2603:10a6:20b:447::16) by DBBPR04MB7612.eurprd04.prod.outlook.com (2603:10a6:10:202::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.10; Fri, 23 Jan 2026 09:36:17 +0000 Received: from AS8PR04MB9080.eurprd04.prod.outlook.com ([fe80::92c2:2e03:bf99:68eb]) by AS8PR04MB9080.eurprd04.prod.outlook.com ([fe80::92c2:2e03:bf99:68eb%6]) with mapi id 15.20.9542.010; Fri, 23 Jan 2026 09:36:17 +0000 From: Guoniu Zhou Date: Fri, 23 Jan 2026 17:35:18 +0800 Subject: [PATCH v5 2/2] media: nxp: Add i.MX9 CSI pixel formatter v4l2 driver Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260123-csi_formatter-v5-2-d5b803f867bf@nxp.com> References: <20260123-csi_formatter-v5-0-d5b803f867bf@nxp.com> In-Reply-To: <20260123-csi_formatter-v5-0-d5b803f867bf@nxp.com> To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Laurent Pinchart , Frank Li Cc: imx@lists.linux.dev, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769160965; l=27936; i=guoniu.zhou@nxp.com; s=20250815; h=from:subject:message-id; bh=M8Q9ybSqqpvmcdU+CyYMtYUbIv+PLrsg1eguPS9YTFQ=; b=K4hdDNdHExcIyOLbjX8vDv65bMVicnhz9m6WuxN57zn3LerB/EmRBUH16Vj8j1i3m+S2br2Mn CKm6vzFwwZbAjvXIoXvn3zvHUHui5zV3IwF8hhh+CSXvTm7kcaxC77c X-Developer-Key: i=guoniu.zhou@nxp.com; a=ed25519; pk=MM+/XICg5S78/gs+f9wtGP6yIvkyjTdZwfaxXeu5rlo= X-ClientProxiedBy: SI2PR02CA0017.apcprd02.prod.outlook.com (2603:1096:4:194::17) To AS8PR04MB9080.eurprd04.prod.outlook.com (2603:10a6:20b:447::16) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9080:EE_|DBBPR04MB7612:EE_ X-MS-Office365-Filtering-Correlation-Id: 1cb28595-85ce-423c-597f-08de5a62db69 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|19092799006|52116014|376014|7416014|921020|38350700014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?S3VTSnJrWlZGVWhxYUlPc2xBalJZOTBsUG1USUtYLzVCRGVtSWVGU2w4Rkkz?= =?utf-8?B?eVJQNEdXTkdSVUtxWFhpbmZHL0RIL2MwSE0xNEw5Wlh4UzdHRXFpNlhGVG1M?= =?utf-8?B?QSsyY0JpdEprRWFZdlFDNXc5SG9Fa1M4MXlyWDJTT01wY1NUUU4vNU1pK0Fr?= =?utf-8?B?NTlPblVzN0Mza0JkWW5Wb0VnaktNckkyY3RxekJqQVQ3RHI2U2Q5MTNhRExs?= =?utf-8?B?ZVRuSmFHbjRIcnJicm1iejQwYmVZL2cvSnpKWUlnNU9DNGt4aTBlQ0d6Tm4z?= =?utf-8?B?c3hYT0FuRWNyL29VOEFuNXdOSDl2YlJvRXhKZ2pXWFI4TnpIMHUzN2l4QkZy?= =?utf-8?B?cUtKZjFEeVhlczN3RXl6RXdhZlFibHJYK3hzZmNEeVVvMVIvdExBUjhVU29P?= =?utf-8?B?VXVqbkdMTk91Ymd2WHdGMWlOb1l1Z1g0SjdpdFFIczd1ZFE3U3RhY0tjTlJx?= =?utf-8?B?YzVCdC9RYnJLclAyTzlOU1dOQVRQdGRCUVNwaVp2eXVsclR0UzVGM0RndnRj?= =?utf-8?B?RVF0ZDVaMDNBVnkxTjk2d1NkVitGR0NNc0dMMGptRG9jMmY2WC9BYkRha2x0?= =?utf-8?B?VVRaNHMzMEk0NktNT3Z0cVBDRVkwNVhHNHd5dEc4cTBzUEZPSzRBV2FYWHps?= =?utf-8?B?U0hZbTdyUFl4a0Nyc0FDQU5Rb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?RHorT3JvZHpWdmxHYkpvOTRZQ3pXbDVQdHdmQWVYMEJ0cGZVV0FicWVqZG4x?= =?utf-8?B?TWZKM0VUbEpzVzcrK0pUakVrekVIcWRBMjQzVVNkdWJmc2hkblk1N0ZrbFZU?= =?utf-8?B?Y29qMisza3dpWCt6Q1RBUFRwcUE2UjNtS3RQQkVnanZjbDhZK3V0aWhrdzZK?= =?utf-8?B?UHExK2dESnp0NmpaSEVQMVl4REJzT2J3czA0dVM3aTFZdFUvK2VLWjNjajRv?= =?utf-8?B?WjlxajJ0M2Z3elU1dlB5KzNpVkRSY1QwSllvdHZWZGY5TE82K20waTZFZ0lN?= =?utf-8?B?TzNFRk5BL2JMS3U2YmlFbXFXSitZK1VuVE1McHBxbUM2N2FoWEZFTkdCWGdz?= =?utf-8?B?VGt4ekx5d2FTanNnYmhaNjVDcE1ZUFk2aHFsOUFnZWFkd0ZPSkNUQWpCTW1U?= =?utf-8?B?Lyt6M2FqVzlmaDdTR2xyQ2xhdTV1WlZNTnhocUllQzJIdUFxclpOZUk4NW1w?= =?utf-8?B?NXJVNjB2Q01kczI4S3lxZXdBRzIwSDMrWVNyWGZBTkU0YnNlUzVESWE1RDhi?= =?utf-8?B?ZkdMM0xKeWRmc1ZVYWo3L3FkNFNvUjdEbVlpZjJ5LzdLdEIzNmgzcXkzVjdM?= =?utf-8?Q?dMXkV1Vd+yNL6QlTn2WBDHrTvxGHfLSC1SvJwCWephHD?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9080.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(19092799006)(52116014)(376014)(7416014)(921020)(38350700014)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YXhmS0hmd3pjOEVXTHhicEU2VE9VcGI4QWRXa3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OYXBLbTVnVFliUWdZcEoweTk4WGZvOXRuZVdiSmgyc3BIN25p?= =?utf-8?B?K1JnUHI5MDBLN3d6bE92S0V2c2pMUVc4YzBJSWRPZEZYN2JHZ1d6djhkbUN5?= =?utf-8?B?ekpob3RVZWZ0eXBxYXNIN1dKUmVFeHJmTkN0MEQxV0NaTjFGYWE0NEFFbStk?= =?utf-8?B?eEJBYmtENW4xbnFNMXpyR3d3THNRYmt3VnlOZEZWcGZ1MUliYVBNeDVFUmNj?= =?utf-8?B?NjMybkUzNEJZaTJkSFh0ckR3REtDU2tCM01XS0plbFdNMEZYaFpvakw4aXJu?= =?utf-8?B?MHA3WDM2ZUovMUdTYWJ5VzBOTFl0NWdPOVRkcXhmdTM4K0pHOThxUk9PcGlx?= =?utf-8?B?YXdJNms5dnkycElhUjlXNU9FUis5ODY1Q3RUTW1nSVNaV0h4Y3ZYSVhadWZR?= =?utf-8?B?SDZrTE9zTktHSW9ILzlMSlVWWDE3cFlJQ2xOdkVJN0RGdlp2bDVKNzRkSWhr?= =?utf-8?B?a0RGSSs5anRjMlpKMlFqREZEL29jUmZqZUtzWEtkaGNkQmdMbnhhdz09?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cb28595-85ce-423c-597f-08de5a62db69 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9080.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2026 09:36:16.9339 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yot+ff0MkYzD/0CNAXdzXvOkT4uhh9Yu8ncUoKX4KdGP6wZZDskKkpVehiDciJ4gYnNxVEtTzBFBGZRRv/8X7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7612 From: Guoniu Zhou The CSI pixel formatter is a module found on i.MX95 used to reformat packet info, pixel and non-pixel data from CSI-2 host controller to match Pixel Link(PL) definition. Add data formatting support. Signed-off-by: Guoniu Zhou Reviewed-by: Frank Li --- MAINTAINERS | 8 + drivers/media/platform/nxp/Kconfig | 14 + drivers/media/platform/nxp/Makefile | 1 + drivers/media/platform/nxp/imx9-csi-formatter.c | 861 ++++++++++++++++++++= ++++ 4 files changed, 884 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5560da0deb716c247c9bf8f245e7bbeb9b69e788..c2c80148e8b225768d32e3069cc= 4a70115ae21ab 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18867,6 +18867,14 @@ S: Maintained F: Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml F: drivers/media/platform/nxp/imx-jpeg =20 +NXP i.MX 9 CSI PIXEL FORMATTER V4L2 DRIVER +M: Guoniu Zhou +L: imx@lists.linux.dev +L: linux-media@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/media/fsl,imx9-csi-formatter.yaml +F: drivers/media/platform/nxp/imx9-csi-formatter.c + NXP i.MX CLOCK DRIVERS M: Abel Vesa R: Peng Fan diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nx= p/Kconfig index 40e3436669e213fdc5da70821dc0b420e1821f4f..a7bb62a2b0249659ffdfeac50fa= 488aee9590a87 100644 --- a/drivers/media/platform/nxp/Kconfig +++ b/drivers/media/platform/nxp/Kconfig @@ -28,6 +28,20 @@ config VIDEO_IMX8MQ_MIPI_CSI2 Video4Linux2 driver for the MIPI CSI-2 receiver found on the i.MX8MQ SoC. =20 +config VIDEO_IMX9_CSI_FORMATTER + tristate "NXP i.MX9 CSI Pixel Formatter driver" + depends on ARCH_MXC || COMPILE_TEST + depends on VIDEO_DEV + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + This driver provides support for the CSI Pixel Formatter found on + i.MX9 series SoC. This module unpacks the pixels received by the + formatter and reformats them to meet the pixel link format requirement. + + Say Y here to enable CSI Pixel Formater module for i.MX9 SoC. + config VIDEO_IMX_MIPI_CSIS tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models" depends on ARCH_MXC || COMPILE_TEST diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/n= xp/Makefile index 4d90eb71365259ebdda84ea58483e1c4131d3ac7..39ba5660ba923141e7637b01b5b= 34a021dad7bb3 100644 --- a/drivers/media/platform/nxp/Makefile +++ b/drivers/media/platform/nxp/Makefile @@ -6,6 +6,7 @@ obj-y +=3D imx8-isi/ =20 obj-$(CONFIG_VIDEO_IMX7_CSI) +=3D imx7-media-csi.o obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) +=3D imx8mq-mipi-csi2.o +obj-$(CONFIG_VIDEO_IMX9_CSI_FORMATTER) +=3D imx9-csi-formatter.o obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) +=3D imx-mipi-csis.o obj-$(CONFIG_VIDEO_IMX_PXP) +=3D imx-pxp.o obj-$(CONFIG_VIDEO_MX2_EMMAPRP) +=3D mx2_emmaprp.o diff --git a/drivers/media/platform/nxp/imx9-csi-formatter.c b/drivers/medi= a/platform/nxp/imx9-csi-formatter.c new file mode 100644 index 0000000000000000000000000000000000000000..8a91e88d6eed639159a5672623a= 3292beca4c675 --- /dev/null +++ b/drivers/media/platform/nxp/imx9-csi-formatter.c @@ -0,0 +1,861 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2025 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* CSI Pixel Formatter registers map */ + +#define CSI_VCx_INTERLACED_LINE_CNT(x) (0x00 + (x) * 0x04) +#define INTERLACED_ODD_LINE_CNT_SET(x) FIELD_PREP(GENMASK(13, 0), (x)) +#define INTERLACED_EVEN_LINE_CNT_SET(x) FIELD_PREP(GENMASK(29, 16), (x)) + +#define CSI_VC_INTERLACED_CTRL 0x20 + +#define CSI_VC_INTERLACED_ERR 0x24 +#define CSI_VC_ERR_MASK GENMASK(7, 0) +#define CSI_VC_ERR(vc) BIT((vc)) + +#define CSI_VC_YUV420_FIRST_LINE_EVEN 0x28 +#define YUV420_FIRST_LINE_EVEN(vc) BIT((vc)) + +#define CSI_RAW32_CTRL 0x30 +#define CSI_VCX_RAW32_MODE(vc) BIT((vc)) +#define CSI_VCX_RAW32_SWAP_MODE(vc) BIT((vc) + 8) + +#define STREAM_FENCING_CTRL 0x34 +#define CSI_VCx_STREAM_FENCING(vc) BIT((vc)) +#define CSI_VCx_STREAM_FENCING_RST(vc) BIT((vc) + 8) + +#define STREAM_FENCING_STS 0x38 +#define STREAM_FENCING_STS_MASK GENMASK(7, 0) + +#define CSI_VCX_NON_PIXEL_DATA_TYPE(vc) (0x40 + (vc) * 0x04) + +#define CSI_VCX_PIXEL_DATA_CTRL(vc) (0x60 + (vc) * 0x04) +#define NEW_VC(x) FIELD_PREP(GENMASK(3, 1), x) +#define REROUTE_VC_ENABLE BIT(0) + +#define CSI_VCx_ROUTE_PIXEL_DATA_TYPE(vc) (0x80 + (vc) * 0x04) + +#define CSI_VCx_NON_PIXEL_DATA_CTRL(vc) (0xa0 + (vc) * 0x04) + +#define CSI_VCx_PIXEL_DATA_TYPE(vc) (0xc0 + (vc) * 0x04) + +#define CSI_VCx_PIXEL_DATA_TYPE_ERR(vc) (0xe0 + (vc) * 0x04) + +#define CSI_FORMATTER_PAD_SINK 0 +#define CSI_FORMATTER_PAD_SOURCE 1 +#define CSI_FORMATTER_PAD_NUM 2 + +#define CSI_FORMATTER_VC_MAX 8 + +struct formatter_pix_format { + u32 code; + u32 data_type; +}; + +struct csi_formatter { + struct device *dev; + struct regmap *regs; + struct clk *clk; + + struct v4l2_subdev sd; + struct v4l2_subdev *csi_sd; + struct v4l2_async_notifier notifier; + struct v4l2_mbus_framefmt format[CSI_FORMATTER_PAD_NUM]; + struct media_pad pads[CSI_FORMATTER_PAD_NUM]; + const struct formatter_pix_format *fmt; + + u16 remote_pad; + u32 reg_offset; + u64 enabled_streams; +}; + +struct dt_index { + u8 dtype; + u8 index; +}; + +/* + * The index should correspond to the bit index define in register + * which enable the data type of pixel data transported by Formatter. + */ +static const struct dt_index formatter_dt_to_index_map[] =3D { + { .dtype =3D MIPI_CSI2_DT_YUV420_8B, .index =3D 0 }, + { .dtype =3D MIPI_CSI2_DT_YUV420_8B_LEGACY, .index =3D 2 }, + { .dtype =3D MIPI_CSI2_DT_YUV422_8B, .index =3D 6 }, + { .dtype =3D MIPI_CSI2_DT_RGB444, .index =3D 8 }, + { .dtype =3D MIPI_CSI2_DT_RGB555, .index =3D 9 }, + { .dtype =3D MIPI_CSI2_DT_RGB565, .index =3D 10 }, + { .dtype =3D MIPI_CSI2_DT_RGB666, .index =3D 11 }, + { .dtype =3D MIPI_CSI2_DT_RGB888, .index =3D 12 }, + { .dtype =3D MIPI_CSI2_DT_RAW6, .index =3D 16 }, + { .dtype =3D MIPI_CSI2_DT_RAW7, .index =3D 17 }, + { .dtype =3D MIPI_CSI2_DT_RAW8, .index =3D 18 }, + { .dtype =3D MIPI_CSI2_DT_RAW10, .index =3D 19 }, + { .dtype =3D MIPI_CSI2_DT_RAW12, .index =3D 20 }, + { .dtype =3D MIPI_CSI2_DT_RAW14, .index =3D 21 }, + { .dtype =3D MIPI_CSI2_DT_RAW16, .index =3D 22 }, +}; + +static const struct formatter_pix_format formats[] =3D { + /* YUV formats */ + { + .code =3D MEDIA_BUS_FMT_UYVY8_1X16, + .data_type =3D MIPI_CSI2_DT_YUV422_8B, + }, + /* RGB formats */ + { + .code =3D MEDIA_BUS_FMT_RGB565_1X16, + .data_type =3D MIPI_CSI2_DT_RGB565, + }, { + .code =3D MEDIA_BUS_FMT_RGB888_1X24, + .data_type =3D MIPI_CSI2_DT_RGB888, + }, + /* RAW (Bayer and greyscale) formats. */ + { + .code =3D MEDIA_BUS_FMT_SBGGR8_1X8, + .data_type =3D MIPI_CSI2_DT_RAW8, + }, { + .code =3D MEDIA_BUS_FMT_SGBRG8_1X8, + .data_type =3D MIPI_CSI2_DT_RAW8, + }, { + .code =3D MEDIA_BUS_FMT_SGRBG8_1X8, + .data_type =3D MIPI_CSI2_DT_RAW8, + }, { + .code =3D MEDIA_BUS_FMT_SRGGB8_1X8, + .data_type =3D MIPI_CSI2_DT_RAW8, + }, { + .code =3D MEDIA_BUS_FMT_Y8_1X8, + .data_type =3D MIPI_CSI2_DT_RAW8, + }, { + .code =3D MEDIA_BUS_FMT_SBGGR10_1X10, + .data_type =3D MIPI_CSI2_DT_RAW10, + }, { + .code =3D MEDIA_BUS_FMT_SGBRG10_1X10, + .data_type =3D MIPI_CSI2_DT_RAW10, + }, { + .code =3D MEDIA_BUS_FMT_SGRBG10_1X10, + .data_type =3D MIPI_CSI2_DT_RAW10, + }, { + .code =3D MEDIA_BUS_FMT_SRGGB10_1X10, + .data_type =3D MIPI_CSI2_DT_RAW10, + }, { + .code =3D MEDIA_BUS_FMT_Y10_1X10, + .data_type =3D MIPI_CSI2_DT_RAW10, + }, { + .code =3D MEDIA_BUS_FMT_SBGGR12_1X12, + .data_type =3D MIPI_CSI2_DT_RAW12, + }, { + .code =3D MEDIA_BUS_FMT_SGBRG12_1X12, + .data_type =3D MIPI_CSI2_DT_RAW12, + }, { + .code =3D MEDIA_BUS_FMT_SGRBG12_1X12, + .data_type =3D MIPI_CSI2_DT_RAW12, + }, { + .code =3D MEDIA_BUS_FMT_SRGGB12_1X12, + .data_type =3D MIPI_CSI2_DT_RAW12, + }, { + .code =3D MEDIA_BUS_FMT_Y12_1X12, + .data_type =3D MIPI_CSI2_DT_RAW12, + }, { + .code =3D MEDIA_BUS_FMT_SBGGR14_1X14, + .data_type =3D MIPI_CSI2_DT_RAW14, + }, { + .code =3D MEDIA_BUS_FMT_SGBRG14_1X14, + .data_type =3D MIPI_CSI2_DT_RAW14, + }, { + .code =3D MEDIA_BUS_FMT_SGRBG14_1X14, + .data_type =3D MIPI_CSI2_DT_RAW14, + }, { + .code =3D MEDIA_BUS_FMT_SRGGB14_1X14, + .data_type =3D MIPI_CSI2_DT_RAW14, + }, { + .code =3D MEDIA_BUS_FMT_SBGGR16_1X16, + .data_type =3D MIPI_CSI2_DT_RAW16, + }, { + .code =3D MEDIA_BUS_FMT_SGBRG16_1X16, + .data_type =3D MIPI_CSI2_DT_RAW16, + }, { + .code =3D MEDIA_BUS_FMT_SGRBG16_1X16, + .data_type =3D MIPI_CSI2_DT_RAW16, + }, { + .code =3D MEDIA_BUS_FMT_SRGGB16_1X16, + .data_type =3D MIPI_CSI2_DT_RAW16, + } +}; + +static const struct v4l2_mbus_framefmt formatter_default_fmt =3D { + .code =3D MEDIA_BUS_FMT_UYVY8_1X16, + .width =3D 1920U, + .height =3D 1080U, + .field =3D V4L2_FIELD_NONE, + .colorspace =3D V4L2_COLORSPACE_SMPTE170M, + .xfer_func =3D V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SMPTE170M), + .ycbcr_enc =3D V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SMPTE170M), + .quantization =3D V4L2_QUANTIZATION_LIM_RANGE, +}; + +static const struct formatter_pix_format *find_csi_format(u32 code) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(formats); i++) + if (code =3D=3D formats[i].code) + return &formats[i]; + + return &formats[0]; +} + +/* -----------------------------------------------------------------------= ------ + * V4L2 subdev operations + */ + +static inline struct csi_formatter *sd_to_formatter(struct v4l2_subdev *sd= ev) +{ + return container_of(sdev, struct csi_formatter, sd); +} + +static int __formatter_subdev_set_routing(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + struct v4l2_subdev_krouting *routing) +{ + int ret; + + if (routing->num_routes > V4L2_FRAME_DESC_ENTRY_MAX) + return -EINVAL; + + ret =3D v4l2_subdev_routing_validate(sd, routing, + V4L2_SUBDEV_ROUTING_ONLY_1_TO_1); + if (ret) + return ret; + + return v4l2_subdev_set_routing_with_fmt(sd, state, routing, + &formatter_default_fmt); +} + +static int formatter_subdev_init_state(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state) +{ + struct v4l2_subdev_route routes[] =3D { + { + .sink_pad =3D CSI_FORMATTER_PAD_SINK, + .sink_stream =3D 0, + .source_pad =3D CSI_FORMATTER_PAD_SOURCE, + .source_stream =3D 0, + .flags =3D V4L2_SUBDEV_ROUTE_FL_ACTIVE, + }, + }; + + struct v4l2_subdev_krouting routing =3D { + .num_routes =3D ARRAY_SIZE(routes), + .routes =3D routes, + }; + + return __formatter_subdev_set_routing(sd, sd_state, &routing); +} + +static int formatter_subdev_enum_mbus_code(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_mbus_code_enum *code) +{ + if (code->pad =3D=3D CSI_FORMATTER_PAD_SOURCE) { + struct v4l2_mbus_framefmt *fmt; + + if (code->index > 0) + return -EINVAL; + + fmt =3D v4l2_subdev_state_get_format(sd_state, code->pad, + code->stream); + code->code =3D fmt->code; + return 0; + } + + if (code->index >=3D ARRAY_SIZE(formats)) + return -EINVAL; + + code->code =3D formats[code->index].code; + + return 0; +} + +static int formatter_subdev_set_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_format *sdformat) +{ + struct csi_formatter *formatter =3D sd_to_formatter(sd); + struct formatter_pix_format const *format; + struct v4l2_mbus_framefmt *fmt; + + if (sdformat->pad =3D=3D CSI_FORMATTER_PAD_SOURCE) + return v4l2_subdev_get_fmt(sd, sd_state, sdformat); + + /* + * Validate the media bus code and clamp and align the size. + * + * The total number of bits per line must be a multiple of 8. We thus + * need to align the width for formats that are not multiples of 8 + * bits. + */ + format =3D find_csi_format(sdformat->format.code); + + v4l_bound_align_image(&sdformat->format.width, 1, 0xffff, 2, + &sdformat->format.height, 1, 0xffff, 0, 0); + + fmt =3D v4l2_subdev_state_get_format(sd_state, sdformat->pad, + sdformat->stream); + *fmt =3D sdformat->format; + + /* Set default code if user set an invalid value */ + fmt->code =3D format->code; + + /* Propagate the format from sink stream to source stream */ + fmt =3D v4l2_subdev_state_get_opposite_stream_format(sd_state, sdformat->= pad, + sdformat->stream); + if (!fmt) + return -EINVAL; + + *fmt =3D sdformat->format; + + /* Store the CSIS format descriptor for active formats. */ + if (sdformat->which =3D=3D V4L2_SUBDEV_FORMAT_ACTIVE) + formatter->fmt =3D format; + + return 0; +} + +static int formatter_subdev_get_frame_desc(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_frame_desc *fd) +{ + struct csi_formatter *formatter =3D sd_to_formatter(sd); + struct v4l2_mbus_frame_desc csi_fd; + struct v4l2_subdev_route *route; + struct v4l2_subdev_state *state; + int ret; + + if (pad !=3D CSI_FORMATTER_PAD_SOURCE) + return -EINVAL; + + ret =3D v4l2_subdev_call(formatter->csi_sd, pad, get_frame_desc, + formatter->remote_pad, &csi_fd); + if (ret) + return ret; + + if (csi_fd.type !=3D V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { + dev_err(formatter->dev, + "Frame descriptor does not describe CSI-2 link\n"); + return -EINVAL; + } + + memset(fd, 0, sizeof(*fd)); + + fd->type =3D V4L2_MBUS_FRAME_DESC_TYPE_CSI2; + + state =3D v4l2_subdev_lock_and_get_active_state(sd); + + for_each_active_route(&state->routing, route) { + struct v4l2_mbus_frame_desc_entry *entry =3D NULL; + unsigned int i; + + if (route->source_pad !=3D pad) + continue; + + for (i =3D 0; i < csi_fd.num_entries; ++i) { + if (csi_fd.entry[i].stream =3D=3D route->sink_stream) { + entry =3D &csi_fd.entry[i]; + break; + } + } + + if (!entry) { + dev_err(formatter->dev, + "Failed to find stream from source frames desc\n"); + ret =3D -EPIPE; + break; + } + + fd->entry[fd->num_entries].stream =3D route->source_stream; + fd->entry[fd->num_entries].flags =3D entry->flags; + fd->entry[fd->num_entries].length =3D entry->length; + fd->entry[fd->num_entries].pixelcode =3D entry->pixelcode; + fd->entry[fd->num_entries].bus.csi2.vc =3D entry->bus.csi2.vc; + fd->entry[fd->num_entries].bus.csi2.dt =3D entry->bus.csi2.dt; + + fd->num_entries++; + } + + v4l2_subdev_unlock_state(state); + return ret; +} + +static int formatter_subdev_set_routing(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + enum v4l2_subdev_format_whence which, + struct v4l2_subdev_krouting *routing) +{ + if (which =3D=3D V4L2_SUBDEV_FORMAT_ACTIVE && + media_entity_is_streaming(&sd->entity)) + return -EBUSY; + + return __formatter_subdev_set_routing(sd, state, routing); +} + +static inline void formatter_write(struct csi_formatter *formatter, + unsigned int reg, unsigned int value) +{ + u32 offset =3D formatter->reg_offset; + + regmap_write(formatter->regs, reg + offset, value); +} + +static u8 get_index_by_dt(u8 data_type) +{ + unsigned int i; + + for (i =3D 0; i < ARRAY_SIZE(formatter_dt_to_index_map); ++i) + if (data_type =3D=3D formatter_dt_to_index_map[i].dtype) + break; + + if (i =3D=3D ARRAY_SIZE(formatter_dt_to_index_map)) + return formatter_dt_to_index_map[0].index; + + return formatter_dt_to_index_map[i].index; +} + +static int get_vc(struct csi_formatter *formatter, unsigned int stream) +{ + struct v4l2_mbus_frame_desc source_fd; + struct v4l2_mbus_frame_desc_entry *entry =3D NULL; + unsigned int i; + int ret; + + /* + * Return virtual channel 0 as default value when remote subdev + * don't implement .get_frame_desc subdev callback + */ + ret =3D v4l2_subdev_call(formatter->csi_sd, pad, get_frame_desc, + formatter->remote_pad, &source_fd); + if (ret < 0) + return (ret =3D=3D -ENOIOCTLCMD) ? 0 : ret; + + for (i =3D 0; i < source_fd.num_entries; ++i) { + if (source_fd.entry[i].stream =3D=3D stream) { + entry =3D &source_fd.entry[i]; + break; + } + } + + if (!entry) { + dev_err(formatter->dev, + "Can't find valid frame desc corresponding to stream %d\n", stream); + return -EPIPE; + } + + return entry->bus.csi2.vc; +} + +static int csi_formatter_start_stream(struct csi_formatter *formatter, + u64 stream_mask) +{ + const struct formatter_pix_format *fmt =3D formatter->fmt; + unsigned int i; + u32 val; + int vc; + + for (i =3D 0; i < V4L2_FRAME_DESC_ENTRY_MAX; ++i) { + if (stream_mask & BIT(i)) + break; + } + + if (i =3D=3D V4L2_FRAME_DESC_ENTRY_MAX) { + dev_err(formatter->dev, "Stream ID out of range\n"); + return -EINVAL; + } + + val =3D BIT(get_index_by_dt(fmt->data_type)); + vc =3D get_vc(formatter, i); + + if (vc < 0 || vc > CSI_FORMATTER_VC_MAX) { + dev_err(formatter->dev, "Invalid virtual channel(%d)\n", vc); + return -EINVAL; + } + + formatter_write(formatter, CSI_VCx_PIXEL_DATA_TYPE(vc), val); + + return 0; +} + +static int csi_formatter_stop_stream(struct csi_formatter *formatter, + u64 stream_mask) +{ + unsigned int i; + int vc; + + for (i =3D 0; i < V4L2_FRAME_DESC_ENTRY_MAX; ++i) { + if (stream_mask & BIT(i)) + break; + } + + if (i =3D=3D V4L2_FRAME_DESC_ENTRY_MAX) { + dev_err(formatter->dev, "Stream ID out of range\n"); + return -EINVAL; + } + + vc =3D get_vc(formatter, i); + + if (vc < 0 || vc > CSI_FORMATTER_VC_MAX) { + dev_err(formatter->dev, "Invalid virtual channel(%d)\n", vc); + return -EINVAL; + } + + formatter_write(formatter, CSI_VCx_PIXEL_DATA_TYPE(vc), 0); + + return 0; +} + +static int formatter_subdev_enable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + u32 pad, u64 streams_mask) +{ + struct csi_formatter *formatter =3D sd_to_formatter(sd); + struct device *dev =3D formatter->dev; + u64 sink_streams; + int ret; + + sink_streams =3D v4l2_subdev_state_xlate_streams(state, + CSI_FORMATTER_PAD_SOURCE, + CSI_FORMATTER_PAD_SINK, + &streams_mask); + if (!sink_streams || !streams_mask) + return -EINVAL; + + dev_dbg(dev, "remote sd: %s pad: %u, sink_stream:0x%llx\n", + formatter->csi_sd->name, formatter->remote_pad, sink_streams); + + if (!formatter->csi_sd) { + dev_err(dev, "CSI controller don't link with formatter\n"); + return -EPIPE; + } + + if (!formatter->enabled_streams) { + ret =3D pm_runtime_resume_and_get(formatter->dev); + if (ret < 0) { + dev_err(dev, "Formatter runtime get fail\n"); + return ret; + } + } + + ret =3D csi_formatter_start_stream(formatter, streams_mask); + if (ret) + goto runtime_put; + + ret =3D v4l2_subdev_enable_streams(formatter->csi_sd, + formatter->remote_pad, + sink_streams); + if (ret) + goto stop_stream; + + formatter->enabled_streams |=3D streams_mask; + + return 0; + +stop_stream: + csi_formatter_stop_stream(formatter, streams_mask); +runtime_put: + if (!formatter->enabled_streams) + pm_runtime_put(formatter->dev); + return ret; +} + +static int formatter_subdev_disable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + u32 pad, u64 streams_mask) +{ + struct csi_formatter *formatter =3D sd_to_formatter(sd); + u64 sink_streams; + int ret; + + sink_streams =3D v4l2_subdev_state_xlate_streams(state, + CSI_FORMATTER_PAD_SOURCE, + CSI_FORMATTER_PAD_SINK, + &streams_mask); + if (!sink_streams || !streams_mask) + return -EINVAL; + + ret =3D v4l2_subdev_disable_streams(formatter->csi_sd, formatter->remote_= pad, + sink_streams); + if (ret) + return ret; + + ret =3D csi_formatter_stop_stream(formatter, streams_mask); + if (ret) + return ret; + + formatter->enabled_streams &=3D ~streams_mask; + + if (!formatter->enabled_streams) + pm_runtime_put(formatter->dev); + + return 0; +} + +static const struct v4l2_subdev_pad_ops formatter_subdev_pad_ops =3D { + .enum_mbus_code =3D formatter_subdev_enum_mbus_code, + .get_fmt =3D v4l2_subdev_get_fmt, + .set_fmt =3D formatter_subdev_set_fmt, + .get_frame_desc =3D formatter_subdev_get_frame_desc, + .set_routing =3D formatter_subdev_set_routing, + .enable_streams =3D formatter_subdev_enable_streams, + .disable_streams =3D formatter_subdev_disable_streams, +}; + +static const struct v4l2_subdev_ops formatter_subdev_ops =3D { + .pad =3D &formatter_subdev_pad_ops, +}; + +static const struct v4l2_subdev_internal_ops formatter_internal_ops =3D { + .init_state =3D formatter_subdev_init_state, +}; + +/* -----------------------------------------------------------------------= ------ + * Media entity operations + */ + +static const struct media_entity_operations formatter_entity_ops =3D { + .link_validate =3D v4l2_subdev_link_validate, + .get_fwnode_pad =3D v4l2_subdev_get_fwnode_pad_1_to_1, +}; + +static int csi_formatter_subdev_init(struct csi_formatter *formatter) +{ + struct v4l2_subdev *sd =3D &formatter->sd; + int ret; + + v4l2_subdev_init(sd, &formatter_subdev_ops); + + snprintf(sd->name, sizeof(sd->name), "%s", dev_name(formatter->dev)); + sd->internal_ops =3D &formatter_internal_ops; + + sd->flags |=3D V4L2_SUBDEV_FL_HAS_DEVNODE | + V4L2_SUBDEV_FL_HAS_EVENTS | + V4L2_SUBDEV_FL_STREAMS; + sd->entity.function =3D MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; + sd->entity.ops =3D &formatter_entity_ops; + sd->dev =3D formatter->dev; + + formatter->pads[CSI_FORMATTER_PAD_SINK].flags =3D MEDIA_PAD_FL_SINK; + formatter->pads[CSI_FORMATTER_PAD_SOURCE].flags =3D MEDIA_PAD_FL_SOURCE; + + ret =3D media_entity_pads_init(&sd->entity, CSI_FORMATTER_PAD_NUM, + formatter->pads); + if (ret) { + dev_err(formatter->dev, "Failed to init pads\n"); + return ret; + } + + ret =3D v4l2_subdev_init_finalize(sd); + if (ret) + media_entity_cleanup(&sd->entity); + + return ret; +} + +static inline struct csi_formatter * +notifier_to_formatter(struct v4l2_async_notifier *n) +{ + return container_of(n, struct csi_formatter, notifier); +} + +static int csi_formatter_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_connection *asc) +{ + const unsigned int link_flags =3D MEDIA_LNK_FL_IMMUTABLE + | MEDIA_LNK_FL_ENABLED; + struct csi_formatter *formatter =3D notifier_to_formatter(notifier); + struct v4l2_subdev *sdev =3D &formatter->sd; + struct media_pad *sink =3D &sdev->entity.pads[CSI_FORMATTER_PAD_SINK]; + struct media_pad *remote_pad; + int ret; + + formatter->csi_sd =3D sd; + + dev_dbg(formatter->dev, "Bound subdev: %s pad\n", sd->name); + + ret =3D v4l2_create_fwnode_links_to_pad(sd, sink, link_flags); + if (ret < 0) + return ret; + + remote_pad =3D media_pad_remote_pad_first(sink); + if (!remote_pad) { + dev_err(formatter->dev, "Pipe not setup correctly\n"); + return -EPIPE; + } + formatter->remote_pad =3D remote_pad->index; + + return 0; +} + +static const struct v4l2_async_notifier_operations formatter_notify_ops = =3D { + .bound =3D csi_formatter_notify_bound, +}; + +static int csi_formatter_async_register(struct csi_formatter *formatter) +{ + struct device *dev =3D formatter->dev; + struct v4l2_async_connection *asc; + int ret; + + struct fwnode_handle *ep __free(fwnode_handle) =3D + fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0, + FWNODE_GRAPH_ENDPOINT_NEXT); + if (!ep) + return -ENOTCONN; + + v4l2_async_subdev_nf_init(&formatter->notifier, &formatter->sd); + + asc =3D v4l2_async_nf_add_fwnode_remote(&formatter->notifier, ep, + struct v4l2_async_connection); + if (IS_ERR(asc)) + return PTR_ERR(asc); + + formatter->notifier.ops =3D &formatter_notify_ops; + + ret =3D v4l2_async_nf_register(&formatter->notifier); + if (ret) + return ret; + + return v4l2_async_register_subdev(&formatter->sd); +} + +/* -----------------------------------------------------------------------= ------ + * Suspend/resume + */ + +static int csi_formatter_runtime_suspend(struct device *dev) +{ + struct v4l2_subdev *sd =3D dev_get_drvdata(dev); + struct csi_formatter *formatter =3D sd_to_formatter(sd); + + clk_disable_unprepare(formatter->clk); + + return 0; +} + +static int csi_formatter_runtime_resume(struct device *dev) +{ + struct v4l2_subdev *sd =3D dev_get_drvdata(dev); + struct csi_formatter *formatter =3D sd_to_formatter(sd); + + return clk_prepare_enable(formatter->clk); +} + +static DEFINE_RUNTIME_DEV_PM_OPS(csi_formatter_pm_ops, + csi_formatter_runtime_suspend, + csi_formatter_runtime_resume, NULL); + +static int csi_formatter_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct csi_formatter *formatter; + u32 val; + int ret; + + formatter =3D devm_kzalloc(dev, sizeof(*formatter), GFP_KERNEL); + if (!formatter) + return -ENOMEM; + + formatter->dev =3D dev; + + formatter->regs =3D syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(formatter->regs)) + return dev_err_probe(dev, PTR_ERR(formatter->regs), + "Failed to get csi formatter regmap\n"); + + ret =3D of_property_read_u32(dev->of_node, "reg", &val); + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to get csi formatter reg property= \n"); + + formatter->reg_offset =3D val; + + formatter->clk =3D devm_clk_get(dev, NULL); + if (IS_ERR(formatter->clk)) + return dev_err_probe(dev, PTR_ERR(formatter->clk), + "Failed to get pixel clock\n"); + + ret =3D csi_formatter_subdev_init(formatter); + if (ret < 0) + return dev_err_probe(dev, ret, "formatter subdev init fail\n"); + + /* Initialize formatter pixel format */ + formatter->fmt =3D find_csi_format(formatter_default_fmt.code); + + ret =3D csi_formatter_async_register(formatter); + if (ret < 0) { + v4l2_subdev_cleanup(&formatter->sd); + return dev_err_probe(dev, ret, "Async register failed\n"); + } + + platform_set_drvdata(pdev, &formatter->sd); + + /* Enable runtime PM. */ + pm_runtime_enable(dev); + + return 0; +} + +static void csi_formatter_remove(struct platform_device *pdev) +{ + struct v4l2_subdev *sd =3D platform_get_drvdata(pdev); + struct csi_formatter *formatter =3D sd_to_formatter(sd); + + v4l2_async_nf_unregister(&formatter->notifier); + v4l2_async_nf_cleanup(&formatter->notifier); + v4l2_async_unregister_subdev(&formatter->sd); + + pm_runtime_disable(&pdev->dev); + media_entity_cleanup(&formatter->sd.entity); + pm_runtime_set_suspended(&pdev->dev); +} + +static const struct of_device_id csi_formatter_of_match[] =3D { + { .compatible =3D "fsl,imx9-csi-formatter" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, csi_formatter_of_match); + +static struct platform_driver csi_formatter_device_driver =3D { + .driver =3D { + .name =3D "csi-pixel-formatter", + .of_match_table =3D csi_formatter_of_match, + .pm =3D pm_ptr(&csi_formatter_pm_ops), + }, + .probe =3D csi_formatter_probe, + .remove =3D csi_formatter_remove, +}; + +module_platform_driver(csi_formatter_device_driver); + +MODULE_AUTHOR("NXP Semiconductor, Inc."); +MODULE_DESCRIPTION("NXP i.MX9 CSI Pixel Formatter driver"); +MODULE_LICENSE("GPL"); --=20 2.34.1