From 0308b8b14b58779a0ad4f1b12e6fea36200d0944 Mon Sep 17 00:00:00 2001 From: Akash Kumar Date: Mon, 13 Oct 2025 15:54:38 +0530 Subject: [PATCH] usb: gadget: uvc: Add grey and I420 YUV UVC format support uvc_formats[] needs to be updated with bitsperpixel,fcc tuple so that these formats can be passed by user space to S_FMT ioctl. user space must use streaming/uncompressed/u/guidFormat to specify the guid. user space must use streaming/uncompressed/u/bBitsPerPixel to set the bitsperpixel. In this case they are 8 and 12 respectively for grey and yuv420. GUID for these formats taken from drivers/media/usb/uvc/uvc_driver.c V4L2_PIX_FMT_GREY: { 'Y', '8', ' ', ' ', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} (bitsperpixel) : 8 V4L2_PIX_FMT_YUV420: { 'I', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} (bitsperpixel) : 12 Change-Id: I6c164e4d77d4af03223f16a088ee743fbf0878b9 Signed-off-by: Akash Kumar --- drivers/usb/gadget/function/uvc_v4l2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index 495f0ec663ea..93d0d0d2f75f 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -58,6 +58,8 @@ struct uvc_format { static struct uvc_format uvc_formats[] = { { 16, V4L2_PIX_FMT_YUYV }, { 0, V4L2_PIX_FMT_MJPEG }, + { 12, V4L2_PIX_FMT_YUV420 }, + { 8, V4L2_PIX_FMT_GREY }, }; static int