Takashi Iwai 0d6169
From e95765e97d9cb93258a4840440d410fa6ff7e819 Mon Sep 17 00:00:00 2001
Takashi Iwai 0d6169
From: Daniel Scally <dan.scally@ideasonboard.com>
Takashi Iwai 0d6169
Date: Fri, 16 Dec 2022 16:05:28 +0000
Takashi Iwai 0d6169
Subject: [PATCH] usb: gadget: g_webcam: Send color matching descriptor per frame
Takashi Iwai 0d6169
Git-commit: e95765e97d9cb93258a4840440d410fa6ff7e819
Takashi Iwai 0d6169
Patch-mainline: v6.2-rc5
Takashi Iwai 0d6169
References: git-fixes
Takashi Iwai 0d6169
Takashi Iwai 0d6169
Currently the color matching descriptor is only sent across the wire
Takashi Iwai 0d6169
a single time, following the descriptors for each format and frame.
Takashi Iwai 0d6169
According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching
Takashi Iwai 0d6169
Descriptors"): 
Takashi Iwai 0d6169
Takashi Iwai 0d6169
"Only one instance is allowed for a given format and if present,
Takashi Iwai 0d6169
the Color Matching descriptor shall be placed following the Video
Takashi Iwai 0d6169
and Still Image Frame descriptors for that format".
Takashi Iwai 0d6169
Takashi Iwai 0d6169
Add another reference to the color matching descriptor after the
Takashi Iwai 0d6169
yuyv frames so that it's correctly transmitted for that format
Takashi Iwai 0d6169
too.
Takashi Iwai 0d6169
Takashi Iwai 0d6169
Fixes: a9914127e834 ("USB gadget: Webcam device")
Takashi Iwai 0d6169
Cc: stable <stable@kernel.org>
Takashi Iwai 0d6169
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Takashi Iwai 0d6169
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Takashi Iwai 0d6169
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Takashi Iwai 0d6169
Link: https://lore.kernel.org/r/20221216160528.479094-1-dan.scally@ideasonboard.com
Takashi Iwai 0d6169
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Takashi Iwai 0d6169
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 0d6169
Takashi Iwai 0d6169
---
Takashi Iwai 0d6169
 drivers/usb/gadget/legacy/webcam.c | 3 +++
Takashi Iwai 0d6169
 1 file changed, 3 insertions(+)
Takashi Iwai 0d6169
Takashi Iwai 0d6169
diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
Takashi Iwai 0d6169
index 53e38f87472b..c06dd1af7a0c 100644
Takashi Iwai 0d6169
--- a/drivers/usb/gadget/legacy/webcam.c
Takashi Iwai 0d6169
+++ b/drivers/usb/gadget/legacy/webcam.c
Takashi Iwai 0d6169
@@ -293,6 +293,7 @@ static const struct uvc_descriptor_header * const uvc_fs_streaming_cls[] = {
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_format_yuv,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
Takashi Iwai 0d6169
+	(const struct uvc_descriptor_header *) &uvc_color_matching,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
Takashi Iwai 0d6169
@@ -305,6 +306,7 @@ static const struct uvc_descriptor_header * const uvc_hs_streaming_cls[] = {
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_format_yuv,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
Takashi Iwai 0d6169
+	(const struct uvc_descriptor_header *) &uvc_color_matching,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
Takashi Iwai 0d6169
@@ -317,6 +319,7 @@ static const struct uvc_descriptor_header * const uvc_ss_streaming_cls[] = {
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_format_yuv,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
Takashi Iwai 0d6169
+	(const struct uvc_descriptor_header *) &uvc_color_matching,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
Takashi Iwai 0d6169
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
Takashi Iwai 0d6169
-- 
Takashi Iwai 0d6169
2.35.3
Takashi Iwai 0d6169