Camera Driver Porting

This topic gives a high-level overview of changes in Jetson Linux release 36 that may impact camera driver development when kernel version 5.10 is replaced by kernel version 5.15. It is intended to assist camera driver developers who must migrate to the new kernel version.

For more details, see the source code released with the BSP and the documentation in the BSP distribution’s directory <top>/kernel/3rdparty/canonical/linux-jammy/kernel-source/Documentation.

For additional information about kernel 5.15, see the description of changes in Linux 5.15 on the Kernelnewbies web site.

Configuration Changes

This table summarizes Linux configuration changes from kernel version 5.10 to version 5.15.

Environment variable Kernel 5.10 Kernel 5.15
CONFIG_MEDIA CONFIG_MEDIA_PLATFORM_SUPPORT=y
CONFIG_MEDIA_TEST_SUPPORT=y
N/A
CONFIG_TEGRA_GRHOST CONFIG_TEGRA_GRHOST_NVCSI=y
CONFIG_TEGRA_GRHOST_SLVSEC=y
N/A
CONFIG_VIDEO CONFIG_VIDEO_ISC=m
CONFIG_VIDEO_CDI=m
N/A
CONFIG_VIDEO (sensor) CONFIG_NV_VIDEO_IMX185=m
CONFIG_NV_VIDEO_IMX268=m
CONFIG_NV_VIDEO_IMX318=m
CONFIG_NV_VIDEO_OV9281=m
CONFIG_NV_VIDEO_OV10823=m
CONFIG_NV_VIDEO_OV23850=m
CONFIG_NV_VIDEO_IMX390=y
CONFIG_NV_VIDEO_IMX219=m
CONFIG_NV_VIDEO_IMX274=m
CONFIG_NV_VIDEO_LC898212=m
CONFIG_NV_VIDEO_OV5693=m
N/A

Kernel Version-Specific Code

NVIDIA-specific kernel code in kernel/nvidia-oot/ is guarded by checks that compare the LINUX_VERSION_CODE macro against KERNEL_VERSION(x, x, x).

These are the changes in the new driver:

  1. Adapting the Power Domain framework in drivers and corresponding header inclusions.

    The following table shows paths for the functions used in the current kernel versions.

    Kernel 5.15 Kernel 5.10

    /kernel/3rdparty/canonical/linux-jammy/kernel-source/include/linux/pm_domain.h

    /kernel/kernel-5.10/include/linux/pm_domain.h

  2. Adapting VI drivers to V4L2 framework changes to replace video buffer state, and changes to time related v4l2-ctl APIs and structures. Some examples are listed in the table below.

    Kernel 5.15
    ktime_get_ts64
    struct timespec64
    ns_to_timespec64
    VB2_BUF_STATE_ERROR

    VFL_TYPE_VIDEO

    /kernel/3rdparty/canonical/linux-jammy/kernel-source/include/media/v4l2-dev.h

    V4L2 structure changes:

    /kernel/3rdparty/canonical/linux-jammy/kernel-source/include/media/v4l2-async.h

    Modified enum type for C-PHY and D-PHY in v4l2_mbus_config:

    /kernel/3rdparty/canonical/linux-jammy/kernel-source/include/uapi/linux//v4l2-mediabus.h

  3. Adapting to changes in debugfs APIs. For function definitions, see the files listed in the table below.

    Kernel 5.15 Kernel 5.10

    /kernel/3rdparty/canonical/linux-jammy/kernel-source/fs/debugfs/file.c

    /kernel/kernel-5.10/fs/debugfs/file.c

  4. Adapting to replacement of kmap APIs with vmap dma_buf APIs. For API definitions, see the files listed in the table below.

    Kernel 5.15 Kernel 5.10

    /kernel/3rdparty/canonical/linux-jammy/kernel-source/drivers/dma-buf/dma-buf.c

    /kernel/kernel-5.10/drivers/dma-buf/dma-buf.c

dev_err() Function

The definition of dev_err() has changed. For more information, see the files listed below.

Kernel 5.15 Kernel 5.10

/kernel/3rdparty/canonical/linux-jammy/kernel-source/include/include/linux/dev_printk.h

/kernel/kernel-5.10/include/linux/dev_printk.h

I2C API

I2C API changes are listed below.

Kernel 5.15

i2c_lock_bus() and i2c_unlock_bus()

/kernel/3rdparty/canonical/linux-jammy/kernel-source/include/linux/i2c.h

i2c_new_client_device()

/kernel/3rdparty/canonical/linux-jammy/kernel-source/drivers/i2c/i2c-core-base.c

NVIDIA Capture Driver Code Path

Some of the capture mode driver file paths for channel configuration (VI, ISP) have changed.

Kernel 5.15 Kernel 5.10

/kernel/nvidia-oot/drivers/media/platform/tegra/camera/fusa-capture/

/kernel/nvidia/drivers/media/platform/tegra/camera/fusa-capture/