Adv7282 PAL to MIPI CSI Linux Driver Development

Update : when i went through analog forums i found below Device tree example which they were telling to use

&i2c3 {
           clock-frequency = <100000>;
           pinctrl-names = "default";
           pinctrl-0 = <&pinctrl_i2c3>;
           status = "okay";

           adv7281m@21 {
                        compatible = "adi,adv7281-m";
                        reg = <0x21>;
                        powerdown-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;

                        adv7281m_out: endpoint {
                                     clock-lanes = <0>;
                                     data-lanes = <1>;
                                     remote-endpoint = <&mipi_csi0_ep>;
                        };
          };

};



&mipi_csi_0 {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";

            port@0 {
                         reg = <0>;
                         mipi_csi0_ep: endpoint {
                                        remote-endpoint = <&adv7281m_out>;
                                        clock-lanes = <0>;
                                        data-lanes = <1>;
                                        csis-hs-settle = <13>;
                                        csis-clk-settle = <2>;
                          };
             };

My doubt is how to incorporate above example to existing xavier nx device tree ? in above example device stated is 7281, in my case i need to use 7282m

As per guide article NVIDIA Jetson Linux Driver Package Software Features : Camera Development | NVIDIA Docs

I need to write in below fashion

 tegra-camera-platform {
        compatible = "nvidia, tegra-camera-platform";
        modules {
            module0 {
                badge = "imx185_bottom_liimx185";
                position = "bottom";
                orientation = "0";
                drivernode0 {
                    pcl_id = "v4l2_sensor";
                    devname = "imx185 30-001a";
                    proc-device-tree =
          "/proc/device-tree/i2c@3180000/tca9546@70/i2c@0/imx185_a@1a";
                };
            };
        };
    };

is it sufficient or i need to write any extra things ?

You can googling about the extlinux.conf for detail information. Also you can modify multiple kernel entry to avoid unable boot. But you need UART connect to select boot entry.

For your case you can ignore the tegra-camera-platform{}

1 Like

Thanks, now i am stuck in which dtb file to modify, i see few files of xavier nx with names tegra194-p3668-xx, which are the only found in the file system

instead i wish to use a imx219 file but i could not find it in final dtb result

how to include our own dtb file post wrting a dtsi file ?

Check by below command to know the top of file and check the header include which files.

dmesg | grep -i kernel

1 Like

my-change.zip (33.1 KB)
For Kernel Customization i followed Nvidia Docs
Basically i have done below changes in the folder attached.
Synopsis of changes

  1. Added ADV7282M to Kconfig file
  2. Added ADV7282.c to folder – adopted from ADV7280m configuration - Jetson & Embedded Systems / Jetson TX2 - NVIDIA Developer Forums
  3. Made change of compiling above file in Makefile
  4. Regular Kernel of jetpack uses dts file tegra194-camera-jakku-rbpcv2-imx219.dtsi
    I made below change to include my file which is placed in same location.
    //#include “tegra194-camera-rbpcv2-imx219.dtsi”
    #include “tegra194-camera-rbpcv2-dual-adv7282m.dtsi”
  5. after above changes i found the program flow not moving further
  6. i have compared a regular kernel log with my customized kernel log
    i found following error
    i2c i2c-10: of_i2c: modalias failure on /cam_i2cmux/i2c@1/rbpcv2_imx219_c@10

Can you please throw some light on where exactly the device tree is faulty ?

Remove plugin manager and include your dts.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/camera_sensor_prog.47.2.html#wwpID0E0XF0HA

in the process of re building the kernel again
i always get the kernel not clean , please run make mrproper why so ?
every time i am building from scratch, kindly let me know how to over come this issue

I tried the approach you suggested of going with modifying extlinux conf script, i was able to boot to back up images and dtb, but the new dtb and new images throwed following error

i got error mainly of digest on binary did not match

[0004.282] I> L4T boot options
[0004.283] I> [1]: "primary kernel"
[0004.283] I> [2]: "backup kernel"
[0004.283] I> Enter choice: 
[0007.284] I> Continuing with default option: 1
[0007.284] I> Loading kernel sig file from rootfs ...
[0007.284] I> rootfs path: /sd/boot/Image.sig
[0007.301] I> Loading kernel binary from rootfs ...
[0007.302] I> rootfs path: /sd/boot/Image
[0010.131] I> overload load_size to 34338824 (from 34666504)
[0010.155] I> Validate kernel ...
[0010.155] I> T19x: Authenticate kernel (bin_type: 37), max size 0x5000000
[0010.468] E> digest on binary did not match!!
[0010.468] C> OEM authentication of kernel payload failed!
[0010.468] W> Failed to validate kernel binary (err=1077936152, fail=0)
[0010.469] W> Security fuse not burned, ignore validation failure
[0010.478] I> Loading kernel-dtb sig file from rootfs ...
[0010.478] I> rootfs path: /sd/boot/dtb/tegra194-p3668-all-p3509-0000.dtb.sig
[0014.613] I> lookup_linear_dir:447: Invalid file block num
[0014.614] I> ext2_walk:142: 'tegra194-p3668-all-p3509-0000.dtb.sig' lookup failed
[0014.614] I> ext4_open_file:666: '/boot/dtb/tegra194-p3668-all-p3509-0000.dtb.sig' lookup failed
[0014.615] E> file /sd/boot/dtb/tegra194-p3668-all-p3509-0000.dtb.sig open failed!!
[0014.617] W> Failed to load kernel-dtb sig file (err=202113041)
[0014.623] I> Loading kernel-dtb binary from rootfs ...
[0014.628] I> rootfs path: /sd/boot/dtb/tegra194-p3668-all-p3509-0000.dtb
[0014.669] I> Validate kernel-dtb ...
[0014.670] I> T19x: Authenticate kernel-dtb (bin_type: 38), max size 0x400000
[0014.670] E> Stage2Signature validation failed with SHA2!!
[0014.671] C> OEM authentication of kernel-dtb header failed!
[0014.671] W> Failed to validate kernel-dtb binary (err=1077936152, fail=1)
[0014.672] W> Security fuse not burned, ignore validation failure
[0014.678] I> Loading ramdisk from rootfs ...
[0014.682] I> Loading initrd sig file from rootfs ...
[0014.687] I> rootfs path: /sd/boot/initrd.sig
[0014.708] I> Loading initrd binary from rootfs ...
[0014.708] I> rootfs path: /sd/boot/initrd
[0015.305] I> overload load_size to 7236840 (from 7236848)
[0015.308] I> Validate initrd ...
[0015.308] I> T19x: Authenticate initrd (bin_type: 49), max size 0x4000000
[0015.375] I> Encryption fuse is not ON

Complete log is attached
capture.txt (27.6 KB)

Does the path correct?

yes i assume,as i am booting from sd card
i have replaced the default image and backed up the working
it doensnt work becasue i feel it veryfies with signature of image with Image.sig
should i need to create a Image.sig for my new image and dtb ? if so how ?
some forums suggested to remove this Image.sig, but i am hesitant as i may loose backup kernel boot up also.

For me I just copy the Image and modify the extlinux.conf to apply it don’t need any *.sig file.
But not sure if the encrypt image need the *.sig or not.

by removing .sig files the back up kernel was able to boot with out any issue
the compiled kernel still having same issue of boot with error.
i2c i2c-10: of_i2c: modalias failure on /cam_i2cmux/i2c@1/rbpcv2_imx219_c@10

i have created a new image on host machine by following typical regular process to see any difference
the issue remains same.
this time the kernel boot was successful but the video device was not found , i am really clue less in going ahead
also can you brief me why you were saying tegra camera doenst apply to me ? i wish to create video node of analog input feed and provide the handle to v4l2 for itegrating the feed to deepstream sdk.

It’s must be your tegra194-camera-rbpcv2-dual-adv7282m.dtsi have problem.

also can you brief me why you were saying tegra camera doenst apply to me ? i wish to create video node of analog input feed and provide the handle to v4l2 for itegrating the feed to deepstream sdk.

Please answer below two questions

  1. can you brief me why you were saying tegra camera doenst apply to me ? i wish to create video node of analog input feed and provide the handle to v4l2 for itegrating the feed to deepstream sdk.

  2. the image i am seeing as final dtb in my nvidia file system is kernel_tegra194-p3668-all-p3509-0000.dtb where as the dtbs generated in my build folder are many, how to create dtb which is present in my file system, kindly dont suggest the process of back compiling, which is a very complicated process as the file is very heavy and i am not really sure where to make entry in.

  1. Just ignore my early comment.
  2. For NX the top of dts file is tegra194-p3668-all-p3509-0000.dts you need to trace all of the include files
  1. i could not boot forward with error
    ÿá[ 3.715176] cgroup: cgroup2: unknown option “nsdelegate”
    also i was able to see an error “Failed to start nvpmodel” and “Failed to start kernel” on monitor
  2. also i did not find the modalias error as before, where could be the mistake ?

I would suggest build the original dtb/Image to confirm can boost normally first. And add your customized code to step by step should be know the cause well.

i could boot normally with the back up images of both dtb and Image
check 1 : i have put default dtb file with my custom image which resulted in same failure
check 2 : i have put default img file with custom dtb which resulted in no failure
Conclusion : there is some mistake in build process, which need to be addressed first.
Here is my build script as it is

cp adv7282.c $HOME/nvidia/sources/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/media/i2c/ &&
cp Makefile $HOME/nvidia/sources/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/media/i2c/  &&
cp Kconfig $HOME/nvidia/sources/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/media/i2c/   &&
cp tegra194-camera-jakku-rbpcv2-imx219.dtsi $HOME/nvidia/sources/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/ &&
cp tegra194-camera-rbpcv2-dual-adv7282m-new.dtsi $HOME/nvidia/sources/Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/ &&
cd $HOME/nvidia/sources/Linux_for_Tegra/source/public/kernel/kernel-4.9/ &&
TEGRA_KERNEL_OUT=$HOME/nvidia/final_out/ &&
LOCALVERSION=-tegra &&
mkdir -p $TEGRA_KERNEL_OUT &&
make O=$TEGRA_KERNEL_OUT tegra_defconfig &&
make O=$TEGRA_KERNEL_OUT menuconfig &&
make O=$TEGRA_KERNEL_OUT -j6 &&
sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image /boot/;
sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p3668-all-p3509-0000.dtb /boot/dtb/

Please verify without any modification first. Build the Image/dtb without any modification.