HDMI 2 MIPI CSI Device Tree

Hi,

I am attempting to develop a driver for the Toshiba TC358743 chip for the Jetson Nano,
I am using JetPack 4.2.2.

I already have a driver for the TC358743 chip which i use on our older platforms (not Nvidia based)
which i know to be working in 2/4 lanes UYVY or BGR2

I have found a TC358840 driver in the JetPack so i have used it as reference,
I have also found what seems like a device tree example in the JetPack in the file:tegra210-camera-imx274-hdmi.dtsi.

I am not sure about the device tree example, is it Ok to use ?
I took the Imx219 dual dtsi and changed it to look like this:

#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>

/ {
host1x {
vi_base: vi {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
vi_port0: port@0 {
reg = <0>;
rbpcv2_imx219_vi_in0: endpoint {
port-index = <4>;
bus-width = <2>;
remote-endpoint = <&rbpcv2_imx219_csi_out0>;
};
};
};
};

	csi_base: nvcsi {
		num-channels = <1>;
		#address-cells = <1>;
		#size-cells = <0>;
		csi_chan0: channel@0 {
			reg = <0>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				csi_chan0_port0: port@0 {
					reg = <0>;
					rbpcv2_imx219_csi_in0: endpoint@0 {
						port-index = <4>;
						bus-width = <2>;
						remote-endpoint = <&rbpcv2_imx219_dual_out0>;
					};
				};
				csi_chan0_port1: port@1 {
					reg = <1>;
					rbpcv2_imx219_csi_out0: endpoint@1 {
						remote-endpoint = <&rbpcv2_imx219_vi_in0>;
					};
				};
			};
		};
	};
};


cam_i2cmux {
	i2c_0: i2c@0 {
		imx219_cam0: rbpcv2_imx219_a@10 {
			compatible = "nvidia,tc358840";
			/* I2C device address */
			reg = <0x0F>;
			status = "disabled";
			
			/* V4L2 device node location */
			devnode = "video0";

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";
			
		
			sensor_model = "tc358840";
			use_sensor_mode_id = "false";

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					rbpcv2_imx219_dual_out0: endpoint {
						port-index = <4>;
						bus-width = <2>;
						remote-endpoint = <&rbpcv2_imx219_csi_in0>;
					};
				};
			};
		};
	};
};

};

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

	/**
	* Physical settings to calculate max ISO BW
	*
	* num_csi_lanes = <>;
	* Total number of CSI lanes when all cameras are active
	*
	* max_lane_speed = <>;
	* Max lane speed in Kbit/s
	*
	* min_bits_per_pixel = <>;
	* Min bits per pixel
	*
	* vi_peak_byte_per_pixel = <>;
	* Max byte per pixel for the VI ISO case
	*
	* vi_bw_margin_pct = <>;
	* Vi bandwidth margin in percentage
	*
	* max_pixel_rate = <>;
	* Max pixel rate in Kpixel/s for the ISP ISO case
	*
	* isp_peak_byte_per_pixel = <>;
	* Max byte per pixel for the ISP ISO case
	*
	* isp_bw_margin_pct = <>;
	* Isp bandwidth margin in percentage
	*/
	num_csi_lanes = <2>;
	max_lane_speed = <1500000>;
	min_bits_per_pixel = <10>;
	vi_peak_byte_per_pixel = <2>;
	vi_bw_margin_pct = <25>;
	max_pixel_rate = <240000>;
	isp_peak_byte_per_pixel = <5>;
	isp_bw_margin_pct = <25>;

	/**
	 * The general guideline for naming badge_info contains 3 parts, and is as follows,
	 * The first part is the camera_board_id for the module; if the module is in a FFD
	 * platform, then use the platform name for this part.
	 * The second part contains the position of the module, ex. "rear" or "front".
	 * The third part contains the last 6 characters of a part number which is found
	 * in the module's specsheet from the vendor.
	 */
};

};

