CSI driver

I fix the device tree and add an driver for my camera module.
And this is the device tree and driver code
tegra234-camera-rbpcv2-imx219.txt (8.4 KB)
nv_cam.txt (3.4 KB)

After I load the .ko to the kernel

Blockquote
$sudo dmesg
[ 118.080772] tegra-camrtc-capture-vi tegra-capture-vi: subdev gctcam bound
[ 118.081669] tegra-camrtc-capture-vi tegra-capture-vi: invalid port number 0 for /cam_i2cmux/i2c@0/rbpcv2_imx219_a@33
[ 118.092726] tegra-camrtc-capture-vi tegra-capture-vi: subdev gctcam unbind
[ 118.092733] gctcam 9-0033: Failed to register V4L2 subdev
[ 118.098331] gctcam: probe of 9-0033 failed with error -22

How can I fix it?
I had check the endpoint already

The port-index should be 1

						rbpcv2_imx219_out0: endpoint {
							port-index = <0>;
							bus-width = <2>;
							remote-endpoint = <&rbpcv2_imx219_csi_in0>;

Thanks for your reply.
I had changed this yesterday. But still have same result at dmesg.

According to this picture, i set device tree as:

tegra_sinterface = “serial_b”;
port-index = <1>;
lane_polarity = “6”;

Are these correct?
If it is, what other factors might cause this issue?

Check below error to print the value to check what cause the failed.

How to print it?
Thanks.

Download the kernel source code to add message to do it.

https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/text/SD/Kernel/KernelCustomization.html

I mean which file.
Is this file?
Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/platform/tegra/camera/vi/graph.c

I use “grep -rnw “invalid port number” ~/20250102/Linux_for_Tegra/source/public/” find out this file. Should I add at this file?

Yes, in this file.

What kind of information should I print?
I don’t know how to get the error value.

From the log it could be the num_pads is 0 cause the error.
It could be the status in some node is disable in device tree.
You may need to dump the device tree to confirm.

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

Thanks for your reply.
This is the output file.
extracted_proc.txt (415.4 KB)

The " csi_chan0 {}" in the nvcsi@15a00000 {} looks like incorrect.

How can I modify it to make it look right?

Should remove below.

csi_chan0 {

				ports {

					port@0 {

						endpoint@0 {
							port-index = <0x01>;
						};
					};
				};
			};

This is original dtsi.


Do you mean change like this


remove "port-index = <1> "

Do you compare your source with dump file?
The csi_chan0 {} I mention looks like in incorrect scope.