Tx2 with 2-lane csi imx274 camera

hello!
I use 4 *imx274 cameras with custom carrier board on tx2,our carrier board has two 4-lane csi mipi connector,4-lane connector is good for tests IMX274 . We customized a 4-lane to 2x 2-lane MIPI adapter board, this adapter board works normally on version R28.2.1 with 4 imx274 cameras.
but not I use r32.4.3 ,After I modified the DTS file,After the start,Display the following information:
dmesg | grep i2c
[ 0.404819] iommu: Adding device 3160000.i2c to group 3
[ 0.405242] iommu: Adding device c240000.i2c to group 4
[ 0.405562] iommu: Adding device 3180000.i2c to group 5
[ 0.405889] iommu: Adding device 3190000.i2c to group 6
[ 0.406281] iommu: Adding device 31b0000.i2c to group 7
[ 0.406594] iommu: Adding device 31c0000.i2c to group 8
[ 0.406898] iommu: Adding device c250000.i2c to group 9
[ 0.407203] iommu: Adding device 31e0000.i2c to group 10
[ 1.073361] i2c /dev entries driver
[ 1.075444] i2c i2c-30: Added multiplexed i2c bus 40
[ 1.075767] i2c i2c-30: Added multiplexed i2c bus 41
[ 1.075971] i2c i2c-30: Added multiplexed i2c bus 42
[ 1.076124] i2c i2c-30: Added multiplexed i2c bus 43
[ 1.080170] i2c i2c-2: Added multiplexed i2c bus 30
[ 1.080355] i2c i2c-2: Added multiplexed i2c bus 31
[ 1.081075] i2c i2c-50: of_i2c: modalias failure on /i2c@3180000/tca9546@70/i2c@2/tca9546@77/i2c@0/imx274_c@1a
[ 1.091101] i2c i2c-50: Failed to create I2C device for /i2c@3180000/tca9546@70/i2c@2/tca9546@77/i2c@0/imx274_c@1a
[ 1.091116] i2c i2c-32: Added multiplexed i2c bus 50
[ 1.091433] i2c i2c-32: Added multiplexed i2c bus 51
[ 1.091582] i2c i2c-32: Added multiplexed i2c bus 52
[ 1.091724] i2c i2c-32: Added multiplexed i2c bus 53
[ 1.095587] i2c i2c-2: Added multiplexed i2c bus 32
[ 1.095803] i2c i2c-2: Added multiplexed i2c bus 33
[ 5.607096] tegra-ivc ivc-b000000.rtcpu:i2c@480: i2c: ver=0 grp=1 RX[8x128]=0x1900-0x1d80 TX[8x128]=0x1d80-0x2200
[ 8.132577] imx274 40-001a: i2c bus regbase unavailable
[ 8.257890] imx274 41-001a: i2c bus regbase unavailable
[ 8.364883] imx274 51-001a: i2c bus regbase unavailable

hello baijianping1989,

you should also have to implement the i2c mux for all of your four imx274 sensors.
it seems here’s failure about creating the i2c devices, please dig this further.
thanks

Could you please help me to see if there are any other questions

#include <t18x-common-modules/tegra186-camera-imx274-a00-9002u-2lanes.dtsi>
#include “dt-bindings/clock/tegra186-clock.h”

#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)

#define CAMERA_I2C_MUX_BUS(x) (0x1E + x)

/* camera control gpio definitions */

/ {
gpio@2200000 {
camera-control-output-high {
gpio-hog;
output-high;
gpios = <TEGRA_MAIN_GPIO(BB, 0) 0 TEGRA_MAIN_GPIO(Y, 1) 0>;
label = “camera3v3”, “camera5v”;
};
camera-control-output-low {
status = “disabled”;
};

            camera-control-input {
                    status = "disabled";
            };
};
    en_vif_cam:fixedregulator@10 {
            compatible = "regulator-fixed";
            regulator-name = "vif";
            regulator-min-microvolt = <1800000>;
            regulator-max-microvolt = <1800000>;
            regulator-boot-on;
            regulator-always-on;
    };
    en_vana_cam_hv_2v8:fixedregulator@11 {
            compatible = "regulator-fixed";
            regulator-name = "vana";
            regulator-min-microvolt = <2800000>;
            regulator-max-microvolt = <2800000>;
            regulator-boot-on;
            regulator-always-on;
    };
    en_vdig_cam_1v2:fixedregulator@12 {
            compatible = "regulator-fixed";
            regulator-name = "vdig";
            regulator-min-microvolt = <1200000>;
            regulator-max-microvolt = <1200000>;
            regulator-boot-on;
            regulator-always-on;
    };
i2c@3180000 {
	tca9546@70 {
		compatible = "nxp,pca9546";
		reg = <0x70>;
		#address-cells = <1>;
		#size-cells = <0>;
		skip_mux_detect = "yes";
		
		vif-supply = <&en_vif_cam>;
		vcc-supply = <&en_vif_cam>;
		vcc-pullup-supply = <&en_vif_cam>;
	
		vcc_lp = "vif";
                    force_bus_start = <CAMERA_I2C_MUX_BUS(0)>;

		i2c@0 {
			reg = <0>;
                            i2c-mux,deselect-on-exit;
                            #address-cells = <1>;
                            #size-cells = <0>;

                            cam01_rst: pca9554@20 {
                                    compatible = "nxp,pca9554";
                                    reg = <0x20>;
                                    #gpio-cells = <2>;
                                    gpio-controller;
                                    vcc-supply = <&en_vif_cam>;

                                    pca9554_20_input {
                                            gpio-hog;
                                            input;
                                            gpios = <6 0 7 0>;
                                            label = "pca9554_20_input_6",
                                                     "pca9554_20_input_7";
                                    };
                                    pca9554_20_outlow {
                                            gpio-hog;
                                            output-low;
                                            gpios = < 1 0 2 0 3 0  5 0>;
                                            label =
                                                    "pca9554_20_outlow_1",
                                                    "pca9554_20_outlow_2",
                                                    "pca9554_20_outlow_3",
                                                    "pca9554_20_outlow_5";
                                    };
				pca9554_20_outhigh {
                                            gpio-hog;
                                            output-high;
                                            gpios = <0 1  4 1 >;
                                            label = "pca9554_20_outhigh_0",
                                                    "pca9554_20_outhigh_4";
                                            status = "disabled";
                                    };
                            };
			tca9546@77{
					compatible = "nxp,pca9546";
					reg = <0x77>;
					#address-cells = <1>;
					#size-cells = <0>;
					skip_mux_detect = "yes";
					vif-supply = <&en_vif_cam>;
					vcc-supply = <&en_vif_cam>;
					vcc-pullup-supply = <&en_vif_cam>;
					vcc_lp = "vif";
					force_bus_start = <CAMERA_I2C_MUX_BUS(10)>;
				i2c@0{
					reg = <0>;
					i2c-mux,deselect-on-exit;
					#address-cells = <1>;
					#size-cells = <0>;
                            		pca9570_a@24 {
						compatible = "nvidia,pca9570";
						reg = <0x24>;
						channel = "a";
						drive_ic = "DRV8838";
					};
					imx274_a@1a {
					/* Define any required hw resources needed by driver */
					/* ie. clocks, io pins, power sources */
					clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
					       <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
					clock-names = "extperiph1", "pllp_grtba";
					mclk = "extperiph1";
					
					reset-gpios = <&cam01_rst 0 GPIO_ACTIVE_HIGH>;
					vdig-supply = <&en_vdig_cam_1v2>;
					vana-supply = <&en_vana_cam_hv_2v8>;
					vif-supply = <&en_vif_cam>;
				};
			};
				i2c@1{
					reg = <1>;
                                            i2c-mux,deselect-on-exit;
                                            #address-cells = <1>;
                                            #size-cells = <0>;
                                            pca9570_b@24 {
                                                    compatible = "nvidia,pca9570";
                                                    reg = <0x24>;
                                                    channel = "b";
                                                    drive_ic = "DRV8838";
                                            };
					imx274_b@1a {
					/* Define any required hw resources needed by driver */
					/* ie. clocks, io pins, power sources */
					clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
					       <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
					clock-names = "extperiph1", "pllp_grtba";
					mclk = "extperiph1";

					
					reset-gpios = <&cam01_rst 4 GPIO_ACTIVE_HIGH>;
					vdig-supply = <&en_vdig_cam_1v2>;
					vana-supply = <&en_vana_cam_hv_2v8>;
					vif-supply = <&en_vif_cam>;
                           	 	};
			};
		};
	};
		i2c@2 {
			reg = <2>;
                            i2c-mux,deselect-on-exit;
                            #address-cells = <1>;
                            #size-cells = <0>;

                            cam23_rst: pca9554@20 {
                                    compatible = "nxp,pca9554";
                                    reg = <0x20>;
                                    #gpio-cells = <2>;
                                    gpio-controller;
                                    vcc-supply = <&en_vif_cam>;

                                    pca9554_20_input {
                                            gpio-hog;
                                            input;
                                            gpios = <6 0 7 0>;
                                            label = "pca9554_21_input_6",
                                                     "pca9554_21_input_7";
                                    };
                                    pca9554_20_outlow {
                                            gpio-hog;
                                            output-low;
                                            gpios = < 1 0 2 0 3 0  5 0>;
                                            label =
                                                    "pca9554_21_outlow_1",
                                                    "pca9554_21_outlow_2",
                                                    "pca9554_21_outlow_3",
                                                    "pca9554_21_outlow_5";
                                    };
				pca9554_20_outhigh {
                                            gpio-hog;
                                            output-high;
                                            gpios = <0 1  4 1 >;
                                            label = "pca9554_21_outhigh_0",
                                                    "pca9554_21_outhigh_4"; 
                                           status = "disabled";
                                    };
                            };
			tca9546@77{
					compatible = "nxp,pca9546";
					reg = <0x77>;
					#address-cells = <1>;
					#size-cells = <0>;
					skip_mux_detect = "yes";
					vif-supply = <&en_vif_cam>;
					vcc-supply = <&en_vif_cam>;
					vcc-pullup-supply = <&en_vif_cam>;
					vcc_lp = "vif";
					force_bus_start = <CAMERA_I2C_MUX_BUS(20)>;
				i2c@0{
					reg = <0>;
					i2c-mux,deselect-on-exit;
					#address-cells = <1>;
					#size-cells = <0>;
                            		pca9570_a@24 {
						compatible = "nvidia,pca9570";
						reg = <0x24>;
						channel = "a";
						drive_ic = "DRV8838";
					};
					imx274_a@1a {
						/* Define any required hw resources needed by driver */
						/* ie. clocks, io pins, power sources */
						clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
						       <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
						clock-names = "extperiph1", "pllp_grtba";
						mclk = "extperiph1";
						
						reset-gpios = <&cam23_rst 0 GPIO_ACTIVE_HIGH>;
						vdig-supply = <&en_vdig_cam_1v2>;
						vana-supply = <&en_vana_cam_hv_2v8>;
						vif-supply = <&en_vif_cam>;
					};
				};
				i2c@1{
					reg = <1>;
					i2c-mux,deselect-on-exit;
					#address-cells = <1>;
					#size-cells = <0>;
					pca9570_b@24 {
						compatible = "nvidia,pca9570";
						reg = <0x24>;
						channel = "b";
						drive_ic = "DRV8838";
					};
					imx274_b@1a {
						/* Define any required hw resources needed by driver */
						/* ie. clocks, io pins, power sources */
						clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
						       <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
						clock-names = "extperiph1", "pllp_grtba";
						mclk = "extperiph1";

						
						reset-gpios = <&cam23_rst 4 GPIO_ACTIVE_HIGH>;
						vdig-supply = <&en_vdig_cam_1v2>;
						
						vana-supply = <&en_vana_cam_hv_2v8>;
						vif-supply = <&en_vif_cam>;
					};
				};
			};
		};
	};
};

};

