Jetson Xavier NX Device tree for two type cameras

Hello. I’m developing our custom board with jetson xavier nx.
We have two types of products. Each one is identical in all aspects except for the camera. It would be great if the device could be recognized properly regardless of which camera is connected and booted.
What I discovered is that the device module is well registered in the kernel, so if we modify the device tree, each camera will function properly. Let me show you the device tree for each camera, which works well.

Camera 1.

/*
 * Copyright (c) 2015-2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <dt-bindings/media/camera.h>
#include <dt-bindings/gpio/tegra186-gpio.h>

#define CAM0_PWDN	TEGRA194_MAIN_GPIO(P, 4)
#define CAM0_RESET	TEGRA194_MAIN_GPIO(P, 5)
//#define CAM1_PWDN	TEGRA194_MAIN_GPIO(P, 5)
//#define CAM_I2C_MUX 	TEGRA194_AON_GPIO(CC, 3)

/* Enable Six overlays in Jetson Xavier NX */
&head0 {
	win-mask = <0x3f>;
};


/* camera control gpio definitions */
/ {
	/* F-03 usb power enable */
	gpio@2200000 {
		extusb-enable {
			gpio-hog;
			gpios = <TEGRA_MAIN_GPIO(P, 5) 0>;
			output-high;
			line-name = "extusb-enable";
		};
		camera-control-output-low {
			gpio-hog;
			output-low;
			gpios = <CAM0_PWDN 0>;
			label = "cam0-pwdn";
		};
	};

	host1x {
		vi@15c10000  {
			num-channels = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				vi_port0: port@0 {
					reg = <0>;
					ecam_imx415_vi_in0: endpoint {
						port-index = <4>;
						bus-width = <2>;
						remote-endpoint = <&ecam_imx415_csi_out0>;
					};
				};
				// vi_port1: port@1 {
				// 	reg = <1>;
				// 	ecam_ar0521_vi_in1: endpoint {
				// 		port-index = <2>;
				// 		bus-width = <2>;
				// 		remote-endpoint = <&ecam_ar0521_csi_out1>;
				// 	};
				// };
			};
		};

		nvcsi@15a00000 {
			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>;
						ecam_imx415_csi_in0: endpoint@0 {
							port-index = <4>;
							bus-width = <2>;
							remote-endpoint = <&ecam_imx415_out0>;
						};
					};
					csi_chan0_port1: port@1 {
						reg = <1>;
						ecam_imx415_csi_out0: endpoint@1 {
							remote-endpoint = <&ecam_imx415_vi_in0>;
						};
					};
				};
			};
			// csi_chan1: channel@1 {
			// 	reg = <1>;
			// 	ports {
			// 		#address-cells = <1>;
			// 		#size-cells = <0>;
			// 		csi_chan1_port0: port@0 {
			// 			reg = <0>;
			// 			ecam_ar0521_csi_in1: endpoint@2 {
			// 				port-index = <2>;
			// 				bus-width = <2>;
			// 				remote-endpoint = <&ecam_ar0521_out1>;
			// 			};
			// 		};
			// 		csi_chan1_port1: port@1 {
			// 			reg = <1>;
			// 			ecam_ar0521_csi_out1: endpoint@3 {
			// 				remote-endpoint = <&ecam_ar0521_vi_in1>;
			// 			};
			// 		};
			// 	};
			// };
		};
	};

	i2c@3180000 {
		status = "okay";
		tca6424_22_a: tca6424@22 {
			compatible = "ti,tca6424";
			gpio-controller;
			#gpio-cells = <2>;
			reg = <0x22>;
			vcc-supply = <&p3509_vdd_sys_en>;
			status = "okay";
			tca6424_22_outlow {
			/*
				* GPIO-0 : RST_CAM1
				* GPIO-1 : RST_CAM2
				* GPIO-2 : RST_CAM3
				* .... more is there
			*/
				gpio-hog;
				gpios = <0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0>;
				output-low;
				label = "tca6424_22_outlow_0",
						"tca6424_22_outlow_1",
						"tca6424_22_outlow_2",
						"tca6424_22_outlow_3",
						"tca6424_22_outlow_4",
						"tca6424_22_outlow_5",
						"tca6424_22_outlow_6",
						"tca6424_22_outlow_7";
			};
			tca6424_22_outhigh {
					status = "disabled";
			};
			tca6424_22_input {
					status = "disabled";
			};
		};
		imx415_a@42 {
			reset-gpios = <&tca6424_22_a 1 GPIO_ACTIVE_HIGH>;
			boot-gpios  = <&tca6424_22_a 2 GPIO_ACTIVE_HIGH>;
			compatible = "nvidia,eimx415";
			/* I2C device address */
			reg = <0x42>;

			/* V4L2 device node location */
			devnode = "video0";
			status = "okay";
			/* Physical dimensions of sensor */
			physical_w = "5.60";
			physical_h = "3.175";

			sensor_model = "eimx415";

			use_decibel_gain = "true";
			use_sensor_mode_id = "true";
			use_dol_wdr_mode = "false";
			use_master_slave_mode = "false";
			limit_analog_gain = "true";
			camera_mipi_lanes = /bits/ 8 <2>;
			mipi-clk-configurable;
			camera_mipi_clk = /bits/ 16 <2000>;
			mode0 {
				mclk_khz = "37125";
				num_lanes = "2";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";
				pixel_phase = "gbrg";

				active_w = "3840";
				active_h = "2160";
				readout_orientation = "0";
				line_length = "887";
				inherent_gain = "1";
				mclk_multiplier = "1";
				pix_clk_hz = "693000000";

				gain_factor = "10";
				min_gain_val = "0";
				max_gain_val = "300";
				step_gain_val = "3";
				default_gain = "0";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "2500000";
				max_framerate = "37000000";
				step_framerate = "1";
				default_framerate = "37000000";
				exposure_factor = "1000000";
				min_exp_time = "450";
				max_exp_time = "400000";
				step_exp_time = "1";
				default_exp_time = "27027";
				embedded_metadata_height = "1";
			};
			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					ecam_imx415_out0: endpoint {
						status = "okay";						
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&ecam_imx415_csi_in0>;
					};
				};
			};
		};//imx415_a
	};//i2c@3180000
};


