From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5419DC35FF1 for ; Fri, 14 Mar 2025 15:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To: Content-Type:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ex/U2kEkckYFBGjtS1F1srxDj0oUEaowyXHHuu7xQZ8=; b=ApS8fUBCDWeKCFhjSCwfUoI499 yK6w/8M+FGn55g1OwE/szAa4pRPAfxgPr/PZypBY/opyQjavFptB3NJA/eFXogCp6bPR1S5wlmRz1 U3Y7AoihejIgBkcQHRS+n0GAyChzstuJL1e4iQe7JU6h7DcEW9JZiDdEGTjtF1XdhfboRSNvAGEHH MwibQK4UYxJK+tY1wtHu7IliUhQRiJ959/a7JFIXieUR5ZwYnFj3LnQ5Cusas8Yu7LXe5XhcF5OjF hCtaUGF/HtTiyA6ohfKxC3LHLZSlUlK7opdjVYuZM6Tdat7PwqIJyeIlWzAzQpRd/RfbisKZIUnjV NEdSRe7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tt6yY-0000000EZ6K-3i6C; Fri, 14 Mar 2025 15:29:30 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tt6vX-0000000EYeH-0Tfv for linux-arm-kernel@lists.infradead.org; Fri, 14 Mar 2025 15:26:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hqoMDziCBap1Yu2Dqusqp9sx4oBjJZdwcGqNvFosKTw4jW9JpYiLpWIRQcib7l/BFWn1Gk9ZUNIx3kpBaFbcPyuqzw974b8SHJm9wDh9h74pOFlYzMEUVwWLYEjTiXOu0uwDBLo+NLhCyB1wi4c71/b8fwsFCI4C408v3SvAs117TGOGY07MLSvViXJiY29zKE9B2TRktoDhZErGoM1Tge8e03fFZU5HkcBWtsw5gqDlgE1FjeeFPDLYNH8jaQm5rK9OqCWDMfKNojFS3cAD6How5Tx7fRaXuOwWmELLoJXxoaw16FaE6+jwoZ47VfnvURz35BeD5c/ZVF1iCfkMWA== 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=ex/U2kEkckYFBGjtS1F1srxDj0oUEaowyXHHuu7xQZ8=; b=lX5ACNm42dEQLJRSAb/XJXaQ0fqqPD7FmhNxfwvWJHKR3cekREhH3bW7hEziX0z3J3oUh9oEqgxXU2q8D6hS9pgysLbsB+f1TGiqHZMBPPLwjbko6X3cUnUgF3xYE2JNs6khXy9TuR6h+E3Q4TeXFPF6Tra/g/HLqmrsY7Rp1kgfNbGtLPM3t37VRIzrwZR6Hj7RiS0aIib1tXAmlQvZ7emZfc8XKkcoywio33BKpItaZANnru5e2FLry3jGtLbnYSHKCMpCOuQxurTindRyNcpEGO+YaWtoLLynF+bEDORe7ECDY8nhwt5jq+80jvJ++Kk9saaw22s+ze5UlOsoYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mt.com; dmarc=pass action=none header.from=mt.com; dkim=pass header.d=mt.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ex/U2kEkckYFBGjtS1F1srxDj0oUEaowyXHHuu7xQZ8=; b=NiC8qz10L7nwQxaR+rCQNBQ70NQCQrfBxZtNTcxZqiGY567H86bFtAZ8PJGj5tOKfLDCjz0TDg4FcL94B/gU0A6/nv+fz7RPU+n2pim8kva0dweUWcyUVoYcRsNXrqaYibYJQVqwGoZxYbwWc0nLaQvXt34inVTQ94fHW6UQ8pAruxn7DL6+Ci41S3olbQxAfNribgxP9t8WWzSM/Q9GaDhaZlz5SPRLYVk38L0NcjcBwjBlU7bnbcdwhreKZIzCaBX4OW2pljNDfssQ7zk93JwV6XReu9aq79yk2jKCsXjJErNh9I9hR027qdKnIOcTfzkgfqZwIBAtEzkPoXYIZQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mt.com; Received: from DBBPR03MB10396.eurprd03.prod.outlook.com (2603:10a6:10:53a::11) by DU0PR03MB8599.eurprd03.prod.outlook.com (2603:10a6:10:3e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.25; Fri, 14 Mar 2025 15:26:20 +0000 Received: from DBBPR03MB10396.eurprd03.prod.outlook.com ([fe80::ee3c:c9be:681:c0bf]) by DBBPR03MB10396.eurprd03.prod.outlook.com ([fe80::ee3c:c9be:681:c0bf%4]) with mapi id 15.20.8511.026; Fri, 14 Mar 2025 15:26:20 +0000 Date: Fri, 14 Mar 2025 16:26:14 +0100 From: Mathis Foerst To: Sakari Ailus Cc: Dan Carpenter , linux-kernel@vger.kernel.org, Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, manuel.traut@mt.com, mathis.foerst@zuehlke.com Subject: Re: [PATCH v1 1/1] media: imx: csi: Parse link configuration from fw_node Message-ID: References: <20250305113802.897087-1-mathis.foerst@mt.com> <20250305113802.897087-2-mathis.foerst@mt.com> <84aa2d87-d7f1-46c9-b28d-6f0e9a78788d@stanley.mountain> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MI1P293CA0004.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:2::13) To DBBPR03MB10396.eurprd03.prod.outlook.com (2603:10a6:10:53a::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBPR03MB10396:EE_|DU0PR03MB8599:EE_ X-MS-Office365-Filtering-Correlation-Id: d2af97d4-98f5-4c5e-9356-08dd630c920a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vsk3WQFMExYDjx2jHkbi2xWNM65PO2FnVpSStZlK7zLP9a6WFd/tPh57F2BS?= =?us-ascii?Q?Mh31FVkPQ//0vWXVerBFVUNh2KDZrtTkXsnSTdgIDp/l+X0aGc3AKuQHLFaJ?= =?us-ascii?Q?aZAQMFlHhdHmmg6XO4855oEk99XKHteGHg1Ya3V3FYX7tBxytkZCGuNgoG10?= =?us-ascii?Q?JnnJrmBuHXjZSYuOovTIaEDMsSY1llazP/IIPZsdIgV3zg2eJ3Dsd150p8ol?= =?us-ascii?Q?RUH/Sy7jR13NxH+gghA1vt/7pbUkEJkcyfRLr6YA6fZAoPTMXuWDBXsO903U?= =?us-ascii?Q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g+W73ISTuNbc?= =?us-ascii?Q?/bNil3KdqBW/Dmh9OYyBm86H8ElJ+qXdPzOpSrdL125xrQAnAgLxGhiAGyTB?= =?us-ascii?Q?cTiT6eDPp1acDSxXh6qMXRluVe2XVz6zh24HPi58PYg1q3DW1hSOPCYLF4vP?= =?us-ascii?Q?iPLQKxx3FVP1vpaWpgl817SsfrYbBhor6XYCXoyK2mYHGfGZ7m94peYXiU1G?= =?us-ascii?Q?PPvLWSFqtjUk3t/RiMDwP1qhkMUjkeVDhFOAA78soelNZ1WtAJQK7V6fK0wa?= =?us-ascii?Q?WhTVcoSVpYXez8fzs4ji+5T+J018eaz6?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBBPR03MB10396.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?X5gYPSGbXNDbOiC7aLBsQuredoqbW/jDSKcTZWvkklYSTrRAyqItT5zHk5Ii?= =?us-ascii?Q?r4lWsFbUSlWTYdm+enpCdMACGPEIsPHWZAgCUhDBck3GDdXSQAWZnxkqwPJb?= =?us-ascii?Q?v8QOSPt/1bn5MKW6LWzFp6mQlKhoO4C4iSV0vg7mQVC4BhB0MQsfifi6TW+l?= =?us-ascii?Q?mGEB0Tw/PGG68k8+x/LEeqLoEP6Ch6JRrCHarq7hHhDa6o9bKhYPValZRRxD?= =?us-ascii?Q?vpAfcuUhUYuXQPrYeqQxVxaglm/cBjHyZ4QLmRQDJr9Za5bgrOHNr08Xle4+?= =?us-ascii?Q?wDNH5WMovbvqO6l5YQgFsC6RUL0TY3xakLOSBzNEpLg663E1upuRXFeeszPd?= =?us-ascii?Q?Obm5Pjxg50Aao5c+laWNYZ2QeesVzORlFzExjtl33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i45h31gybtbL9OFqNu88C+32hVs7YdY9dX47+?= =?us-ascii?Q?fWcTSjooobQZJAv+PXta6nrocbKWBwo0fPkFuN7OhOn96X5KUlCOO/NZG/Ks?= =?us-ascii?Q?6kI+24txp3SZsXuThSL3SB9720Dx7bwt6g7L6LaUB59XMBlflpvmR9+8w+tU?= =?us-ascii?Q?cGLanQnYd6KgwFT/MTcduEXcwRLzfabSyzYEWT8Shy421IoNnIUascayOiin?= =?us-ascii?Q?cHhwbgHuooJQUBdm6fVE70MavmwjxJarSLCDSVCCFaFlWj5TUYKsXLKAhhkV?= =?us-ascii?Q?whn3MpNTOhLYju6pTsYDgOpO2rrpGcZtKj1BBcEg?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2af97d4-98f5-4c5e-9356-08dd630c920a X-MS-Exchange-CrossTenant-AuthSource: DBBPR03MB10396.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2025 15:26:19.9282 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fb4c0aee-6cd2-482f-a1a5-717e7c02496b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xt9Noa/RdxBMY/u2hFasC1NinHd1/H29/M7boNej2ig8ZItyv8jocT2T6kA5uBV/kyOu2/pFR8ylJi6xOI5LUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8599 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250314_082623_308383_46AC62CE X-CRM114-Status: GOOD ( 51.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Mar 10, 2025 at 10:25:04AM +0000, Sakari Ailus wrote: Hi Sakari, > Hi Mathis, > > On Fri, Mar 07, 2025 at 02:38:29PM +0100, Mathis Foerst wrote: > > Hi Sakari, Hi Dan, > > > > thanks a lot for your feedback. > > > > On Thu, Mar 06, 2025 at 09:13:46PM +0000, Sakari Ailus wrote: > > > Hi Dan, > > > > > > On Thu, Mar 06, 2025 at 10:07:20PM +0300, Dan Carpenter wrote: > > > > On Thu, Mar 06, 2025 at 04:33:18PM +0000, Sakari Ailus wrote: > > > > > Hi Mathis, > > > > > > > > > > Thanks for the patch. > > > > > > > > > > On Wed, Mar 05, 2025 at 12:38:02PM +0100, Mathis Foerst wrote: > > > > > > The imx-media-csi driver requires upstream camera drivers to implement > > > > > > the subdev-pad-op "get_mbus_config" [0]. Camera drivers that don't > > > > > > implement this function are not usable on the i.MX6. > > > > > > > > > > > > The docs for get_mbus_config [1] say: > > > > > > @get_mbus_config: get the media bus configuration of a remote sub-device. > > > > > > The media bus configuration is usually retrieved from the > > > > > > firmware interface at sub-device probe time, immediately > > > > > > applied to the hardware and eventually adjusted by the > > > > > > driver. > > > > > > > > > > > > Currently, the imx-media-csi driver is not incorporating the information > > > > > > from the firmware interface and therefore relies on the implementation of > > > > > > get_mbus_config by the camera driver. > > > > > > > > > > > > To be compatible with camera drivers not implementing get_mbus_config > > > > > > (which is the usual case), use the bus information from the fw interface: > > > > > > > > > > > > The camera does not necessarily has a direct media bus link to the CSI as > > > > > > the video-mux and/or the MIPI CSI-2 receiver of the i.MX6 might be in > > > > > > between them on the media pipeline. > > > > > > The CSI driver already implements the functionality to find the connected > > > > > > camera sub-device to call get_mbus_config on it. > > > > > > > > > > > > At this point the driver is modified as follows: > > > > > > In the case that get_mbus_config is not implemented by the upstream > > > > > > camera, try to get its endpoint configuration from the firmware interface > > > > > > usign v4l2_fwnode_endpoint_parse. > > > > > > For the supported mbus_types (V4L2_MBUS_PARALLEL, V4L2_MBUS_BT656 and > > > > > > V4L2_MBUS_CSI2_DPHY), extract the mbus_config from the endpoint > > > > > > configuration. > > > > > > For all other mbus_types, return an error. > > > > > > > > > > > > Note that parsing the mbus_config from the fw interface is not done during > > > > > > probing because the camera that's connected to the CSI can change based on > > > > > > the selected input of the video-mux at runtime. > > > > > > > > > > > > [0] drivers/staging/media/imx/imx-media-csi.c - line 211..216 > > > > > > [1] include/media/v4l2-subdev.h - line 814 > > > > > > > > > > > > Signed-off-by: Mathis Foerst > > > > > > --- > > > > > > drivers/staging/media/imx/imx-media-csi.c | 36 ++++++++++++++++++++--- > > > > > > 1 file changed, 32 insertions(+), 4 deletions(-) > > > > > > > > > > > > diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c > > > > > > index 3edbc57be2ca..394a9321a10b 100644 > > > > > > --- a/drivers/staging/media/imx/imx-media-csi.c > > > > > > +++ b/drivers/staging/media/imx/imx-media-csi.c > > > > > > @@ -169,6 +169,8 @@ static int csi_get_upstream_mbus_config(struct csi_priv *priv, > > > > > > { > > > > > > struct v4l2_subdev *sd, *remote_sd; > > > > > > struct media_pad *remote_pad; > > > > > > + struct fwnode_handle *ep_node; > > > > > > + struct v4l2_fwnode_endpoint ep = { .bus_type = 0 }; > > > > > > > > > > Are there any defaults in DT bindings (other than 0's)? Also initialising a > > > > > field to zero this way is redundant, just use {}. > > > > > > > > > > > > > I was going to respond in much the same way. This is equivalen to: > > > > > > > > struct v4l2_fwnode_endpoint ep = { .bus_type = V4L2_MBUS_UNKNOWN }; > > > > > > Thinking about this in a context of parsing the endpoint, in fact the > > > bus_type should be specified. Presumably the hardware is D-PHY, so the > > > correct value would be V4L2_MBUS_CSI2_DPHY. This way > > > v4l2_fwnode_endpoint_parse() doesn't need to guess. > > > > I think we must use "bus_type = V4L2_MBUS_UNKNOWN" here: > > > > The i.MX6 has two types of camera interfaces: Parallel and MIPI CSI-2. > > They are connected either directly or via a video-mux to the CSIs > > (See IMX6DQRM.pdf - Figure 9-3 for the connection diagram) > > > > Pre-defining V4L2_MBUS_CSI2_DPHY here would let > > v4l2_fwnode_endpoint_parse() fail if the camera uses the parallel bus. > > > > We could distinguish between MIPI CSI-2 and Parallel input by checking > > the grp_id of the upstream device like it's already done in > > csi_get_upstream_mbus_config(). > > But for the Parallel case we still can't know if we should set bus_type > > to V4L2_MBUS_PARALLEL or to V4L2_MBUS_BT656 - the i.MX6 supports both > > formats on the parallel interface. > > > > That's why I would argue that v4l2_fwnode_endpoint_parse() must figure > > out the bus_type from the fw node. > > Right, nowadays you can indeed do this -- it wasn't a long ago when you > couldn't. I presume the bindings do specify the bus-type property is > mandatory? Where are the bindings btw.? > >From my understanding, it's not even required to set the bus-type as v4l2_fwnode_endpoint_parse() will try to parse the endpoint first as a CSI-2 bus and in case of failure as a Parallel bus if the bus-type is unknown (see drivers/media/v4l2-core/v4l2-fwnode.c#L493). About the bindings: There are bindings for the MIPI CSI-2 receiver: Documentation/devicetree/bindings/media/imx.txt I think here it's not necessary to make the bus-type property mandatory as the imx6-mipi-csi2 driver enforces V4L2_MBUS_CSI2_DPHY anyhow (see drivers/staging/media/imx/imx6-mipi-csi2.c#L677). For the case of a camera with parallel bus, the camera endpoint is connected to a video-mux and not directly to the CSI. Therefore, we cannot make the bus-type property mandatory on this endpoint as it this wouldn't apply to other use-cases of video-mux. > > > > > > > > > > > > > > > int ret; > > > > > > > > > > > > if (!priv->src_sd) > > > > > > @@ -210,11 +212,37 @@ static int csi_get_upstream_mbus_config(struct csi_priv *priv, > > > > > > > > > > > > ret = v4l2_subdev_call(remote_sd, pad, get_mbus_config, > > > > > > remote_pad->index, mbus_cfg); > > > > > > - if (ret == -ENOIOCTLCMD) > > > > > > - v4l2_err(&priv->sd, > > > > > > - "entity %s does not implement get_mbus_config()\n", > > > > > > - remote_pad->entity->name); > > > > > > + if (ret == -ENOIOCTLCMD) { > > > > > > > > > > if (!ret) > > > > > return 0; > > > > > > > > > > And you can unindent the rest. > > > > > > > > I was going to say this too but then I thought actually this needs to > > > > be: > > > > > > > > if (ret != -ENOIOCTLCMD) > > > > return ret; > > > > > > > > Which is weird. Better to break all the new code into a separate > > > > helper function. > > > > > > > > if (ret == -ENOIOCTLCMD) > > > > ret = parse_fw_link_config_stuff(); > > > > > > > > return ret; > > > > Good point. I factored out a helper function as suggested. > > > > > > > > Indeed. get_mbus_config() presumably wouldn't return an error but > > > correctness is usually a good idea. > > > > > -- > Regards, > > Sakari Ailus Best regards, Mathis Foerst