"S_FMT cannot handle an invalid pixelformat." for MEDIA_BUS_FMT_UYVY8_2X8

thanks, which fmt the code 0x200F means?
if there is some documents for reading, that’s will be better!

The function camera_common_find_datafmt(mf->code) here the mf->code should be MEDIA_BUS_FMT_UYVY8_2X8 instead of 0x200f

https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/subdev-formats.html

thank you, 0x200F is MEDIA_BUS_FMT_UYVY8_1X16, I will try to trace!

static int
__tegra_channel_try_format(struct tegra_channel *chan,
			struct v4l2_pix_format *pix)
{
	const struct tegra_video_format *vfmt;
	struct v4l2_subdev_format fmt;
	struct v4l2_subdev *sd = chan->subdev_on_csi;
	int ret = 0;
	struct v4l2_mbus_framefmt *mf = &fmt.format;

	<b>/* Use the channel format if pixformat is not supported */</b>
	vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);
	if (!vfmt) {
		pix->pixelformat = chan->format.pixelformat;
		vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);
	}

	printk("%sxxx(%u)\n", __func__,
			vfmt->code);
        ...}


here, it get the code 0x200F already!
"/* Use the channel format if pixformat is not supported "*/ means that nvidia don’t support MEDIA_BUS_FMT_UYVY8_2X8?

Could you check the vale of the pix->pixelformat before and after tegra_core_get_format_by_fourcc by hex also print below u32 value if any of them the same with pix->pixelformat.

V4L2_PIX_FMT_YUYV
V4L2_PIX_FMT_YYUV
V4L2_PIX_FMT_YVYU
V4L2_PIX_FMT_UYVY
V4L2_PIX_FMT_VYUY

[ 55.823701] __tegra_channel_try_formatpixelformat before(0x59565955)
[ 55.823707] __tegra_channel_try_formatpixelformat after(0x59565955)

[ 55.823712] V4L2_PIX_FMT_YUYV 0x56595559
[ 55.823717] V4L2_PIX_FMT_YYUV 0x56555959
[ 55.823722] V4L2_PIX_FMT_YVYU 0x55595659
[ 55.823727] V4L2_PIX_FMT_UYVY 0x59565955
[ 55.823732] V4L2_PIX_FMT_VYUY 0x59555956

printk("%spixelformat before(0x%x)\n", __func__,
			pix->pixelformat);
	/* Use the channel format if pixformat is not supported */
	vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);
	if (!vfmt) {
		pix->pixelformat = chan->format.pixelformat;
		vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);
	}
	printk("%spixelformat after(0x%x)\n", __func__,
			pix->pixelformat);
	printk("V4L2_PIX_FMT_YUYV 0x%x", V4L2_PIX_FMT_YUYV);
	printk("V4L2_PIX_FMT_YYUV 0x%x", V4L2_PIX_FMT_YYUV);
	printk("V4L2_PIX_FMT_YVYU 0x%x", V4L2_PIX_FMT_YVYU);
	printk("V4L2_PIX_FMT_UYVY 0x%x", V4L2_PIX_FMT_UYVY);
	printk("V4L2_PIX_FMT_VYUY 0x%x", V4L2_PIX_FMT_VYUY);

Could you try to remove the below from the camera_common_color_fmts in camera_common.c to try.

{
                MEDIA_BUS_FMT_UYVY8_1X16,
                V4L2_COLORSPACE_SRGB,
                V4L2_PIX_FMT_UYVY,
        },

I have removed it at beginning!
or there will be two V4L2_PIX_FMT_UYVY definition!

If you have remove it the tegra_core_get_format_by_fourcc() should return MEDIA_BUS_FMT_UYVY8_2X8(0x2006) instead of 0x200f, right.

But it returns MEDIA_BUS_FMT_UYVY8_1X16(0x200F )!What’s the problem? Xavier don’t support MEDIA_BUS_FMT_UYVY8_2X8?
or there is some other configs?

static const struct camera_common_colorfmt camera_common_color_fmts[] = {
	{
		MEDIA_BUS_FMT_SRGGB12_1X12,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB12,
	},
	{
		MEDIA_BUS_FMT_SGRBG12_1X12,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SGRBG12,
	},
	{
		MEDIA_BUS_FMT_SRGGB10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB10,
	},
	{
		MEDIA_BUS_FMT_SGRBG10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SGRBG10,
	},
	{
		MEDIA_BUS_FMT_SBGGR10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SBGGR10,
	},
	{
		MEDIA_BUS_FMT_SRGGB8_1X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB8,
	},
	{
		MEDIA_BUS_FMT_YUYV8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_YUYV,
	},
	{
		MEDIA_BUS_FMT_YVYU8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_YVYU,
	},
	{
		MEDIA_BUS_FMT_UYVY8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_UYVY,
	},
	{
		MEDIA_BUS_FMT_VYUY8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_VYUY,
	},
	/*
	 * The below two formats are not supported by VI4,
	 * keep them at the last to ensure they get discarded
	 */
	{
		MEDIA_BUS_FMT_XRGGB10P_3X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_XRGGB10P,
	},
	{
		MEDIA_BUS_FMT_XBGGR10P_3X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_XRGGB10P,
	},
};

Have you remove the UYVY8_1X16 from the vi5_video_formats in the vi5_formats.h

/* YUV422 */
	TEGRA_VIDEO_FORMAT(YUV422, 16, UYVY8_1X16, 2, 1, T_U8_Y8__V8_Y8,
				YUV422_8, UYVY, "YUV 4:2:2"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, UYVY8_1X16, 1, 1, T_Y8__V8U8_N422,
				YUV422_8, NV16, "NV16"),