Using ADV7482 with JetPack 4.4 (Linux Kernel 4.9)

I am trying to connect Jetson Nano to a custom board with ADV7482 chip using CSI-2 connectors and capture video. However, there is no driver available for ADV7482 in linux kernel 4.9.

I tried the following 3 approaches, without any success. It should be noted that in the custom board, ADV7482 is clocked and configured externally and there is no need to read or write any configuration from I2C. Therefore, in these approaches I ignored reads and writes from I2C. Here are the approaches:

  1. From kernel 4.14 the driver of this chip is added to the kernel sources. However it cannot be compiled on kernel 4.9 due to the V4l2 API changes mainly because of using fwnode in some parts. I commented the part that made compile errors. Now the code is compiled but /dev/video0 or any other similar device is not created. I tried both static and dynamic module modes because it’s noted in this post that dynamic modules my not work.
    Source Files:
    adv748x-hdmi.c (20.4 KB) (no changes)
    adv748x-afe.c (13.3 KB) (no changes)
    adv748x-csi2.c (8.3 KB) (commented line 293)
    adv748x-core.c (24.5 KB) (ignoring reads and writes and hdmi and afe and txa)
    adv748x.h.txt (13.1 KB)
    Device Tree: tegra210-adv7482.dtsi.txt (5.7 KB)

  2. There is an older driver which is mentioned in this post from Renesas Electronics. This driver is for kernel 3.x and again can’t be compiled . Again some parts commented out and similarly /dev/video0 is not created nor statically nor dynamically.
    Source: adv7482.c (76.0 KB)
    Device Tree: tegra210-adv7482.dtsi.txt (4.9 KB)

  3. I tried to change the IMX219 sensor driver as in our scenario there is no need for configurations and only capturing the video is needed. So Again I ignored the parts writing to registers and instead of reads, passed the values manually where it was needed. This time /dev/video0 is created but capturing using v4l2-ctrl results in the following error in kernel :
    tegra_channel_error_status:error 4000
    Source: imx219.c (23.4 KB)
    Device Tree: tegra210-camera-rbpcv2-dual-imx219.dtsi.txt (23.4 KB)

And here is the ADV7482 output video configuration :

  • frame rate: 50 fps
  • size: 720 x 576
  • continuous clock
  • YUV8

For the item 3 any kernel message like below. Have enable it by the csi2_fops.c/vi2_fops.c to check.

[ 193.236738] vi 54080000.vi: TEGRA_CSI_CIL_STATUS 0x00000000
[ 193.242306] vi 54080000.vi: TEGRA_CSI_CILX_STATUS 0x00000000

After running the below commands:

echo file csi2_fops.c +p > /sys/kernel/debug/dynamic_debug/control
echo file vi2_fops.c +p > /sys/kernel/debug/dynamic_debug/control

nothing changed. However, if in the device tree I set discontinous-clock="yes" some messages like below are shown:

TEGRA_CSI_CIL_STATUS 0x00000000
TEGRA_CSI_CILA_STATUS 0x00040002

Also for the first approach I compared struct v4l2_subdev code between the two kernel versions (4.9 v.s. 4.14), and found that it seems reasonable to change line 293 of adv748x-csi2.c from

tx->sd.fwnode = of_fwnode_handle(ep);

to

tx->sd.of_node = tx->sd.dev->of_node;

so the code will be compiled without any errors on kernel 4.9. However, still /dev/video0 is not created.

Do you mean /dev/video0?
Also need to check the driver message why failed register the video node.

Do you mean /dev/video0?

Yes, I corrected the post.

Also need to check the driver message why failed register the video node.

No errors. Albeit as I mentioned in the first post I have changed the code to ignore the writes and passed some constant values manually instead of reads.

Do you think the device tree is correct? And can the driver of TC358840 module be useful?

Yes, at least TC358840 was verified by CISCO.
Have check the xxx_probe() function if any kernel message to check.

I tried to use TC358840 but strangely when the module is loaded the proble() function is not called and nothing happens!