Unable to load adv7180 module after updating device tree

Hello,
I am trying to interface a Jetson Orin NX (8GB) to the Analog Devices ADV7282A-M
analog video decoder board. I’m using Jetson Linux v36.3. The driver for the ADV
board is included in the Jetson kernel source tree, but is not built by default.
After modifying the kernel config to build the adv7180 module, modifying the
device tree, building the kernel and dtbs and flashing the board, I am unable
to load the adv7180 module. It is unable to find the module, even though it
clearly exists:

$ sudo insmod adv7180.ko
insmod: ERROR: could not load module adv7180.ko: No such file or directory
$ sudo modprobe adv7180.ko
modprobe: FATAL: Module adv7180.ko not found in directory /lib/modules/5.15.136-tegra
$ sudo find /lib/modules -name adv7180.ko
/lib/modules/5.15.136-tegra/kernel/drivers/media/i2c/adv7180.ko

What am I missing? Does this error actually indicate an issue with the device tree?

Below is more detail on the exact procedure I’ve followed, with links to the
relevant Developer Guide sections:

  1. Download and unpack the BSP and sample root file system per Quick Start.
  2. Sync kernel sources with Git per Kernel Customization.
  3. Modify kernel config to build the adv7180 module. This is a bit tedious
    with make menuconfig, so I just edited the makefile:
    vim Linux_for_Tegra/source/kernel/kernel-jammy-src/drivers/media/i2c/Makefile
    #obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o
    obj-m += adv7180.o
    
  4. Modify the device tree to register the new ADV device.
    • I’m using the ADV7282A-M device tree file shared from another forum post
      here, specifically tegra186-camera-adv7281am-a00.dtsi.
    • Included the new device file from the top-level file
      Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/nv-platform/tegra234-p3768-0000+p3767-0001-nv.dts.
      • I initially tried to include the new device file from the one specified
        here, but it did not work. The new contents are not included in the compiled output.
  5. Build the kernel, modules and dtbs per Kernel Customization.
  6. Verify that the new device file contents are included in the compiled top-level
    dtb file output:
    fdtdump ../kernel/dtb/tegra234-p3768-0000+p3767-0001-nv.dtb | grep adv7282
    
  7. Flash the Jetson board per Quick Start. Specifically, I flashed the image to NVMe.
  8. Power off Jetson, remove USB-C flashing cable and Force Recovery Mode jumper,
    then power on. Complete OS setup.
  9. Per lsmod | grep adv7180, the module was not already loaded. Tried to
    manually load it with sudo insmod adv7180.ko.

Follow the below steps link to update config file:

Confirm the file is there. If not copy it manually to try again.

sudo ls /lib/modules/5.15.136-tegra/kernel/drivers/media/i2c/adv7180.ko

I updated the kernel config following this process, rebuilt the kernel and booted into it. The result is that the running kernel config now shows the module is configured (it did not before). However, I still cannot load it, with the same error as before.

$ zcat /proc/config.gz | grep CONFIG_VIDEO_ADV7180
CONFIG_VIDEO_ADV7180=m
$ sudo insmod adv7180.ko
insmod: ERROR: could not load module adv7180.ko: No such file or directory

The module is there. Copying it again does not help.

$ ls -l /lib/modules/5.15.136-tegra/kernel/drivers/media/i2c/adv7180.ko 
-rw-r--r-- 1 root root 150369 Jul 21  2024 /lib/modules/5.15.136-tegra/kernel/drivers/media/i2c/adv7180.ko
$ sudo insmod adv7180.ko
insmod: ERROR: could not load module adv7180.ko: No such file or directory

I’m able to load the module by specifying the full path to insmod:

$ sudo insmod /lib/modules/5.15.136-tegra/kernel/drivers/media/i2c/adv7180.ko
$ lsmod | grep adv7180
adv7180                28672  0
v4l2_async             24576  3 v4l2_fwnode,adv7180,tegra_camera
videodev              270336  5 v4l2_async,adv7180,videobuf2_v4l2,tegra_camera,videobuf2_common
mc                     61440  5 videodev,adv7180,videobuf2_v4l2,tegra_camera,videobuf2_common

For some reason sudo insmod adv7180.ko worked to load the module before I started modifying the device tree.

I’m still not getting a /dev/video0 device after loading the adv7180 module. Presumably there is an issue with the device tree. Should I open a separate ticket for that?

Have you connected any camera device to the jetson

Check the probe() function to check the video register if still have problem please file new topic.

Thanks

Check the probe() function to check the video register

Please elaborate on how I would go about doing this. Are you suggesting to modify the module source code, adding print statements inside the adv7180_probe function?

I’m currently assuming that the driver code is fine and the issue is with my device tree. I’ve tried several .dtsi modifications, and in each case I don’t see anything with dmesg upon loading the module, nor do I get a /dev/video0 device file.

Any error message by dmesg after insmod?

Have you connected any camera device to the jetson

Yes, the ADV7282A-M board is connected to the Jetson via I2C and MIPI CSI on the CAM0 port.

1 Like

No errors or other messages with dmesg upon loading the module. Attached is the .dtsi I am using. I could really use some advice on how the .dtsi file should be structured. I’m trying to piece it together from the dev guide info and ADV .dtsi files in related forum posts (here and here), but there are definitely some gaps in my understanding. My goal is to use the Direct V4L2 Interface to get camera data into a GStreamer application with v4l2src.

