linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] media: uvcvideo: Fix comments in uvc_meta_detect_msxu
@ 2025-07-16 10:43 Ricardo Ribalda
  2025-07-21 12:14 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Ribalda @ 2025-07-16 10:43 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Mauro Carvalho Chehab,
	Hans Verkuil
  Cc: linux-media, linux-kernel, Ricardo Ribalda

The comments can be more precise. Let's fix them.

Fixes: 6cb786f040ad ("media: uvcvideo: Auto-set UVC_QUIRK_MSXU_META")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
This series fixes the uvc metadata series landed in:
https://patchwork.linuxtv.org/project/linux-media/patch/998c5fb0-8d32-496c-a1e2-cc9c1a73ede0@kernel.org/

There is no need to Cc: stable, because the series have not landed in
any stable kernel.
---
Changes in v2:
- Improve comment even more... Thanks Laurent
- Link to v1: https://lore.kernel.org/r/20250714-uvc-meta-followup-v1-1-67bd2dc05ef2@chromium.org
---
 drivers/media/usb/uvc/uvc_metadata.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c
index 229e08ff323eed9129d835b24ea2e8085bb713b8..2eea543b0575598279d7537ea767ca521b6431c0 100644
--- a/drivers/media/usb/uvc/uvc_metadata.c
+++ b/drivers/media/usb/uvc/uvc_metadata.c
@@ -196,7 +196,10 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
 	if (!data)
 		return -ENOMEM;
 
-	/* Check if the metadata is already enabled. */
+	/*
+	 * Check if the metadata is already enabled, or if the device always
+	 * returns metadata.
+	 */
 	ret = uvc_query_ctrl(dev, UVC_GET_CUR, entity->id, dev->intfnum,
 			     MSXU_CONTROL_METADATA, data, sizeof(*data));
 	if (ret)
@@ -208,9 +211,11 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
 	}
 
 	/*
-	 * We have seen devices that require 1 to enable the metadata, others
-	 * requiring a value != 1 and others requiring a value >1. Luckily for
-	 * us, the value from GET_MAX seems to work all the time.
+	 * Set the value of MSXU_CONTROL_METADATA to the value reported by
+	 * GET_MAX to enable production of MSXU metadata. The GET_MAX request
+	 * reports the maximum size of the metadata, if its value is 0 then MSXU
+	 * metadata is not supported. For more information, see
+	 * https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#2229-metadata-control
 	 */
 	ret = uvc_query_ctrl(dev, UVC_GET_MAX, entity->id, dev->intfnum,
 			     MSXU_CONTROL_METADATA, data, sizeof(*data));

---
base-commit: d968e50b5c26642754492dea23cbd3592bde62d8
change-id: 20250714-uvc-meta-followup-1ccb6e8efc2b

Best regards,
-- 
Ricardo Ribalda <ribalda@chromium.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media: uvcvideo: Fix comments in uvc_meta_detect_msxu
  2025-07-16 10:43 [PATCH v2] media: uvcvideo: Fix comments in uvc_meta_detect_msxu Ricardo Ribalda
@ 2025-07-21 12:14 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2025-07-21 12:14 UTC (permalink / raw)
  To: Ricardo Ribalda, Laurent Pinchart, Mauro Carvalho Chehab,
	Hans Verkuil
  Cc: linux-media, linux-kernel

Hi,

On 16-Jul-25 12:43 PM, Ricardo Ribalda wrote:
> The comments can be more precise. Let's fix them.
> 
> Fixes: 6cb786f040ad ("media: uvcvideo: Auto-set UVC_QUIRK_MSXU_META")
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> This series fixes the uvc metadata series landed in:
> https://patchwork.linuxtv.org/project/linux-media/patch/998c5fb0-8d32-496c-a1e2-cc9c1a73ede0@kernel.org/
> 
> There is no need to Cc: stable, because the series have not landed in
> any stable kernel.
> ---
> Changes in v2:
> - Improve comment even more... Thanks Laurent
> - Link to v1: https://lore.kernel.org/r/20250714-uvc-meta-followup-v1-1-67bd2dc05ef2@chromium.org

Thank you for your patch.

I have merged this into:

https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/for-next/

Regards,

Hans



> ---
>  drivers/media/usb/uvc/uvc_metadata.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c
> index 229e08ff323eed9129d835b24ea2e8085bb713b8..2eea543b0575598279d7537ea767ca521b6431c0 100644
> --- a/drivers/media/usb/uvc/uvc_metadata.c
> +++ b/drivers/media/usb/uvc/uvc_metadata.c
> @@ -196,7 +196,10 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
>  	if (!data)
>  		return -ENOMEM;
>  
> -	/* Check if the metadata is already enabled. */
> +	/*
> +	 * Check if the metadata is already enabled, or if the device always
> +	 * returns metadata.
> +	 */
>  	ret = uvc_query_ctrl(dev, UVC_GET_CUR, entity->id, dev->intfnum,
>  			     MSXU_CONTROL_METADATA, data, sizeof(*data));
>  	if (ret)
> @@ -208,9 +211,11 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
>  	}
>  
>  	/*
> -	 * We have seen devices that require 1 to enable the metadata, others
> -	 * requiring a value != 1 and others requiring a value >1. Luckily for
> -	 * us, the value from GET_MAX seems to work all the time.
> +	 * Set the value of MSXU_CONTROL_METADATA to the value reported by
> +	 * GET_MAX to enable production of MSXU metadata. The GET_MAX request
> +	 * reports the maximum size of the metadata, if its value is 0 then MSXU
> +	 * metadata is not supported. For more information, see
> +	 * https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#2229-metadata-control
>  	 */
>  	ret = uvc_query_ctrl(dev, UVC_GET_MAX, entity->id, dev->intfnum,
>  			     MSXU_CONTROL_METADATA, data, sizeof(*data));
> 
> ---
> base-commit: d968e50b5c26642754492dea23cbd3592bde62d8
> change-id: 20250714-uvc-meta-followup-1ccb6e8efc2b
> 
> Best regards,


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-21 12:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 10:43 [PATCH v2] media: uvcvideo: Fix comments in uvc_meta_detect_msxu Ricardo Ribalda
2025-07-21 12:14 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).