Confuse about port-index with cam setting

Hi,
I have read https://docs.nvidia.com/jetson/archives/r35.4.1/DeveloperGuide/text/SD/CameraDevelopment/SensorSoftwareDriverProgramming.html#_Device_Properties

But still confused and can not get correct cam setting.

I have 4 cam sensor, name w x y z.

w x connect to SoC csi-port-c, y z connect to SoC csi-port-d

So here is the question

  1. I have to do add 4 port eahch two have same port-index in tegra-capture-vi to create /dev/video?
	tegra-capture-vi {
			num-channels = <4>;
			ports {
				port@0 {
					reg = <0>;
					ar0234_vi_in0: endpoint {
						vc-id = <0>;
						port-index = <2>;
                                                bus-width = <2>;
						remote-endpoint = <&ar0234_csi_out0>;
					};
				};
				port@1 {
					reg = <1>;
					ar0234_vi_in1: endpoint {
					vc-id = <1>;
					port-index = <2>;
					bus-width = <2>;
					remote-endpoint = <&ar0234_csi_out1>;
					};
				};
				port@2 {
					reg = <2>;
					ar0234_vi_in2: endpoint {
						vc-id = <0>;
						port-index = <3>;
						bus-width = <2>;
						remote-endpoint = <&ar0234_csi_out2>;
					};
				};
				port@3 {
					reg = <3>;
					ar0234_vi_in3: endpoint {
						vc-id = <1>;
						port-index = <3>;
						bus-width = <2>;
						remote-endpoint = <&ar0234_csi_out3>;
					};
				};
			};
		};

  1. In nvcsi port-index is mean which csi_port for Soc?
    If yes, channel0&1 port-index gonna be 2 for csi-port-c, channel2&3 port-index gonna be 3 for csi-port-d, right?
channel@0 {
        port0{
                ar0234_csi_in0: endpoint@0 {
                        port-index = <0>;
               }
        }
}
channel@1 {
        port0{
                ar0234_csi_in1: endpoint@2 {
                        port-index = <0>;
               }
        }
}
channel@2 {
        port0{
                ar0234_csi_in2: endpoint@4 {
                        port-index = <1>;
               }
        }
}
channel@3 {
        port0{
                ar0234_csi_in3: endpoint@6 {
                        port-index = <1>;
               }
        }
}
  1. For sensor node, port-index is for seeting sensor data input to which vi port?
    If yes, w x y z DTS goona be this, right?
mode_0{
        tegra_sinterface = "serial_c"
};
port@0{
        ar0234_ar0234_out0: endpoint{
                vc-id=<0>;
                port-index=<2>;
        }
}
/* x */
mode_0{
        tegra_sinterface = "serial_c"
};
port@0{
        ar0234_ar0234_out1: endpoint{
                vc-id=<1>;
                port-index=<2>;
        }
}
/* y */
mode_0{
        tegra_sinterface = "serial_d"
};
port@0{
        ar0234_ar0234_out2: endpoint{
                vc-id=<0>;
                port-index=<3>;
        }
}
/* z */
mode_0{
        tegra_sinterface = "serial_d"
};
port@0{
        ar0234_ar0234_out3: endpoint{
                vc-id=<1>;
                port-index=<3>;
        }
}

But when I use this DTSI only got /dev/video0 and /dev/video1

cam.txt (18.3 KB)
nvcsi.txt (2.1 KB)
tegra-capture-vi.txt (1.3 KB)

Here is the pad and sink info

Media controller API version 5.10.120

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

Device topology
- entity 1: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		<- "zedx 12-0018":0 [ENABLED]
	pad1: Source
		-> "vi-output, zedx 12-0018":0 [ENABLED]

- entity 4: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
	pad0: Sink
		<- "zedx 12-0010":0 [ENABLED]
	pad1: Source
		-> "vi-output, zedx 12-0010":0 [ENABLED]

- entity 7: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev2
	pad0: Sink
		<- "zedx 13-0018":0 [ENABLED]
	pad1: Source
		-> "vi-output, zedx 13-0018":0 [ENABLED]

- entity 10: 13e40000.host1x:nvcsi@15a00000- (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev3
	pad0: Sink
		<- "zedx 13-0010":0 [ENABLED]
	pad1: Source
		-> "vi-output, zedx 13-0010":0 [ENABLED]

- entity 13: zedx 12-0018 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev4
	pad0: Source
		[fmt:SGRBG10_1X10/1920x1200 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 15: vi-output, zedx 12-0018 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video0
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 33: zedx 12-0010 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev5
	pad0: Source
		[fmt:SGRBG10_1X10/1920x1200 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 35: vi-output, zedx 12-0010 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video1
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 45: zedx 13-0018 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev6
	pad0: Source
		[fmt:SGRBG10_1X10/1920x1200 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 47: vi-output, zedx 13-0018 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video2
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 57: zedx 13-0010 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev7
	pad0: Source
		[fmt:SGRBG10_1X10/1920x1200 field:none colorspace:srgb]
		-> "13e40000.host1x:nvcsi@15a00000-":0 [ENABLED]

- entity 59: vi-output, zedx 13-0010 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video3
	pad0: Sink
		<- "13e40000.host1x:nvcsi@15a00000-":1 [ENABLED]

Now I can see /dev/video0~3

But I notice I can’t use two csi serial port in same time.

For example single port work

$ v4l2-ctl --stream-mmap -d0 # csi port c
# Or
$ v4l2-ctl --stream-mmap -d2 # csi port d

But

$ v4l2-ctl --stream-mmap -d0 # csi port c
# Also
$ v4l2-ctl --stream-mmap -d2 # csi port d

The first stream will break (In here is vidoe0(csi_port_c))
I will got

[ 1009.991255] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: flags 2, err_data 0
[ 1010.042788] [RCE] ERROR: camera-ip/vi5/vi5.c:745 [vi5_handle_eof] "General error queue is out of sync with frame queue. ts=1030815275936 sof_ts=1030815286080 gerror_code=2 gerror_data=a3 notify_bits=4000000000
[ 1010.042796] [RCE] "
[ 1012.690735] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 1012.699927] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 1012.711365] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1012.719117] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=3, csi_port=3
[ 1012.730518] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1012.738338] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 3 vc- 0
[ 1012.749206] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 1014.524421] bwmgr API not supported
[ 1017.042646] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 1017.051885] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 1017.062451] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1017.070197] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=3, csi_port=3
[ 1017.080886] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1017.088606] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 3 vc- 0
[ 1017.099409] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[ 1019.858591] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[ 1019.867739] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[ 1019.878307] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1019.886104] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=3, csi_port=3
[ 1019.897107] (NULL device *): vi_capture_control_message: NULL VI channel received
[ 1019.904884] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 3 vc- 0
[ 1019.915960] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel