TC358743 on Jetson Orin NX with Jetpack 5.x

I am trying to get input from TC358743 Toshiba HDMI to CSI converter on Jetson ORIN NX.

I have installed the driver using buildKernelAndModules:
tc358743-orin.zip (25.0 KB)

I want to know what files and lines should I change in the device tree to get the video in stream. As I don’t have a result for:
sudo dmesg | grep tc358743

hello emadomari40,

there’re some popular topics for your reference.

I am trying to add the device tree file dtsi, I am getting a syntax error, my dtsi file

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

/ {
host1x {

    vi_base: vi {
        num-channels = <1>;  // Change 4->2
        ports {
            #address-cells = <1>;
            #size-cells = <0>;

            vi_port0: port@0 {
                status = "okay";
                reg = <0>;
                tc358743_vi_in1: endpoint {
                    status = "okay";
                    port-index = <0>;  /* CSI-B */
                    bus-width = <2>; /* Use CSI-B only */
                    remote-endpoint = <&tc358743_csi_out0>;
                };
            };
        };
    };


    csi_base: nvcsi {
        num-channels = <1>;
        #address-cells = <1>;
        #size-cells = <0>;

        channel@0 {
            reg = <0>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                port@0 {
                    status = "okay";
                    reg = <0>;
                    tc358743_csi_in0: endpoint@0 {
                        status = "okay";
                        port-index = <0>;
                        bus-width = <2>;
                        remote-endpoint = <&tc358743_out1>;
                    };
                };
                port@1 {
                    reg = <1>;
                    status = "okay";
                    tc358743_csi_out0: endpoint@1 {
                        status = "okay";
                        remote-endpoint = <&tc358743_vi_in1>;
                    };
                };
            };
        };
    };

    i2c@546c0000 {  /* I2C_PM, "adapter" 6 */
        status = "okay";
        #address-cells = <1>;
        #size-cells = <0>;
        tc358743@0f {
            status = "okay";
            compatible = "tc358743";
            reg = <0x0f>; /* shifted by 2 */
            clocks = <&tegra_car TEGRA210_CLK_EXTERN3>;
            #clock-cells = <0>;
            clock-names = "extperiph1";
            //mclk = "cam_mclk1";
            reset-gpios = <&gpio 149 0>;
            refclk_hz = <27000000>;  // refclk_hz -> regclk

	        interrupt-parent = <&gpio>;
	        interrupts = <TEGRA_GPIO(E, 6) GPIO_ACTIVE_HIGH>;

            /* Physical dimensions of sensor */
            physical_w = "4.713";
            physical_h = "3.494";
            /* Sensor Model */
            sensor_model ="tc358743";
            
   

            ddc5v_delay = <2>;
            enable_hdcp = "false";
            lineinitcnt = <0xe80>;
            lptxtimecnt = <0x003>;
            tclk_headercnt = <0x1403>;
            tclk_trailcnt = <0x00>;
            ths_headercnt = <0x0103>;
            twakeup = <0x4882>;
            tclk_postcnt = <0x008>;
            ths_trailcnt = <0x02>;
            hstxvregcnt = <0>;

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

                port@0 {
                    reg = <0>;
                    tc358743_out1: endpoint {
                        port-index = <0>; /* CSI A */
                        bus-width = <2>;
                        phy_mode = "DPHY";
                        data-lanes = <1 2>;
                        clock-lanes = <0>;
                        //clock-noncontinuous;
                        link-frequencies = /bits/ 64 <594000000>;//297000000///594000000
                        remote-endpoint = <&tc358743_csi_in0>;
                    };
                };
            };
        };
    };
};

// tc358743_clk: bridge-clk {
//     compatible = "fixed-clock";
//     //clock-cells = <0>;
//     clock-frequency = <24000000>;
// };

tegra-camera-platform {
    status = "okay";
	compatible = "nvidia, tegra-camera-platform";
	num_csi_lanes = <2>;  // Changed 2 -> 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 {

	    module1 {
	        status = "okay";
	        badge = "tc358743_top_i2c6_b";
	        position = "front";
	        orientation = "1";
	        drivernode0 {
	            status = "okay";
	            /* Declare PCL support driver (classically known as guid)  */
	            pcl_id = "v4l2_sensor";
	            /* Driver's v4l2 device name */
	            devname = "tc358743 6-000f";
	            /* Declare the device-tree hierarchy to driver instance */
	            proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/tc358743@0f";
	        };
	    };
        
	};
};
};