Everything loads fine, the device is probed successfully,
I configure the TC358743 and can see that it is detecting the HDMI correctly,
So i am positive that it is outputting the MIPI signal,

When i try to use it using any v4l software (yavta)
I can see:

[ 39.805554] vi 54080000.vi: Calibrate csi port 4

So it does try to calibrate the intended port, we are connected to port 4

When I try to use it I get the following error:
[ 49.398184] Detected Width = 1280
[ 49.401868] Detected Height = 720
[ 49.606837] video4linux video0: frame start syncpt timeout!0
[ 49.612901] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
[ 49.619503] vi 54080000.vi: TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000000
[ 49.625935] vi 54080000.vi: TEGRA_CSI_CIL_STATUS 0x00000010
[ 49.631702] vi 54080000.vi: TEGRA_CSI_CILX_STATUS 0x00040041
[ 49.637462] vi 54080000.vi: cil_settingtime was autocalculated
[ 49.643323] vi 54080000.vi: csi clock settle time: 13, cil settle time: 10
[ 49.850848] video4linux video0: frame start syncpt timeout!0
[ 49.856888] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
[ 49.863486] vi 54080000.vi: TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000000
[ 49.869917] vi 54080000.vi: TEGRA_CSI_CIL_STATUS 0x00000010
[ 49.875529] vi 54080000.vi: TEGRA_CSI_CILX_STATUS 0x00040041
[ 49.881237] vi 54080000.vi: cil_settingtime was autocalculated
[ 49.887078] vi 54080000.vi: csi clock settle time: 13, cil settle time: 10
[ 50.094669] video4linux video0: frame start syncpt timeout!0
[ 50.100652] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
[ 50.107225] vi 54080000.vi: TEGRA_CSI_PIXEL_PARSER_STATUS 0x00000000
[ 50.113644] vi 54080000.vi: TEGRA_CSI_CIL_STATUS 0x00000010
[ 50.119339] vi 54080000.vi: TEGRA_CSI_CILX_STATUS 0x00040041
[ 50.125108] vi 54080000.vi: cil_settingtime was autocalculated
[ 50.130972] vi 54080000.vi: csi clock settle time: 13, cil settle time: 10

Can you help me figure out what these error mean ?
Are they hardware related ?

Thanks,
Amir

It could be HW connection or signal problem.
Have a check the TRM for the CSI_CSI_CILx_STATUS_0

[ 49.875529] vi 54080000.vi: TEGRA_CSI_CILX_STATUS 0x00040041

CILA_CLK_LANE_CTRL_ERR: Control Error. Set when CIL-A detects incorrect line state sequence on clk
lane

CILA_DATA_LANE0_CTRL_ERR: Control Error. Set when CIL-A detects LP state 01 or 10 followed by a
stop state (LP11) instead of transitioning

CILA_DATA_LANE1_CTRL_ERR: Control Error. Set when CIL-A detects LP state 01 or 10 followed by a
stop state (LP11) instead of transitioning

Also you can have below link as driver reference.

https://developer.ridgerun.com/wiki/index.php?title=Toshiba_TC358743_Linux_driver_for_Jetson_TX1/TX2/Nano

Hi,

Thanks for the reply,

I saw a few TRM’s on the download center, which one if for the nano ?

Also, are ridgerun an official partner of nvidia ?
I dont mind buying their driver, but i cant get in touch with them for a few days now.

Thanks

Check the TX1 TRM for nano.
Have a check the partner from below link.

https://developer.nvidia.com/embedded/community/ecosystem

Hello amir.s

Since you are using Jetson Nano, the port-index should be 0.

port-index = <0>;

Hi,
I just modified the tegra210-camera-rbpcv2-dual-imx219.dtsi file with the modifications you applied except that I used the TC358743. I am able to probe the TC358743. However, I do not see any /dev/video* files created. How do I make it appear?
Do I need to see a imx219 device in the kernel dump? If it is the case, I am not seeing it.