关于设备树问题

我使用了两个imx390+两个max9295+一个max9296,从一个mipi口输出,以下是我配置的设备树内容,当我把 port@0 {
reg = <0>;
imx390_vi_in0: endpoint {
vc-id = <0>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&imx390_csi_out0>;
};
};
中的vi-id改成<0>,我能接收虚拟通道id为0的mipi数据。也就是说这个时候我使用/dev/video0能能接收id为0的数据,但是/dev/video1不能接收id为1的数据。

当我将vi-id改成<1>,我能接收虚拟通道id为1的mipi数据。也就是说这个时候我使用/dev/video0能能接收id为1的数据,但是/dev/video1还是不能接收任何数据。

请问是下面的那个字段配错了吗?,我经过测试发现mode中的lane_polarity会影响是否能正常接收数据,但是我不知道它的含义。

生成的设备节点/dev/video1无论我怎么配置都无法接收数据,能帮我看看哪里有问题吗。

我现在使用的是jetson origin nano,因为没有原始的imx390设备树,所以我自己根据AGX的imx390修改的,所以有些字段是我根据nano的imx219设备树添加的

/ {
tegra-capture-vi {
num-channels = <2>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
imx390_vi_in0: endpoint {
vc-id = <0>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&imx390_csi_out0>;
};
};
port@1 {
reg = <1>;
imx390_vi_in1: endpoint {
vc-id = <1>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&imx390_csi_out1>;
};
};
};
};

host1x@13e00000 {
	nvcsi@15a00000 {
		num-channels = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
		channel@0 {
			reg = <0>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					imx390_csi_in0: endpoint@0 {
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&imx390_imx390_out0>;
					};
				};
				port@1 {
					reg = <1>;
					imx390_csi_out0: endpoint@1 {
						remote-endpoint = <&imx390_vi_in0>;
					};
				};
			};
		};
		channel@1 {
			reg = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					imx390_csi_in1: endpoint@2 {
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&imx390_imx390_out1>;
					};
				};
				port@1 {
					reg = <1>;
					imx390_csi_out1: endpoint@3 {
						remote-endpoint = <&imx390_vi_in1>;
					};
				};
			};
		};
	};
};

