Orin NX - LT6911 and 4k over MIPI

Hello.

I would like to ask about problem when receiving 4k video @ 60FPS via 4-lanes MIPI.

We have custom board with Orin NX module, running jetson Linux 35.5.0.
Lontium LT6911UXE is connected to Jetson via 4 lanes MIPI.

We are using modified driver from here: https://github.com/InES-HPMM/Lontium_lt6911uxc

Device tree:

/ {
	i2c@c250000 { /* I2C7 */
		clock-frequency = <400000>;

		lt6911uxc_0@2b {
			compatible = "lontium,lt6911uxc";
			reg = <0x2b>;
			status = "okay";
			reset-gpio = <&expander 1 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&tegra_main_gpio>;
			interrupts = <TEGRA234_MAIN_GPIO(Z, 1) IRQ_TYPE_EDGE_FALLING>; // GPIO00
			devnode = "video0";

			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					status = "okay";
					reg = <0>;
					hdmi2csi_lt6911_out0: endpoint {
						status = "okay";
						port-index = <0>;
						bus-width = <4>;
						remote-endpoint = <&hdmi2csi_csi_in0>;
					};
				};
			};
		};

    host1x@13e00000 {
		nvcsi@15a00000 {
			status = "okay";
			num-channels = <2>;
			#address-cells = <1>;
			#size-cells = <0>;
			channel@0 {
				status = "okay";
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					csi_chan0_port0: port@0 {
						status = "okay";
						reg = <0>;
						hdmi2csi_csi_in0: endpoint@0 {
							status = "okay";
							port-index = <0>;
							// csi-port = <0>;
							bus-width = <4>;
							remote-endpoint = <&hdmi2csi_lt6911_out0>;
						};
					};
					csi_chan0_port1: port@1 {
						status = "okay";
						reg = <1>;
						hdmi2csi_csi_out0: endpoint@1 {
							status = "okay";
							remote-endpoint = <&hdmi2csi_vi_in0>;
						};
                    };
                };
            };
        };
    };
};

/ {
	tcp: tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";

		num_csi_lanes = <8>;
		max_lane_speed = <2500000>;
		min_bits_per_pixel = <16>;
		vi_peak_byte_per_pixel = <3>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <750000>;
		isp_peak_byte_per_pixel = <3>;
		isp_bw_margin_pct = <25>;
		status = "okay";

		modules {
			module0 {
				status = "okay";
				badge = "lt6911uxe_front";
				position = "front";
				orientation = "1";
				drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "lt6911uxe 7-002b";
					proc-device-tree = "/proc/device-tree/i2c@c250000/lt6911uxe@2b";
				};
			};
		};
	};
};

Since there is no modeX node, we set fixed MIPI frequency in csi5_fops.c:

diff --git a/nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c b/nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c
index fdeef5f1a203..8fc73a52ff93 100644
--- a/nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c
+++ b/nvidia/drivers/media/platform/tegra/camera/nvcsi/csi5_fops.c

@@ -290,6 +293,10 @@ static int csi5_stream_set_config(struct tegra_csi_channel *chan, u32 stream_id,
 	else
 		cil_config.mipi_clock_rate = csi->clk_freq / 1000;
 
+	cil_config.mipi_clock_rate = 592064;

 	/* Set NVCSI stream config */
 	memset(&msg, 0, sizeof(msg));
 	msg.header.msg_id = CAPTURE_CSI_STREAM_SET_CONFIG_REQ;

With resolution 2560x1440x60, all is working fine, I can capture frames from /dev/videox without problem, without any errors during playback in dmesg.

v4l2-ctl --device /dev/video1 --set-fmt-video=pixelformat=UYVY --stream-mmap
New timings found
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.95 fps

But when resolution is 4k (3840x2160x60), it sometimes works for a while (And I can really see correct image, so there are correct data in MIPI signals), or it broke immediatelly.
Boosting clocks have no impact

echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee  /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate

I can get errors when use python3 and cv2 to read image:

[   67.303971] (NULL device *): vi_capture_control_message: NULL VI channel received
[   67.311526] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   70.365678] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   70.365968] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   70.366260] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stop_streaming: csi_pt=0, st_id=0, vc_id=0, pg_mode=0x0
[   70.366584] (NULL device *): vi_capture_control_message: NULL VI channel received
[   70.366820] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[   70.367122] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_start_streaming: csi_pt=0, st_id=0, vc_id=0, pg_mode=0x0
[   70.367422] csi5_stream_set_config: stream_id=0, csi_port=0
[   70.367577] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_set_config: stream_id=0, csi_port=0
[   70.367833] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: cil_settletime is pulled from device of_node

Or different errors when receiving via v4l2. See dmesg log bellow.

v4l2-ctl --device /dev/video1 --set-fmt-video=pixelformat=UYVY --stream-mmap
[  120.961785] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 3, flags: 0, err_data 256
[  120.978455] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 0, flags: 0, err_data 256
[  120.995144] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 1, flags: 0, err_data 256
[  121.011806] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 2, flags: 0, err_data 256
[  121.028472] tegra-camrtc-capture-vi tegra-capture-vi: corr_err: discarding frame 3, flags: 0, err_data 256
...

And trace during this.
trace_at_4k.txt (28.0 MB)

Thanks for help.

The error tell err_intr_stat_pd_crc_err_vc0.

     kworker/1:4-90      [001] ....   104.402805: rtcpu_nvcsi_intr: tstamp:3724093074 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:0 vc:0 status:0x00000004

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