tegra234-p3768-camera-adv7282am.dtsi.txt (1.9 KB)

  1. Check the /proc/device-tree/ have adv7180.
  2. Add message in the probe() function to confirm system load the driver by insmod command.
  1. The device tree is getting populated per the .dtsi file:
    $ ls /proc/device-tree/i2c@3180000/adv7282am@42/
    compatible  devnode  name  ports  reg  sensor_model
    
  2. I have added print statements to the driver adv7180_probe function at entry and every early exit point. None of them appear in the dmesg output after loading the module. The print statements are info level (e.g. pr_info). The current console log level is 8 (see below), so I have no idea why they are not appearing:
    $ cat /proc/sys/kernel/printk
    8	    6	    1	    7
    

Below is some additional info that may be helpful in getting to the bottom of this.

There were some warnings compiling the device tree (shown below). Please let me know if any of these warnings should be addressed via changes to the .dtsi:

$ make dtbs |& grep adv7282
/home/troyb/Downloads/nvidia/custom/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3768-camera-adv7282am.dtsi:54.4-17: Warning (reg_format): /i2c@3180000/adv7282am@42:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
/home/troyb/Downloads/nvidia/custom/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3768-camera-adv7282am.dtsi:50.14-71.4: Warning (i2c_bus_bridge): /i2c@3180000: incorrect #address-cells for I2C bus
/home/troyb/Downloads/nvidia/custom/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3768-camera-adv7282am.dtsi:50.14-71.4: Warning (i2c_bus_bridge): /i2c@3180000: incorrect #size-cells for I2C bus
/home/troyb/Downloads/nvidia/custom/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3768-camera-adv7282am.dtsi:51.16-70.5: Warning (avoid_default_addr_size): /i2c@3180000/adv7282am@42: Relying on default #address-cells value
/home/troyb/Downloads/nvidia/custom/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3768-camera-adv7282am.dtsi:51.16-70.5: Warning (avoid_default_addr_size): /i2c@3180000/adv7282am@42: Relying on default #size-cells value

Since there is nothing logged by the kernel when I load the ADV driver, I’m taking a step back and trying to verify whether the ADV board is even communicating over I2C using the linux i2c-tools package. I have verified the physical connections (I2C and CSI, specifically) are correct, to the extent that I can anyway. As mentioned above, the ADV board is connected to the Jetson’s CAM0 (J20) connector. Which I2C bus from the i2cdetect output below does this correspond to? I’m current specifying bus 2 (i2c-2) in the .dtsi. However, on page 19 of the dev kit carrier board spec, it says “The module CAM_I2C pins connect to an I2C mux.” Does this mean I should be using the i2c-10 bus instead?

$ i2cdetect -l
i2c-0	i2c       	3160000.i2c                     	I2C adapter
i2c-1	i2c       	c240000.i2c                     	I2C adapter
i2c-2	i2c       	3180000.i2c                     	I2C adapter
i2c-4	i2c       	Tegra BPMP I2C adapter          	I2C adapter
i2c-5	i2c       	31b0000.i2c                     	I2C adapter
i2c-7	i2c       	c250000.i2c                     	I2C adapter
i2c-9	i2c       	i2c-2-mux (chan_id 1)           	I2C adapter
i2c-10	i2c       	i2c-2-mux (chan_id 0)           	I2C adapter
i2c-11	i2c       	NVIDIA SOC i2c adapter 0        	I2C adapter

It appears there are no devices detected on either I2C bus (the output for bus 10 is identical):

$ i2cdetect -y 2
Warning: Can't use SMBus Quick Write command, will skip some addresses
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                                                 
10:                                                 
20:                                                 
30: -- -- -- -- -- -- -- --                         
40:                                                 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60:                                                 
70:  

UPDATE: I can communicate with the ADV board on bus i2c-10 at device address 0x21, even though it is not detected with i2cdetect:

$ i2cget -y 10 0x21 0x0E
0x00
$ i2cset -y 10 0x21 0x0E 0x40
$ i2cget -y 10 0x21 0x0E
0x40

@ShaneCCC This old forum post potentially explains why the print statements in the module probe function don’t appear in dmesg. Am I understanding correctly that the module probe function may not be called if there is an issue with the device tree?

Ok, I am making some progress. The adv7180 module now successfully detects the ADV I2C device on boot:

$ sudo dmesg | grep adv7180
[    9.184059] adv7180 10-0021: chip id 0x43 found @ 0x21 (i2c-2-mux (chan_id 0))

However, I still don’t get /dev/video0, presumably because the device tree port binding is not correct:

$ sudo media-ctl -p -d /dev/media0
Media controller API version 5.15.136

Media device information
------------------------
driver          tegra-camrtc-ca
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  5.15.136

Device topology
- entity 1: 13e00000.host1x:nvcsi@15a00000- (2 pads, 0 link)
            type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
	pad1: Source

- entity 4: 13e00000.host1x:nvcsi@15a00000- (2 pads, 0 link)
            type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
	pad1: Source

My latest .dtsi file is attached. Please advise on how I can resolve the port binding.

tegra234-p3768-camera-adv7282am.dtsi.txt (4.1 KB)

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

Suppose it’s customer driver implementation. User need figure it out by themself.

Thanks