Could not support multi cameras on 28.2 kernel

Dear all,

We have facing problem when try to support multi cameras on 28.2 kernel version. On 28.1 kernel version, 3 cameras could display as well (/dev/video0, /dev/video1, /dev/video2) with below dtb file

/*
 * Copyright (c) 2016-2017, 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; version 2 of the License.
 *
 * 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.
 *
 */

#include "t18x-common-platforms/tegra186-quill-camera-e3322-a00.dtsi"

#define CAM0_RST_L	TEGRA_MAIN_GPIO(R, 5)
#define CAM0_PWDN	TEGRA_MAIN_GPIO(R, 0)
#define CAM1_RST_L	TEGRA_MAIN_GPIO(R, 1)
#define CAM1_PWDN	TEGRA_MAIN_GPIO(L, 6)

/ {
	/* all cameras are disabled by default */
	host1x {
		vi@15700000 {
			num-channels = <3>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				
				port@0 {
					reg = <0>;
					e3326_vi_in0: endpoint {
						csi-port = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out0>;
					};
				};
				
				port@1 {
					reg = <1>;
					e3326_vi_in1: endpoint {
						csi-port = <2>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out1>;
					};
				};
				
				port@2 {
					reg = <2>;
					e3326_vi_in2: endpoint {
						csi-port = <4>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out2>;
					};
				};
			};
		};

		nvcsi@150c0000 {
			num-channels = <3>;
			#address-cells = <1>;
			#size-cells = <0>;
			
			channel@0 {
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in0: endpoint@0 {
							csi-port = <0>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out0>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out0: endpoint@1 {
							remote-endpoint = <&e3326_vi_in0>;
						};
					};
				};
			};
			
			channel@1 {
				reg = <1>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in1: endpoint@0 {
							csi-port = <2>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out1>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out1: endpoint@1 {
							remote-endpoint = <&e3326_vi_in1>;
						};
					};
				};
			};
			
			channel@2 {
				reg = <2>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in2: endpoint@0 {
							csi-port = <4>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out2>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out2: endpoint@1 {
							remote-endpoint = <&e3326_vi_in2>;
						};
					};
				};
			};
		};
	};

	i2c@3180000 {
		ov10635_a@30 {
			compatible = "nvidia,ov10635";
			
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			/* mclk-index indicates the index of the */
			/* mclk-name with in the clock-names array */

			clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
					 <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
			clock-names = "extperiph1", "pllp_grtba";
			mclk = "extperiph1";
			clock-frequency = <24000000>;
			reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>;
			pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
			
			/* I2C device address */
			reg = <0x30>;

			/* V4L2 device node location */
			devnode = "video0";

			/* Physical dimensions of sensor */
			physical_w = "3.674";
			physical_h = "2.738";

			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			avdd-reg = "vana";
			iovdd-reg = "vif";
			vana-supply = <&en_vdd_cam_hv_2v8>;
			vif-supply = <&en_vdd_cam>;
			
			mode0 {
					mclk_khz = "24000";
					num_lanes = "4";
					tegra_sinterface = "serial_a";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";

					active_w = "1280";
					active_h = "720";
					pixel_t = "bayer_bggr";
					readout_orientation = "90";
					line_length = "2688";
					inherent_gain = "1";
					mclk_multiplier = "6.67";
					pix_clk_hz = "160000000";

					min_gain_val = "1.0";
					max_gain_val = "16";
					min_hdr_ratio = "1";
					max_hdr_ratio = "64";
					min_framerate = "1.816577";
					max_framerate = "30";
					min_exp_time = "34";
					max_exp_time = "550385";
				};

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

				port@0 {
					reg = <0>;
					e3326_ov10635_out0: endpoint {
						csi-port = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_in0>;
					};
				};
			};
		};
	};
	
	i2c@31c0000 {
		ov10635_b@30 {
			compatible = "nvidia,ov10635";
			
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			/* mclk-index indicates the index of the */
			/* mclk-name with in the clock-names array */

			clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
					 <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
			clock-names = "extperiph1", "pllp_grtba";
			mclk = "extperiph1";
			clock-frequency = <24000000>;
			reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>;
			pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
			
			/* I2C device address */
			reg = <0x30>;

			/* V4L2 device node location */
			devnode = "video1";

			/* Physical dimensions of sensor */
			physical_w = "3.674";
			physical_h = "2.738";

			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			avdd-reg = "vana";
			iovdd-reg = "vif";
			vana-supply = <&en_vdd_cam_hv_2v8>;
			vif-supply = <&en_vdd_cam>;
			
			mode0 {
					mclk_khz = "24000";
					num_lanes = "4";
					tegra_sinterface = "serial_c";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";

					active_w = "1280";
					active_h = "720";
					pixel_t = "bayer_bggr";
					readout_orientation = "90";
					line_length = "2688";
					inherent_gain = "1";
					mclk_multiplier = "6.67";
					pix_clk_hz = "160000000";

					min_gain_val = "1.0";
					max_gain_val = "16";
					min_hdr_ratio = "1";
					max_hdr_ratio = "64";
					min_framerate = "1.816577";
					max_framerate = "30";
					min_exp_time = "34";
					max_exp_time = "550385";
				};

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

				port@0 {
					reg = <0>;
					e3326_ov10635_out1: endpoint {
						csi-port = <2>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_in1>;
					};
				};
			};
		};
	};
	
	i2c@31e0000 {
		ov10635_c@30 {
			compatible = "nvidia,ov10635";
			
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			/* mclk-index indicates the index of the */
			/* mclk-name with in the clock-names array */

			clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
					 <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
			clock-names = "extperiph1", "pllp_grtba";
			mclk = "extperiph1";
			clock-frequency = <24000000>;
			reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>;
			pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
			
			/* I2C device address */
			reg = <0x30>;

			/* V4L2 device node location */
			devnode = "video2";

			/* Physical dimensions of sensor */
			physical_w = "3.674";
			physical_h = "2.738";

			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			avdd-reg = "vana";
			iovdd-reg = "vif";
			vana-supply = <&en_vdd_cam_hv_2v8>;
			vif-supply = <&en_vdd_cam>;
			
			mode0 {
					mclk_khz = "24000";
					num_lanes = "4";
					tegra_sinterface = "serial_e";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";

					active_w = "1280";
					active_h = "720";
					pixel_t = "bayer_bggr";
					readout_orientation = "90";
					line_length = "2688";
					inherent_gain = "1";
					mclk_multiplier = "6.67";
					pix_clk_hz = "160000000";

					min_gain_val = "1.0";
					max_gain_val = "16";
					min_hdr_ratio = "1";
					max_hdr_ratio = "64";
					min_framerate = "1.816577";
					max_framerate = "30";
					min_exp_time = "34";
					max_exp_time = "550385";
				};

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

				port@0 {
					reg = <0>;
					e3326_ov10635_out2: endpoint {
						csi-port = <4>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_in2>;
					};
				};
			};
		};
	};

	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 = <10>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <160000>;
		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 = "e3326_front_P5V27C";
				position = "rear";
				orientation = "1";
				drivernode0 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_sensor";
					/* Driver v4l2 device name */
					devname = "ov10635 2-0030";
					/* Declare the device-tree hierarchy to driver instance */
					proc-device-tree = "/proc/device-tree/i2c@3180000/ov10635_c@30";
					status = "okay";
				};
				drivernode1 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/e3326_rear_lens_ov10635@P5V27C/";
				};
			};
			
			module1 {
				badge = "e3326_left_P5V27C";
				position = "left";
				orientation = "1";
				drivernode0 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_sensor";
					/* Driver v4l2 device name */
					devname = "ov10635 1-0030";
					/* Declare the device-tree hierarchy to driver instance */
					proc-device-tree = "/proc/device-tree/i2c@31c0000/ov10635_c@30";
					status = "okay";
				};
				drivernode1 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/e3326_left_lens_ov10635@P5V27C/";
				};
			};
			
			module2 {
				badge = "e3326_right_P5V27C";
				position = "right";
				orientation = "1";
				drivernode0 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_sensor";
					/* Driver v4l2 device name */
					devname = "ov10635 3-0030";
					/* Declare the device-tree hierarchy to driver instance */
					proc-device-tree = "/proc/device-tree/i2c@31e0000/ov10635_c@30";
					status = "okay";
				};
				drivernode1 {
					/* Declare PCL support driver (classically known as guid)  */
					pcl_id = "v4l2_lens";
					proc-device-tree = "/proc/device-tree/e3326_right_lens_ov10635@P5V27C/";
				};
			};
		};
	};
};