/* camera control gpio definitions */
/ {
	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 = <4>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <16>;
		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 vender.
		 */
		modules {
			module0 {
				badge = "imx415_front_0415";
				position = "front";
				orientation = "1";
				drivernode0 {
					/*status = "okay";*/
					pcl_id = "v4l2_sensor";
					devname = "e-con_cam 2-0042";
					proc-device-tree = "/proc/device-tree/i2c@3180000/imx415_a@42";
				};
				/*drivernode1 {
					pcl_id = "v4l2_lens";
				};*/
			};
		};
	};
};

Camera 2.

/*
 * Copyright (c) 2015-2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <dt-bindings/media/camera.h>
#include <dt-bindings/gpio/tegra186-gpio.h>

#define CAM0_PWDN	TEGRA194_MAIN_GPIO(P, 4)
#define CAM0_RESET	TEGRA194_MAIN_GPIO(P, 5)
//#define CAM1_PWDN	TEGRA194_MAIN_GPIO(P, 5)
//#define CAM_I2C_MUX 	TEGRA194_AON_GPIO(CC, 3)

/* Enable Six overlays in Jetson Xavier NX */
&head0 {
	win-mask = <0x3f>;
};


/* camera control gpio definitions */
/ {
	/* F-03 usb power enable */
	gpio@2200000 {
		extusb-enable {
			gpio-hog;
			gpios = <TEGRA_MAIN_GPIO(P, 5) 0>;
			output-high;
			line-name = "extusb-enable";
		};
	};

	host1x {
		vi@15c10000  {
			num-channels = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				vi_port0: port@0 {
					reg = <0>;
					e3322_vi_in0: endpoint {
						port-index = <4>;
						bus-width = <2>;
						remote-endpoint = <&e3322_csi_out0>;
					};
				};
				// vi_port1: port@1 {
				// 	reg = <1>;
				// 	ecam_ar0521_vi_in1: endpoint {
				// 		port-index = <2>;
				// 		bus-width = <2>;
				// 		remote-endpoint = <&ecam_ar0521_csi_out1>;
				// 	};
				// };
			};
		};

		nvcsi@15a00000 {
			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>;
						e3322_csi_in0: endpoint@0 {
							port-index = <4>;
							bus-width = <2>;
							remote-endpoint = <&e3322_veye327_out0>;
						};
					};
					csi_chan0_port1: port@1 {
						reg = <1>;
						e3322_csi_out0: endpoint@1 {
							remote-endpoint = <&e3322_vi_in0>;
						};
					};
				};
			};
			// csi_chan1: channel@1 {
			// 	reg = <1>;
			// 	ports {
			// 		#address-cells = <1>;
			// 		#size-cells = <0>;
			// 		csi_chan1_port0: port@0 {
			// 			reg = <0>;
			// 			ecam_ar0521_csi_in1: endpoint@2 {
			// 				port-index = <2>;
			// 				bus-width = <2>;
			// 				remote-endpoint = <&ecam_ar0521_out1>;
			// 			};
			// 		};
			// 		csi_chan1_port1: port@1 {
			// 			reg = <1>;
			// 			ecam_ar0521_csi_out1: endpoint@3 {
			// 				remote-endpoint = <&ecam_ar0521_vi_in1>;
			// 			};
			// 		};
			// 	};
			// };
		};
	};

	i2c@3180000 {
		status = "okay";
		veye327_a@3b {
			devnode = "video0";
			compatible = "nvidia,veye327";
			reg = <0x3b>;

			/* Physical dimensions of sensor */
			physical_w = "5.6";
			physical_h = "3.1";

			sensor_model = "veye327";
			use_sensor_mode_id = "false";
			//dovdd-supply = <&en_vdd_cam>;
			avdd-reg = "vana";
			dvdd-reg = "vdig";
			iovdd-reg = "dovdd";

			mode0 { /* CS307_MODE_1920X1080_30FPS */
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "1920";
				active_h = "1080";
				pixel_t = "yuv_uyvy16";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				mclk_multiplier = "2";
				pix_clk_hz = "74250000";

				gain_factor = "16";
				framerate_factor = "1000000";
				exposure_factor = "1000000";
				min_gain_val = "16"; /* 1.00x */
				max_gain_val = "170"; /* 10.66x */
				step_gain_val = "1";
				default_gain = "16"; /* 1.00x */
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "2000000"; /* 2.0 fps */
				max_framerate = "30000000"; /* 30 fps */
				step_framerate = "1";
				default_framerate = "30000000"; /* 30 fps */
				min_exp_time = "13"; /* us */
				max_exp_time = "333333"; /* us */
				step_exp_time = "1";
				default_exp_time = "2495"; /* us */

				embedded_metadata_height = "0";
			};

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

				port@0 {
					reg = <0>;
					e3322_veye327_out0: endpoint {
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&e3322_csi_in0>;
					};
				};
			};
		};//veye327_a
	};//i2c@3180000
};


