diff --git a/.github/workflows/build-jp5.yml b/.github/workflows/build-jp502.yml
similarity index 91%
rename from .github/workflows/build-jp5.yml
rename to .github/workflows/build-jp502.yml
index 98874f2f..04ed9c60 100644
--- a/.github/workflows/build-jp5.yml
+++ b/.github/workflows/build-jp502.yml
@@ -1,4 +1,4 @@
-name: C/C++ CI
+name: Build JP 5.0.2
on:
push:
@@ -8,6 +8,8 @@ on:
pull_request:
branches: ['**']
+permissions: read-all
+
jobs:
build:
diff --git a/.github/workflows/build-jp512.yml b/.github/workflows/build-jp512.yml
new file mode 100644
index 00000000..a5a856f8
--- /dev/null
+++ b/.github/workflows/build-jp512.yml
@@ -0,0 +1,25 @@
+name: Build JP 5.1.2
+
+on:
+ push:
+ branches:
+ - master
+ - dev
+ pull_request:
+ branches: ['**']
+
+permissions: read-all
+
+jobs:
+ build:
+
+ runs-on: ubuntu-20.04
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: setup workspace
+ run: yes | ./setup_workspace.sh 5.1.2
+ - name: apply patches
+ run: git config --global user.email "builder@example.com" && git config --global user.name "builder" && ./apply_patches.sh apply 5.1.2
+ - name: build
+ run: ./build_all.sh 5.1.2
diff --git a/.github/workflows/build-jp6.yml b/.github/workflows/build-jp6.yml
new file mode 100644
index 00000000..45d5ed97
--- /dev/null
+++ b/.github/workflows/build-jp6.yml
@@ -0,0 +1,25 @@
+name: Build JP 6.0
+
+on:
+ push:
+ branches:
+ - master
+ - dev
+ pull_request:
+ branches: ['**']
+
+permissions: read-all
+
+jobs:
+ build:
+
+ runs-on: ubuntu-22.04
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: setup workspace
+ run: yes | ./setup_workspace.sh 6.0
+ - name: apply patches
+ run: git config --global user.email "builder@example.com" && git config --global user.name "builder" && ./apply_patches.sh apply 6.0
+ - name: build
+ run: ./build_all.sh 6.0
diff --git a/README.md b/README.md
index 90fe2ea8..f100bfb5 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
# Intel® RealSense™ camera driver for GMSL* interface
-# D457 MIPI on Jetson AGX Xavier
-The RealSense MIPI platform driver enables the user to control and stream RealSense 3D MIPI cameras.
+# D457 MIPI on NVIDIA® Jetson AGX Xavier™ and AGX Orin™
+The RealSense™ MIPI platform driver enables the user to control and stream RealSense™ 3D MIPI cameras.
The system shall include:
-* Jetson platform (Currently Supported JetPack versions are: 6.0, 5.1.2, 5.0.2, 4.6.1)
+* NVIDIA® Jetson platform (Currently Supported JetPack versions are: 6.0, 5.1.2, 5.0.2, 4.6.1)
* RealSense De-Serialize board (https://store.intelrealsense.com/buy-intel-realsense-des457.html)
+* NVIDIA® Jetson AGX Orin™ Passive adapter board from [Leopard Imaging LI-JTX1-SUB-ADPT](https://leopardimaging.com/product/accessories/adapters-carrier-boards/for-nvidia-jetson/li-jtx1-sub-adpt/)
* RS MIPI camera (e.g. https://store.intelrealsense.com/buy-intel-realsense-depth-camera-d457.html)
> Note: This MIPI reference driver is based on RealSense de-serialize board. For other de-serialize boards, modification might be needed.
@@ -12,220 +13,29 @@ The system shall include:

-## Jetson AGX Xavier board setup
+# Documentation
-Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the Jetson AGX Xavier with NVIDIA SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use.
-
-## Build kernel, dtb and D457 driver
-
-The developers can set up the source code with NVIDIA's Jetson git repositories by using the provided setup script:
-
-```
-# Using setup script, recommended for developers. If JetPack version is not given, default version will be chosen.
-./setup_workspace.sh [JetPack_version]
-```
-
-Or download Jetson Linux source code tarball from
-- [JetPack 6.0-DP BSP sources](https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/sources/public_sources.tbz2)
-- [JetPack 5.1.2 BSP sources](https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2)
-- [JetPack 5.0.2 BSP sources](https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2)
-- [JetPack 4.6.1 BSP sources](https://developer.nvidia.com/embedded/l4t/r32_release_v7.1/sources/t186/public_sources.tbz2)
-
-```
-# JetPack 6.0
-mkdir -p l4t-gcc/6.0
-cd ./l4t-gcc/6.0
-wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2 -O aarch64--glibc--stable-final.tar.bz2
-tar xf aarch64--glibc--stable-final.tar.bz2 --strip-components 1
-cd ../..
-wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/sources/public_sources.tbz2
-tar xjf public_sources.tbz2
-cd Linux_for_Tegra/source
-tar xjf kernel_src.tbz2
-tar xjf kernel_oot_modules_src.tbz2
-tar xjf nvidia_kernel_display_driver_source.tbz2
-
-# JetPack 5.1.2
-mkdir -p l4t-gcc/5.1.2
-cd ./l4t-gcc/5.1.2
-wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz
-tar xf aarch64--glibc--stable-final.tar.gz
-cd ../..
-wget https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2
-tar xjf public_sources.tbz2
-cd Linux_for_Tegra/source/public
-tar xjf kernel_src.tbz2
-
-# JetPack 5.0.2
-mkdir -p l4t-gcc/5.0.2
-cd ./l4t-gcc/5.0.2
-wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz
-tar xf aarch64--glibc--stable-final.tar.gz --strip-components 1
-cd ../..
-wget https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2
-tar xjf public_sources.tbz2
-cd Linux_for_Tegra/source/public
-tar xjf kernel_src.tbz2
-
-# JetPack 4.6.1
-mkdir -p l4t-gcc/4.6.1
-cd ./l4t-gcc/4.6.1
-wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
-tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz --strip-components 1
-cd ../..
-wget https://developer.nvidia.com/embedded/l4t/r32_release_v7.1/sources/t186/public_sources.tbz2
-tar xjf public_sources.tbz2
-cd Linux_for_Tegra/source/public
-tar xjf kernel_src.tbz2
-```
-
-Apply D457 patches and build the kernel image, dtb and D457 driver.
-
-```
-# if using setup script
-./apply_patches.sh [--one-cam | --dual-cam] apply [JetPack_version]
-
-# or, if using direct download method
-# ./apply_patches_ext.sh [--one-cam | --dual-cam] ./Linux_for_tegra/source/public [JetPack_version]
-# for JP6.0, source path is ./Linux_for_tegra/source :
-# ./apply_patches_ext.sh ./Linux_for_tegra/source 6.0
-
-Note: The `--one-cam` and `--dual-cam` option applies only for JetPack 5.0.2,
-compatible with adapter: https://store.intelrealsense.com/buy-intel-realsense-des457.html.
-By setting the `--one-cam` option it builds DT with only camera on GMSL link A (default).
-By setting the `--dual-cam` option it builds DT with dual cameras on GMSL link A and B.
-The default is to single camera configuration for JetPack 5.0.2.
-
-# build kernel, dtb and D457 driver
-# install dependencies
-sudo apt install build-essential bc flex bison
-# method 1: build kernel Debian packages
-./build_all_deb.sh [--no-dbg-pkg] [JetPack_version] [JetPack_source_dir]
-# method 2: build kernel and modules only
-./build_all.sh [JetPack_version] [JetPack_source_dir]
-
-# remove our patches from JetPack kernel source code if using setup script
-# ./apply_patches.sh reset [JetPack_version]
-```
-
-Debian packages will be generated in `images` folder.
-
-## Install kernel and D457 driver to Jetson Orin
-
-JP6.0 build results
-
-- kernel image (not modified): `images/6.0/rootfs/boot/Image`
-- dtb overlay: `images/6.0/rootfs/boot/tegra234-camera-d4xx-overlay.dtbo`
-- oot modules: `images/6.0/rootfs/lib/modules/5.15.122-tegra/extra`
-
-Following steps required:
-
-1. Copy entire directory `images/6.0/rootfs/lib/modules/5.15.122-tegra/extra/` from host to `/lib/modules/5.15.122-tegra/extra/` on Orin
-2. Copy `tegra234-camera-d4xx-overlay.dtbo` from host to `/boot/tegra234-camera-d4xx-overlay.dtbo` on Orin
-3. Run $ `sudo /opt/nvidia/jetson-io/jetson-io.py`
- 1. Configure Jetson AGX CSI Connector
- 2. Configure for compatible hardware
- 3. Jetson RealSense Camera D457
- 4. $ `sudo depmod`
- 5. $ `echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf`
-4. Reboot
-
-Copy them to the right places:
+- NVIDIA® Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide
+- Build Tools manual page [Build Manual page](./README_tools.md)
+- Driver API manual page [Driver API page](./README_driver.md)
-```
-scp -r images/6.0/rootfs/boot/tegra234-camera-d4xx-overlay.dtbo nvidia@10.0.0.116:~/
-scp -r images/6.0/rootfs/lib/modules/5.15.122-tegra/extra nvidia@10.0.0.116:~/
-# RealSense metadata patched kernel modules
-scp -r images/6.0/rootfs/lib/modules/5.15.122-tegra/kernel/drivers/media/v4l2-core/videodev.ko nvidia@10.0.0.116:~/
-scp -r images/6.0/rootfs/lib/modules/5.15.122-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko nvidia@10.0.0.116:~/
-# Kernel Image with SENSOR_HID support for RealSense USB cameras with IMU
-scp -r images/6.0/rootfs/boot/Image nvidia@10.0.0.116:~/
-```
+## NVIDIA® Jetson AGX Xavier™ and AGX Orin™ board setup
-on target:
-
-```
-sudo cp ~/tegra234-camera-d4xx-overlay.dtbo /boot/
-# backup:
-sudo tar -cjf /lib/modules/$(uname -r)/modules_$(uname -r)_extra.tar.bz2 /lib/modules/$(uname -r)/extra
-sudo cp -r ~/extra /lib/modules/$(uname -r)/
-# enable RealSense metadata:
-sudo cp uvcvideo.ko /lib/modules/5.15.122-tegra/kernel/drivers/media/usb/uvc/uvcvideo.ko
-sudo cp videodev.ko /lib/modules/5.15.122-tegra/kernel/drivers/media/v4l2-core/videodev.ko
-# backup kernel (better to have additional boot entry in extlinux.conf)
-sudo cp /boot/Image /boot/Image.orig
-sudo cp Image /boot/Image
-```
-
-Enable d4xx overlay:
-
-With Jetson-IO tool:
-`sudo /opt/nvidia/jetson-io/jetson-io.py`
-
-1. Configure Jetson AGX CSI Connector
-2. Configure for compatible hardware
-3. Jetson RealSense Camera D457
-
-With command line
-
-`sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2="Jetson RealSense Camera D457"`
-
-Expected:
-```
-nvidia@ubuntu:~$ sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2="Jetson RealSense Camera D457"
-Configuration saved to /boot/tegra234-camera-d4xx-overlay.dtbo.
-Reboot system to reconfigure.
-```
-Enable d4xx autoload:
-
-`echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf`
-
-`sudo depmod`
-
----
-
-
-
-## Install kernel and D457 driver to Jetson AGX Xavier
-
-1. Install the kernel and modules
-
-1.1 If building with `build_all_deb.sh`
-
-Copy the Debian package `linux-image-5.10.104-d457_5.10.104-d457-1_arm64.deb` to the Jetson AGX Xavier board and install with `sudo dpkg -i linux-image-5.10.104-d457_5.10.104-d457-1_arm64.deb`. The header, libc-dev, dbg and firmware packages are optional.
-
-1.2 If building with `build_all.sh`
-
-The necessary files are:
-
-- kernel image `images//arch/arm64/boot/Image`
-- dtb `images//arch/arm64/boot/dts/nvidia/tegra194-p2888-0001-p2822-0000.dtb`, or `images/4.6.1/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb` for JetPack 4.6.1.
-- D457 driver `images//drivers/media/i2c/d4xx.ko`
-- UVC Video driver `images//drivers/media/usb/uvc/uvcvideo.ko`
-- V4L2 Core Video driver `images//drivers/media/v4l2-core/videobuf-core.ko`
-- V4L2 VMalloc Video driver `images//drivers/media/v4l2-core/videobuf-vmalloc.ko`
-
-And copy them to the right places:
-```
-sudo cp Image /boot
-sudo cp tegra194-p2888-0001-p2822-0000.dtb /boot/dtb
-sudo cp d4xx.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/i2c/
-sudo cp uvcvideo.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/usb/uvc/
-sudo cp videobuf-core.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/v4l2-core/
-sudo cp videobuf-vmalloc.ko /lib/modules/5.10.104-tegra/kernel/drivers/media/v4l2-core/
-sudo depmod
-```
+Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the Jetson AGX Xavier with NVIDIA SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use.
-2. Edit `/boot/extlinux/extlinux.conf` primary boot option's LINUX/FDT lines to use built kernel image and dtb file:
+**NOTE** : On Jetsons with modified factory setup modifications to build and deploy steps should be made by developer.
-```
-LINUX /boot/Image-5.10.104-d457
-FDT /usr/lib/linux-image-5.10.104-d457/tegra194-p2888-0001-p2822-0000.dtb
-```
+# JetPack build
-3. Make D457 I2C module autoload at boot time: `echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf`
+- [JetPack 6.0](./README_JP6.md#build-environment-prerequisites)
+- [JetPack 5.1.2](./README_JP5.md#build-kernel-dtb-and-d457-driver)
+- [JetPack 5.0.2](./README_JP5.md#build-kernel-dtb-and-d457-driver)
+- [JetPack 4.6.1](./README_JP4.md#build-kernel-dtb-and-d457-driver)
-After rebooting Jetson, the D457 driver should work.
+### Verify driver after installation
+- Driver API manual page [Driver API page](./README_driver.md)
**NOTE**
diff --git a/README_JP4.md b/README_JP4.md
new file mode 100644
index 00000000..71b7337f
--- /dev/null
+++ b/README_JP4.md
@@ -0,0 +1,173 @@
+# Intel® RealSense™ camera driver for GMSL* interface on NVIDIA® Jetson AGX Xavier™ JetPack 4.6.1
+
+# D457 MIPI on NVIDIA® Jetson AGX Xavier™
+The Intel® RealSense™ MIPI platform driver enables the user to control and stream RealSense 3D MIPI cameras.
+
+The system shall include:
+* NVIDIA® Jetson™ platform (Currently Supported JetPack versions are: 4.6.1)
+* RealSense™ De-Serialize board (https://store.intelrealsense.com/buy-intel-realsense-des457.html)
+* RS MIPI camera (e.g. https://store.intelrealsense.com/buy-intel-realsense-depth-camera-d457.html)
+
+> Note: This MIPI reference driver is based on RealSense™ de-serialize board. For other de-serialize boards, modification might be needed.
+
+### Links
+- Intel® RealSense™ camera driver for GMSL* interface [Front Page](./README.md)
+- Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide
+- Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide
+- Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide
+- Build Tools manual page [Build Manual page](./README_tools.md)
+- Driver API manual page [Driver API page](./README_driver.md)
+
+
+## NVIDIA® Jetson AGX Xavier™ board setup for cross compile on x86-64
+
+Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the Jetson AGX Xavier™ with NVIDIA® SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use.
+
+
+## Build kernel, dtb and D457 driver - cross compile x86-64
+
+
+JetPack 4.6.1 manual build
+
+### Download Jetson Linux source code tarball from
+- [JetPack 4.6.1 BSP sources](https://developer.nvidia.com/embedded/l4t/r32_release_v7.1/sources/t186/public_sources.tbz2)
+- [JetPack 4.6.1 Toolchain](http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz)
+
+### JetPack 4.6.1 manual workspace setup
+```
+mkdir -p l4t-gcc/4.6.1
+cd ./l4t-gcc/4.6.1
+wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
+tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz --strip-components 1
+cd ../..
+wget https://developer.nvidia.com/embedded/l4t/r32_release_v7.1/sources/t186/public_sources.tbz2
+tar xjf public_sources.tbz2
+cd Linux_for_Tegra/source/public
+tar xjf kernel_src.tbz2
+cd ../../..
+```
+
+### Apply D457 patches and build the kernel image, dtb and D457 driver.
+
+```
+# install dependencies
+sudo apt install build-essential bc flex bison
+
+# apply patches
+./apply_patches_ext.sh ./Linux_for_Tegra/source/public 4.6.1
+
+# remove BUILD_NUMBER env dependency kernel vermagic
+sed -i s/'UTS_RELEASE=\$(KERNELRELEASE)-ab\$(BUILD_NUMBER)'/'UTS_RELEASE=\$(KERNELRELEASE)'/g ./Linux_for_Tegra/source/public/kernel/kernel-4.9/Makefile
+sed -i 's/the-space :=/E =/g' ./Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/Kbuild.include
+sed -i 's/the-space += /the-space = \$E \$E/g' ./Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/Kbuild.include
+
+# build kernel, dtb and D457 driver
+./build_all.sh 4.6.1 ./Linux_for_Tegra/source/public
+# Debian build
+# ./build_all_deb.sh --no-dbg-pkg 4.6.1 ./Linux_for_Tegra/source/public
+```
+
+
+---
+
+The developers can set up the source code with NVIDIA's Jetson git repositories by using the provided scripts.
+- Prepare build workspace for cross-compile on host
+- Apply necessary patches
+- Build workspace
+- Deploy build results on target Jetson
+
+```
+# prepare workspace
+./setup_workspace.sh 4.6.1
+
+# apply patches
+./apply_patches.sh apply 4.6.1
+
+# install dependencies
+sudo apt install build-essential bc flex bison
+
+# build kernel, dtb and D457 driver
+
+# method 2: build kernel and modules only
+./build_all.sh 4.6.1
+
+```
+
+Debian build:
+```
+./build_all_deb.sh [--no-dbg-pkg] 4.6.1
+```
+
+Debian packages will be generated in `images` folder.
+
+## Install kernel, device-tree and D457 driver to Jetson AGX Xavier
+
+1. Install the kernel and modules
+
+1.2 If building with `build_all.sh`
+
+The necessary files are:
+
+- kernel image `images/4.6.1/arch/arm64/boot/Image`
+- dtb `images/4.6.1/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb`
+- D457 driver `images/4.6.1/drivers/media/i2c/d4xx.ko`
+- UVC Video driver `images/4.6.1/drivers/media/usb/uvc/uvcvideo.ko`
+- V4L2 Core Video driver `images/4.6.1/drivers/media/v4l2-core/videobuf-core.ko`
+- V4L2 VMalloc Video driver `images/4.6.1/drivers/media/v4l2-core/videobuf-vmalloc.ko`
+
+Copy them to the right places on Jetson target:
+```
+sudo cp Image /boot
+sudo cp tegra194-p2888-0001-p2822-0000.dtb /boot/dtb
+sudo cp d4xx.ko /lib/modules/$(uname -r)/kernel/drivers/media/i2c/
+sudo cp uvcvideo.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/uvc/
+sudo cp videobuf-core.ko /lib/modules/$(uname -r)/kernel/drivers/media/v4l2-core/
+sudo cp videobuf-vmalloc.ko /lib/modules/$(uname -r)/kernel/drivers/media/v4l2-core/
+sudo depmod
+```
+
+2. Edit `/boot/extlinux/extlinux.conf` primary boot option's LINUX/FDT lines to use built kernel image and dtb file:
+
+```
+LINUX /boot/Image
+FDT /boot/dtb/tegra194-p2888-0001-p2822-0000.dtb
+```
+
+3. Make D457 I2C module autoload at boot time: `echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf`
+
+After rebooting Jetson, the D457 driver should work.
+
+### Verify driver
+- Driver API manual page [Driver API page](./README_driver.md)
+
+## Available directives on max9295/max9296 register setting
+
+- Dump registers
+```
+cat /sys/bus/i2c/drivers/max9295/30-0040/register_dump
+cat /sys/bus/i2c/drivers/max9296/30-0048/register_dump
+```
+
+- Dump setting version
+
+```
+cat /sys/module/max9295/parameters/max9295_setting_verison
+cat /sys/module/max9296/parameters/max9296_setting_verison
+```
+
+- Disable updating setting dynamically (updating setting manually by running script).
+ **0** means disable updating setting dynamically, while **1** means enable updating setting dynamically.
+
+```
+echo 0 | sudo tee /sys/module/max9295/parameters/max9295_dynamic_update
+echo 0 | sudo tee /sys/module/max9296/parameters/max9296_dynamic_update
+```
+
+- Refresh max9295/max9295 register values, this is used for forcely set serdes setting when necessary
+
+```
+echo 1 | sudo tee /sys/bus/i2c/drivers/max9295/30-0040/refresh_setting
+echo 1 | sudo tee /sys/bus/i2c/drivers/max9296/30-0048/refresh_setting
+```
+**NOTE**
+- It's recommended to save the original kernel image as backup boot option in `/boot/extlinux/extlinux.conf`.
\ No newline at end of file
diff --git a/README_JP5.md b/README_JP5.md
new file mode 100644
index 00000000..9aeb949e
--- /dev/null
+++ b/README_JP5.md
@@ -0,0 +1,172 @@
+# Intel® RealSense™ camera driver for GMSL* interface on NVIDIA® Jetson AGX Xavier™ JetPack 5.x.2
+
+# D457 MIPI on NVIDIA® Jetson AGX Xavier™
+The Intel® RealSense™ MIPI platform driver enables the user to control and stream RealSense™ 3D MIPI cameras.
+
+The system shall include:
+* NVIDIA® Jetson™ platform (Currently Supported JetPack versions are: 5.1.2, 5.0.2)
+* RealSense™ De-Serialize board (https://store.intelrealsense.com/buy-intel-realsense-des457.html)
+* RS MIPI camera (e.g. https://store.intelrealsense.com/buy-intel-realsense-depth-camera-d457.html)
+
+> Note: This MIPI reference driver is based on RealSense™ de-serialize board. For other de-serialize boards, modification might be needed.
+
+### Links
+- Intel® RealSense™ camera driver for GMSL* interface [Front Page](./README.md)
+- Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide
+- Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide
+- Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide
+- Build Tools manual page [Build Manual page](./README_tools.md)
+- Driver API manual page [Driver API page](./README_driver.md)
+
+
+## NVIDIA® Jetson AGX Xavier™ board setup for cross compile on x86-64
+
+Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the Jetson AGX Xavier™ with NVIDIA® SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use.
+
+## Build kernel, dtb and D457 driver on host - cross compile x86-64
+
+
+JetPack manual build
+
+Download Jetson Linux source code tarball from
+- [JetPack 5.1.2 BSP sources](https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2)
+- [JetPack 5.0.2 BSP sources](https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2)
+
+- [JetPack 5.x.2 Toolchain](https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93)
+
+
+## JetPack 5.1.2
+```
+mkdir -p l4t-gcc/5.1.2
+cd ./l4t-gcc/5.1.2
+wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz
+tar xf aarch64--glibc--stable-final.tar.gz
+cd ../..
+wget https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/sources/public_sources.tbz2
+tar xjf public_sources.tbz2
+cd Linux_for_Tegra/source/public
+tar xjf kernel_src.tbz2
+```
+## JetPack 5.0.2
+```
+mkdir -p l4t-gcc/5.0.2
+cd ./l4t-gcc/5.0.2
+wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz
+tar xf aarch64--glibc--stable-final.tar.gz --strip-components 1
+cd ../..
+wget https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2
+tar xjf public_sources.tbz2
+cd Linux_for_Tegra/source/public
+tar xjf kernel_src.tbz2
+cd ../../..
+```
+
+## Apply D457 patches and build the kernel image, dtb and D457 driver.
+
+```
+# install dependencies
+sudo apt install build-essential bc flex bison
+
+# apply patches
+./apply_patches_ext.sh ./Linux_for_Tegra/source/public 5.0.2
+
+# build kernel, dtb and D457 driver
+./build_all.sh 5.0.2 ./Linux_for_Tegra/source/public
+```
+
+
+
+---
+
+The developers can set up the source code with NVIDIA's Jetson git repositories by using the provided scripts.
+- Prepare build workspace for cross-compile on host
+- Apply necessary patches
+- Build workspace
+- Deploy build results on target Jetson
+
+```
+./setup_workspace.sh 5.0.2
+
+./apply_patches.sh apply 5.0.2
+
+./build_all.sh 5.0.2
+```
+
+## Install kernel, device-tree and D457 driver to Jetson AGX Xavier
+
+1. Install the kernel and modules
+
+Building with `build_all.sh`
+
+The necessary files are:
+
+- kernel image `images//arch/arm64/boot/Image`
+- dtb `images/5.0.2/arch/arm64/boot/dts/nvidia/tegra194-p2888-0001-p2822-0000.dtb`
+- D457 driver `images/5.0.2/drivers/media/i2c/d4xx.ko`
+- UVC Video driver `images/5.0.2/drivers/media/usb/uvc/uvcvideo.ko`
+- V4L2 Core Video driver `images/5.0.2/drivers/media/v4l2-core/videobuf-core.ko`
+- V4L2 VMalloc Video driver `images/5.0.2/drivers/media/v4l2-core/videobuf-vmalloc.ko`
+
+Copy build results from Host to Jetson target `10.0.0.116` user `nvidia`
+```
+scp ./images/5.0.2/arch/arm64/boot/Image nvidia@10.0.0.116:~/
+scp ./images/5.0.2/arch/arm64/boot/dts/nvidia/tegra194-p2888-0001-p2822-0000.dtb nvidia@10.0.0.116:~/
+scp ./images/5.0.2/drivers/media/i2c/d4xx.ko nvidia@10.0.0.116:~/
+scp ./images/5.0.2/drivers/media/usb/uvc/uvcvideo.ko nvidia@10.0.0.116:~/
+scp ./images/5.0.2/drivers/media/v4l2-core/videobuf-core.ko nvidia@10.0.0.116:~/
+scp ./images/5.0.2/drivers/media/v4l2-core/videobuf-vmalloc.ko nvidia@10.0.0.116:~/
+```
+
+Copy them to the right places on Jetson target:
+```
+sudo mkdir /boot/d457
+sudo mkdir /lib/modules/$(uname -r)/updates
+sudo cp Image /boot/d457/
+sudo cp tegra194-p2888-0001-p2822-0000.dtb /boot/d457/
+sudo cp d4xx.ko /lib/modules/$(uname -r)/updates/
+sudo cp uvcvideo.ko /lib/modules/$(uname -r)/updates/
+sudo cp videobuf-core.ko /lib/modules/$(uname -r)/updates/
+sudo cp videobuf-vmalloc.ko /lib/modules/$(uname -r)/updates/
+sudo depmod
+```
+
+2. Edit `/boot/extlinux/extlinux.conf` primary boot option's LINUX/FDT lines to use built kernel image and dtb file:
+
+ ```
+ LINUX /boot/d457/Image
+ FDT /boot/d457/tegra194-p2888-0001-p2822-0000.dtb
+ ```
+
+```
+$ cat /boot/extlinux/extlinux.conf
+TIMEOUT 30
+DEFAULT d457
+
+MENU TITLE L4T boot options
+
+LABEL primary
+ MENU LABEL primary kernel
+ LINUX /boot/Image
+ INITRD /boot/initrd
+ FDT /boot/dtb/tegra194-p2888-0001-p2822-0000.dtb
+ APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 rootfstype=ext4
+
+LABEL d457
+ MENU LABEL d457 kernel
+ LINUX /boot/d457/Image
+ INITRD /boot/initrd
+ FDT /boot/d457/tegra194-p2888-0001-p2822-0000.dtb
+ APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 rootfstype=ext4
+```
+
+
+3. Make D457 I2C module autoload at boot time:
+ ```
+ echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf
+ ```
+
+After rebooting Jetson, the D457 driver should work.
+
+**NOTE**
+
+- It's recommended to save the original kernel image as backup boot option in `/boot/extlinux/extlinux.conf`.
\ No newline at end of file
diff --git a/README_JP6.md b/README_JP6.md
new file mode 100644
index 00000000..4c425399
--- /dev/null
+++ b/README_JP6.md
@@ -0,0 +1,204 @@
+# Intel® RealSense™ camera driver for GMSL* interface
+
+# D457 MIPI on NVIDIA® Jetson AGX Orin™ JetPack 6.0
+The Intel® RealSense™ MIPI platform driver enables the user to control and stream RealSense™ 3D MIPI cameras.
+The system shall include:
+* NVIDIA® Jetson™ platform Supported JetPack versions are: [6.0 production release](https://developer.nvidia.com/embedded/jetpack-sdk-60)
+* RealSense™ [De-Serialize board](https://store.intelrealsense.com/buy-intel-realsense-des457.html)
+* Jetson AGX Orin™ Passive adapter board from [Leopard Imaging® LI-JTX1-SUB-ADPT](https://leopardimaging.com/product/accessories/adapters-carrier-boards/for-nvidia-jetson/li-jtx1-sub-adpt/)
+* RS MIPI camera [D457](https://store.intelrealsense.com/buy-intel-realsense-depth-camera-d457.html)
+
+
+
+
+> Note: This MIPI reference driver is based on RealSense™ de-serialize board. For other de-serialize boards, modification might be needed.
+
+### Links
+- Intel® RealSense™ camera driver for GMSL* interface [Front Page](./README.md)
+- NVIDIA® Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide
+- Build Tools manual page [Build Manual page](./README_tools.md)
+- Driver API manual page [Driver API page](./README_driver.md)
+
+## NVIDIA® Jetson AGX Orin™ board setup on x86-64 host for cross-compile
+
+Please follow the [instruction](https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html) to flash JetPack to the NVIDIA® Jetson AGX Orin™ with NVIDIA® SDK Manager or other methods NVIDIA provides. Make sure the board is ready to use.
+
+
+
+## Build environment prerequisites
+```
+sudo apt-get install -y build-essential bc wget flex bison curl libssl-dev xxd
+```
+## Build NVIDIA® kernel drivers, dtb and D457 driver - cross compile x86-64
+
+1. Clone [realsense_mipi_platform_driver](https://github.com/IntelRealSense/realsense_mipi_platform_driver.git) repo.
+2. The developers can set up build environment, ARM64 compiler, kernel sources and NVIDIA's Jetson git repositories by using the setup script.
+3. Apply patches for kernel drivers, nvidia-oot module and tegra devicetree.
+4. Build cross-compile project on host (Build PC).
+5. Apply build results to target (Jetson).
+6. Configure target.
+
+```
+git clone https://github.com/IntelRealSense/realsense_mipi_platform_driver.git
+cd realsense_mipi_platform_driver
+./setup_workspace.sh 6.0
+./apply_patches.sh apply 6.0
+./build_all.sh 6.0
+```
+
+
+
+## JetPack manual build - cross compile x86-64 (CI deploy)
+
+[NVIDIA® Jetson Linux 36.3](https://developer.nvidia.com/embedded/jetson-linux-r363)
+1. Download Jetson Linux Driver Package - [JetPack 6.0 BSP sources](https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/release/jetson_linux_r36.3.0_aarch64.tbz2)
+2. Download Toolchain ARM64 compiler - [Bootlin Toolchain gcc 11.3](https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2)
+3. Apply patches for kernel drivers, nvidia-oot module and tegra devicetree.
+4. Build cross-compile project on host (Build PC).
+5. Apply build results to target (Jetson).
+6. Configure target.
+
+```
+# JetPack 6.0
+mkdir -p l4t-gcc/6.0
+cd ./l4t-gcc/6.0
+wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2 -O aarch64--glibc--stable-final.tar.bz2
+tar xf aarch64--glibc--stable-final.tar.bz2 --strip-components 1
+cd ../..
+wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/sources/public_sources.tbz2
+tar xjf public_sources.tbz2
+cd Linux_for_Tegra/source
+tar xjf kernel_src.tbz2
+tar xjf kernel_oot_modules_src.tbz2
+tar xjf nvidia_kernel_display_driver_source.tbz2
+cd ../..
+
+./apply_patches_ext.sh ./Linux_for_Tegra/source 6.0
+
+# build kernel, dtb and D457 driver
+./build_all.sh 6.0 ./Linux_for_Tegra/source
+```
+
+## Archive JetPack 6.0 build results (optional) on build host
+- kernel image (not modified): `images/6.0/rootfs/boot/Image`
+- dtb: `images/6.0/rootfs/boot/dtb/tegra234-p3737-0000+p3701-0000-nv.dtb`
+- dtb overlay: `images/6.0/rootfs/boot/tegra234-camera-d4xx-overlay.dtbo`
+- nvidia-oot modules: `images/6.0/rootfs/lib/modules/5.15.136-tegra/updates`
+- kernel modules: `images/6.0/rootfs/lib/modules/5.15.136-tegra/extra`
+
+```
+echo "Archiving boot configuration build results"
+tar -czf ./images/6.0/boot-config.tar.gz -C "./images/6.0/rootfs/" ./boot
+echo "Archiving nvidia-oot modules"
+tar -czf ./images/6.0/nvidia-oot-modules.tar.gz -C "./images/6.0/rootfs/" ./lib/modules/5.15.136-tegra/updates
+echo "Archiving kernel HID modules"
+tar -czf ./images/6.0/kernel-hid-modules.tar.gz -C "./images/6.0/rootfs/" ./lib/modules/5.15.136-tegra/extra
+```
+## Backup JetPack 6.0 boot configuration and drivers (optional)
+```
+echo "Backup boot configuration"
+sudo cp /boot/tegra234-p3737-0000+p3701-0000-nv.dtb /boot/tegra234-p3737-0000+p3701-0000-nv-bkp.dtb
+echo "backup nvidia-oot modules"
+sudo tar -czf /lib/modules/$(uname -r)/updates.tar.gz -C /lib/modules/$(uname -r)/ updates
+```
+
+## Install kernel drivers, extra modules and device-tree to Jetson AGX Orin
+
+Following steps required:
+
+1. Copy entire directory `images/6.0/rootfs/lib/modules/5.15.136-tegra/updates` from host to `/lib/modules/5.15.136-tegra/` on Orin target
+2. Copy entire directory `images/6.0/rootfs/lib/modules/5.15.136-tegra/extra` from host to `/lib/modules/5.15.136-tegra/` on Orin target
+3. Copy `tegra234-camera-d4xx-overlay.dtbo` from host to `/boot/tegra234-camera-d4xx-overlay.dtbo` on Orin target
+4. Copy `tegra234-p3737-0000+p3701-0000-nv.dtb` from host to `/boot/` on Orin
+5. Run $ `sudo /opt/nvidia/jetson-io/jetson-io.py`
+ 1. Configure Jetson AGX CSI Connector
+ 2. Configure for compatible hardware
+ 3. Jetson RealSense Camera D457
+ 4. Enable depmod scan for "extra" modules $ `sudo sed -i 's/search updates/search extra updates/g' /etc/depmod.d/ubuntu.conf`
+ 5. $ `sudo depmod`
+ 6. $ `echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf`
+
+6. Verify bootloader configuration
+
+ ```
+ cat /boot/extlinux/extlinux.conf
+ --------
+ LABEL JetsonIO
+ MENU LABEL Custom Header Config:
+ LINUX /boot/Image
+ FDT /boot/dtb/kernel_tegra234-p3737-0000+p3701-0000-nv.dtb
+ APPEND ${cbootargs} root=PARTUUID=bbb3b34e-......
+ OVERLAYS /boot/tegra234-camera-d4xx-overlay.dtbo
+ --------
+ ```
+7. Reboot
+
+## Deploy build results on Jetson target
+On build host, copy build results to the right places.
+Assuming Jetson has ip: `10.0.0.116`
+
+```
+# Configuration files
+scp -r images/6.0/rootfs/boot nvidia@10.0.0.116:~/
+# RealSense support for NVIDIA Tegra
+scp -r images/6.0/rootfs/lib/modules/5.15.136-tegra/updates nvidia@10.0.0.116:~/
+# RealSense metadata patched kernel modules and IMU HID support
+scp -r images/6.0/rootfs/lib/modules/5.15.136-tegra/extra nvidia@10.0.0.116:~/
+```
+
+On Jetson target, assuming backup step was followed:
+
+```
+# enable RealSense extra formats and metadata
+sudo cp -r ~/extra /lib/modules/$(uname -r)/
+# enable RealSense MIPI support for D457 GMSL
+sudo cp -r ~/updates /lib/modules/$(uname -r)/
+sudo cp ~/boot/tegra234-camera-d4xx-overlay.dtbo /boot/
+sudo cp ./boot/dtb/tegra234-p3737-0000+p3701-0000-nv.dtb /boot/tegra234-p3737-0000+p3701-0000-nv.dtb
+# Enable d4xx overlay:
+sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2="Jetson RealSense Camera D457"
+
+# Enable d4xx autoload:
+echo "d4xx" | sudo tee /etc/modules-load.d/d4xx.conf
+# Enable depmod scan for "extra" modules
+# original file content: cat /etc/depmod.d/ubuntu.conf -- search updates ubuntu built-in
+sudo sed -i 's/search updates/search extra updates/g' /etc/depmod.d/ubuntu.conf
+# update driver cache
+sudo depmod
+
+#Reboot machine.
+sudo reboot
+```
+
+### Verify driver loaded - on Jetson:
+- Driver API manual page [Driver API page](./README_driver.md)
+
+```
+nvidia@ubuntu:~$ sudo dmesg | grep tegra-capture-vi
+[ 9.357521] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with tegra-capture-vi
+[ 9.419926] tegra-camrtc-capture-vi tegra-capture-vi: ep of_device is not enabled endpoint.
+[ 9.419932] tegra-camrtc-capture-vi tegra-capture-vi: ep of_device is not enabled endpoint.
+[ 10.001170] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 9-001a bound
+[ 10.025295] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 12-001a bound
+[ 10.040934] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 13-001a bound
+[ 10.056151] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 14-001a bound
+[ 10.288088] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+[ 10.324025] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+[ 10.324631] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+[ 10.325056] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+
+nvidia@ubuntu:~$ sudo dmesg | grep d4xx
+[ 9.443608] d4xx 9-001a: Probing driver for D45x
+[ 9.983168] d4xx 9-001a: ds5_chrdev_init() class_create
+[ 9.989521] d4xx 9-001a: D4XX Sensor: DEPTH, firmware build: 5.15.1.0
+[ 10.007813] d4xx 12-001a: Probing driver for D45x
+[ 10.013899] d4xx 12-001a: D4XX Sensor: RGB, firmware build: 5.15.1.0
+[ 10.025787] d4xx 13-001a: Probing driver for D45x
+[ 10.029095] d4xx 13-001a: D4XX Sensor: Y8, firmware build: 5.15.1.0
+[ 10.041282] d4xx 14-001a: Probing driver for D45x
+[ 10.044759] d4xx 14-001a: D4XX Sensor: IMU, firmware build: 5.15.1.0
+
+```
+---
diff --git a/README_driver.md b/README_driver.md
new file mode 100644
index 00000000..f365d9b6
--- /dev/null
+++ b/README_driver.md
@@ -0,0 +1,359 @@
+# Intel® RealSense™ camera driver for GMSL* interface
+
+# D457 MIPI on NVIDIA® Jetson AGX Xavier™ and AGX Orin™ driver API manual pages
+
+### Links
+- Intel® RealSense™ camera driver for GMSL* interface [Front Page](./README.md)
+- NVIDIA® Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide
+- Build Tools manual page [Build Manual page](./README_tools.md)
+- Driver API manual page [Driver API page](./README_driver.md)
+
+#### Verify driver installation
+- Install V4L2 Utilities
+```
+sudo apt install v4l-utils
+```
+
+- Verify driver loaded - on Jetson JetPack 6.0:
+```
+nvidia@ubuntu:~$ sudo dmesg | grep tegra-capture-vi
+[ 9.357521] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with tegra-capture-vi
+[ 9.419926] tegra-camrtc-capture-vi tegra-capture-vi: ep of_device is not enabled endpoint.
+[ 9.419932] tegra-camrtc-capture-vi tegra-capture-vi: ep of_device is not enabled endpoint.
+[ 10.001170] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 9-001a bound
+[ 10.025295] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 12-001a bound
+[ 10.040934] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 13-001a bound
+[ 10.056151] tegra-camrtc-capture-vi tegra-capture-vi: subdev DS5 mux 14-001a bound
+[ 10.288088] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+[ 10.324025] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+[ 10.324631] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+[ 10.325056] tegra-camrtc-capture-vi tegra-capture-vi: subdev 13e00000.host1x:nvcsi@15a00000- bound
+
+nvidia@ubuntu:~$ sudo dmesg | grep d4xx
+[ 9.443608] d4xx 9-001a: Probing driver for D45x
+[ 9.983168] d4xx 9-001a: ds5_chrdev_init() class_create
+[ 9.989521] d4xx 9-001a: D4XX Sensor: DEPTH, firmware build: 5.15.1.0
+[ 10.007813] d4xx 12-001a: Probing driver for D45x
+[ 10.013899] d4xx 12-001a: D4XX Sensor: RGB, firmware build: 5.15.1.0
+[ 10.025787] d4xx 13-001a: Probing driver for D45x
+[ 10.029095] d4xx 13-001a: D4XX Sensor: Y8, firmware build: 5.15.1.0
+[ 10.041282] d4xx 14-001a: Probing driver for D45x
+[ 10.044759] d4xx 14-001a: D4XX Sensor: IMU, firmware build: 5.15.1.0
+
+```
+
+- Check video devices, should be six video devices:
+ - video0 - Depth stream
+ - video1 - Depth metadata stream
+ - video2 - Color RGB stream
+ - video3 - Color RGB metadata stream
+ - video4 - IR stream
+ - video5 - IMU stream
+```
+$ ls -l /dev/video*
+crw-rw----+ 1 root video 81, 0 Jun 1 04:36 /dev/video0
+crw-rw----+ 1 root video 81, 1 Jun 1 04:36 /dev/video1
+crw-rw----+ 1 root video 81, 11 Jun 1 04:36 /dev/video2
+crw-rw----+ 1 root video 81, 12 Jun 1 04:36 /dev/video3
+crw-rw----+ 1 root video 81, 18 Jun 1 04:36 /dev/video4
+crw-rw----+ 1 root video 81, 24 Jun 1 04:36 /dev/video5
+```
+- Check DFU device:
+```
+ls -l /sys/class/d4xx-class/
+total 0
+lrwxrwxrwx 1 root root 0 Jun 2 15:39 d4xx-dfu-30-0010 -> ../../devices/virtual/d4xx-class/d4xx-dfu-30-0010
+
+ls -l /dev/d4xx-dfu-*
+crw-rw---- 1 root video 506, 0 Jun 1 04:36 /dev/d4xx-dfu-30-0010
+```
+#### Check capture driver:
+```
+v4l2-ctl -d0 -D
+Driver Info (not using libv4l2):
+ Driver name : tegra-video
+ Card type : vi-output, DS5 mux 30-0010
+ Bus info : platform:15c10000.vi:0
+ Driver version: 4.9.253
+ Capabilities : 0x84A00001
+ Video Capture
+ Metadata Capture
+ Streaming
+ Extended Pix Format
+ Device Capabilities
+ Device Caps : 0x04200001
+ Video Capture
+ Streaming
+ Extended Pix Format
+```
+#### Check available formats
+```
+v4l2-ctl -d0 -V
+Format Video Capture:
+ Width/Height : 640/480
+ Pixel Format : 'Z16 '
+ Field : None
+ Bytes per Line : 1280
+ Size Image : 614400
+ Colorspace : sRGB
+ Transfer Function : Default (maps to sRGB)
+ YCbCr/HSV Encoding: Default (maps to ITU-R 601)
+ Quantization : Default (maps to Full Range)
+ Flags :
+
+```
+```
+v4l2-ctl -d4 --list-formats
+ioctl: VIDIOC_ENUM_FMT
+ Index : 0
+ Type : Video Capture
+ Pixel Format: 'GREY'
+ Name : 8-bit Greyscale
+
+ Index : 1
+ Type : Video Capture
+ Pixel Format: 'Y8I '
+ Name : Interleaved 8-bit Greyscale
+
+ Index : 2
+ Type : Video Capture
+ Pixel Format: 'Y12I'
+ Name : Interleaved 12-bit Greyscale
+```
+- Depth formats
+```
+v4l2-ctl -d0 --list-formats
+ioctl: VIDIOC_ENUM_FMT
+ Index : 0
+ Type : Video Capture
+ Pixel Format: 'Z16 '
+ Name : 16-bit Depth
+```
+- Depth metadata format
+```
+v4l2-ctl -d1 --list-formats-meta
+ioctl: VIDIOC_ENUM_FMT
+ Index : 0
+ Type : Metadata Capture
+ Pixel Format: 'D4XX'
+ Name : D4XX meta data
+```
+
+
+Depth extended formats
+
+```
+v4l2-ctl -d0 --list-formats-ext
+ioctl: VIDIOC_ENUM_FMT
+ Index : 0
+ Type : Video Capture
+ Pixel Format: 'Z16 '
+ Name : 16-bit Depth
+ Size: Discrete 1280x720
+ Interval: Discrete 0.200s (5.000 fps)
+ Interval: Discrete 0.067s (15.000 fps)
+ Interval: Discrete 0.033s (30.000 fps)
+ Size: Discrete 848x480
+ Interval: Discrete 0.200s (5.000 fps)
+ Interval: Discrete 0.067s (15.000 fps)
+ Interval: Discrete 0.033s (30.000 fps)
+ Interval: Discrete 0.017s (60.000 fps)
+ Interval: Discrete 0.011s (90.000 fps)
+ Size: Discrete 848x100
+ Interval: Discrete 0.010s (100.000 fps)
+ Size: Discrete 640x480
+ Interval: Discrete 0.200s (5.000 fps)
+ Interval: Discrete 0.067s (15.000 fps)
+ Interval: Discrete 0.033s (30.000 fps)
+ Interval: Discrete 0.017s (60.000 fps)
+ Interval: Discrete 0.011s (90.000 fps)
+ Size: Discrete 640x360
+ Interval: Discrete 0.200s (5.000 fps)
+ Interval: Discrete 0.067s (15.000 fps)
+ Interval: Discrete 0.033s (30.000 fps)
+ Interval: Discrete 0.017s (60.000 fps)
+ Interval: Discrete 0.011s (90.000 fps)
+ Size: Discrete 480x270
+ Interval: Discrete 0.200s (5.000 fps)
+ Interval: Discrete 0.067s (15.000 fps)
+ Interval: Discrete 0.033s (30.000 fps)
+ Interval: Discrete 0.017s (60.000 fps)
+ Interval: Discrete 0.011s (90.000 fps)
+ Size: Discrete 424x240
+ Interval: Discrete 0.200s (5.000 fps)
+ Interval: Discrete 0.067s (15.000 fps)
+ Interval: Discrete 0.033s (30.000 fps)
+ Interval: Discrete 0.017s (60.000 fps)
+ Interval: Discrete 0.011s (90.000 fps)
+ Size: Discrete 256x144
+ Interval: Discrete 0.011s (90.000 fps)
+```
+
+
+
+
+
+#### Verify camera controls
+```
+v4l2-ctl -d0 -l
+```
+- Read firmware version v4l2 control
+```
+v4l2-ctl -d0 -C fw_version
+fw version: 84934657
+```
+
+
+Camera Controls
+
+```
+v4l2-ctl -d0 -l
+
+Camera Controls
+
+ auto_exposure 0x009a0901 (menu) : min=0 max=3 default=3 value=3 flags=volatile, execute-on-write
+ exposure_time_absolute 0x009a0902 (u32) : min=1 max=200000 step=1 default=33000 flags=volatile, execute-on-write
+ sensor_configuration 0x009a2032 (u32) : min=0 max=4294967295 step=1 default=0 [22] flags=read-only, volatile, has-payload
+ sensor_mode_i2c_packet 0x009a2033 (u32) : min=0 max=4294967295 step=1 default=0 [1026] flags=read-only, volatile, has-payload
+ sensor_control_i2c_packet 0x009a2034 (u32) : min=0 max=4294967295 step=1 default=0 [1026] flags=read-only, volatile, has-payload
+ bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0
+ override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
+ height_align 0x009a2066 (int) : min=1 max=16 step=1 default=1 value=1
+ size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
+ write_isp_format 0x009a2068 (int) : min=1 max=1 step=1 default=1 value=1
+ sensor_signal_properties 0x009a2069 (u32) : min=0 max=4294967295 step=1 default=0 [30][18] flags=read-only, has-payload
+ sensor_image_properties 0x009a206a (u32) : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
+ sensor_control_properties 0x009a206b (u32) : min=0 max=4294967295 step=1 default=0 [30][36] flags=read-only, has-payload
+ sensor_dv_timings 0x009a206c (u32) : min=0 max=4294967295 step=1 default=0 [30][16] flags=read-only, has-payload
+ low_latency_mode 0x009a206d (bool) : default=0 value=0
+ preferred_stride 0x009a206e (int) : min=0 max=65535 step=1 default=0 value=0
+ sensor_modes 0x009a2082 (int) : min=0 max=30 step=1 default=30 value=1 flags=read-only
+ logger 0x009a4000 (u8) : min=0 max=0 step=1 default=0 [1024] flags=read-only, volatile, has-payload
+ laser_power_on_off 0x009a4001 (bool) : default=1 value=1 flags=volatile, execute-on-write
+ manual_laser_power 0x009a4002 (int) : min=0 max=360 step=30 default=150 value=360 flags=volatile, execute-on-write
+ get_depth_calib 0x009a4003 (u8) : min=0 max=0 step=1 default=0 [256] flags=read-only, volatile, has-payload
+ set_depth_calib 0x009a4004 (u8) : min=0 max=4294967295 step=1 default=240 [256] flags=has-payload
+ get_coeff_calib 0x009a4005 (u8) : min=0 max=0 step=1 default=0 [512] flags=read-only, volatile, has-payload
+ set_coeff_calib 0x009a4006 (u8) : min=0 max=4294967295 step=1 default=240 [512] flags=has-payload
+ fw_version 0x009a4007 (u32) : min=0 max=0 step=1 default=0 [1] flags=read-only, volatile, has-payload
+ gvd 0x009a4008 (u8) : min=0 max=0 step=1 default=0 [239] flags=read-only, volatile, has-payload
+ ae_roi_get 0x009a4009 (u8) : min=0 max=0 step=1 default=0 [8] flags=read-only, volatile, has-payload
+ ae_roi_set 0x009a400a (u8) : min=0 max=4294967295 step=1 default=240 [8] flags=has-payload
+ ae_setpoint_get 0x009a400b (int) : min=0 max=0 step=1 default=0 value=0 flags=read-only, volatile
+ ae_setpoint_set 0x009a400c (int) : min=0 max=4095 step=1 default=0 value=0
+ erb_eeprom_read 0x009a400d (u8) : min=0 max=4294967295 step=1 default=240 [1020] flags=has-payload
+ ewb_eeprom_write 0x009a400e (u8) : min=0 max=4294967295 step=1 default=240 [1020] flags=has-payload
+ hwmc 0x009a400f (u8) : min=0 max=4294967295 step=1 default=240 [1028] flags=has-payload
+ pwm_frequency_selector 0x009a4016 (int) : min=0 max=1 step=1 default=1 value=1 flags=volatile, execute-on-write
+ hwmc_rw 0x009a4020 (u8) : min=0 max=4294967295 step=1 default=240 [1024] flags=volatile, has-payload, execute-on-write
+
+Image Source Controls
+
+ analogue_gain 0x009e0903 (int) : min=16 max=248 step=1 default=16 value=16 flags=volatile, execute-on-write
+
+```
+
+
+
+---
+
+
+#### Verify stream
+```
+v4l2-ctl -d0 --stream-mmap
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 29.70 fps
+```
+
+- Verify FPS changes
+```
+v4l2-ctl -d0 -p 60
+Frame rate set to 60.000 fps
+
+v4l2-ctl -d0 --stream-mmap
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 60.39 fps
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 60.19 fps
+```
+
+#### Verify Firmware Version
+```
+cat /dev/d4xx-dfu-30-0010
+DFU info: ver: 5.16.0.1
+```
+
+#### Verify media bindings
+
+```
+media-ctl --print-dot
+```
+- Use Graphviz tool to visualize media bindings - [Graphviz Visual Editor](http://magjac.com/graphviz-visual-editor/)
+
+
+Media Bindings
+
+media-ctl --print-dot
+
+digraph board {
+ rankdir=TB
+ n00000001 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 9-001a\n/dev/v4l-subdev4 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000001:port0 -> n00000059:port0
+ n00000007 [label="{{} | D4XX depth 9-001a\n/dev/v4l-subdev0 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000007:port0 -> n00000001:port1 [style=bold]
+ n0000000b [label="{{} | D4XX ir 9-001a\n/dev/v4l-subdev1 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000000b:port0 -> n00000001:port3 [style=bold]
+ n0000000f [label="{{} | D4XX rgb 9-001a\n/dev/v4l-subdev2 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000000f:port0 -> n00000001:port2 [style=bold]
+ n00000013 [label="{{} | D4XX imu 9-001a\n/dev/v4l-subdev3 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000013:port0 -> n00000001:port4 [style=bold]
+ n00000017 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 12-001a\n/dev/v4l-subdev9 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000017:port0 -> n00000092:port0
+ n0000001d [label="{{} | D4XX depth 12-001a\n/dev/v4l-subdev5 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000001d:port0 -> n00000017:port1 [style=bold]
+ n00000021 [label="{{} | D4XX ir 12-001a\n/dev/v4l-subdev6 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000021:port0 -> n00000017:port3 [style=bold]
+ n00000025 [label="{{} | D4XX rgb 12-001a\n/dev/v4l-subdev7 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000025:port0 -> n00000017:port2 [style=bold]
+ n00000029 [label="{{} | D4XX imu 12-001a\n/dev/v4l-subdev8 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000029:port0 -> n00000017:port4 [style=bold]
+ n0000002d [label="{{ 1 | 2 | 3 | 4} | DS5 mux 13-001a\n/dev/v4l-subdev14 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000002d:port0 -> n000000a3:port0
+ n00000033 [label="{{} | D4XX depth 13-001a\n/dev/v4l-subdev10 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000033:port0 -> n0000002d:port1 [style=bold]
+ n00000037 [label="{{} | D4XX ir 13-001a\n/dev/v4l-subdev11 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000037:port0 -> n0000002d:port3 [style=bold]
+ n0000003b [label="{{} | D4XX rgb 13-001a\n/dev/v4l-subdev12 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000003b:port0 -> n0000002d:port2 [style=bold]
+ n0000003f [label="{{} | D4XX imu 13-001a\n/dev/v4l-subdev13 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000003f:port0 -> n0000002d:port4 [style=bold]
+ n00000043 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 14-001a\n/dev/v4l-subdev19 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000043:port0 -> n000000b0:port0
+ n00000049 [label="{{} | D4XX depth 14-001a\n/dev/v4l-subdev15 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000049:port0 -> n00000043:port1 [style=bold]
+ n0000004d [label="{{} | D4XX ir 14-001a\n/dev/v4l-subdev16 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n0000004d:port0 -> n00000043:port3 [style=bold]
+ n00000051 [label="{{} | D4XX rgb 14-001a\n/dev/v4l-subdev17 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000051:port0 -> n00000043:port2 [style=bold]
+ n00000055 [label="{{} | D4XX imu 14-001a\n/dev/v4l-subdev18 | { 0}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000055:port0 -> n00000043:port4 [style=bold]
+ n00000059 [label="{{ 0} | 13e00000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev20 | { 1}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000059:port1 -> n0000005c
+ n0000005c [label="vi-output, DS5 mux 9-001a\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
+ n00000064 [label="tegra-capture-vi-metadata-0\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
+ n00000092 [label="{{ 0} | 13e00000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev21 | { 1}}", shape=Mrecord, style=filled, fillcolor=green]
+ n00000092:port1 -> n00000095
+ n00000095 [label="vi-output, DS5 mux 12-001a\n/dev/video2", shape=box, style=filled, fillcolor=yellow]
+ n0000009d [label="tegra-capture-vi-metadata-0\n/dev/video3", shape=box, style=filled, fillcolor=yellow]
+ n000000a3 [label="{{ 0} | 13e00000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev22 | { 1}}", shape=Mrecord, style=filled, fillcolor=green]
+ n000000a3:port1 -> n000000a6
+ n000000a6 [label="vi-output, DS5 mux 13-001a\n/dev/video4", shape=box, style=filled, fillcolor=yellow]
+ n000000b0 [label="{{ 0} | 13e00000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev23 | { 1}}", shape=Mrecord, style=filled, fillcolor=green]
+ n000000b0:port1 -> n000000b3
+ n000000b3 [label="vi-output, DS5 mux 14-001a\n/dev/video5", shape=box, style=filled, fillcolor=yellow]
+}
+
+
+
+
+
+---
diff --git a/README_tools.md b/README_tools.md
new file mode 100644
index 00000000..a947a718
--- /dev/null
+++ b/README_tools.md
@@ -0,0 +1,106 @@
+# Intel® RealSense™ camera driver for GMSL* interface
+
+# D457 MIPI on NVIDIA® Jetson AGX Xavier™ and AGX Orin™ build scripts manual pages
+
+### Links
+- Intel® RealSense™ camera driver for GMSL* interface [Front Page](./README.md)
+- NVIDIA® Jetson AGX Orin™ board setup - AGX Orin™ [JetPack 6.0](./README_JP6.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 5.x.2](./README_JP5.md) setup guide
+- NVIDIA® Jetson AGX Xavier™ board setup - AGX Xavier™ [JetPack 4.6.1](./README_JP4.md) setup guide
+- Build Tools manual page [Build Manual page](./README_tools.md)
+- Driver API manual page [Driver API page](./README_driver.md)
+
+# Build dependencies
+```
+sudo apt install -y build-essential bc wget flex bison curl libssl-dev xxd
+```
+
+# setup_workspace.sh
+The developers can set up the source code with NVIDIA's Jetson git repositories by using the provided setup script:
+
+Using setup script, recommended for developers.
+If JetPack version is not given, default version, 5.0.2, will be chosen.
+
+This script prepare all necessary tools and sources to build JetPack BSP.
+
+The following directories will be created:
+- JetPack 4.6.1: `sources_4.6.1`
+- JetPack 5.0.2: `sources_5.0.2`
+- JetPack 5.1.2: `sources_5.1.2`
+- JetPack 6.0: `sources_6.0`
+```
+./setup_workspace.sh [JetPack_version]
+```
+Example setup build workspace for JetPack 5.0.2:
+```
+./setup_workspace.sh 5.0.2
+```
+# apply_patches.sh
+Apply D457 patches for kernel image, dtb and D457 driver.
+
+```
+./apply_patches.sh [--one-cam | --dual-cam] apply [JetPack_version]
+```
+Reset D457 patches for kernel image, dtb and D457 driver.
+```
+./apply_patches.sh reset [JetPack_version]
+```
+
+Note: The `--one-cam` and `--dual-cam` option applies only for JetPack 5.0.2,
+compatible with adapter: https://store.intelrealsense.com/buy-intel-realsense-des457.html.
+- By setting the `--one-cam` option it builds DT with only camera on GMSL link A (default).
+
+- By setting the `--dual-cam` option it builds DT with dual cameras on GMSL link A and B.
+- The default is to single camera configuration for JetPack 5.0.2.
+
+# apply_patches_ext.sh
+When setup_workspace.sh was not used, using sources direct download method (example: for CI build)
+
+Apply D457 patches for external build the kernel image, dtb and D457 driver.
+```
+./apply_patches_ext.sh [--one-cam | --dual-cam] ./Linux_for_tegra/source/public [JetPack_version]
+```
+Example: for JP5.0.2, source path is ./Linux_for_tegra/source :
+```
+./apply_patches_ext.sh ./Linux_for_tegra/source 5.0.2
+```
+
+# build_all.sh
+build kernel and modules only
+```
+./build_all.sh [JetPack_version] [JetPack_source_dir]
+```
+Example: build JetPack 5.0.2 workspace created by `setup_workspace.sh`:
+```
+./build_all.sh 5.0.2
+```
+Example: build JetPack 5.0.2 workspace created by direct source download
+```
+./build_all.sh 6.0 ./Linux_for_tegra/source
+```
+The following directories will be created:
+- JetPack 4.6.1: `images/4.6.1`
+- JetPack 5.0.2: `images/5.0.2`
+- JetPack 5.1.2: `images/5.1.2`
+- JetPack 6.0: `images/6.0`
+
+# build_all_deb.sh
+Build kernel Debian packages for JetPack 5.0.2 or 4.6.1
+```
+./build_all_deb.sh [--no-dbg-pkg] [JetPack_version] [JetPack_source_dir]
+```
+
+Debian packages will be generated in `images` folder.
+
+Example:
+
+- Debian package `linux-image-5.10.104-d457_5.10.104-d457-1_arm64.deb`
+- Install with `sudo dpkg -i linux-image-5.10.104-d457_5.10.104-d457-1_arm64.deb`
+- The header, libc-dev, dbg and firmware packages are optional.
+
+
+**NOTE**
+
+- Each JetPack version's kernel may be different, the user needs to change the kernel version in file names and paths accordingly, for example for JetPack 4.6.1 the version is `4.9.253-d457` or `4.9.253-tegra`, depending on the build method applied.
+- For JetPack 4.6.1, the dtb file is not included in the deb package. User needs to manually copy `images/4.6.1/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb` file to board and edit `extlinux.conf` to point to it.
+- It's recommended to save the original kernel image as backup boot option in `/boot/extlinux/extlinux.conf`.
\ No newline at end of file
diff --git a/build_all.sh b/build_all.sh
index 18159e08..031e354b 100755
--- a/build_all.sh
+++ b/build_all.sh
@@ -43,7 +43,6 @@ if [[ "$JETPACK_VERSION" == "6.0" ]]; then
export KERNEL_HEADERS=$SRCS/kernel/kernel-jammy-src
ln -sf $TEGRA_KERNEL_OUT $SRCS/out
make ARCH=arm64 -C kernel
- # export KERNEL_HEADERS=$SRCS/out
make ARCH=arm64 modules
make ARCH=arm64 dtbs
mkdir -p $TEGRA_KERNEL_OUT/rootfs/boot/dtb
@@ -52,6 +51,20 @@ if [[ "$JETPACK_VERSION" == "6.0" ]]; then
export INSTALL_MOD_PATH=$TEGRA_KERNEL_OUT/rootfs/
make ARCH=arm64 install -C kernel
make ARCH=arm64 modules_install
+ # iio support
+ KERNELVERSION=$(cat $KERNEL_HEADERS/include/config/kernel.release)
+ KERNEL_MODULES_OUT=$INSTALL_MOD_PATH/lib/modules/${KERNELVERSION}
+ mkdir -p $KERNEL_MODULES_OUT/extra
+ cp $KERNEL_MODULES_OUT/kernel/drivers/iio/buffer/kfifo_buf.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/iio/buffer/industrialio-triggered-buffer.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/iio/common/hid-sensors/hid-sensor-iio-common.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/hid/hid-sensor-hub.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/iio/accel/hid-sensor-accel-3d.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/iio/gyro/hid-sensor-gyro-3d.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/iio/common/hid-sensors/hid-sensor-trigger.ko $KERNEL_MODULES_OUT/extra/
+ # RealSense cameras support
+ cp $KERNEL_MODULES_OUT/kernel/drivers/media/usb/uvc/uvcvideo.ko $KERNEL_MODULES_OUT/extra/
+ cp $KERNEL_MODULES_OUT/kernel/drivers/media/v4l2-core/videodev.ko $KERNEL_MODULES_OUT/extra/
else
#jp4/5
cd $SRCS/$KERNEL_DIR
diff --git a/hardware/nvidia/t23x/nv-public/6.0/0001-overlay-enable-d4xx-camera-for-Orin-jp6.patch b/hardware/nvidia/t23x/nv-public/6.0/0001-overlay-enable-d4xx-camera-for-Orin-jp6.patch
index 7f23f40a..8177aef5 100644
--- a/hardware/nvidia/t23x/nv-public/6.0/0001-overlay-enable-d4xx-camera-for-Orin-jp6.patch
+++ b/hardware/nvidia/t23x/nv-public/6.0/0001-overlay-enable-d4xx-camera-for-Orin-jp6.patch
@@ -1,6 +1,6 @@
-From 91e9bb1de78dbd96dc80d47e1a7c1fd28873e8fa Mon Sep 17 00:00:00 2001
+From 00f96bc253e0e35235b221af28bddf25d185d84d Mon Sep 17 00:00:00 2001
From: Dmitry Perchanov
-Date: Mon, 29 Jan 2024 05:52:20 +0200
+Date: Mon, 20 May 2024 18:16:07 +0300
Subject: [PATCH] overlay: enable d4xx camera for Orin jp6
Signed-off-by: Dmitry Perchanov
@@ -9,17 +9,17 @@ Signed-off-by: Dmitry Perchanov
1 file changed, 1 insertion(+)
diff --git a/overlay/Makefile b/overlay/Makefile
-index b3b0638..ff0cb54 100644
+index c88bbe2..3f6354e 100644
--- a/overlay/Makefile
+++ b/overlay/Makefile
-@@ -54,6 +54,7 @@ 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
+@@ -60,6 +60,7 @@ 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
+dtbo-y += tegra234-camera-d4xx-overlay.dtbo
-
ifneq ($(dtb-y),)
+ dtb-y := $(addprefix $(makefile-path)/,$(dtb-y))
--
2.34.1
diff --git a/kernel/kernel-5.10/5.0.2/0003-tegra-i2c-fix-return-value-for-tegra_i2c.patch b/kernel/kernel-5.10/5.0.2/0003-tegra-i2c-fix-return-value-for-tegra_i2c.patch
new file mode 100644
index 00000000..822397c5
--- /dev/null
+++ b/kernel/kernel-5.10/5.0.2/0003-tegra-i2c-fix-return-value-for-tegra_i2c.patch
@@ -0,0 +1,26 @@
+From 6b671e33a579fe4d4aae755172a70aefa69866f6 Mon Sep 17 00:00:00 2001
+From: Dmitry Perchanov
+Date: Mon, 13 May 2024 10:34:45 +0300
+Subject: [PATCH] tegra-i2c: fix return value for tegra_i2c_change_clock_rate
+
+Signed-off-by: Dmitry Perchanov
+---
+ drivers/i2c/busses/i2c-tegra.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
+index 22672c53c3fc..eb89b3aed193 100644
+--- a/drivers/i2c/busses/i2c-tegra.c
++++ b/drivers/i2c/busses/i2c-tegra.c
+@@ -1738,7 +1738,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
+
+ if (adap->bus_clk_rate != i2c_dev->bus_clk_rate) {
+ i2c_dev->bus_clk_rate = adap->bus_clk_rate;
+- tegra_i2c_change_clock_rate(i2c_dev);
++ ret = tegra_i2c_change_clock_rate(i2c_dev);
+ if (ret) {
+ dev_err(i2c_dev->dev,
+ "failed changing clock rate: %d\n", ret);
+--
+2.34.1
+
diff --git a/kernel/kernel-5.10/5.1.2/0002-tegra-i2c-fix-return-value-for-tegra_i2c.patch b/kernel/kernel-5.10/5.1.2/0002-tegra-i2c-fix-return-value-for-tegra_i2c.patch
new file mode 100644
index 00000000..ff9c1993
--- /dev/null
+++ b/kernel/kernel-5.10/5.1.2/0002-tegra-i2c-fix-return-value-for-tegra_i2c.patch
@@ -0,0 +1,26 @@
+From 07f6aebb91427ae7f68213b371240b255a1ce0e6 Mon Sep 17 00:00:00 2001
+From: Dmitry Perchanov
+Date: Mon, 13 May 2024 10:36:25 +0300
+Subject: [PATCH] tegra-i2c: fix return value for tegra_i2c_change_clock_rate
+
+Signed-off-by: Dmitry Perchanov
+---
+ drivers/i2c/busses/i2c-tegra.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
+index 22672c53c3fc..eb89b3aed193 100644
+--- a/drivers/i2c/busses/i2c-tegra.c
++++ b/drivers/i2c/busses/i2c-tegra.c
+@@ -1738,7 +1738,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
+
+ if (adap->bus_clk_rate != i2c_dev->bus_clk_rate) {
+ i2c_dev->bus_clk_rate = adap->bus_clk_rate;
+- tegra_i2c_change_clock_rate(i2c_dev);
++ ret = tegra_i2c_change_clock_rate(i2c_dev);
+ if (ret) {
+ dev_err(i2c_dev->dev,
+ "failed changing clock rate: %d\n", ret);
+--
+2.34.1
+
diff --git a/kernel/kernel-jammy-src/6.0/0001-kernel-enable-HID_SENSOR.patch b/kernel/kernel-jammy-src/6.0/0001-kernel-enable-HID_SENSOR.patch
index 48a09c9b..80f83a82 100644
--- a/kernel/kernel-jammy-src/6.0/0001-kernel-enable-HID_SENSOR.patch
+++ b/kernel/kernel-jammy-src/6.0/0001-kernel-enable-HID_SENSOR.patch
@@ -1,45 +1,45 @@
-From 8abf5719599328104b1eb0c6cbc5f9526f106adc Mon Sep 17 00:00:00 2001
+From 0d3461ffac77eff2fac5f5f7261e5f2937d09ebd Mon Sep 17 00:00:00 2001
From: Dmitry Perchanov
-Date: Tue, 5 Mar 2024 16:42:02 +0200
+Date: Mon, 20 May 2024 18:11:44 +0300
Subject: [PATCH] kernel: enable HID_SENSOR
Signed-off-by: Dmitry Perchanov
---
- arch/arm64/configs/defconfig | 9 +++++++++
- 1 file changed, 9 insertions(+)
+ arch/arm64/configs/defconfig | 8 ++++++++
+ 1 file changed, 8 insertions(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
-index dc016a3a18a8..8ed5714a17fc 100644
+index 57e2a364e309..0c21dc7bec59 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
-@@ -849,7 +849,12 @@ CONFIG_SND_SOC_LPASS_WSA_MACRO=m
+@@ -862,8 +862,12 @@ CONFIG_SND_SOC_LPASS_WSA_MACRO=m
CONFIG_SND_SOC_LPASS_VA_MACRO=m
CONFIG_SND_SIMPLE_CARD=m
CONFIG_SND_AUDIO_GRAPH_CARD=m
-+CONFIG_HID=y
-+CONFIG_HIDRAW=y
-+CONFIG_HID_GENERIC=y
++CONFIG_HID=m
+ CONFIG_HIDRAW=y
++CONFIG_HID_GENERIC=m
CONFIG_HID_MULTITOUCH=m
-+CONFIG_HID_SENSOR_HUB=y
-+CONFIG_USB_HID=y
++CONFIG_HID_SENSOR_HUB=m
++CONFIG_USB_HID=m
CONFIG_I2C_HID_ACPI=m
CONFIG_I2C_HID_OF=m
CONFIG_USB=y
-@@ -1131,6 +1136,7 @@ CONFIG_EXTCON_USB_GPIO=y
+@@ -1148,6 +1152,7 @@ CONFIG_EXTCON_USB_GPIO=y
CONFIG_EXTCON_USBC_CROS_EC=y
CONFIG_RENESAS_RPCIF=m
CONFIG_IIO=y
-+CONFIG_HID_SENSOR_ACCEL_3D=y
++CONFIG_HID_SENSOR_ACCEL_3D=m
CONFIG_EXYNOS_ADC=y
CONFIG_MAX9611=m
CONFIG_QCOM_SPMI_VADC=m
-@@ -1138,6 +1144,9 @@ CONFIG_QCOM_SPMI_ADC5=m
+@@ -1155,6 +1160,9 @@ CONFIG_QCOM_SPMI_ADC5=m
CONFIG_ROCKCHIP_SARADC=m
CONFIG_IIO_CROS_EC_SENSORS_CORE=m
CONFIG_IIO_CROS_EC_SENSORS=m
-+CONFIG_HID_SENSOR_IIO_COMMON=y
-+CONFIG_HID_SENSOR_IIO_TRIGGER=y
-+CONFIG_HID_SENSOR_GYRO_3D=y
++CONFIG_HID_SENSOR_IIO_COMMON=m
++CONFIG_HID_SENSOR_IIO_TRIGGER=m
++CONFIG_HID_SENSOR_GYRO_3D=m
CONFIG_IIO_ST_LSM6DSX=m
CONFIG_IIO_CROS_EC_LIGHT_PROX=m
CONFIG_SENSORS_ISL29018=m
diff --git a/kernel/kernel-jammy-src/Makefile b/kernel/kernel-jammy-src/Makefile
index 5bc57e09..7874f699 100644
--- a/kernel/kernel-jammy-src/Makefile
+++ b/kernel/kernel-jammy-src/Makefile
@@ -7,13 +7,19 @@ KERNEL_DEF_CONFIG ?= defconfig
MAKEFILE_DIR := $(abspath $(shell dirname $(lastword $(MAKEFILE_LIST))))
kernel_source_dir := $(MAKEFILE_DIR)/$(KERNEL_SRC_DIR)
-kernel_image := ${kernel_source_dir}/arch/arm64/boot/Image
+ifdef KERNEL_OUTPUT
+O_OPT := O=$(KERNEL_OUTPUT)
+$(mkdir -p $(KERNEL_OUTPUT))
+kernel_image := $(KERNEL_OUTPUT)/arch/arm64/boot/Image
+else
+kernel_image := $(kernel_source_dir)/arch/arm64/boot/Image
+endif
NPROC ?= $(shell nproc)
# LOCALVERSION : -tegra or -rt-tegra
version = $(shell grep -q "CONFIG_PREEMPT_RT=y" \
- ${kernel_source_dir}/arch/arm64/configs/defconfig && echo "-rt-tegra" || echo "-tegra")
+ ${kernel_source_dir}/arch/arm64/configs/${KERNEL_DEF_CONFIG} && echo "-rt-tegra" || echo "-tegra")
.PHONY : kernel install clean help
@@ -23,25 +29,25 @@ kernel:
@echo "================================================================================"
$(MAKE) \
ARCH=arm64 \
- -C $(kernel_source_dir) \
+ -C $(kernel_source_dir) $(O_OPT) \
LOCALVERSION=$(version) \
$(KERNEL_DEF_CONFIG)
$(MAKE) -j $(NPROC) \
ARCH=arm64 \
- -C $(kernel_source_dir) \
+ -C $(kernel_source_dir) $(O_OPT) \
LOCALVERSION=$(version) \
--output-sync=target Image
$(MAKE) -j $(NPROC) \
ARCH=arm64 \
- -C $(kernel_source_dir) \
+ -C $(kernel_source_dir) $(O_OPT) \
LOCALVERSION=$(version) \
--output-sync=target dtbs
$(MAKE) -j $(NPROC) \
ARCH=arm64 \
- -C $(kernel_source_dir) \
+ -C $(kernel_source_dir) $(O_OPT) \
LOCALVERSION=$(version) \
--output-sync=target modules
@@ -63,7 +69,7 @@ install:
install $(kernel_image) $(INSTALL_MOD_PATH)/boot/
$(MAKE) \
ARCH=arm64 \
- -C $(kernel_source_dir) \
+ -C $(kernel_source_dir) $(O_OPT) \
LOCALVERSION=$(version) \
INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
modules_install
@@ -78,7 +84,7 @@ clean:
@echo "================================================================================"
$(MAKE) \
ARCH=arm64 \
- -C $(kernel_source_dir) \
+ -C $(kernel_source_dir) $(O_OPT) \
mrproper
@echo "================================================================================"
@echo "Kernel and in-tree modules installed successfully."
diff --git a/kernel/nvidia/5.1.2/0001-Porting-driver-patches-to-jetpack-5.1.2.patch b/kernel/nvidia/5.1.2/0001-Porting-driver-patches-to-jetpack-5.1.2.patch
index d7c2e90d..2a215718 100644
--- a/kernel/nvidia/5.1.2/0001-Porting-driver-patches-to-jetpack-5.1.2.patch
+++ b/kernel/nvidia/5.1.2/0001-Porting-driver-patches-to-jetpack-5.1.2.patch
@@ -1530,6 +1530,15 @@ diff --git a/include/media/tegra_camera_core.h b/include/media/tegra_camera_core
index 788cf77dc..421c22491 100644
--- a/include/media/tegra_camera_core.h
+++ b/include/media/tegra_camera_core.h
+@@ -23,7 +23,7 @@
+ /* Width alignment */
+ #define TEGRA_WIDTH_ALIGNMENT 1
+ /* Stride alignment */
+-#define TEGRA_STRIDE_ALIGNMENT 1
++#define TEGRA_STRIDE_ALIGNMENT 64
+ /* Height alignment */
+ #define TEGRA_HEIGHT_ALIGNMENT 1
+ /* Size alignment */
@@ -37,6 +37,8 @@
#define TEGRA_IMAGE_FORMAT_DEF 32
diff --git a/kernel/nvidia/5.1.2/0003-vi-channel-verify-s-g-callbacks.patch b/kernel/nvidia/5.1.2/0003-vi-channel-verify-s-g-callbacks.patch
new file mode 100644
index 00000000..3be83eea
--- /dev/null
+++ b/kernel/nvidia/5.1.2/0003-vi-channel-verify-s-g-callbacks.patch
@@ -0,0 +1,44 @@
+From d8e057a16a3a10300633ee9fad32131ee3189cc1 Mon Sep 17 00:00:00 2001
+From: Dmitry Perchanov
+Date: Sun, 31 Mar 2024 15:05:18 +0200
+Subject: [PATCH] vi: channel: verify s/g callbacks
+
+Signed-off-by: Dmitry Perchanov
+---
+ drivers/media/platform/tegra/camera/vi/channel.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/media/platform/tegra/camera/vi/channel.c b/drivers/media/platform/tegra/camera/vi/channel.c
+index 5801984aa..8498ff034 100644
+--- a/drivers/media/platform/tegra/camera/vi/channel.c
++++ b/drivers/media/platform/tegra/camera/vi/channel.c
+@@ -2261,9 +2261,11 @@ __tegra_channel_get_parm(struct tegra_channel *chan,
+ struct v4l2_subdev_frame_interval interval;
+
+ /* dmipx: fixing G_PARM EINVAL error */
+-// ret = v4l2_subdev_call(sd, video, g_frame_interval, &interval);
+- ret = sd->ops->video->g_frame_interval(sd, &interval);
+-
++ ret = v4l2_subdev_call(sd, video, g_frame_interval, &interval);
++ if (ret) {
++ if (sd && sd->ops->video && sd->ops->video->g_frame_interval)
++ ret = sd->ops->video->g_frame_interval(sd, &interval);
++ }
+ a->parm.capture.timeperframe.numerator = interval.interval.numerator;
+ a->parm.capture.timeperframe.denominator = interval.interval.denominator;
+
+@@ -2293,6 +2295,11 @@ __tegra_channel_set_parm(struct tegra_channel *chan,
+ interval.interval.denominator = a->parm.capture.timeperframe.denominator;
+
+ ret = v4l2_subdev_call(sd, video, s_frame_interval, &interval);
++ if (ret) {
++ if (sd && sd->ops->video && sd->ops->video->s_frame_interval)
++ ret = sd->ops->video->s_frame_interval(sd, &interval);
++ }
++
+ if (ret == -ENOIOCTLCMD)
+ return -ENOTTY;
+
+--
+2.34.1
+
diff --git a/kernel/realsense/d4xx.c b/kernel/realsense/d4xx.c
index 1a50166b..a08e3030 100644
--- a/kernel/realsense/d4xx.c
+++ b/kernel/realsense/d4xx.c
@@ -431,7 +431,7 @@ struct ds5_dfu_dev {
enum dfu_state dfu_state_flag;
unsigned char *dfu_msg;
u16 msg_write_once;
- unsigned char init_v4l_f;
+ // unsigned char init_v4l_f; // need refactoring
u32 bus_clk_rate;
};
@@ -495,7 +495,7 @@ struct ds5_counters {
#define ds5_from_depth_sd(sd) container_of(sd, struct ds5, depth.sd)
#define ds5_from_ir_sd(sd) container_of(sd, struct ds5, ir.sd)
#define ds5_from_rgb_sd(sd) container_of(sd, struct ds5, rgb.sd)
-#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 15, 122)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 15, 136)
static inline void msleep_range(unsigned int delay_base)
{
usleep_range(delay_base * 1000, delay_base * 1000 + 500);
@@ -1776,6 +1776,8 @@ enum DS5_HWMC_ERR {
DS5_HWMC_ERR_CMD = -1,
DS5_HWMC_ERR_PARAM = -6,
DS5_HWMC_ERR_NODATA = -21,
+ DS5_HWMC_ERR_UNKNOWN = -64,
+ DS5_HWMC_ERR_LAST,
};
static int ds5_get_hwmc_status(struct ds5 *state)
@@ -1795,26 +1797,11 @@ static int ds5_get_hwmc_status(struct ds5 *state)
if (ret || status != DS5_HWMC_STATUS_OK) {
if (status == DS5_HWMC_STATUS_ERR) {
ds5_raw_read(state, DS5_HWMC_DATA, &errorCode, sizeof(errorCode));
- switch(errorCode) {
- case (DS5_HWMC_ERR_CMD):
- case (DS5_HWMC_ERR_PARAM):
- ret = -EBADMSG;
- break;
- case (DS5_HWMC_ERR_NODATA):
- ret = -ENODATA;
- break;
-
- default:
- dev_dbg(&state->client->dev,
- "%s(): HWMC failed, ret: %d, status: %x, error code: %d\n",
- __func__, ret, status, errorCode);
- ret = -EBADMSG;
- break;
- }
+ return errorCode;
}
}
if (!ret && (status != DS5_HWMC_STATUS_OK))
- ret = -EBUSY;
+ ret = DS5_HWMC_ERR_LAST;
return ret;
}
@@ -1834,7 +1821,13 @@ static int ds5_get_hwmc(struct ds5 *state, unsigned char *data,
dev_dbg(&state->client->dev,
"%s(): HWMC status not clear, ret: %d\n",
__func__, ret);
+ if (ret != DS5_HWMC_ERR_LAST) {
+ int *p = (int *)data;
+ *p = ret;
+ return 0;
+ } else {
return ret;
+ }
}
ret = regmap_raw_read(state->regmap, DS5_HWMC_RESP_LEN,
@@ -2534,10 +2527,6 @@ static int ds5_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
u16 dataLen = 0;
u16 bufLen = ctrl->dims[0];
ret = ds5_get_hwmc(state, data, bufLen, &dataLen);
- if (ret) {
- ret = 0; // LRS doesn't expect to get errors with HWMC
- break;
- }
/* This is needed for librealsense, to align there code with UVC,
* last word is length - 4 bytes header length */
dataLen -= 4;
@@ -2714,6 +2703,8 @@ static const struct v4l2_ctrl_config ds5_ctrl_ae_setpoint_get = {
.name = "ae setpoint get",
.type = V4L2_CTRL_TYPE_INTEGER,
.flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY,
+ .min = 0,
+ .max = 4095,
.step = 1,
};
@@ -4835,18 +4826,33 @@ static ssize_t ds5_dfu_device_read(struct file *flip,
{
struct ds5 *state = flip->private_data;
u16 fw_ver, fw_build;
- char msg[32];
+ char msg[64];
int ret = 0;
+ struct __fw_status f = {0};
if (mutex_lock_interruptible(&state->lock))
return -ERESTARTSYS;
- ret |= ds5_read(state, DS5_FW_VERSION, &fw_ver);
- ret |= ds5_read(state, DS5_FW_BUILD, &fw_build);
- if (ret < 0)
- goto e_dfu_read_failed;
- snprintf(msg, sizeof(msg) ,"DFU info: \tver: %d.%d.%d.%d\n",
+ if (state->dfu_dev.dfu_state_flag == DS5_DFU_RECOVERY) {
+ /* Read device info in recovery mode */
+ ret = ds5_dfu_detach(state);
+ if (ret < 0)
+ goto e_dfu_read_failed;
+ ret = ds5_dfu_get_dev_info(state, &f);
+ if (ret < 0)
+ goto e_dfu_read_failed;
+ snprintf(msg, sizeof(msg) ,
+ "DFU info: \trecovery: %02x%02x%02x%02x%02x%02x\n",
+ f.ivcamSerialNum[0], f.ivcamSerialNum[1], f.ivcamSerialNum[2],
+ f.ivcamSerialNum[3], f.ivcamSerialNum[4], f.ivcamSerialNum[5] );
+ } else {
+ ret |= ds5_read(state, DS5_FW_VERSION, &fw_ver);
+ ret |= ds5_read(state, DS5_FW_BUILD, &fw_build);
+ if (ret < 0)
+ goto e_dfu_read_failed;
+ snprintf(msg, sizeof(msg) ,"DFU info: \tver: %d.%d.%d.%d\n",
(fw_ver >> 8) & 0xff, fw_ver & 0xff,
(fw_build >> 8) & 0xff, fw_build & 0xff);
+ }
if (copy_to_user(buffer, msg, strlen(msg)))
ret = -EFAULT;
@@ -4888,7 +4894,8 @@ static ssize_t ds5_dfu_device_write(struct file *flip,
goto dfu_write_error;
}
state->dfu_dev.dfu_state_flag = DS5_DFU_IN_PROGRESS;
- state->dfu_dev.init_v4l_f = 1;
+ /* find a better way to reinitialize driver from recovery to operational */
+ // state->dfu_dev.init_v4l_f = 1;
/* fallthrough - procceed to download */
__attribute__((__fallthrough__));
case DS5_DFU_IN_PROGRESS: {
@@ -4926,7 +4933,8 @@ static ssize_t ds5_dfu_device_write(struct file *flip,
goto dfu_write_error;
state->dfu_dev.dfu_state_flag = DS5_DFU_DONE;
}
- dev_notice(&state->client->dev, "%s(): DFU block (%d) bytes written\n",
+ if (len)
+ dev_notice(&state->client->dev, "%s(): DFU block (%d) bytes written\n",
__func__, (int)len);
break;
}
@@ -5055,10 +5063,12 @@ static int ds5_dfu_device_release(struct inode *inode, struct file *file)
state->dfu_dev.device_open_count--;
if (state->dfu_dev.dfu_state_flag != DS5_DFU_RECOVERY)
state->dfu_dev.dfu_state_flag = DS5_DFU_IDLE;
- if (state->dfu_dev.dfu_state_flag == DS5_DFU_DONE
- && state->dfu_dev.init_v4l_f)
- ds5_v4l_init(state->client, state);
- state->dfu_dev.init_v4l_f = 0;
+ /* We disable this section as it has no effect when device in operational
+ mode and has not enough effect when device in recovery mode */
+ // if (state->dfu_dev.dfu_state_flag == DS5_DFU_DONE
+ // && state->dfu_dev.init_v4l_f)
+ // ds5_v4l_init(state->client, state);
+ // state->dfu_dev.init_v4l_f = 0;
if (state->dfu_dev.dfu_msg)
devm_kfree(&state->client->dev, state->dfu_dev.dfu_msg);
state->dfu_dev.dfu_msg = NULL;
@@ -5489,6 +5499,8 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id)
if (rec_state == 0x201) {
dev_info(&c->dev, "%s(): D4XX recovery state\n", __func__);
state->dfu_dev.dfu_state_flag = DS5_DFU_RECOVERY;
+ /* Override I2C drvdata with state for use in remove function */
+ i2c_set_clientdata(c, state);
return 0;
}
@@ -5503,8 +5515,6 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id)
ret = ds5_v4l_init(c, state);
if (ret < 0)
goto e_chardev;
- /* Override I2C drvdata */
- /* i2c_set_clientdata(c, state); */
/* regulators? clocks?
* devm_regulator_bulk_get(&c->dev, DS5_N_SUPPLIES, state->supplies);
@@ -5541,10 +5551,15 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id)
static int ds5_remove(struct i2c_client *c)
{
+#ifdef CONFIG_VIDEO_D4XX_SERDES
+ int i, ret;
+#endif
struct ds5 *state = container_of(i2c_get_clientdata(c), struct ds5, mux.sd.subdev);
+ if (state && !state->mux.sd.subdev.v4l2_dev) {
+ state = i2c_get_clientdata(c);
+ }
#ifdef CONFIG_VIDEO_D4XX_SERDES
- int i, ret;
for (i = 0; i < MAX_DEV_NUM; i++) {
if (serdes_inited[i] && serdes_inited[i] == state) {
serdes_inited[i] = NULL;
@@ -5589,14 +5604,16 @@ static int ds5_remove(struct i2c_client *c)
regulator_disable(state->vcc);
// gpio_free(state->pwdn_gpio);
- if (state->dfu_dev.dfu_state_flag != DS5_DFU_RECOVERY) {
+ if (state->dfu_dev.dfu_state_flag != DS5_DFU_RECOVERY && \
+ state->mux.sd.subdev.v4l2_dev) {
#ifdef CONFIG_SYSFS
sysfs_remove_group(&c->dev.kobj, &ds5_attr_group);
#endif
ds5_mux_remove(state);
- if (state->is_depth) {
- ds5_chrdev_remove(state);
- }
+ }
+
+ if (state->is_depth && state->dfu_dev.ds5_class) {
+ ds5_chrdev_remove(state);
}
return 0;
@@ -5639,4 +5656,4 @@ MODULE_AUTHOR("Guennadi Liakhovetski ,\n\
Shikun Ding ");
MODULE_AUTHOR("Dmitry Perchanov ");
MODULE_LICENSE("GPL v2");
-MODULE_VERSION("1.0.1.21");
+MODULE_VERSION("1.0.1.23");
diff --git a/nvidia-oot/6.0/0001-Porting-nvidia-driver-patches-to-jetpack-6.0.patch b/nvidia-oot/6.0/0001-Porting-nvidia-driver-patches-to-jetpack-6.0.patch
index 59821308..69c806ab 100644
--- a/nvidia-oot/6.0/0001-Porting-nvidia-driver-patches-to-jetpack-6.0.patch
+++ b/nvidia-oot/6.0/0001-Porting-nvidia-driver-patches-to-jetpack-6.0.patch
@@ -1,17 +1,17 @@
-From 205fc8227e5a3a1c0b4781562d599a800a43d85e Mon Sep 17 00:00:00 2001
+From 1ce2b2e647c63724bfd1434f963eabbe4aa83941 Mon Sep 17 00:00:00 2001
From: Dmitry Perchanov
-Date: Wed, 10 Jan 2024 17:27:18 +0200
+Date: Mon, 20 May 2024 18:08:02 +0300
Subject: [PATCH] Porting nvidia driver patches to jetpack 6.0
Signed-off-by: Dmitry Perchanov
---
drivers/media/i2c/Makefile | 3 +
- drivers/media/i2c/max9295.c | 140 ++++++
- drivers/media/i2c/max9296.c | 189 +++++++++
+ drivers/media/i2c/max9295.c | 139 ++++++
+ drivers/media/i2c/max9296.c | 190 +++++++++
.../platform/tegra/camera/sensor_common.c | 4 +
.../media/platform/tegra/camera/vi/channel.c | 401 +++++++++++++++++-
.../media/platform/tegra/camera/vi/graph.c | 38 +-
- .../platform/tegra/camera/vi/mc_common.c | 28 +-
+ .../platform/tegra/camera/vi/mc_common.c | 27 ++
.../media/platform/tegra/camera/vi/vi5_fops.c | 36 ++
.../platform/tegra/camera/vi/vi5_formats.h | 30 +-
include/media/gmsl-link.h | 3 +
@@ -19,10 +19,10 @@ Signed-off-by: Dmitry Perchanov
include/media/max9296.h | 8 +
include/media/mc_common.h | 22 +
include/media/tegra_camera_core.h | 8 +
- 14 files changed, 902 insertions(+), 12 deletions(-)
+ 14 files changed, 902 insertions(+), 11 deletions(-)
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
-index 866fc75b..ab7eb8fa 100644
+index 7c5913c6..396b9bc3 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -5,6 +5,9 @@ subdir-ccflags-y += -Werror
@@ -34,12 +34,12 @@ index 866fc75b..ab7eb8fa 100644
+obj-m += d4xx.o
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
obj-m += max96712.o
- obj-m += ar1335_common.o
+
diff --git a/drivers/media/i2c/max9295.c b/drivers/media/i2c/max9295.c
-index 2f69c355..a9b8ae67 100644
+index b363d5f6..e7c77845 100644
--- a/drivers/media/i2c/max9295.c
+++ b/drivers/media/i2c/max9295.c
-@@ -463,6 +463,146 @@ static struct regmap_config max9295_regmap_config = {
+@@ -465,6 +465,145 @@ static struct regmap_config max9295_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
@@ -182,15 +182,14 @@ index 2f69c355..a9b8ae67 100644
+}
+EXPORT_SYMBOL(max9295_set_pipe);
+
-+
- #if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
+ #if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int max9295_probe(struct i2c_client *client)
#else
diff --git a/drivers/media/i2c/max9296.c b/drivers/media/i2c/max9296.c
-index 0337cb5f..9754acfd 100644
+index 1ceaf3cd..97559460 100644
--- a/drivers/media/i2c/max9296.c
+++ b/drivers/media/i2c/max9296.c
-@@ -32,6 +32,8 @@
+@@ -34,6 +34,8 @@
#define MAX9296_PIPE_X_DST_1_MAP_ADDR 0x410
#define MAX9296_PIPE_X_SRC_2_MAP_ADDR 0x411
#define MAX9296_PIPE_X_DST_2_MAP_ADDR 0x412
@@ -199,7 +198,7 @@ index 0337cb5f..9754acfd 100644
#define MAX9296_PIPE_X_ST_SEL_ADDR 0x50
-@@ -248,6 +250,9 @@ void max9296_power_off(struct device *dev)
+@@ -250,6 +252,9 @@ void max9296_power_off(struct device *dev)
mutex_lock(&priv->lock);
priv->pw_ref--;
@@ -209,7 +208,7 @@ index 0337cb5f..9754acfd 100644
if (priv->pw_ref == 0) {
/* enter reset mode: XCLR */
usleep_range(1, 2);
-@@ -767,6 +772,190 @@ ret:
+@@ -769,6 +774,191 @@ ret:
}
EXPORT_SYMBOL(max9296_setup_streaming);
@@ -354,6 +353,7 @@ index 0337cb5f..9754acfd 100644
+
+ return err;
+}
++
+int max9296_init_settings(struct device *dev)
+{
+ int err = 0;
@@ -416,10 +416,10 @@ index 92cc2fdf..69139eee 100644
pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
return -EINVAL;
diff --git a/drivers/media/platform/tegra/camera/vi/channel.c b/drivers/media/platform/tegra/camera/vi/channel.c
-index c4da4119..e2258ce9 100644
+index 91f8d5f8..d9be2677 100644
--- a/drivers/media/platform/tegra/camera/vi/channel.c
+++ b/drivers/media/platform/tegra/camera/vi/channel.c
-@@ -203,7 +203,12 @@ static void tegra_channel_fmt_align(struct tegra_channel *chan,
+@@ -202,7 +202,12 @@ static void tegra_channel_fmt_align(struct tegra_channel *chan,
* different. Aligned width also may force a sensor mode change other
* than the requested one
*/
@@ -441,9 +441,9 @@ index c4da4119..e2258ce9 100644
+ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS |
+ V4L2_CAP_META_CAPTURE;
- strlcpy(cap->driver, "tegra-video", sizeof(cap->driver));
- strlcpy(cap->card, chan->video->name, sizeof(cap->card));
-@@ -2218,6 +2224,62 @@ static long tegra_channel_default_ioctl(struct file *file, void *fh,
+ len = strscpy(cap->driver, "tegra-video", sizeof(cap->driver));
+ if (len < 0)
+@@ -2224,6 +2230,62 @@ static long tegra_channel_default_ioctl(struct file *file, void *fh,
return ret;
}
@@ -506,7 +506,7 @@ index c4da4119..e2258ce9 100644
static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
.vidioc_querycap = tegra_channel_querycap,
.vidioc_enum_framesizes = tegra_channel_enum_framesizes,
-@@ -2249,6 +2311,9 @@ static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
+@@ -2255,6 +2317,9 @@ static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
.vidioc_s_input = tegra_channel_s_input,
.vidioc_log_status = tegra_channel_log_status,
.vidioc_default = tegra_channel_default_ioctl,
@@ -516,7 +516,7 @@ index c4da4119..e2258ce9 100644
};
static int tegra_channel_close(struct file *fp);
-@@ -2464,6 +2529,331 @@ static int tegra_channel_csi_init(struct tegra_channel *chan)
+@@ -2470,6 +2535,331 @@ static int tegra_channel_csi_init(struct tegra_channel *chan)
return ret;
}
@@ -848,7 +848,7 @@ index c4da4119..e2258ce9 100644
int tegra_channel_init_video(struct tegra_channel *chan)
{
struct tegra_mc_vi *vi = chan->vi;
-@@ -2650,6 +3040,13 @@ int tegra_channel_cleanup(struct tegra_channel *chan)
+@@ -2656,6 +3046,13 @@ int tegra_channel_cleanup(struct tegra_channel *chan)
chan->emb_buf_size,
chan->emb_buf_addr, chan->emb_buf);
chan->emb_buf_size = 0;
@@ -863,10 +863,10 @@ index c4da4119..e2258ce9 100644
tegra_channel_dealloc_buffer_queue(chan);
diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c
-index dc14fe4e..cea4bda9 100644
+index 7c2d05e7..5e25cf6a 100644
--- a/drivers/media/platform/tegra/camera/vi/graph.c
+++ b/drivers/media/platform/tegra/camera/vi/graph.c
-@@ -290,6 +290,11 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
+@@ -292,6 +292,11 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
struct tegra_channel *chan =
container_of(notifier, struct tegra_channel, notifier);
struct tegra_vi_graph_entity *entity;
@@ -878,7 +878,7 @@ index dc14fe4e..cea4bda9 100644
int ret;
dev_dbg(chan->vi->dev, "notify complete, all subdevs registered\n");
-@@ -323,16 +328,46 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
+@@ -325,16 +330,46 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
if (ret < 0)
goto graph_error;
@@ -926,7 +926,7 @@ index dc14fe4e..cea4bda9 100644
graph_error:
video_unregister_device(chan->video);
register_device_error:
-@@ -396,6 +431,7 @@ static void tegra_vi_graph_notify_unbind(struct v4l2_async_notifier *notifier,
+@@ -398,6 +433,7 @@ static void tegra_vi_graph_notify_unbind(struct v4l2_async_notifier *notifier,
/* cleanup for complete */
if (chan->link_status) {
@@ -935,10 +935,10 @@ index dc14fe4e..cea4bda9 100644
tegra_channel_cleanup_video(chan);
chan->link_status--;
diff --git a/drivers/media/platform/tegra/camera/vi/mc_common.c b/drivers/media/platform/tegra/camera/vi/mc_common.c
-index 57c2d61a..57db86d5 100644
+index ae6b4927..6288d712 100644
--- a/drivers/media/platform/tegra/camera/vi/mc_common.c
+++ b/drivers/media/platform/tegra/camera/vi/mc_common.c
-@@ -161,6 +161,10 @@ static int vi_parse_dt(struct tegra_mc_vi *vi, struct platform_device *dev)
+@@ -164,6 +164,10 @@ static int vi_parse_dt(struct tegra_mc_vi *vi, struct platform_device *dev)
struct device_node *port;
int value = 0xFF;
int ret = 0;
@@ -949,11 +949,9 @@ index 57c2d61a..57db86d5 100644
err = of_property_read_u32(node, "num-channels", &num_channels);
if (err) {
-@@ -168,8 +172,30 @@ static int vi_parse_dt(struct tegra_mc_vi *vi, struct platform_device *dev)
- "Failed to find num of channels, set to 0\n");
- num_channels = 0;
+@@ -173,6 +177,29 @@ static int vi_parse_dt(struct tegra_mc_vi *vi, struct platform_device *dev)
}
-- vi->num_channels = num_channels;
+ vi->num_channels = num_channels;
+ vi->dser_dev = NULL;
+ dser_node = of_parse_phandle(node, "nvidia,gmsl-dser-device", 0);
@@ -982,10 +980,10 @@ index 57c2d61a..57db86d5 100644
if (ports == NULL)
ports = node;
diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
-index 3d29ee78..22dd202f 100644
+index 7b16dcaf..487ae44b 100644
--- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c
+++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
-@@ -424,6 +424,39 @@ static void vi5_setup_surface(struct tegra_channel *chan,
+@@ -426,6 +426,39 @@ static void vi5_setup_surface(struct tegra_channel *chan,
chan->capture_descr_sequence += 1;
}
@@ -1025,7 +1023,7 @@ index 3d29ee78..22dd202f 100644
static void vi5_release_buffer(struct tegra_channel *chan,
struct tegra_channel_buffer *buf)
{
-@@ -434,6 +467,9 @@ static void vi5_release_buffer(struct tegra_channel *chan,
+@@ -436,6 +469,9 @@ static void vi5_release_buffer(struct tegra_channel *chan,
vb2_set_plane_payload(&vbuf->vb2_buf, 0, chan->format.sizeimage);
vb2_buffer_done(&vbuf->vb2_buf, buf->vb2_state);
@@ -1175,10 +1173,10 @@ index 210dbc80..6b4c796e 100644
#endif /* __MAX9296_H__ */
diff --git a/include/media/mc_common.h b/include/media/mc_common.h
-index f10bde3d..63a0ce71 100644
+index 0408ba67..1252fb3f 100644
--- a/include/media/mc_common.h
+++ b/include/media/mc_common.h
-@@ -222,6 +222,23 @@ struct tegra_channel {
+@@ -224,6 +224,23 @@ struct tegra_channel {
unsigned int embedded_data_width;
unsigned int embedded_data_height;
@@ -1202,7 +1200,7 @@ index f10bde3d..63a0ce71 100644
DECLARE_BITMAP(fmts_bitmap, MAX_FORMAT_NUM);
atomic_t power_on_refcnt;
struct v4l2_fh *fh;
-@@ -300,6 +317,9 @@ struct tegra_mc_vi {
+@@ -304,6 +321,9 @@ struct tegra_mc_vi {
unsigned int num_channels;
unsigned int num_subdevs;
@@ -1212,7 +1210,7 @@ index f10bde3d..63a0ce71 100644
struct tegra_csi_device *csi;
struct list_head vi_chans;
struct tegra_channel *tpg_start;
-@@ -396,7 +416,9 @@ struct tegra_channel_buffer *dequeue_inflight(struct tegra_channel *chan);
+@@ -400,7 +420,9 @@ struct tegra_channel_buffer *dequeue_inflight(struct tegra_channel *chan);
int tegra_channel_set_power(struct tegra_channel *chan, bool on);
int tegra_channel_init_video(struct tegra_channel *chan);
@@ -1226,6 +1224,15 @@ diff --git a/include/media/tegra_camera_core.h b/include/media/tegra_camera_core
index e6d9a2b1..38634b77 100644
--- a/include/media/tegra_camera_core.h
+++ b/include/media/tegra_camera_core.h
+@@ -18,7 +18,7 @@
+ /* Width alignment */
+ #define TEGRA_WIDTH_ALIGNMENT 1
+ /* Stride alignment */
+-#define TEGRA_STRIDE_ALIGNMENT 1
++#define TEGRA_STRIDE_ALIGNMENT 64
+ /* Height alignment */
+ #define TEGRA_HEIGHT_ALIGNMENT 1
+ /* Size alignment */
@@ -32,6 +32,8 @@
#define TEGRA_IMAGE_FORMAT_DEF 32
diff --git a/nvidia-oot/Makefile b/nvidia-oot/Makefile
index f992c514..5499ee71 100644
--- a/nvidia-oot/Makefile
+++ b/nvidia-oot/Makefile
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
KERNEL_HEADERS ?= /lib/modules/$(shell uname -r)/build
@@ -14,6 +14,10 @@ endif
NPROC ?= $(shell nproc)
+ifeq ("$(wildcard $(KERNEL_OUTPUT))","")
+$(error kernel headers/output directory "$(KERNEL_OUTPUT)" does not exist!)
+endif
+
.PHONY : help modules modules_install clean conftest nvidia-headers hwpm nvidia-oot nvgpu
# help is default target!
@@ -39,7 +43,7 @@ ifeq ($(MAKECMDGOALS), modules)
@echo "================================================================================"
mkdir -p $(NVIDIA_CONFTEST)/nvidia;
cp -av $(MAKEFILE_DIR)/nvidia-oot/scripts/conftest/* $(NVIDIA_CONFTEST)/nvidia/;
- $(MAKE) ARCH=arm64 \
+ $(MAKE) -j $(NPROC) ARCH=arm64 \
src=$(NVIDIA_CONFTEST)/nvidia obj=$(NVIDIA_CONFTEST)/nvidia \
CC=$(CROSS_COMPILE)gcc LD=$(CROSS_COMPILE)ld \
NV_KERNEL_SOURCES=$(KERNEL_HEADERS) \
@@ -56,7 +60,7 @@ hwpm: conftest
@echo "make $(MAKECMDGOALS) - hwpm ..."
@echo "================================================================================"
$(MAKE) -j $(NPROC) ARCH=arm64 \
- -C $(KERNEL_HEADERS) \
+ -C $(KERNEL_OUTPUT) \
M=$(MAKEFILE_DIR)/hwpm/drivers/tegra/hwpm \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.hwpm=$(MAKEFILE_DIR)/hwpm \
@@ -72,7 +76,7 @@ nvidia-oot: conftest hwpm
@echo "make $(MAKECMDGOALS) - nvidia-oot ..."
@echo "================================================================================"
$(MAKE) -j $(NPROC) ARCH=arm64 \
- -C $(KERNEL_HEADERS) \
+ -C $(KERNEL_OUTPUT) \
M=$(MAKEFILE_DIR)/nvidia-oot \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
@@ -90,7 +94,7 @@ nvgpu: conftest nvidia-oot
@echo "make $(MAKECMDGOALS) - nvgpu ..."
@echo "================================================================================"
$(MAKE) -j $(NPROC) ARCH=arm64 \
- -C $(KERNEL_HEADERS) \
+ -C $(KERNEL_OUTPUT) \
M=$(MAKEFILE_DIR)/nvgpu/drivers/gpu/nvgpu \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.nvidia=$(MAKEFILE_DIR)/nvidia-oot \
@@ -118,9 +122,16 @@ endef
nvidia-headers: nvidia-oot
- mkdir -p $(NVIDIA_HEADERS) && cp -LR $(KERNEL_HEADERS)/* $(NVIDIA_HEADERS) && \
- cp -LR $(MAKEFILE_DIR)/nvidia-oot/include/* $(NVIDIA_HEADERS)/include/ && \
- cat $(KERNEL_HEADERS)/Module.symvers $(MAKEFILE_DIR)/nvidia-oot/Module.symvers > \
+ mkdir -p $(NVIDIA_HEADERS)
+ cp -LR $(KERNEL_HEADERS)/* $(NVIDIA_HEADERS)
+ if [ "$(KERNEL_HEADERS)" != "$(KERNEL_OUTPUT)" ] ; then \
+ cp -LR $(KERNEL_OUTPUT)/include/* $(NVIDIA_HEADERS)/include/ ; \
+ cp -LR $(KERNEL_OUTPUT)/arch/arm64/include/* $(NVIDIA_HEADERS)/arch/arm64/include/ ; \
+ cp -LR $(KERNEL_OUTPUT)/scripts/* $(NVIDIA_HEADERS)/scripts/ ; \
+ cp $(KERNEL_OUTPUT)/System.map $(NVIDIA_HEADERS)/ || true ; \
+ fi
+ cp -LR $(MAKEFILE_DIR)/nvidia-oot/include/* $(NVIDIA_HEADERS)/include/
+ cat $(KERNEL_OUTPUT)/Module.symvers $(MAKEFILE_DIR)/nvidia-oot/Module.symvers > \
$(NVIDIA_HEADERS)/Module.symvers
@@ -160,6 +171,7 @@ nvidia-dtbs:
@echo "================================================================================"
TEGRA_TOP=$(MAKEFILE_DIR) \
srctree=$(KERNEL_HEADERS) \
+ objtree=$(KERNEL_OUTPUT) \
oottree=$(MAKEFILE_DIR)/nvidia-oot \
HOSTCC=gcc \
$(MAKE) -f $(MAKEFILE_DIR)/nvidia-oot/scripts/Makefile.build \
diff --git a/scripts/setup-common b/scripts/setup-common
index 970d26be..2447815f 100755
--- a/scripts/setup-common
+++ b/scripts/setup-common
@@ -9,7 +9,7 @@ if [[ -z "$1" ]]; then
fi
if [[ $JETPACK_VERSION == "6.0" ]]; then
- L4T_VERSION="jetson_36.2"
+ L4T_VERSION="jetson_36.3"
KERNEL_DIR="kernel/kernel-jammy-src"
elif [[ $JETPACK_VERSION == "5.1.2" ]]; then
L4T_VERSION="jetson_35.4.1"
diff --git a/scripts/source_sync_5.1.2.sh b/scripts/source_sync_5.1.2.sh
index 061597c6..84a53f89 100755
--- a/scripts/source_sync_5.1.2.sh
+++ b/scripts/source_sync_5.1.2.sh
@@ -77,7 +77,6 @@ k:hardware/nvidia/platform/t23x/prometheus/kernel-dts:nv-tegra.nvidia.com/device
k:hardware/nvidia/soc/t23x:nv-tegra.nvidia.com/device/hardware/nvidia/soc/t23x.git:
k:hardware/nvidia/soc/tegra:nv-tegra.nvidia.com/device/hardware/nvidia/soc/tegra.git:
k:tegra/kernel-src/nv-kernel-display-driver:nv-tegra.nvidia.com/tegra/kernel-src/nv-kernel-display-driver.git:
-o:3rdparty/dtc:nv-tegra.nvidia.com/3rdparty/dtc.git:
o:3rdparty/libnl/3.5.0:nv-tegra.nvidia.com/3rdparty/libnl/3.5.0.git:
o:tegra/argus-cam-libav/argus_cam_libavencoder:nv-tegra.nvidia.com/tegra/argus-cam-libav/argus_cam_libavencoder.git:
o:tegra/cuda-src/nvsample_cudaprocess:nv-tegra.nvidia.com/tegra/cuda-src/nvsample_cudaprocess.git:
diff --git a/setup_workspace.sh b/setup_workspace.sh
index 0e86d863..acbdf33f 100755
--- a/setup_workspace.sh
+++ b/setup_workspace.sh
@@ -13,8 +13,7 @@ function DisplayNvidiaLicense {
echo -e "\nPlease notice: This script will download the kernel source (from nv-tegra, NVIDIA's public git repository) which is subject to the following license:\n\nhttps://developer.nvidia.com/embedded/l4t/r35_release_v1.0/release/tegra_software_license_agreement-tegra-linux.txt\n"
- # license="$(curl -L -s https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/release/tegra_software_license_agreement-tegra-linux.txt)\n\n"
- license="$(curl -L -s https://developer.download.nvidia.com/embedded/L4T/r35_Release_v4.1/release/Tegra_Software_License_Agreement-Tegra-Linux.txt)\n\n"
+ license="$(curl -L -s https://developer.download.nvidia.com/embedded/L4T/r36_Release_v3.0/release/Tegra_Software_License_Agreement-Tegra-Linux.txt)\n\n"
## display the page ##
echo -e "${license}"
@@ -43,7 +42,7 @@ if [[ ! -d "$DEVDIR/l4t-gcc/$JETPACK_VERSION/bin/" ]]; then
mkdir -p $DEVDIR/l4t-gcc/$JETPACK_VERSION
cd $DEVDIR/l4t-gcc/$JETPACK_VERSION
if [[ "$JETPACK_VERSION" == "6.0" ]]; then
- wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2 -O aarch64--glibc--stable-final.tar.bz2
+ wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2 -O aarch64--glibc--stable-final.tar.bz2
tar xf aarch64--glibc--stable-final.tar.bz2 --strip-components 1
elif [[ "$JETPACK_VERSION" == "5.1.2" ]]; then
wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93 -O aarch64--glibc--stable-final.tar.gz
diff --git a/test/run_ci.py b/test/run_ci.py
new file mode 100644
index 00000000..63a1fc2c
--- /dev/null
+++ b/test/run_ci.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python3
+
+'''
+This script helps running the tests using pytest.
+'''
+
+import sys, os, subprocess, re, getopt, time
+
+start_time = time.time()
+running_on_ci = False
+if 'WORKSPACE' in os.environ:
+ running_on_ci = True
+
+#logs are stored @ ./realsense_mipi_driver_platform/test/logs
+logdir = os.path.join( '/'.join(os.path.abspath( __file__ ).split( os.path.sep )[0:-1]), 'logs')
+dir_live_tests = os.path.dirname(__file__)
+
+regex = None
+handle = None
+test_ran = False
+
+def usage():
+ ourname = os.path.basename( sys.argv[0] )
+ print( 'Syntax: ' + ourname + ' [options] ' )
+ print( 'Options:' )
+ print( ' -h, --help Usage help' )
+ print( ' -r, --regex Run all tests whose name matches the following regular expression' )
+ print( ' e.g.: --regex test_fw_version; -r test_fw_version')
+
+ sys.exit( 0 )
+
+def command(dev_name, test=None):
+ cmd = ['pytest']
+ cmd += ['-vs']
+ cmd += ['-m', ''.join(dev_name)]
+ if test:
+ cmd += ['-k', f'{test}']
+ cmd += [''.join(dir_live_tests)]
+ cmd += ['--debug']
+ cmd += [f'--junit-xml={logdir}/{dev_name.upper()}_pytest.xml']
+ return cmd
+
+def run_test(cmd):
+ try:
+ subprocess.run( cmd,
+ timeout=200,
+ check=True )
+ except Exception as e:
+ print( "Exception occurred.")
+
+
+def run_tests_on_d457():
+ global logdir
+
+ try:
+ os.makedirs( logdir, exist_ok=True )
+ device = "D457"
+
+ testname = regex if regex else None
+
+ cmd = command(device.lower(), testname)
+ run_test(cmd)
+
+ finally:
+ if running_on_ci:
+ print("Log path- \"Build Artifacts\":/realsense_mipi_driver_platform/test/logs ")
+ run_time = time.time() - start_time
+ print( "server took", run_time, "seconds" )
+
+if __name__ == '__main__':
+ try:
+ opts, args = getopt.getopt( sys.argv[1:], 'hr:', longopts=['help', 'regex=' ] )
+ except getopt.GetoptError as err:
+ print( err )
+ usage()
+
+ for opt, arg in opts:
+ if opt in ('-h', '--help'):
+ usage()
+ elif opt in ('-r', '--regex'):
+ regex = arg
+
+ run_tests_on_d457()
+
+sys.exit( 0 )
diff --git a/test/test_fw_version.py b/test/test_fw_version.py
new file mode 100644
index 00000000..3cd1b271
--- /dev/null
+++ b/test/test_fw_version.py
@@ -0,0 +1,34 @@
+import subprocess
+import pytest
+
+@pytest.mark.d457
+@pytest.mark.parametrize("device", {'0'})
+def test_fw_version(device):
+ try:
+ result = subprocess.check_call(["v4l2-ctl", "-d"+device, "-C", "fw_version"])
+ assert result == 0
+
+ std_output = subprocess.check_output(["v4l2-ctl", "-d"+device, "-C", "fw_version"])
+ assert "fw version: " in std_output, "Couldn't fetch FW version"
+
+ # Remove the 'fw version: ' string from std output
+ fw_version = int(std_output.replace("fw version: ", ""))
+
+ fw_version_str = str(fw_version>>24 & 0xFF) + "." + str(fw_version>>16 & 0xFF) + "." + str(fw_version>>8 & 0xFF) + "." + str(fw_version & 0xFF)
+ print ("fw_version:", fw_version_str)
+
+ # Check if the FW version matching with 5.x.x.x
+ assert fw_version == (fw_version & 0x05FFFFFF), "Expected FW version is 5.x.x.x, but received {}".format(fw_version_str)
+
+ # Get DFU device name
+ dfu_device = subprocess.check_output(["ls", "/sys/class/d4xx-class/"])
+ assert "d4xx-dfu-" in dfu_device, "D4xx DFU device not found"
+
+ # Get FW version from DFU device info
+ dfu_device_info = subprocess.check_output(["cat", "/dev/"+dfu_device.strip()])
+
+ # Check whether the DFU info also has same FW version
+ assert fw_version_str in dfu_device_info, "FW versions read through v4l2-ctl utility and DFU device info doesn't match"
+
+ except Exception as e:
+ assert False, e