Adv7282 PAL to MIPI CSI Linux Driver Development

Hi i have made a custom board based on ADV7282-M to take PAL / NTSL Input stream from a analog camera and convert it to YCbCr output

My schematic is quite simple the single lane CSI from ADV is interfaced directly to the camera connector pins

i wish to develop a linux driver now to take the data from the ADV device to the v4l2 architecture , so that i can stream the feed over IP using Gstreamer

i have came across below link
NVIDIA Jetson Linux Driver Package Software Features : Camera Development | NVIDIA Docs

which speaks on Custom Camera development, but i being begineer in writing v4l2 drivers, kindly provide necessary steps to go ahead for writing kernel drivers

main things i may need help on is

  1. Re building the jetson image with my driver
  2. device tree modification for adding adv7282-m hardware
  3. binding the video feed to v4l2 architecture

Experts can suggest me to way ahead.

Have reference to this sensor programing guide.

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

Thanks for you response
The reference you provides wrting custom driver, from few forum post i found how to go ahead
ADV7280m configuration - Jetson & Embedded Systems / Jetson TX2 - NVIDIA Developer Forums

but i am not sure how to re-compile the kernel again with the file provided

how can we recompile jetpack with above file and boot ?

Check the kernel customization chapter in the same document.

https://docs.nvidia.com/jetson/l4t/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

The process seems quite time consuming and long, if the driver doesnt work it might be repetetive also

is there a way to evaluate adv7282 driver (in-tree kernel module) as out of the tree kernel module where i can simply load a module and verify the driver functionality ? with out modifying the module code ?

You can build adv7282 as loadable module(adv7282.ko) and configure device tree for it.

how to rebuild the device tree of current jetson image alone ? is it possible to update device tree on run time ?

Have check kernel customization chapter to build kernel module/Image/dtb on your host PC.

Kindly elobarate, i did not understand
is it possible to change the dtb on the jetson platform itself ? if not kindly provide a link to do it.

You can use dtc to dump from the jetson platform and modify it then convert it to dtb again.
Have googling the dtc for the command.

Frankly , before going further i was going through many post where people tried to write LKM modules for camera drivers which are mainly part of soc_camera tree

The end result seemed unsucessfull

the driver adv7280 which is present in main stream kernel under soc_camera of i2c drivers, involves i2c device detection and making the v4l2 video device node appear for access to gstreamer

is this really possible through out-of the tree kernel modules, kindly confirm

i just wish to go in a right path, before wasting time.

You may need to update the driver from soc_camera to media control base.

Looks like there’s …/kernel/kernel-4.9/drivers/media/i2c/adv7180.c for adv7282

Yes your are true but in below thread there are few concerns raised in using the default code

ADV7280m configuration - Jetson & Embedded Systems / Jetson TX2 - NVIDIA Developer Forums

the author tired to tweak the driver as it did not work for him, will it apply to me also ? or can i simply make the necessary device tree entry and can expect it work ?

I can’t make sure of it you may need to try.

can you please let me know any way to fast up things
everytime i need to build kernel image, create final sd card image, insert sd card, configure ubuntu and then check for dmesg to see logs of device are called, is there any quick way while driver development

You don’t need to create sd card image. Just replace the /boot/Image to apply your kernel. And add FDT to /boot/extlinux/extlinux.conf to apply your dtb.

can you please elaborate
currently i am coding new driver file in /media/i2c/adv7282.c
compiling the L4T source
copying sample rootfs to it
then creating the sd image on host machine, then using balena to flash to sd card and then boot the board

are you trying to say replace the /boot/Image in dev kit file system ? and reboot ?

Yes, that how I apply the kernel Image without flash.

Just in case lets say you have ended in kernel panic and not able to boot again, what would you do ? how would you put back default image in place ?

same approach can be applied to dtb file also ? kindly elaborate what is FDT to extlinux.conf to apply dtb
kindly share some guide to follow.