hello emadomari40,

may I also know what’s the syntax error reported.
it seems there’re couple of issue by went through your code quickly,
for instance,
(1) since you’re developing on Orin NX, this looks an incorrect clock definition.

(2) it’s also an incorrect GPIO API for toggle a pin.

I have actually changed the dtsi file to:

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

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

#define CAM1_PWDN	TEGRA234_MAIN_GPIO(H, 6)
#define CAM2_PWDN	TEGRA234_MAIN_GPIO(AC, 0)

/{
        i2c@3180000 {
            tca9548@70 {
				compatible = "nxp,pca9548";
				reg = <0x70>;
				#address-cells = <1>;
				#size-cells = <0>;
				skip_mux_detect;
				force_bus_start = <CAMERA_I2C_MUX_BUS(0)>;
				status = "okay";
                i2c@0{
                    reg = <0>;
                    i2c-mux,deselect-on-exit;
                    #address-cells = <1>;
                    #size-cells = <0>;
                };

	    };
	};

	gpio@6000d000 {
		camera-control-output-low {
			gpio-hog;
			output-low;
			gpios = < CAM1_PWDN 0  CAM2_PWDN 0>;
			label = "cam1-pwdn", "cam2-pwdn";
		};
	};

    tegra-capture-vi  {
        num-channels = <2>;
        ports {
            #address-cells = <1>;
            #size-cells = <0>;
            port@0{
                status = "okay";
                reg = <0>;
                tc358743_vi_in0: endpoint {
                    status = "okay";
                    // TC358743
                    port-index = <0>;  /* MIPIO*/
                    bus-width = <4>;
                    remote-endpoint = <&tc358743_csi_out0>;
                };
            };

            port@1{
                status = "okay";
                reg = <1>;
                adv7280_vi_in0: endpoint {
                    status = "okay";
                    // ADV7280
                    port-index = <3>;  /* MIPI3 -> CSI-D */
                    bus-width = <1>;   /* Use CSI-D only */
                    remote-endpoint = <&adv7280_csi_out0>;
                };
            };

        };
    };

    host1x@13e00000 {
        nvcsi@15a00000 {
            num-channels = <2>;
            #address-cells = <1>;
            #size-cells = <0>;
            channel@0 {
                status = "okay";
                reg = <0>;
                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        status = "okay";
                        reg = <0>;
                        tc358743_i2c_csi_in0: endpoint@0 {
                            status = "okay";
                            port-index = <0>; /* MIPI0 */
                            bus-width = <4>;
                            remote-endpoint = <&tc358743_i2c_out0>;
                        };
                    };
                    port@1 {
                        status = "okay";
                        reg = <1>;
                        tc358743_csi_out0: endpoint@1 {
                            status = "okay";
                            remote-endpoint = <&tc358743_vi_in0>;
                        };
                    };
                };
            };//end chanel@0
            channel@1 {
                status = "okay";
                reg = <1>;
                discontinuous_clk = "no";
                ports {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    port@0 {
                        status = "okay";
                        reg = <0>;
                        adv7280_i2C_csi_in0: endpoint@0 {
                            status = "okay";
                            port-index = <3>; /* MIPI0 */
                            bus-width = <1>;
                            remote-endpoint = <&adv7280_i2c_out0>;
                        };
                    };
                    port@1 {
                        status = "okay";
                        reg = <1>;
                        adv7280_csi_out0: endpoint@1 {
                            status = "okay";
                            remote-endpoint = <&adv7280_vi_in0>;
                        };
                    };
                };
            };//end chanel@2
        };
    };

    i2c@3180000 {  /* I2C_PM, "adapter" 6 */
        tca9548@70 {
            i2c@0{
                status = "okay";
                #address-cells = <1>;
                #size-cells = <0>;
                tc358743@0f {
                    status = "okay";
                    compatible = "tc358743";
                    reg = <0x0F>; /* shifted by 2 */
                    devnode = "video0";
                    refclk_hz = <27000000>;  // refclk_hz -> regclk
                    refclk = <27000000>;  // refclk_hz -> regclk

                    reset-gpios = <&tegra_main_gpio CAM1_PWDN GPIO_ACTIVE_HIGH>;

                    #clock-cells = <0>;
                    clock-names = "refclk";
                    clock-frequency = <27000000>;

                    /* Physical dimensions of sensor */
                    physical_w = "4.713";
                    physical_h = "3.494";
                    /* Sensor Model */
                    sensor_model ="tc358743";
                    use_sensor_mode_id = "true";

                    num_lanes = "4";
                    tegra_sinterface = "serial_e";
                    phy_mode = "DPHY";
                    discontinuous_clk = "no";

                    ddc5v_delay = <2>;
                    enable_hdcp = "false";
                    lineinitcnt = <0xe80>;
                    lptxtimecnt = <0x003>;
                    tclk_headercnt = <0x1403>;
                    tclk_trailcnt = <0x00>;
                    ths_headercnt = <0x0103>;
                    twakeup     = <0x4882>;
                    tclk_postcnt = <0x008>;
                    ths_trailcnt = <0x02>;
                    hstxvregcnt = <0>;
                    lane_polarity = "6"; //! it doesn't work
                    ports {
                        #address-cells = <1>;
                         #size-cells = <0>;
                         port@0 {
                            reg = <0>;
                            tc358743_i2c_out0: endpoint {
                                port-index = <0>; /* MIPI-4 CSI-E */
                                bus-width = <4>;
                                phy_mode = "DPHY";
                                cil_settletime = "30";

                                data-lanes = <1 2 3 4>;
                                clock-lanes = <0>;
                                clock-noncontinuous;
                                link-frequencies = /bits/ 64 <297000000>; //<594000000>; // <297000000>;
                                remote-endpoint = <&tc358743_i2c_csi_in0>;
                            };//end tc358743_i2c_out0: endpoint
                        };//end port@0
                    };//end ports
                };//end tc358743@0f
            };//end i2c@1
        };//end tca9548@70
    };//end i2c@3180000

    i2c@c250000{
        status = "okay";
        adv7280@21 {
            compatible = "adi,adv7280-m";
            status = "okay";
            /* I2C device address */
            reg = <0x21>;
            clock-frequency = <24000000>;
            /* V4L2 device node location */
            devnode = "video2";
            /* Physical dimensions of sensor */
            physical_w = "4.713";
            physical_h = "3.494";
            sensor_model = "adv7280-m";
            //use_sensor_mode_id = "false";
            mclk = "extperiph1";
//            refclk_hz = <28636363>;
            refclk_hz = <27000000>;

            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                port@0 {
                    reg = <0>;
                    adv7280_i2c_out0: endpoint {
                        port-index = <3>;
                        bus-width = <1>;
                        cil_settletime = "30";
                        data-lanes = <1>;
                        clock-lanes = <0>;
                        link-frequencies = /bits/ 64 <297000000>;
                        //link-frequencies = /bits/ 64 <216000000>;
                        remote-endpoint = <&adv7280_i2C_csi_in0>;
                    };
                };
            };
        };//end adv7280@21
    };//end i2c@7000c400
};

