Custom camera device tree not found after flash | JP6

Hello,

This topic is continued from this thread.

I’m customizing kernel for jetson orin nx and orin nano boards, JP 6 and jetson linux r36.3.

Since the progress from the previous thread last time, I have re-flashed the system. Before this flash, I commented
# OVERLAY_DTB_FILE+=",tegra234-p3768-0000+p3767-0000-dynamic.dtbo";
in the jetson-orin-nano-devkit.conf at /Linux_for_Tegra/ . This resulted in successfully disabling the boot-time imx219 sensor probe (I guess jetson orin nano and nx devices only probe for imx219 instead of additional imx477).

However, the problem is that I need to interface adv7280m video decoder. Its linux kernel driver, adv7180.c ( adv7xxx devices are a series of video decoders with varying input and output formats. The linux provided device driver adv7180.c is compatible for a range of devices including adv7280m, which is what I am using.), was enabled via menuconfig, compiled and installed in Linux_for_Tegra/rootfs/lib/modules/5.15.136-tegra/, and I can locate it at the respective location after the flash.

The device-tree files of adv7280m (find attached with this message) were copied to Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/ and the folder’s Makefile was edited as follows:

# SPDX-License-Identifier: GPL-2.0-only
# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.

DTC_FLAGS += -@

old-dtb := $(dtb-y)
old-dtbo := $(dtbo-y)
dtb-y :=
dtbo-y :=
makefile-path := t23x/nv-public/overlay

dtbo-y += tegra-optee.dtbo
dtbo-y += tegra234-audio-overlay.dtbo
dtbo-y += tegra234-carveouts.dtbo
dtbo-y += tegra234-dcb-p3767-0000-hdmi.dtbo
dtbo-y += tegra234-jetson.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-as-p3701-0004.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-as-p3767-0000.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-as-p3767-0001.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-as-p3767-0003.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-as-p3767-0004.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-dynamic.dtbo
dtbo-y += tegra234-p3768-0000+p3767-0000-dynamic.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-audio-adafruit-uda1334a.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-audio-adafruit-sph0645lm4h.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-audio-fe-pi.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-audio-respeaker-4-mic-array.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-audio-respeaker-4-mic-lin-array.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-csi.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-hdr40.dtbo
dtbo-y += tegra234-p3737-0000+p3701-0000-m2ke.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-audio-adafruit-sph0645lm4h.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-audio-adafruit-uda1334a.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-audio-fe-pi.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-audio-respeaker-4-mic-array.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-audio-respeaker-4-mic-lin-array.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-csi.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-hdr40.dtbo
dtbo-y += tegra234-p3767-0000+p3509-a02-m2ke.dtbo
dtbo-y += tegra234-p3767-0000+p3768-0000-csi.dtbo
dtbo-y += tegra234-p3740-0002+p3701-0008-hdr20.dtbo
dtbo-y += tegra234-p3740-0002+p3701-0008-m2ke.dtbo
dtbo-y += tegra234-p3740-0002+p3701-0008-m2kb.dtbo
dtbo-y += tegra234-p3740-0002-p3701-0008-csi.dtbo
dtbo-y += tegra234-p3767-camera-p3768-adv7280m-dual.dtbo
# dtbo-y += tegra234-p3737-camera-dual-imx274-overlay.dtbo
# dtbo-y += tegra234-p3737-camera-e3331-overlay.dtbo
# dtbo-y += tegra234-p3737-camera-e3333-overlay.dtbo
# dtbo-y += tegra234-p3737-camera-imx185-overlay.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx219-dual.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx477-dual.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx477-dual-4lane.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx477-imx219.dtbo
# dtbo-y += tegra234-p3737-camera-eCAM130A-overlay.dtbo
# dtbo-y += tegra234-p3737-camera-dual-hawk-ar0234-e3653-overlay.dtbo
# dtbo-y += tegra234-p3737-camera-imx390-overlay.dtbo
# dtbo-y += tegra234-p3737-camera-p3762-a00-overlay.dtbo
# dtbo-y += tegra234-p3740-camera-p3783-a00-overlay.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx219-C.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx219-A.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx219-imx477.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx477-C.dtbo
# dtbo-y += tegra234-p3767-camera-p3768-imx477-A.dtbo

