Camera V4L2 sensor driver migration to Jetpack 6.0 developer preview

I’m trying to migrate our V4L2 camera sensor driver to the Jetpack 6 developer preview image, which has the Jetson Linux 36.2 driver package.
The hardware setup is a Jetson Orin Nano Developer Kit, and it flashed with a JP6 SD card image.

Based on the below steps, create the new camera device tree.

  1. Create the camera device tree overlay file.

  2. compiled the dts and generated the dtbo file.

  3. Copied the dtbo file to /kernel/dtbo

  4. Using the ftdoverlay command, generate a new device tree file.

$ sudo fdtoverlay -i /boot/dtb/kernel_tegra234-p3768-0000+p3767-0005-nv.dtb -o /boot/dtb/kernel_tegra234-p3768-0000+p3767-0005-nv-camera-nvcam.dtb tegra234-p3767-camera-p3768-nvcam.dtbo

  1. Updated the dtb filename in the extlinux.conf

When the camera driver kernel module is inserted, the driver fails to create the video device and sub device. I have added the debug prints to the v4l2-asyn.c file.
The 5.15 kernel v4l2-async.c has removed the driver device name match type (V4L2_ASYNC_MATCH_DEVNAME) and it’s looking to match fwnode (V4L2_ASYNC_MATCH_FWNODE).
But it failed to match the fwnode from the below function of v4l2-asyn.c.

static bool match_fwnode(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)

Can you verify the device tree overlay file available in the attachment and provide some suggestions for further debugging.

tegra234-p3767-camera-p3768-nvcam-dts.txt (16.3 KB)

kernel logs:

test@test:~$ sudo insmod nv_cam.ko

test@test:~$ sudo dmesg
[ 383.190893] nvcam 2-0038: probing nvcam v4l2 sensor
[ 383.190982] nvcam 2-0038: Reset-gpios not found -2
[ 383.192203] nvcam: assign fwnode
[ 383.192207] nvcam: Called v4l2_async_find_match
[ 383.192210] nvcam: asd->match_type: 1
[ 383.192212] nvcam: match_fwnode success
[ 383.192216] nvcam: matches endpoint
[ 383.192217] nvcam: return null
[ 383.192218] nvcam: called continue
[ 383.192220] nvcam: v4l2_async_register_subdev success
[ 383.192222] nvcam 2-0038: Detected nvcam sensor

Apply below patch for it.

diff --git a/drivers/media/platform/tegra/camera/camera_common.c b/drivers/media/platform/tegra/camera/camera_common.c
index 126527c65..aa043a7f2 100644
--- a/drivers/media/platform/tegra/camera/camera_common.c
+++ b/drivers/media/platform/tegra/camera/camera_common.c
@@ -1,8 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * camera_common.c - utilities for tegra camera driver
- *
- * Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+/* SPDX-License-Identifier: GPL-2.0-only
+ * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -14,7 +11,7 @@
  * more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/types.h>
 #include <media/tegra-v4l2-camera.h>
@@ -82,6 +79,11 @@ static const struct camera_common_colorfmt camera_common_color_fmts[] = {
                V4L2_COLORSPACE_SRGB,
                V4L2_PIX_FMT_SGBRG12
        },
+       {
+               MEDIA_BUS_FMT_SBGGR12_1X12,
+               V4L2_COLORSPACE_SRGB,
+               V4L2_PIX_FMT_SBGGR12
+       },
        {
                MEDIA_BUS_FMT_SRGGB10_1X10,
                V4L2_COLORSPACE_SRGB,

Applied this patch and still it fails to register the sub device and video device. It failed to match the fwnode from the below function of v4l2-async.c

static bool match_fwnode(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)

Maybe print the fwnode to know why don’t match.

Thanks

[ 235.895418] sd->fwnode: /bus@0/i2c@3180000/nvcam@38
[ 235.895432] asd->match.fwnode:

The v4l2_async_subdev asd fwnode returns the null. So, it failed to match the fwnode. What could be the reason for null value.

test@test:/home/test# cat /sys/kernel/debug/v4l2-async/pending_async_subdevices
tegra-camrtc-capture-vi tegra-captu:
[fwnode] dev=nil, node=

Hello sivasubramaniyan.padmanab
I have a similar problem with you. Have you solved it?

Hello @Towe_Roll,

With reference to the tegra234-p3767-camera-p3768-imx219-A.dts file, I have created the dts file for my camera sensor and built the dtbo. I applied the overlay to the DTB.

tegra234-p3767-camera-p3768-nvcam.txt (13.9 KB)

During kernel booting, the tegra_vi_graph_init function of graph.c failed to register the notifier. But the endpoints and ports are parsed from the device tree. The __v4l2_async_notifier_add_subdev failed to add the subdev notifier. Another error I am seeing is the failure of v4l2_async_notifier_register in graph.c.

In this successful case, the camera sensor firmware node is added to the notifier_list. It can be displayed in the subdev debugfs file of /sys/kernel/debug/v4l2-async/pending_async_subdevices. Now the file is empty, and it doesn’t have any valid fw_nodes.

Hello @ShaneCCC ,

I tested with the tegra234-p3767-camera-p3768-imx219-A.dtbo and it didn’t register the pending async sub device. The same notifier registration failed in graph.c file.

dev_err(vi->dev, “notifier registration failed %d\n”, ret);

Just confirm imx219 is working on Orin Nano + JP6.0(r36.3)
We

tegra234-p3767-camera-p3768-nvcam.txt

Compiled the dtbo from the above dts file and able to probe the driver. The video device and sub device are registered successfully.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.