ov5693_probe and tegra_vi_channels_register can not work simultaneously


I am trying to develop a driver for a MIPI camera based on ov5693.c. Since the camera does not have eeprom, I have to use the main platform device tree.

First, I mount the camera on /proc/device-tree/host1x/i2c@546c0000/ov5693_c@36. Both ov5693_probe and tegra_vi_channels_register can be invoked during boot. Since the camera is connected to i2c-2, I modify the device tree and mount the camera on /proc/device-tree/i2c@7000c500/ov5693_c@36. Then ov5693_probe is invoked during boot but tegra_vi_channels_register does not work.

Now I mount the camera on /proc/device-tree/host1x/i2c@7000c500/ov5693_c@36. I find that tegra_vi_channels_register is invoked during boot but ov5693_probe does not work.

How can I config the device tree such that ov5693_probe and tegra_vi_channels_register can work simultaneously, and the camera is connected to i2c-2?

Thank you.

The device tree is

i2c@7000c500 {
			avdd_dsi_csi-supply = <0x62>;
			status = "okay";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			compatible = "nvidia,tegra210-vii2c";
			reg = <0x0 0x7000c500 0x0 0x100>;
			iommus = <0x4d 0x12>;
			interrupts = <0x0 0x11 0x4>;
			clocks = <0x41 0xd0 0x41 0x51 0x41 0x1c>;
			clock-names = "vii2c", "i2cslow", "host1x";
			resets = <0x41 0xd0>;
			reset-names = "vii2c";
			clock-frequency = <0x61a80>;
			bus-pullup-supply = <0x64>;

			ov5693_c@36 {
				compatible = "nvidia,ov5693";
				reg = <0x20>;
				devnode = "video0";
				physical_w = "3.674";
				physical_h = "2.738";
				vertical-flip = "true";
				avdd-reg = "vana";
				iovdd-reg = "vif";
				clocks = <0x41 0x117>;
				clock-names = "clk_out_3";
				clock-frequency = <0x16e3600>;
				mclk = "clk_out_3";
				reset-gpios = <0x78 0x94 0x0>;
				pwdn-gpios = <0x78 0x97 0x0>;
				vana-supply = <0x8d>;
				vif-supply = <0x8e>;

				mode0 {
					mclk_khz = "24000";
					num_lanes = [32 00];

hello xu.wang,

may I know which JetPack release you’re working with.
if you’re develop you own camera driver, you should update the driver name.
please verify that driver name matches the name in the device tree.
for example,

ov5693_c@36 {
				compatible = "nvidia,ov5693";

please also refer to Debugging Tips for some hints.

According to your suggestion, I modify the driver name to “SIMIT,ov5693”, but still get the same results.

To find the problem, I create a new test project.

Hardware: TX1 with J120
Software: JetPack 3.3 with L4T R28.2

Trial 1:
I modify four files, which are channel.c, ov5693.c, tegra210-camera-e3326-a00.dtsi and tegra210-jetson-cv-base-p2597-2180-a00.dts.
In channel.c, I add a line in the function tegra_vi_channels_register()

printk(KERN_INFO "SIMIT: %s starts.\n", __func__);

In ov5693.c, I add a line in the function ov5693_probe()

printk(KERN_INFO "SIMIT: %s starts.\n", __func__);

and change .compatible in ov5693_of_match to “SIMIT,ov5693”
In tegra210-camera-e3326-a00.dtsi, I change compatible to “SIMIT,ov5693”.
In tegra210-jetson-cv-base-p2597-2180-a00.dts, I delete the three line

#include "jetson-plugin-manager/tegra210-jetson-cv-eeprom-manager.dtsi"
#include "jetson-plugin-manager/tegra210-jetson-cv-camera-plugin-manager.dtsi"
#include "jetson-plugin-manager/tegra210-jetson-cv-plugin-manager.dtsi"

and replace the line

#include "jetson-platforms/tegra210-jetson-cv-camera-modules.dtsi"


#include "jetson-platforms/tegra210-jetson-cv-camera-e3326-a00.dtsi"

The result of Trial 1 is that I get

SIMIT: ov5693_probe starts

many times when using dmesg, and get

SIMIT: tegra_vi_channels_register starts.

one times when using dmesg

This result show that the driver name matches the name in the device tree.

Trial 2: I further modify two files tegra210-camera-e3326-a00.dtsi and tegra210-jetson-cv-camera-e3326-a00.dtsi.
I change all text “546c0000” in these two files to “7000c500”. This is the only difference between Trial 1 and Trial 2.

The result of Trial 2 is that I get

SIMIT: tegra_vi_channels_register starts.

one times when using dmesg. But I can not get

SIMIT: ov5693_probe starts

FYI, I decompile the file tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb, and upload them. TX1-546c0000.dts is the device tree in Trial 1, and TX1-7000c500.dts is the device tree in Trial 2.

Why ov5693_probe does not work in Trial 2?

Thank you.
TX1-546c0000.dts.txt (599 KB)
TX1-7000c500.dts.txt (600 KB)

I am not sure about the cause of you problem but as JerryChang mentioned if the compatible in the driver and the device tree are the same, the driver should be loaded by the kernel.

Make sure that struct of_device_id contains the same compatible value. Also make sure to define the camera slave address in the reg variable and in the camera node name.

For example for address 0x20: (ov5693_c@20)

Device tree

ov5693_c@20 {
	compatible = "SIMIT,ov5693";
	reg = <0x20>;


static const struct of_device_id ov5693_of_match[] = {
		.compatible = "SIMIT,ov5693",
	{ },


Thank you for your suggestions and patience. I modify the name to “ov5693_c@20” and repeat the trials.

Trial 1:
(1) In channel.c and ov5693.c, I add a printk to see if a function is invoked during boot.
(2) I change the name of the driver from “nvidia,ov5693” to “SIMIT,ov5693”
(3) I modify tegra210-jetson-cv-base-p2597-2180-a00.dts such that Plugin Manager is no longer used.
(4) In the device tree, I replace “ov5693_c@36” with “ov5693_c@20”, and change “reg = <0x36>;” to “reg = <0x20>;”

(1) The camera is mounted at /proc/device-tree/host1x/i2c@546c0000/ov5693_c@20
(2) Both ov5693_probe and tegra_vi_channels_register are invoked during boot. This result shows that the driver name matches the name in the device tree.

I also conduct a new trial based on Trial 1.

Trial 2:
In addition to the modification in Trial 1, the value of reg under /host1x/i2c@546c0000/ is changed from “reg = <0x0 0x546c0000 0x0 0x34000>;” to “reg = <0x0 0x7000c500 0x0 0x34000>;”. I decompile the device tree file in Trial 1, modify it, and then recompile it into the dtb file.

tegra_vi_channels_register is invoked during boot. But ov5693_probe no longer works.

Trial 2 shows that when the kernel searches the device tree, it performs some check on the values of some items. Our camera is mounted at i2c-2. But the default location is i2c-6. So it seems that the kernel does not invoke ov5693_probe due to this difference. Unfortunately, I do not know where the kernel performs this check. Could you help me please?

hello xu.wang,

you should contact with your sensor vendor to check the i2c bus.
please refer to below code snippet for more details.
if you checking ov5693 default device tree. it belong to i2c@546c0000

i2c@546c0000 {
			ov5693_c@36 {
				compatible = "nvidia,ov5693";
				/* I2C device address */
				reg = <0x36>;

you’ll also need to check i2c@546c0000, which is VII2C, please download [Tegra X1 TRM] from Jetson Download Center for reference.

in addition,
you’ll also need to modify the i2c address for change the i2c bus.
please also check below kernel sources for i2c address. thanks