/* camera control gpio definitions */
/ {
	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 = <12>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <8>;
		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 = "e3322_bottomleft_A815P2";
				position = "bottomleft";
				orientation = "1";
				drivernode0 {
					status = "okay";
					pcl_id = "v4l2_sensor";
					devname = "csx307 2-003b";
					proc-device-tree = "/proc/device-tree/i2c@3180000/veye327_a@3b";
				};
				/*drivernode1 {
					pcl_id = "v4l2_lens";
				};*/
			};
		};
	};
};

I tried to merge above two device tree like below(one csi channel and two endpoints of port).

/*
 * Copyright (c) 2015-2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <dt-bindings/media/camera.h>
#include <dt-bindings/gpio/tegra186-gpio.h>

#define CAM0_PWDN	TEGRA194_MAIN_GPIO(P, 4)
#define CAM0_RESET	TEGRA194_MAIN_GPIO(P, 5)
//#define CAM1_PWDN	TEGRA194_MAIN_GPIO(P, 5)
//#define CAM_I2C_MUX 	TEGRA194_AON_GPIO(CC, 3)

/* Enable Six overlays in Jetson Xavier NX */
&head0 {
	win-mask = <0x3f>;
};


/* camera control gpio definitions */
/ {
	/* F-03 usb power enable */
	gpio@2200000 {
		extusb-enable {
			gpio-hog;
			gpios = <TEGRA_MAIN_GPIO(P, 5) 0>;
			output-high;
			line-name = "extusb-enable";
		};
		camera-control-output-low {
			gpio-hog;
			output-low;
			gpios = <CAM0_PWDN 0>;
			label = "cam0-pwdn";
		};
	};

	host1x {
		vi@15c10000  {
			num-channels = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				vi_port0: port@0 {
					reg = <0>;
					ecam_imx415_vi_in0: endpoint {
						port-index = <4>;
						bus-width = <2>;
						remote-endpoint = <&ecam_imx415_csi_out0>;
					};
				};
				// vi_port1: port@1 {
				// 	reg = <1>;
				// 	ecam_ar0521_vi_in1: endpoint {
				// 		port-index = <2>;
				// 		bus-width = <2>;
				// 		remote-endpoint = <&ecam_ar0521_csi_out1>;
				// 	};
				// };
			};
		};

		nvcsi@15a00000 {
			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>;
						ecam_imx415_csi_in0: endpoint@0 {
							port-index = <4>;
							bus-width = <2>;
							remote-endpoint = <&ecam_imx415_out0>;
						};
						e3322_csi_in0: endpoint@1 {
							port-index = <4>;
							bus-width = <2>;
							remote-endpoint = <&e3322_veye327_out0>;
						};
					};
					csi_chan0_port1: port@1 {
						reg = <1>;
						ecam_imx415_csi_out0: endpoint@2 {
							remote-endpoint = <&ecam_imx415_vi_in0>;
						};
					};
				};
			};
			// csi_chan1: channel@1 {
			// 	reg = <1>;
			// 	ports {
			// 		#address-cells = <1>;
			// 		#size-cells = <0>;
			// 		csi_chan1_port0: port@0 {
			// 			reg = <0>;
			// 			ecam_ar0521_csi_in1: endpoint@2 {
			// 				port-index = <2>;
			// 				bus-width = <2>;
			// 				remote-endpoint = <&ecam_ar0521_out1>;
			// 			};
			// 		};
			// 		csi_chan1_port1: port@1 {
			// 			reg = <1>;
			// 			ecam_ar0521_csi_out1: endpoint@3 {
			// 				remote-endpoint = <&ecam_ar0521_vi_in1>;
			// 			};
			// 		};
			// 	};
			// };
		};
	};

	i2c@3180000 {
		status = "okay";
		tca6424_22_a: tca6424@22 {
			compatible = "ti,tca6424";
			gpio-controller;
			#gpio-cells = <2>;
			reg = <0x22>;
			vcc-supply = <&p3509_vdd_sys_en>;
			status = "okay";
			tca6424_22_outlow {
			/*
				* GPIO-0 : RST_CAM1
				* GPIO-1 : RST_CAM2
				* GPIO-2 : RST_CAM3
				* .... more is there
			*/
				gpio-hog;
				gpios = <0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0>;
				output-low;
				label = "tca6424_22_outlow_0",
						"tca6424_22_outlow_1",
						"tca6424_22_outlow_2",
						"tca6424_22_outlow_3",
						"tca6424_22_outlow_4",
						"tca6424_22_outlow_5",
						"tca6424_22_outlow_6",
						"tca6424_22_outlow_7";
			};
			tca6424_22_outhigh {
					status = "disabled";
			};
			tca6424_22_input {
					status = "disabled";
			};
		};
		imx415_a@42 {
			reset-gpios = <&tca6424_22_a 1 GPIO_ACTIVE_HIGH>;
			boot-gpios  = <&tca6424_22_a 2 GPIO_ACTIVE_HIGH>;
			compatible = "nvidia,eimx415";
			/* I2C device address */
			reg = <0x42>;

			/* V4L2 device node location */
			devnode = "video0";
			status = "okay";
			/* Physical dimensions of sensor */
			physical_w = "5.60";
			physical_h = "3.175";

			sensor_model = "eimx415";

			use_decibel_gain = "true";
			use_sensor_mode_id = "true";
			use_dol_wdr_mode = "false";
			use_master_slave_mode = "false";
			limit_analog_gain = "true";
			camera_mipi_lanes = /bits/ 8 <2>;
			mipi-clk-configurable;
			camera_mipi_clk = /bits/ 16 <2000>;
			mode0 {
				mclk_khz = "37125";
				num_lanes = "2";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";
				dynamic_pixel_bit_depth = "12";
				csi_pixel_bit_depth = "12";
				mode_type = "bayer";
				pixel_phase = "gbrg";

				active_w = "3840";
				active_h = "2160";
				readout_orientation = "0";
				line_length = "887";
				inherent_gain = "1";
				mclk_multiplier = "1";
				pix_clk_hz = "693000000";

				gain_factor = "10";
				min_gain_val = "0";
				max_gain_val = "300";
				step_gain_val = "3";
				default_gain = "0";
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				framerate_factor = "1000000";
				min_framerate = "2500000";
				max_framerate = "37000000";
				step_framerate = "1";
				default_framerate = "37000000";
				exposure_factor = "1000000";
				min_exp_time = "450";
				max_exp_time = "400000";
				step_exp_time = "1";
				default_exp_time = "27027";
				embedded_metadata_height = "1";
			};
			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					ecam_imx415_out0: endpoint {
						status = "okay";						
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&ecam_imx415_csi_in0>;
					};
				};
			};
		};//imx415_a
		veye327_a@3b {
			devnode = "video0";
			compatible = "nvidia,veye327";
			reg = <0x3b>;

			/* Physical dimensions of sensor */
			physical_w = "5.6";
			physical_h = "3.1";

			sensor_model = "veye327";
			use_sensor_mode_id = "false";
			//dovdd-supply = <&en_vdd_cam>;
			avdd-reg = "vana";
			dvdd-reg = "vdig";
			iovdd-reg = "dovdd";

			mode0 { /* CS307_MODE_1920X1080_30FPS */
				mclk_khz = "24000";
				num_lanes = "2";
				tegra_sinterface = "serial_e";
				phy_mode = "DPHY";
				discontinuous_clk = "no";
				dpcm_enable = "false";
				cil_settletime = "0";

				active_w = "1920";
				active_h = "1080";
				pixel_t = "yuv_uyvy16";
				readout_orientation = "0";
				line_length = "2200";
				inherent_gain = "1";
				mclk_multiplier = "2";
				pix_clk_hz = "74250000";

				gain_factor = "16";
				framerate_factor = "1000000";
				exposure_factor = "1000000";
				min_gain_val = "16"; /* 1.00x */
				max_gain_val = "170"; /* 10.66x */
				step_gain_val = "1";
				default_gain = "16"; /* 1.00x */
				min_hdr_ratio = "1";
				max_hdr_ratio = "1";
				min_framerate = "2000000"; /* 2.0 fps */
				max_framerate = "30000000"; /* 30 fps */
				step_framerate = "1";
				default_framerate = "30000000"; /* 30 fps */
				min_exp_time = "13"; /* us */
				max_exp_time = "333333"; /* us */
				step_exp_time = "1";
				default_exp_time = "2495"; /* us */

				embedded_metadata_height = "0";
			};

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

				port@0 {
					reg = <0>;
					e3322_veye327_out0: endpoint {
						status = "okay";
						port-index = <0>;
						bus-width = <2>;
						remote-endpoint = <&e3322_csi_in0>;
					};
				};
			};
		};//veye327_a
	};//i2c@3180000
};


