Skip to content

Commit

Permalink
JP5.1.2 porting.
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
  • Loading branch information
dmipx committed Oct 22, 2023
1 parent 4888ca0 commit 0a9d5c9
Show file tree
Hide file tree
Showing 8 changed files with 2,292 additions and 4 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ The developers can set up the source code with NVIDIA's Jetson git repositories
Or download Jetson Linux source code tarball from [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 5.1.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
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
Expand Down
4 changes: 3 additions & 1 deletion build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ if [[ -n "$2" ]]; then
SRCS="$2"
fi

if [[ "$JETPACK_VERSION" == "5.0.2" ]]; then
if [[ "$JETPACK_VERSION" == "5.1.2" ]]; then
export CROSS_COMPILE=$DEVDIR/l4t-gcc/$JETPACK_VERSION/bin/aarch64-buildroot-linux-gnu-
elif [[ "$JETPACK_VERSION" == "5.0.2" ]]; then
export CROSS_COMPILE=$DEVDIR/l4t-gcc/$JETPACK_VERSION/bin/aarch64-buildroot-linux-gnu-
elif [[ "$JETPACK_VERSION" == "4.6.1" ]]; then
export CROSS_COMPILE=$DEVDIR/l4t-gcc/$JETPACK_VERSION/bin/aarch64-linux-gnu-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 761052d064d68b94a7e09a3f2fbbc9557153489f Mon Sep 17 00:00:00 2001
From: Dmitry Perchanov <dmitry.perchanov@intel.com>
Date: Wed, 18 Oct 2023 14:00:35 +0300
Subject: [PATCH] Porting dts to jetpack 5.1.2

Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
---
tegra194-p2888-0001-p2822-0000.dts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tegra194-p2888-0001-p2822-0000.dts b/tegra194-p2888-0001-p2822-0000.dts
index a46befc..7ae66c1 100644
--- a/tegra194-p2888-0001-p2822-0000.dts
+++ b/tegra194-p2888-0001-p2822-0000.dts
@@ -18,7 +18,8 @@
* Top level DTS file for CVM:P2888-0001 and CVB:P2822-0000.
*/
#include "common/tegra194-p2888-0001-p2822-0000-common.dtsi"
-#include "common/tegra194-p2822-camera-modules.dtsi"
+#include "common/tegra194-camera-d4xx.dtsi"
+/*#include "common/tegra194-p2822-camera-modules.dtsi"*/
#include "common/tegra194-audio-p2822-0000.dtsi"

#if defined(LINUX_VERSION) && LINUX_VERSION >= 419
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
From 4ed40b0f511c4cd0236155f5b11471fcf00d2077 Mon Sep 17 00:00:00 2001
From: Dmitry Perchanov <dmitry.perchanov@intel.com>
Date: Wed, 18 Oct 2023 13:49:44 +0300
Subject: [PATCH] Porting kernel patches to jetpack 5.1.2

Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
---
Makefile | 3 +-
arch/arm64/configs/defconfig | 1 +
drivers/media/usb/uvc/Makefile | 1 +
drivers/media/usb/uvc/uvc_ctrl.c | 1 +
drivers/media/usb/uvc/uvc_driver.c | 103 ++++++++++++++++++
drivers/media/usb/uvc/uvcvideo.h | 15 +++
drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 14 +++
drivers/media/v4l2-core/v4l2-dev.c | 12 +-
drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
include/uapi/linux/videodev2.h | 5 +
scripts/package/builddeb | 1 +
11 files changed, 152 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index c420c6dcd916..b6db8bbc59e4 100644
--- a/Makefile
+++ b/Makefile
@@ -1398,7 +1398,8 @@ endif
dtbs_check: dtbs

dtbs_install:
- $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
+ mkdir -p $(INSTALL_DTBS_PATH)
+ cp -rf $(dtstree)/nvidia/*.dtb $(INSTALL_DTBS_PATH)

ifdef CONFIG_OF_EARLY_FLATTREE
all: dtbs
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ce9f3e0a7432..54069a4773ac 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -900,6 +900,7 @@ CONFIG_VIDEO_LT6911UXC=m
CONFIG_I2C_IOEXPANDER_SER_MAX9295=y
CONFIG_I2C_IOEXPANDER_DESER_MAX9296=y
CONFIG_NV_VIDEO_IMX390=y
+CONFIG_VIDEO_D4XX=m
CONFIG_NV_DESER_MAX96712=m
CONFIG_NV_VIDEO_AR0234=m
CONFIG_NV_VIDEO_HAWK_OWL=m
diff --git a/drivers/media/usb/uvc/Makefile b/drivers/media/usb/uvc/Makefile
index 4f9eee4f81ab..93c870f4988a 100644
--- a/drivers/media/usb/uvc/Makefile
+++ b/drivers/media/usb/uvc/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
+CONFIG_MODULE_SIG=n
uvcvideo-objs := uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o \
uvc_status.o uvc_isight.o uvc_debugfs.o uvc_metadata.o
ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index cc81fe83b68b..525ff5e2c93f 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -353,6 +353,7 @@ static const struct uvc_menu_info power_line_frequency_controls[] = {
{ 0, "Disabled" },
{ 1, "50 Hz" },
{ 2, "60 Hz" },
+ { 3, "Auto" },
};

static const struct uvc_menu_info exposure_auto_controls[] = {
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 20ff2a0d9370..e21c129a89c1 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -272,6 +272,109 @@ static struct uvc_format_desc uvc_fmts[] = {
.guid = UVC_GUID_FORMAT_PAIR,
.fcc = V4L2_PIX_FMT_PAIR,
},
+ {
+ .name = "Raw data 8-bit (RAW8)",
+ .guid = UVC_GUID_FORMAT_RAW8,
+ .fcc = V4L2_PIX_FMT_GREY,
+ },
+ {
+ .name = "Raw data 16-bit (RW16)",
+ .guid = UVC_GUID_FORMAT_RW16,
+ .fcc = V4L2_PIX_FMT_RW16,
+ },
+ {
+ .name = "Depth 16-bit (INVZ)",
+ .guid = UVC_GUID_FORMAT_INVZ,
+ .fcc = V4L2_PIX_FMT_Z16,
+ },
+ {
+ .name = "Depth:IR 16:8 24-bit (INZI)",
+ .guid = UVC_GUID_FORMAT_INZI,
+ .fcc = V4L2_PIX_FMT_INZI,
+ },
+ {
+ .name = "Depth 16-bit (INVR)",
+ .guid = UVC_GUID_FORMAT_INVR,
+ .fcc = V4L2_PIX_FMT_INVR,
+ },
+ {
+ .name = "Depth:IR 16:8 24-bit (INRI)",
+ .guid = UVC_GUID_FORMAT_INRI,
+ .fcc = V4L2_PIX_FMT_INRI,
+ },
+ {
+ .name = "Infrared 8-bit (INVI)",
+ .guid = UVC_GUID_FORMAT_INVI,
+ .fcc = V4L2_PIX_FMT_GREY,
+ },
+ {
+ .name = "FlickerIR 8-bit (RELI)",
+ .guid = UVC_GUID_FORMAT_RELI,
+ .fcc = V4L2_PIX_FMT_RELI,
+ },
+ {
+ .name = "Luminosity data 8-bit (L8)",
+ .guid = UVC_GUID_FORMAT_L8,
+ .fcc = V4L2_PIX_FMT_GREY,
+ },
+ {
+ .name = "Luminosity data 16-bit (L16)",
+ .guid = UVC_GUID_FORMAT_L16,
+ .fcc = V4L2_PIX_FMT_Y16,
+ },
+ {
+ .name = "Depth data 16-bit (D16)",
+ .guid = UVC_GUID_FORMAT_D16,
+ .fcc = V4L2_PIX_FMT_Z16,
+ },
+ {
+ .name = "16-bit Bayer BGBG/GRGR",
+ .guid = UVC_GUID_FORMAT_BAYER16,
+ .fcc = V4L2_PIX_FMT_SBGGR16,
+ },
+ {
+ .name = "Packed raw data 10-bit",
+ .guid = UVC_GUID_FORMAT_W10,
+ .fcc = V4L2_PIX_FMT_W10,
+ },
+ {
+ .name = "Confidence data (C )",
+ .guid = UVC_GUID_FORMAT_CONFIDENCE_MAP,
+ .fcc = V4L2_PIX_FMT_CONFIDENCE_MAP,
+ },
+ /* FishEye 8-bit monochrome */
+ {
+ .name = "Raw data 8-bit (RAW8)",
+ .guid = UVC_GUID_FORMAT_RAW8,
+ .fcc = V4L2_PIX_FMT_GREY,
+ },
+ /* Legacy/Development formats for backward-compatibility*/
+ {
+ .name = "Raw data 16-bit (RW16)",
+ .guid = UVC_GUID_FORMAT_RW16,
+ .fcc = V4L2_PIX_FMT_RW16,
+ },
+ {
+ .name = "Frame Grabber (FG )",
+ .guid = UVC_GUID_FORMAT_FG,
+ .fcc = V4L2_PIX_FMT_FG,
+ },
+ {
+ .name = "SR300 Depth/Confidence (INZC)",
+ .guid = UVC_GUID_FORMAT_INZC,
+ .fcc = V4L2_PIX_FMT_INZC,
+ },
+ {
+ .name = "Relative IR (PAIR)",
+ .guid = UVC_GUID_FORMAT_PAIR,
+ .fcc = V4L2_PIX_FMT_PAIR,
+ },
+ {
+ .name = "Z16 Huffman Compression",
+ .guid = UVC_GUID_FORMAT_Z16H,
+ .fcc = V4L2_PIX_FMT_Z16H,
+ },
+
};

