How to set format yuyv8_2x8 on orin nx ,jetpack 5.1.2?

HELLO, i want to know how to set format yuyv8_2x8 ,
because in dts, i set mode_type = “yuv” , pixel_phase = “yuyv”; csi_pixel_bit_depth = “16”;
but by media-ctl cmd ,it shows yuyv8_1x16, so i want to change it, how i change it ???

hello 741024073,

according to VI driver, it’s by default support YUV with 16-bit formats.
for your use-case, please extend the pixel formats to report correct v4l2 fourcc to low level driver side.
for example,
$TOP/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/sensor_common.c

static int extract_pixel_format( 
        const char *pixel_t, u32 *format)
{
...
        else if (strncmp(pixel_t, "yuv_yuyv16", size) == 0)
                *format = V4L2_PIX_FMT_YUYV;

$TOP/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/camera_common.c

static const struct camera_common_colorfmt camera_common_color_fmts[] = {
...
        {    
                MEDIA_BUS_FMT_YUYV8_1X16,
                V4L2_COLORSPACE_SRGB,
                V4L2_PIX_FMT_YUYV,
        }, 

i know this, in camera_common_color_fmts , it have two
V4L2_PIX_FMT_YUYV,
{
MEDIA_BUS_FMT_YUYV8_1X16,
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_YUYV,
},
{
MEDIA_BUS_FMT_YUYV8_2X8,
V4L2_COLORSPACE_SRGB,
V4L2_PIX_FMT_YUYV,
},
so it default pick first one MEDIA_BUS_FMT_YUYV8_1X16, but i want to set MEDIA_BUS_FMT_YUYV8_2X8…

you may modify the code for your customize driver.