cam_i2cmux {
		i2c@0 {
		imx390_a@1b {
			compatible = "sony,imx390";

			reg = <0x1b>;

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";

			sensor_model ="imx390";

			/* enable CID_SENSOR_MODE_ID for sensor modes selection */
			use_sensor_mode_id = "true";

			/**
			* A modeX node is required to support v4l2 driver
			* implementation with NVIDIA camera software stack
			*
			* mclk_khz = "";
			* Standard MIPI driving clock, typically 24MHz
			*
			* num_lanes = "";
			* Number of lane channels sensor is programmed to output
			*
			* tegra_sinterface = "";
			* The base tegra serial interface lanes are connected to
			*
			* vc_id = "";
			* The virtual channel id of the sensor.
			*
			* discontinuous_clk = "";
			* The sensor is programmed to use a discontinuous clock on MIPI lanes
			*
			* dpcm_enable = "true";
			* The sensor is programmed to use a DPCM modes
			*
			* cil_settletime = "";
			* MIPI lane settle time value.
			* A "0" value attempts to autocalibrate based on mclk_khz and pix_clk_hz
			*
			* active_w = "";
			* Pixel active region width
			*
			* active_h = "";
			* Pixel active region height
			*
			* dynamic_pixel_bit_depth = "";
			* sensor dynamic bit depth for sensor mode
			*
			* csi_pixel_bit_depth = "";
			* sensor output bit depth for sensor mode
			*
			* mode_type="";
			* Sensor mode type, For eg: yuv, Rgb, bayer, bayer_wdr_pwl
			*
			* pixel_phase="";
			* Pixel phase for sensor mode, For eg: rggb, vyuy, rgb888
			*
			* readout_orientation = "0";
			* Based on camera module orientation.
			* Only change readout_orientation if you specifically
			* Program a different readout order for this mode
			*
			* line_length = "";
			* Pixel line length (width) for sensor mode.
			* This is used to calibrate features in our camera stack.
			*
			* pix_clk_hz = "";
			* Sensor pixel clock used for calculations like exposure and framerate
			*
			*
			*
			*
			* inherent_gain = "";
			* Gain obtained inherently from mode (ie. pixel binning)
			*
			* min_gain_val = ""; (floor to 6 decimal places)
			* max_gain_val = ""; (floor to 6 decimal places)
			* Gain limits for mode
			* if use_decibel_gain = "true", please set the gain as decibel
			*
			* min_exp_time = ""; (ceil to integer)
			* max_exp_time = ""; (ceil to integer)
			* Exposure Time limits for mode (us)
			*
			*
			* min_hdr_ratio = "";
			* max_hdr_ratio = "";
			* HDR Ratio limits for mode
			*
			* min_framerate = "";
			* max_framerate = "";
			* Framerate limits for mode (fps)
			*
			* embedded_metadata_height = "";
			* Sensor embedded metadata height in units of rows.
			* If sensor does not support embedded metadata value should be 0.
			*/


			mode0 {
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_a";
				vc_id = "0";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "10";//no
				lane_polarity = "0";

				csi_pixel_bit_depth = "10";
				mode_type = "bayer";
				pixel_phase = "rggb";

				active_w = "3840";
				active_h = "2160";
				readout_orientation = "0";
				line_length = "11200";
				inherent_gain = "1";
				pix_clk_hz = "290000000";
				serdes_pix_clk_hz = "290000000";

				gain_factor = "16";
				min_gain_val = "16"; /* dB */
				max_gain_val = "170"; /* dB */
				step_gain_val = "1"; /* 0.3 */
				default_gain = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "2000000";
				max_framerate = "30000000";
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "13"; /*us, 2 lines*/
				max_exp_time = "683709";
				step_exp_time = "1";
				default_exp_time = "2495";/* us */
				embedded_metadata_height = "0";
			};
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					imx390_imx390_out0: endpoint {
						vc-id = <0>;
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&imx390_csi_in0>;
						};
					};
				};
			gmsl-link {
				src-csi-port = "b";
				dst-csi-port = "a";
				serdes-csi-link = "a";
				csi-mode = "1x4";
				st-vc = <0>;
				vc-id = <0>;
				num-lanes = <2>;
				streams = "ued-u1", "raw10";
				};
			};

		imx390_b@1c {
			compatible = "sony,imx390";

			reg = <0x1c>;

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";

			sensor_model ="imx390";


			/* enable CID_SENSOR_MODE_ID for sensor modes selection */
			use_sensor_mode_id = "true";

			/**
			* A modeX node is required to support v4l2 driver
			* implementation with NVIDIA camera software stack
			*
			* mclk_khz = "";
			* Standard MIPI driving clock, typically 24MHz
			*
			* num_lanes = "";
			* Number of lane channels sensor is programmed to output
			*
			* tegra_sinterface = "";
			* The base tegra serial interface lanes are connected to
			*
			* vc_id = "";
			* The virtual channel id of the sensor.
			*
			* discontinuous_clk = "";
			* The sensor is programmed to use a discontinuous clock on MIPI lanes
			*
			* dpcm_enable = "true";
			* The sensor is programmed to use a DPCM modes
			*
			* cil_settletime = "";
			* MIPI lane settle time value.
			* A "0" value attempts to autocalibrate based on mclk_khz and pix_clk_hz
			*
			* active_w = "";
			* Pixel active region width
			*
			* active_h = "";
			* Pixel active region height
			*
			* dynamic_pixel_bit_depth = "";
			* sensor dynamic bit depth for sensor mode
			*
			* csi_pixel_bit_depth = "";
			* sensor output bit depth for sensor mode
			*
			* mode_type="";
			* Sensor mode type, For eg: yuv, Rgb, bayer, bayer_wdr_pwl
			*
			* pixel_phase="";
			* Pixel phase for sensor mode, For eg: rggb, vyuy, rgb888
			*
			* readout_orientation = "0";
			* Based on camera module orientation.
			* Only change readout_orientation if you specifically
			* Program a different readout order for this mode
			*
			* line_length = "";
			* Pixel line length (width) for sensor mode.
			* This is used to calibrate features in our camera stack.
			*
			* pix_clk_hz = "";
			* Sensor pixel clock used for calculations like exposure and framerate
			*
			*
			*
			*
			* inherent_gain = "";
			* Gain obtained inherently from mode (ie. pixel binning)
			*
			* min_gain_val = ""; (floor to 6 decimal places)
			* max_gain_val = ""; (floor to 6 decimal places)
			* Gain limits for mode
			* if use_decibel_gain = "true", please set the gain as decibel
			*
			* min_exp_time = ""; (ceil to integer)
			* max_exp_time = ""; (ceil to integer)
			* Exposure Time limits for mode (us)
			*
			*
			* min_hdr_ratio = "";
			* max_hdr_ratio = "";
			* HDR Ratio limits for mode
			*
			* min_framerate = "";
			* max_framerate = "";
			* Framerate limits for mode (fps)
			*
			* embedded_metadata_height = "";
			* Sensor embedded metadata height in units of rows.
			* If sensor does not support embedded metadata value should be 0.
			*/

			mode0 {
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_a";
				vc_id = "1";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "10";
				lane_polarity = "6";

				csi_pixel_bit_depth = "10";
				mode_type = "bayer";
				pixel_phase = "rggb";

				active_w = "3840";
				active_h = "2160";
				readout_orientation = "0";
				line_length = "11200";
				inherent_gain = "1";
				pix_clk_hz = "290000000";
				serdes_pix_clk_hz = "290000000";

				gain_factor = "16";
				min_gain_val = "16"; /* dB */
				max_gain_val = "170"; /* dB */
				step_gain_val = "1"; /* 0.3 */
				default_gain = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "2000000";
				max_framerate = "30000000";
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "13"; /*us, 2 lines*/
				max_exp_time = "683709";
				step_exp_time = "1";
				default_exp_time = "2495";/* us */
				embedded_metadata_height = "0";
			};
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					imx390_imx390_out1: endpoint {
						vc-id = <1>;
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&imx390_csi_in1>;
						};
					};
				};
			gmsl-link {
				src-csi-port = "b";
				dst-csi-port = "a";
				serdes-csi-link = "b";
				csi-mode = "1x4";
				st-vc = <0>;
				vc-id = <1>;
				num-lanes = <2>;
				streams = "ued-u1", "raw10";
				};
			};
		};
};

};