/* ------------------------------------------------------------------------
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 7b904a767d08..f7bec71be05f 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -151,9 +151,24 @@
#define UVC_GUID_FORMAT_INZI \
{ 'I', 'N', 'Z', 'I', 0x66, 0x1a, 0x42, 0xa2, \
0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
+#define UVC_GUID_FORMAT_INVR \
+ { 'I', 'N', 'V', 'R', 0x90, 0x2d, 0x58, 0x4a, \
+ 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
+#define UVC_GUID_FORMAT_INRI \
+ { 'I', 'N', 'R', 'I', 0x90, 0x2d, 0x58, 0x4a, \
+ 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
#define UVC_GUID_FORMAT_INVI \
{ 'I', 'N', 'V', 'I', 0xdb, 0x57, 0x49, 0x5e, \
0x8e, 0x3f, 0xf4, 0x79, 0x53, 0x2b, 0x94, 0x6f}
+#define UVC_GUID_FORMAT_RELI \
+ { 'R', 'E', 'L', 'I', 0x14, 0x13, 0x43, 0xf9, \
+ 0xa7, 0x5a, 0xee, 0x6b, 0xbf, 0x01, 0x2e, 0x23}
+#define UVC_GUID_FORMAT_L8 \
+ { '2', 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_L16 \
+ { 'Q', 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
#define UVC_GUID_FORMAT_CNF4 \
{ 'C', ' ', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index a99e82ec9ab6..abf4633b1ee4 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -224,6 +224,20 @@ static int put_v4l2_window32(struct v4l2_window __user *p64,
return 0;
}

+static inline int get_v4l2_meta_format(struct v4l2_meta_format *kp, struct v4l2_meta_format __user *up)
+{
+ if (copy_from_user(kp, up, sizeof(struct v4l2_meta_format)))
+ return -EFAULT;
+ return 0;
+}
+
+static inline int put_v4l2_meta_format(struct v4l2_meta_format *kp, struct v4l2_meta_format __user *up)
+{
+ if (copy_to_user(up, kp, sizeof(struct v4l2_meta_format)))
+ return -EFAULT;
+ return 0;
+}
+
struct v4l2_format32 {
__u32 type; /* enum v4l2_buf_type */
union {
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index a593ea0598b5..8a7ac8dd44c7 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -602,26 +602,30 @@ static void determine_valid_ioctls(struct video_device *vdev)
if (is_vid) {
/* video specific ioctls */
if ((is_rx && (ops->vidioc_enum_fmt_vid_cap ||
- ops->vidioc_enum_fmt_vid_overlay)) ||
+ ops->vidioc_enum_fmt_vid_overlay ||
+ ops->vidioc_enum_fmt_meta_cap)) ||
(is_tx && ops->vidioc_enum_fmt_vid_out))
set_bit(_IOC_NR(VIDIOC_ENUM_FMT), valid_ioctls);
if ((is_rx && (ops->vidioc_g_fmt_vid_cap ||
ops->vidioc_g_fmt_vid_cap_mplane ||
- ops->vidioc_g_fmt_vid_overlay)) ||
+ ops->vidioc_g_fmt_vid_overlay ||
+ ops->vidioc_g_fmt_meta_cap)) ||
(is_tx && (ops->vidioc_g_fmt_vid_out ||
ops->vidioc_g_fmt_vid_out_mplane ||
ops->vidioc_g_fmt_vid_out_overlay)))
set_bit(_IOC_NR(VIDIOC_G_FMT), valid_ioctls);
if ((is_rx && (ops->vidioc_s_fmt_vid_cap ||
ops->vidioc_s_fmt_vid_cap_mplane ||
- ops->vidioc_s_fmt_vid_overlay)) ||
+ ops->vidioc_s_fmt_vid_overlay ||
+ ops->vidioc_s_fmt_meta_cap)) ||
(is_tx && (ops->vidioc_s_fmt_vid_out ||
ops->vidioc_s_fmt_vid_out_mplane ||
ops->vidioc_s_fmt_vid_out_overlay)))
set_bit(_IOC_NR(VIDIOC_S_FMT), valid_ioctls);
if ((is_rx && (ops->vidioc_try_fmt_vid_cap ||
ops->vidioc_try_fmt_vid_cap_mplane ||
- ops->vidioc_try_fmt_vid_overlay)) ||
+ ops->vidioc_try_fmt_vid_overlay ||
+ ops->vidioc_try_fmt_meta_cap)) ||
(is_tx && (ops->vidioc_try_fmt_vid_out ||
ops->vidioc_try_fmt_vid_out_mplane ||
ops->vidioc_try_fmt_vid_out_overlay)))
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 62550fb6ca08..945ecb3842d9 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1300,6 +1300,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break;
case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break;
case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break;
+ case V4L2_PIX_FMT_Y8: descr = "Y8-bit Greyscale"; break;
case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break;
case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break;
case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index f750b6cce0e8..1e9e7e2e18de 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -738,11 +738,15 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
#define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
+#define V4L2_PIX_FMT_Y8 v4l2_fourcc('Y', '8', ' ', ' ') /* Greyscale 8-bit */
#define V4L2_PIX_FMT_Y8I v4l2_fourcc('Y', '8', 'I', ' ') /* Greyscale 8-bit L/R interleaved */
#define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */
#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
+#define V4L2_PIX_FMT_INVR v4l2_fourcc('I', 'N', 'V', 'R') /* 16 Depth */
+#define V4L2_PIX_FMT_INRI v4l2_fourcc('I', 'N', 'R', 'I') /* 24 Depth/IR 16:8 */
+#define V4L2_PIX_FMT_RELI v4l2_fourcc('R', 'E', 'L', 'I') /* 8 IR alternating on off illumination */
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
#define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */
#define V4L2_PIX_FMT_RW16 v4l2_fourcc('R', 'W', '1', '6') /* Raw data 16-bit */
@@ -2287,6 +2291,7 @@ struct v4l2_sdr_format {
struct v4l2_meta_format {
__u32 dataformat;
__u32 buffersize;
+ __u8 reserved[24];
} __attribute__ ((packed));

/**
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 91a502bb97e8..6ed7d9a38b87 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -146,6 +146,7 @@ if [ "$ARCH" = "um" ] ; then
else
cp System.map "$tmpdir/boot/System.map-$version"
cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
+ cp "arch/$SRCARCH/boot/Image" "$tmpdir/boot/Image-$version"
fi
cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"

--
2.34.1

Loading

0 comments on commit 0a9d5c9

Please sign in to comment.