/* camera control gpio definitions */
/ {
	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 = <12>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <8>;
		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 vender.
		 */
		modules {
			module0 {
				badge = "imx415_front_0415";
				position = "front";
				orientation = "1";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "e-con_cam 2-0042";
					proc-device-tree = "/proc/device-tree/i2c@3180000/imx415_a@42";
				};
				/*drivernode1 {
					pcl_id = "v4l2_lens";
				};*/
			};
			module1 {
				badge = "e3322_bottomleft_A815P2";
				position = "bottomleft";
				orientation = "1";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "csx307 2-003b";
					proc-device-tree = "/proc/device-tree/i2c@3180000/veye327_a@3b";
				};
				/*drivernode1 {
					pcl_id = "v4l2_lens";
				};*/
			};
		};
	};
};

When checking the kernel messages after connecting and booting each camera, they are initially recognized as I2C devices. However, when attempting to receive data, the message “uvcvideo: Failed to query (GET_DEF) UVC control 7 on unit 2: -32 (exp. 2)” is displayed.

While it may be tempting to attribute this issue to the differences in “num_csi_lanes” or “max_bits_per_pixel” in the device tree, I have confirmed that this aspect does not affect each camera operation.

To modify the device tree in order to ensure proper operation regardless of the two type of camera module connected, what steps should be taken?