hello baijianping1989,

since you’re moving from R28 to R32 code-line.
please refer to Camera Sensor Drivers Porting Guide to review your sensor driver.
thanks

I refer to NVIDIA Jetson Linux Developer Guide- Sensor Software Driver Programming Guide document.
/kernel/nvidia/driver/media/i2c/imx274.c ,The default value of IMX274 is 4LANE, does it need to be changed to 2LANE? I didn’t find out where to modify it

hello baijianping1989,

you may also note that it’s sensor device tree configuration to specify the properties for camera stack.
for example,
here’s IMX274’s default sensor device tree, it’s bus-width, and num_lanes to specify the lanes configuration.
$L4T_Sources/r32.4.4/Linux_for_Tegra/source/public/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-modules/tegra186-camera-imx274-a00.dtsi

you may also contact with sensor vendor for the sensor initial register sets.
due to there’ll be different sensor timing, i.e. Sensor Pixel Clock, please let them know you’re having your driver customization to modify it as 2-lane configuration.
thanks

hello JerryChang,
What are the possible causes of the following errors?

[ 8.337288] imx274 40-001a: i2c bus regbase unavailable
[ 8.480347] imx274 41-001a: i2c bus regbase unavailable
[ 8.578580] imx274 50-001a: i2c bus regbase unavailable
[ 8.632025] imx274 51-001a: i2c bus regbase unavailable

hello baijianping1989,

those error caused by sensor_common.c driver.
for example,

572  static int sensor_common_init_i2c_device_config(
...
637  	/* read parent which is i2c bus */
638  	err = of_property_read_u32_index(parent, "reg", 1, &value);
639  	if (err) {
640  		dev_err(dev, "i2c bus regbase unavailable\n");
641  		return err;
642  	}

you’ll need to dig into your sensor device tree to populate the necessary info, the sensor device tree is also crucial to the operation of each sensor.
thanks