But on 28.2 kernel version, only one camera has been seen (/dev/video0). I make sure that camera probe function has been called and finished 3 times by console log.

Thanks and Best Regards,
Vu Nguyen

@forever3000
Could you trace the function video_register_device() …/kernel/kernel-4.4/drivers/media/platform/tegra/camera/vi/mc_common.c to trace what going on. I think it could be the DT cause this problem.

Yes, after modify DT file as below, it could run well.

/* all cameras are disabled by default */
	host1x {
		vi@15700000 {
			num-channels = <3>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				
				port@0 {
					reg = <0>;
					e3326_vi_in0: endpoint {
						csi-port = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out0>;
					};
				};
				
				port@1 {
					reg = <1>;
					e3326_vi_in1: endpoint {
						csi-port = <2>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out1>;
					};
				};
				
				port@2 {
					reg = <2>;
					e3326_vi_in2: endpoint {
						csi-port = <4>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out2>;
					};
				};
			};
		};

		nvcsi@150c0000 {
			num-channels = <3>;
			#address-cells = <1>;
			#size-cells = <0>;
			
			channel@0 {
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in0: endpoint@0 {
							csi-port = <0>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out0>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out0: endpoint@1 {
							remote-endpoint = <&e3326_vi_in0>;
						};
					};
				};
			};
			
			channel@1 {
				reg = <1>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in1: endpoint@2 {
							csi-port = <2>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out1>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out1: endpoint@3 {
							remote-endpoint = <&e3326_vi_in1>;
						};
					};
				};
			};
			
			channel@2 {
				reg = <2>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in2: endpoint@4 {
							csi-port = <4>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov10635_out2>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out2: endpoint@5 {
							remote-endpoint = <&e3326_vi_in2>;
						};
					};
				};
			};
		};
	};

Thanks
Vu Nguyen

Hi forever3000
I have a problem,
I used two cameras,but the two cameras show the same image.
Can you read my post.https://devtalk.nvidia.com/default/topic/1037220/jetson-tx2/the-two-cameras-have-the-same-image/
Thanks.