Greyscale sensor on Xavier

Hi everyone,

I’m preparing the integration of a CSI 16-bit-greyscale sensor on a Jetson Xavier board. Could you tell if I’m doing it right ?

  • NVIDIA Jetson Linux 35.1
  • Using CSI RAW16 data type, which is supported by the Jetson Xavier NVCSI subsystem, but not by 35.1 Linux. Does the RTCPU support it ?
  • Patches of NVIDIA drivers :
diff --git a/nvidia/drivers/media/platform/tegra/camera/camera_common.c b/nvidia/drivers/media/platform/tegra/camera/camera_common.c
index 2b0b341b0..74388ff77 100644
--- a/nvidia/drivers/media/platform/tegra/camera/camera_common.c
+++ b/nvidia/drivers/media/platform/tegra/camera/camera_common.c
@@ -131,6 +131,11 @@ static const struct camera_common_colorfmt camera_common_color_fmts[] = {
                V4L2_COLORSPACE_SRGB,
                V4L2_PIX_FMT_VYUY,
        },
+       {
+               MEDIA_BUS_FMT_FIXED,
+               V4L2_COLORSPACE_RAW,
+               V4L2_PIX_FMT_Y16,
+       },
        /*
         * The below two formats are not supported by VI4,
         * keep them at the last to ensure they get discarded

diff --git a/nvidia/drivers/media/platform/tegra/camera/sensor_common.c b/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
index 69dbf2d96..c45deaf70 100644
--- a/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
+++ b/nvidia/drivers/media/platform/tegra/camera/sensor_common.c
@@ -265,6 +265,8 @@ static int extract_pixel_format(
                *format = V4L2_PIX_FMT_UYVY;
        else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
                *format = V4L2_PIX_FMT_VYUY;
+       else if (strncmp(pixel_t, "raw_grey16", size) == 0)
+               *format = V4L2_PIX_FMT_Y16;
        else {
                pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
                return -EINVAL;


diff --git a/nvidia/drivers/media/platform/tegra/camera/vi/vi5_formats.h b/nvidia/drivers/media/platform/tegra/camera/vi/vi5_formats.h
index 51cbbad5b..915eb1e58 100644
--- a/nvidia/drivers/media/platform/tegra/camera/vi/vi5_formats.h
+++ b/nvidia/drivers/media/platform/tegra/camera/vi/vi5_formats.h
@@ -116,6 +116,10 @@ static const struct tegra_video_format vi5_video_formats[] = {
        TEGRA_VIDEO_FORMAT(RAW12, 12, SBGGR12_1X12, 2, 1, T_R16,
                                RAW12, SBGGR12, "BGBG.. GRGR.."),

+       /* RAW 16 */
+        TEGRA_VIDEO_FORMAT(RAW16, 16, FIXED, 2, 1, T_R16,
+                                RAW16, Y16, "RAW16"),
+
        /* RGB888 */
        TEGRA_VIDEO_FORMAT(RGB888, 24, RGB888_1X24, 4, 1, T_A8R8G8B8,
                                RGB888, ABGR32, "BGRA-8-8-8-8"),

diff --git a/nvidia/include/media/tegra_camera_core.h b/nvidia/include/media/tegra_camera_core.h
index 788cf77dc..c35bdc464 100644
--- a/nvidia/include/media/tegra_camera_core.h
+++ b/nvidia/include/media/tegra_camera_core.h
@@ -56,6 +56,7 @@ enum tegra_image_dt {
        TEGRA_IMAGE_DT_RAW10,
        TEGRA_IMAGE_DT_RAW12,
        TEGRA_IMAGE_DT_RAW14,
+       TEGRA_IMAGE_DT_RAW16,
 };

 /* Supported CSI to VI Data Formats */
@@ -66,6 +67,7 @@ enum tegra_vf_code {
        TEGRA_VF_RAW10,
        TEGRA_VF_RAW12,
        TEGRA_VF_RAW14,
+       TEGRA_VF_RAW16,
        TEGRA_VF_EMBEDDED8,
        TEGRA_VF_RGB565,
        TEGRA_VF_RGB555,

About TEGRA_IMAGE_DT_RAW16=46 (0x2E), I’m quite confident it is the correct value as it is the MIPI standard value, but is it supported by the RTCPU ?
About TEGRA_VF_RAW16=6, I’m not sure if is the correct way to add the enum in the middle of codes.

  • Device Tree configuration :
mode0 {
	(...)
	mode_type = "raw";
	pixel_phase = "grey";
	csi_pixel_bit_depth = "16";
	(...)

hello utilisateur3107,

driver implementation looks correct, are you able to recognize this sensor to linux kernel and register it?

Hi JerryChang,

Thank you for answering. Yes, the sensor is registered in the linux kernel. The video pipeline is not ready yet for testing, I’ll let you know if I face some issue during the integration.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.