ifneq ($(dtb-y),)
dtb-y := $(addprefix $(makefile-path)/,$(dtb-y))
endif
ifneq ($(dtbo-y),)
dtbo-y := $(addprefix $(makefile-path)/,$(dtbo-y))
endif

dtb-y += $(old-dtb)
dtbo-y += $(old-dtbo)

After running
make dtbs and
cp nvidia-oot/device-tree/platform/generic-dts/dtbs/* <install-path>/Linux_for_Tegra/kernel/dtb/

I confirmed the presence of adv7280m dtbo at /kernel/dtb/. But since all the default dtbo files were already located at /kernel/dtb/, populated due to running $ sudo ./apply_binaries.sh , I manually deleted the other camera dtbo files.

Afterwards, using

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 \
  -c tools/kernel_flash/flash_l4t_t234_nvme.xml -p "-c bootloader/generic/cfg/flash_t234_qspi.xml" \
  --showlogs --network usb0 jetson-orin-nano-devkit internal

I flashed the system. This time, even though it didn’t probe for imx219, it also didn’t include the adv7280m overlay file at /boot/, however the rest of the camera dtbos that I even deleted from /kernel/dtb/ were present.

Please also find attached dmesg.txt and extracted_proc.dts files.

adv7280m_DT.zip (5.4 KB)
dmesg.txt (59.4 KB)
extracted_proc.dts.txt (307.4 KB)

Hi tornado1100,

Are you working on the devkit or custom carrier board?

From your extracted device tree, I can not find any node relating to your adv7280m.

Have you also added the overlay dtbo for adv7280m in board config?

You don’t need to run $ sudo ./apply_binaries.sh after updating the kernel image/dtb.

Devkits.

Please look at these

dmesg.txt (59.3 KB)
extracted_proc.dts.txt (323.2 KB)

files, this is the result after I changed the
#include "tegra234-p3768-camera-rbpcv2-imx219.dtsi" with
#include "tegra234-p3768-camera-rbpcv2-adv7280m.dtsi"
in tegra234-p3768-0000+p3767-0000-dynamic.dtbo and re-flashed the orin nano.

Additionally,

The default kernel image does not show probe for adv in dmesg even though I altered the tegra234-p3768-0000+p3767-0000-dynamic.dtbo file as stated previously. So using the jetson-io.py, I enabled the kernel to include /boot/tegra234-p3767-camera-p3768-adv7280m-dual.dtbo overlay. Even then the status is same.

I have adv7280m connected on CSI1 connector, some relevant commands and their output are given below. Maybe they can help you point out the issue.

jetson@jetson-desktop:~$ sudo dmesg | grep adv
[    8.800076] systemd[1]: System time before build time, advancing clock.
jetson@jetson-desktop:~$ 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, 1 link)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
	pad1: Source
		-> "vi-output, 13e00000.host1x:nvcs":0 [ENABLED]

- entity 4: vi-output, 13e00000.host1x:nvcs (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
	pad0: Sink
		<- "13e00000.host1x:nvcsi@15a00000-":1 [ENABLED]

- entity 12: 13e00000.host1x:nvcsi@15a00000- (2 pads, 1 link)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev1
	pad0: Sink
	pad1: Source
		-> "vi-output, 13e00000.host1x:nvcs":0 [ENABLED]

- entity 15: vi-output, 13e00000.host1x:nvcs (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video1
	pad0: Sink
		<- "13e00000.host1x:nvcsi@15a00000-":1 [ENABLED]

jetson@jetson-desktop:~$ v4l2-ctl --list-devices
NVIDIA Tegra Video Input Device (platform:tegra-camrtc-ca):
	/dev/media0

vi-output, 13e00000.host1x:nvcs (platform:tegra-capture-vi:0):
	/dev/video0

vi-output, 13e00000.host1x:nvcs (platform:tegra-capture-vi:2):
	/dev/video1

jetson@jetson-desktop:~$ lsmod | grep adv
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

Could you add the following line in /boot/extlinux/extlinux.conf to check if it can help for your case?

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      OVERLAYS /boot/tegra234-p3767-camera-p3768-adv7280m-dual.dtbo

Okay, I can see the following node added in your device tree.

				rbpcv2_adv7280m_a@21 {
					sensor_model = "adv7280-m";
					devnode = "video0";
					reset-gpios = <0xe5 0x3e 0x00>;
					compatible = "adi,adv7280-m";

But there’s still no related driver probe messages in dmesg.

Should it be adv7180 or adv7280?

adv7180.c is the name of the driver file. It is compatible for a series of video decoders including adv7280m which is what I’m using. A section of driver file is as follows:

static const struct of_device_id adv7180_of_id[] = {
	{ .compatible = "adi,adv7180", },
	{ .compatible = "adi,adv7180cp", },
	{ .compatible = "adi,adv7180st", },
	{ .compatible = "adi,adv7182", },
	{ .compatible = "adi,adv7280", },
	{ .compatible = "adi,adv7280-m", },
	{ .compatible = "adi,adv7281", },
	{ .compatible = "adi,adv7281-m", },
	{ .compatible = "adi,adv7281-ma", },
	{ .compatible = "adi,adv7282", },
	{ .compatible = "adi,adv7282-m", },
	{ },
};

That’s where I’m stuck as well.

				rbpcv2_adv7280m_a@21 {
					sensor_model = "adv7280-m";
					devnode = "video0";
					reset-gpios = <0xe5 0x3e 0x00>;
					compatible = "adi,adv7280-m";
					physical_h = "3.494";
					use_sensor_mode_id = "false";
					status = "disabled";

I found the status in this node is disabled.
Could you configure it as okay to verify?

Hi Kevin,

Can you tell me the commands to run after applying this change in extracted_proc.dts?

I mean dtb to dts can be compiled back to dtb by changing input output (dtc -I dts -O dtb) type in the dtc command, is it similar for fs as well?

extracted_proc.dts is extracted from your device for checking the current status.

Please decompile the /boot/dtb/kernel_XXX.dtb to DTS to modify the content and assemble it back to apply the change.
You may also need to add the line in /etc/extlinux/extlinux.conf to specify the DTB in use.

The main dtb file at /boot/dtb/ doesn’t contain entry for adv7280.
kernel_tegra234-p3768-0000+p3767-0005-nv.dts.txt (310.1 KB)

Hi,

I changed the dtsi files, recompiled then into dtb and re-flashed the system. The updated logs are attached. Also find:

jetson@jetson-desktop:~$ lsmod | grep adv
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
jetson@jetson-desktop:~$ sudo dmesg | grep adv
[    8.473151] systemd[1]: System time before build time, advancing clock.
[   10.161681] adv7180: probe of 9-0021 failed with error -121
[   10.197960] adv7180: probe of 10-0021 failed with error -121
jetson@jetson-desktop:~$ v4l2-ctl --list-devices
NVIDIA Tegra Video Input Device (platform:tegra-camrtc-ca):
	/dev/media0

Cannot open device /dev/video0, exiting.
jetson@jetson-desktop:~$ 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

Nothing else is changed other than setting status = "okay", so I guess the actual poblem is in the module driver?

extracted_proc.dts.txt (312.9 KB)
dmesg_log.txt (61.4 KB)

Yes, it seems has been enabled in your extracted device tree.

[   10.161681] adv7180: probe of 9-0021 failed with error -121
[   10.197960] adv7180: probe of 10-0021 failed with error -121

The current issue is probing the driver failed.
Please add more messages in this driver to debug or you can also ask your vendor for the meaning of error -121