Hello,

This topic should be posted in the Jetson forums so the support team has visibility. I will go ahead and move it over for you.

Tom

1 Like

Sorry for the late response, is this still an issue to support? Thanks

It’s OK. Yes, it still remains an issue.

The UVC message should be doesn’t matter with that due to it’s CSI camera instead of USB camera.
Your modify should be OK for your case.
Did you check the sensor probe in kernel message to register the video node.

Thank you for checking. Something else came up, so this task got delayed a bit. I think I’ll be able to check it again around next week, and I’ll respond then.

Is this still an issue to support? Any result can be shared? Thanks

Sorry for late response. I checked the sensor probe, and message is here.

It seems that camera driver sensor probe is ok, but there is no /dev/videoX.

When Camera 1 is used,

$ journalctl | grep e-con
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: Probing for sensor eimx415
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: Camera Device detected
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: Same firmware in MCU & text file - (1_2_IMX4_6_1_1_0_680b64b). Skipping FW Update...
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: Setting Max Mipi clock configuration : 2000MHz
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: Num of Controls - 9
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: cam_init 1902MCU CMD ID CAM INIT Success !!
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: mclk not in DT
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: tegracam sensor driver:eimx415_v2.0.6
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: cam_probe : Use_sensor_mode_id = 1
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: cam_fill_string_ctrl[554] Set!
Jan 28 15:58:17 atm220 kernel: tegra194-vi5 15c10000.vi: subdev e-con_cam 2-0042 bound
Jan 28 15:58:17 atm220 kernel: e-con_cam 2-0042: Detected eimx415 sensor

When Camera 2 is used,

$ dmesg | grep veye
[    1.947410] veye327 2-003b: probing v4l2 sensor
[    1.947553] veye327 2-003b: tegracam sensor driver:veye327_v2.0.6
[    1.948237] veye327 2-003b: read sensor id 6
[    1.948408] veye327 2-003b: Detected VEYE327 sensor
[    3.275508] tegra194-vi5 15c10000.vi: subdev veye327 2-003b bound

Attached files are whole kernel message with camera 1 or 2 inserted.

Thanks.

kernel_message_with_camera1.txt (148.8 KB)
kernel_message_with_camera2.txt (147.7 KB)

Most this kind of problem cause by the incorrect device tree configure.
Please review your camera dts.

Thanks

My problem caused when two device tree merged.

As you can see at first post, each Camera 1, Camera 2 device tree operates well, but when i tried to merge these two dts for a purpose which I comment at first, it’s not working. I tried to modify the device tree several times, but it failed.

Could you help me with which point I should look at intensively?

Suppose your two device are connect to the same CSI port.
That couldn’t have problem for it. I would suggest to implement device tree overlay for your case.

Thanks

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