Orin NX CSI camera port binding in device tree

Hello,
I have a single lane of CSI video (YUV format) coming into the Orin NX that I would like to access in a GStreamer application with v4l2src via the direct V4L2 interface. The I2C driver is successfully probing the camera, but /dev/video0 is not created. This seems to indicate an issue with the port binding in my modified device tree, along with the verification output below:

$ sudo media-ctl -p -d /dev/media0
Media controller API version 5.15.136

Media device information
------------------------
driver          tegra-camrtc-ca
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  5.15.136

Device topology
- entity 1: 13e00000.host1x:nvcsi@15a00000- (2 pads, 0 link)
            type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
	pad1: Source

Can someone explain the mapping from physical MIPI CSI camera connector pins to this port mapping diagram?

In my case, the single-lane CSI input video is on CAM0 connector, CSI 1 Data 0 lane (pins 20 and 21 of J20). Is this CSI C in the above diagram? If I make that assumption, the diagram seems to imply that I need to bind VI stream 2 (port-index = <2>) to CSI port 2 (port-index = <2>). Is that the correct interpretation? I’m attempting to do that in the attached device tree, but as stated above, it is not working.

A similar question was asked here, but I found the response confusing. I’m also not sure if it applies to the Orin NX platform.

For context, I am trying to interface a Jetson Orin NX (8GB) with dev kit carrier board (P3768-0000) to the Analog Devices ADV7282A-M analog video decoder board. There is a custom camera connector interface board in between the ADV7282A-M and Jetson Orin NX that brings the ADV7282 single-lane YUV video output (along with I2C) into a 22-pin MIPI CSI connector on pins 20 and 21. This connector is plugged into the CAM0 port of the Jetson carrier board. Per the carrier board spec, page 19, this lane is CSI 1 Data 0.

tegra234-p3768-camera-adv7282am.dtsi.txt (9.3 KB)

You may check if kernel load the adv7282 driver first.

Yes, the adv7180 module successfully detects the ADV I2C device on boot:

$ sudo dmesg | grep adv7180
[    9.184059] adv7180 9-0021: chip id 0x43 found @ 0x21 (i2c-2-mux (chan_id 0))

However, I still don’t get /dev/video0, presumably because the device tree port binding is not correct.

Maybe trace into the v4l2_async_register_subdev() to check if any missing data.

Will do and post findings shortly. In the meantime, please address my question / assumption above about port binding:

By adding a print statement to drivers/media/v4l2-core/v4l2-async.c in the v4l2_async_register_subdev function, I can confirm that there is no match found. Specifically, this block starting on line 756 is executed:

	/* None matched, wait for hot-plugging */
	list_add(&sd->async_list, &subdev_list);
    if (strcmp(sd->name, "adv7180 9-0021") == 0)
    {
        pr_notice("adv7180 v4l2_async_register_subdev -- no match found\n");
    }

What does that mean? How can I dig into this further? Thanks.

Modify the compatible = “adi,adv7282-m”; in device tree to adv7180 to try.

I made this suggested change to the .dtsi, applied and rebooted. Aside from the kernel taking much longer to boot (~40 seconds instead of 10), there was no change in behavior:

$ sudo dmesg | grep adv7180
[   40.452576] adv7180_probe: Entry
[   40.474025] adv7180_probe: v4l2_subdev name: adv7180 9-0021
[   40.474036] adv7180 v4l2_async_register_subdev -- no match found
[   40.474307] adv7180_probe: chip id 0x43 found @ 0x21 (i2c-2-mux (chan_id 0))
[   40.474310] adv7180 9-0021: chip id 0x43 found @ 0x21 (i2c-2-mux (chan_id 0))

The pause during boot occurred here:

$ sudo dmesg
[    9.523462] pcieport 0008:00:00.0: AER: enabled with IRQ 189
[   38.628298] nvme nvme0: I/O 217 QID 1 timeout, completion polled

Is is possible there is some sort of resource conflict with the nv_imx219 driver? My .dtsi file is largely based on the overlay/tegra234-camera-rbpcv2-imx219.dtsi and hence uses a lot of the same labels / tags. Do these need to be globally unique (e.g. csi_chan0)? Note there is no imx219 camera attached to the Jetson, which is why I2C probing fails below:

[   40.365718] imx219 9-0010: imx219_board_setup: error during i2c read probe (-121)
[   40.370822] imx219 9-0010: board setup failed
[   40.370872] imx219: probe of 9-0010 failed with error -121
[   40.376048] imx219 10-0010: tegracam sensor driver:imx219_v2.0.6
[   40.387625] imx219 10-0010: imx219_board_setup: error during i2c read probe (-121)
[   40.393009] imx219 10-0010: board setup failed
[   40.393061] imx219: probe of 10-0010 failed with error -121
[   40.452576] adv7180_probe: Entry
[   40.474025] adv7180_probe: v4l2_subdev name: adv7180 9-0021
[   40.474036] adv7180 v4l2_async_register_subdev -- no match found
[   40.474307] adv7180_probe: chip id 0x43 found @ 0x21 (i2c-2-mux (chan_id 0))
[   40.474310] adv7180 9-0021: chip id 0x43 found @ 0x21 (i2c-2-mux (chan_id 0))

Yet the device files are created by the imx219 driver anyway:

$ ls /sys/firmware/devicetree/base/bus@0/cam_i2cmux/i2c@0
'#address-cells'   adv7282am_a@21   name   phandle   rbpcv2_imx219_a@10   reg  '#size-cells'   status

Print the “sd->name” to confirm.

I was actually already printing the sd->name in the above line and putting the v4l2_async_register_subdev print statement inside an if statement name check since multiple drivers could be calling it. So the sd->name is adv7180 9-0021.

Do you add this code or in somewhere?

Yes, please refer to my post #7 above. I added the if ( .. ) { pr_notice(..) } print statement to determine that the “none matched, wait for hot-plugging” path was being executed within v4l2_async_register_subdev. I’m not sure what this implies though. How would I check for missing data, as you suggested above?

There is no update from you for a period, assuming this is not an issue anymore.
Hence, we are closing this topic. If need further support, please open a new one.
Thanks

Is this still an issue to support? Any result can be shared?