/{
	tegra-camera-platform {
        compatible = "nvidia, tegra-camera-platform";

        num_csi_lanes = <5>;
        max_lane_speed = <2500000>;
        min_bits_per_pixel = <10>;
        vi_peak_byte_per_pixel = <2>;
        vi_bw_margin_pct = <25>;
        max_pixel_rate = <7500000>;
        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 {
           status = "okay";
           badge = "tc358743_top_i2c31";
           position = "front";
           orientation = "1";

            drivernode0 {
                status = "okay";
                /* Declare PCL support driver (classically known as guid)  */
                pcl_id = "v4l2_sensor";
                /* Driver's v4l2 device name */
                devname = "tc358743 30-000f"; //31-000f";
                /* Declare the device-tree hierarchy to driver instance */
                proc-device-tree = "/proc/device-tree/i2c@3180000/tca9548@70/i2c@0/tc358743@0f";
            };
        };
            module1 {
                status = "okay";
                badge = "porg_front_ADV7280";
                position = "front";
                orientation = "1";

                drivernode0 {
                    status = "okay";
                    pcl_id = "v4l2_sensor";
                    devname = "adv7280 7-0021";
                    proc-device-tree = "/proc/device-tree/i2c@c250000/adv7280@21";
                };
            };
        };
    };
};

I will see if it will work now!

Should I add dts file or just to include the dtsi file?