Add YUV420 sensor support

I’m trying to modify my YUV422(16bpp) sensor driver to capture YUV420(12bpp). The driver works fine with YUV422 I am able to capture stream with v4l2-ctl and gstreamer without any problems.

The sensor is able to stream YUV420 but I cannot capture it on jetson side. I have modified the device tree, and kernel images like so:

mode0 {
          mclk_khz = "48000";
          num_lanes = [34 00];
          tegra_sinterface = "serial_a";
          cil_settletime = "20";
          phy_mode = "DPHY";
          csi_pixel_bit_depth = "12";
          discontinuous_clk = "yes";
          mode_type = "yuv";
          pixel_phase = "uyvy";
          active_w = "640";
          active_h = "480";
          readout_orientation = [30 00];
          line_length = "640";
          pix_clk_hz = "280000000";
          embedded_metadata_height = [30 00];
};

Kernel files sensor_common.c and camera_common.c changes:

static int extract_pixel_format(
        const char *pixel_t, u32 *format)
{

          ...

          else if (strncmp(pixel_t, "yuv_uyvy12", size) == 0) //yuv420
                *format = V4L2_PIX_FMT_YUV420;
          ...
}
static const struct camera_common_colorfmt camera_common_color_fmts[] = {
        ...
        {
                MEDIA_BUS_FMT_UYVY8_1_5X8,
                V4L2_COLORSPACE_SRGB,
                V4L2_PIX_FMT_YUV420,
        },
        ...
}

Kernel compiles and installs successfully. After I insmod my driver I get a segmentation fault(NULL pointer derefference).

What is the correct way to support YUV420 format?

Hi,
YUV420 is not supported. It is hardware constraint. Please capture YUV422 such as UYVY or YUYV.

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