/ {

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 = <4000000>;
	min_bits_per_pixel = <10>;
	vi_peak_byte_per_pixel = <2>;
	vi_bw_margin_pct = <25>;
	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 vender.
	 */
	modules {
		module0 {
			badge = "imx390_rear";
			position = "rear";
			orientation = "1";
			drivernode0 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_sensor";
				/* Driver v4l2 device name */
				devname = "imx390 9-001b";
				/* Declare the device-tree hierarchy to driver instance */
				proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/imx390_a@1b";
			};
		};
		module1 {
			badge = "imx390_front";
			position = "front";
			orientation = "1";
			drivernode0 {
				/* Declare PCL support driver (classically known as guid)  */
				pcl_id = "v4l2_sensor";
				/* Driver v4l2 device name */
				devname = "imx390 9-001c";
				/* Declare the device-tree hierarchy to driver instance */
				proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/imx390_b@1c";
			};
		};
	};
};

};

The lane_polarity must set to 6 for tegra_sinterface = “serial_a” doesn’t matter with the vc-id.

So you need set it to 6 for both vc-id=0 or 1 if connect to cam0.

Thanks

This configuration will generate/dev/video1, and its VC id is 1. However, I still cannot capture mipi

imx390_b@1c {
compatible = “sony,imx390”;

			reg = <0x1c>;

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";

			sensor_model ="imx390";


			/* enable CID_SENSOR_MODE_ID for sensor modes selection */
			use_sensor_mode_id = "true";


			mode0 {
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_a";
				vc_id = "1";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "10";
				lane_polarity = "6";

				csi_pixel_bit_depth = "10";
				mode_type = "bayer";
				pixel_phase = "rggb";

				active_w = "3840";
				active_h = "2160";
				readout_orientation = "0";
				line_length = "4440";
				inherent_gain = "1";
				pix_clk_hz = "280000000";
				serdes_pix_clk_hz = "300000000";

				gain_factor = "16";
				min_gain_val = "16"; /* dB */
				max_gain_val = "170"; /* dB */
				step_gain_val = "1"; /* 0.3 */
				default_gain = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "2000000";
				max_framerate = "30000000";
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "13"; /*us, 2 lines*/
				max_exp_time = "683709";
				step_exp_time = "1";
				default_exp_time = "2495";/* us */
				embedded_metadata_height = "0";
			};
The device tree configuration for generating/dev/video0 nodes is able to capture mipi data for vc-id 0 normally

                imx390_a@1b {
			compatible = "sony,imx390";

			reg = <0x1b>;

			/* Physical dimensions of sensor */
			physical_w = "3.680";
			physical_h = "2.760";

			sensor_model ="imx390";

			/* enable CID_SENSOR_MODE_ID for sensor modes selection */
			use_sensor_mode_id = "true";

			mode0 {
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_a";
				phy_mode = "DPHY";
				vc_id = "0";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "10";
				lane_polarity = "6";

				csi_pixel_bit_depth = "10";
				mode_type = "bayer";
				pixel_phase = "rggb";

				active_w = "3840";
				active_h = "2160";
				readout_orientation = "0";
				line_length = "4440";
				inherent_gain = "1";
				pix_clk_hz = "280000000";//250000000      330000000
				serdes_pix_clk_hz = "500000000";

// deskew_initial_enable = “true”;

				gain_factor = "16";
				min_gain_val = "16"; /* dB */
				max_gain_val = "170"; /* dB */
				step_gain_val = "1"; /* 0.3 */
				default_gain = "16";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "2000000";
				max_framerate = "30000000";
				step_framerate = "1";
				default_framerate = "30000000";
				exposure_factor = "1000000";
				min_exp_time = "13"; /*us, 2 lines*/
				max_exp_time = "683709";
				step_exp_time = "1";
				default_exp_time = "2495";/* us */
				embedded_metadata_height = "0";
			};
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					imx390_imx390_out0: endpoint {
						vc-id = <0>;
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&imx390_csi_in0>;
						};
					};
				};
			gmsl-link {
				src-csi-port = "b";
				dst-csi-port = "a";
				serdes-csi-link = "a";
				csi-mode = "1x4";
				st-vc = <0>;
				vc-id = <0>;
				num-lanes = <2>;
				streams = "ued-u1", "raw10";
				};
			};

Because I want to use the CAM0 port to receive data VC-0 and VC-1, I have configured two device nodes in the same I2C. Is there a problem with the nodes generated by me like this?

Do you make sure the vc-id by the max929x?
Maybe check the trace log if any clue.

I can confirm because I changed the device tree configuration for generating/dev/video0 nodes to

/ {
tegra-capture-vi {
num-channels = <2>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
imx390_vi_in0: endpoint {
vc-id = <0>;
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&imx390_csi_out0>;
};
};
Set this vc-id =<0>; change to vc-id=<1>;
Generating/dev/video0 can only receive mip from the sensor with vc-id 1
Set this vc-id =<0>
Generating/dev/video0 can only receive mip from the sensor with vc-id 0

So I think the configuration of the serdes should be fine

You may get the trace log to check why unable capture.

https://elinux.org/Jetson/l4t/Camera_BringUp#Steps_to_enable_more_debug_messages

I still can’t solve this problem,

Do you have any other suggestions

thanks

sudo su
echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 3 > /sys/kernel/debug/camrtc/log-level
echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace
v4l2-ctl --stream-mmap -c bypass_mode=0
cat /sys/kernel/debug/tracing/trace

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