diff mbox series

[v2,2/7] usb: uvc: Enumerate valid values for color matching

Message ID 20221219144316.757680-3-dan.scally@ideasonboard.com (mailing list archive)
State Superseded
Headers show
Series UVC Gadget: Extend color matching support | expand

Commit Message

Dan Scally Dec. 19, 2022, 2:43 p.m. UTC
The color matching descriptors defined in the UVC 1.5 Specification
contain 3 fields with discrete numeric values representing particular
settings. Enumerate those values so that later code setting them can
be more readable.

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
Changes in v2:

  - New patch

 include/uapi/linux/usb/video.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Dan Scally Dec. 19, 2022, 2:45 p.m. UTC | #1
On 19/12/2022 14:43, Daniel Scally wrote:
> The color matching descriptors defined in the UVC 1.5 Specification
> contain 3 fields with discrete numeric values representing particular
> settings. Enumerate those values so that later code setting them can
> be more readable.
>
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---
> Changes in v2:
>
>    - New patch
>
>   include/uapi/linux/usb/video.h | 30 ++++++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
>
> diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
> index 6e8e572c2980..08606a52e1e2 100644
> --- a/include/uapi/linux/usb/video.h
> +++ b/include/uapi/linux/usb/video.h
> @@ -179,6 +179,36 @@
>   #define UVC_CONTROL_CAP_AUTOUPDATE			(1 << 3)
>   #define UVC_CONTROL_CAP_ASYNCHRONOUS			(1 << 4)
>   
> +/* ref Color Matching Descriptor Values */


_Immediately_ noticed that I forgot to replace the placeholder with the 
actual reference to the document - sorry...I'll fix that in the v3

> +enum uvc_color_primaries_values {
> +	UVC_COLOR_PRIMARIES_UNSPECIFIED,
> +	UVC_COLOR_PRIMARIES_BT_709_SRGB,
> +	UVC_COLOR_PRIMARIES_BT_470_2_M,
> +	UVC_COLOR_PRIMARIES_BT_470_2_B_G,
> +	UVC_COLOR_PRIMARIES_SMPTE_170M,
> +	UVC_COLOR_PRIMARIES_SMPTE_240M,
> +};
> +
> +enum uvc_transfer_characteristics_values {
> +	UVC_TRANSFER_CHARACTERISTICS_UNSPECIFIED,
> +	UVC_TRANSFER_CHARACTERISTICS_BT_709,
> +	UVC_TRANSFER_CHARACTERISTICS_BT_470_2_M,
> +	UVC_TRANSFER_CHARACTERISTICS_BT_470_2_B_G,
> +	UVC_TRANSFER_CHARACTERISTICS_SMPTE_170M,
> +	UVC_TRANSFER_CHARACTERISTICS_SMPTE_240M,
> +	UVC_TRANSFER_CHARACTERISTICS_LINEAR,
> +	UVC_TRANSFER_CHARACTERISTICS_SRGB,
> +};
> +
> +enum uvc_matrix_coefficients {
> +	UVC_MATRIX_COEFFICIENTS_UNSPECIFIED,
> +	UVC_MATRIX_COEFFICIENTS_BT_709,
> +	UVC_MATRIX_COEFFICIENTS_FCC,
> +	UVC_MATRIX_COEFFICIENTS_BT_470_2_B_G,
> +	UVC_MATRIX_COEFFICIENTS_SMPTE_170M,
> +	UVC_MATRIX_COEFFICIENTS_SMPTE_240M,
> +};
> +
>   /* ------------------------------------------------------------------------
>    * UVC structures
>    */
Laurent Pinchart Dec. 28, 2022, 2:14 a.m. UTC | #2
Hi Dan,

Thank you for the patch.

On Mon, Dec 19, 2022 at 02:45:07PM +0000, Dan Scally wrote:
> On 19/12/2022 14:43, Daniel Scally wrote:
> > The color matching descriptors defined in the UVC 1.5 Specification

Not just UVC 1.5, but also UVC 1.1. I would just say "UVC" gere.

> > contain 3 fields with discrete numeric values representing particular
> > settings. Enumerate those values so that later code setting them can
> > be more readable.
> >
> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> > ---
> > Changes in v2:
> >
> >    - New patch
> >
> >   include/uapi/linux/usb/video.h | 30 ++++++++++++++++++++++++++++++
> >   1 file changed, 30 insertions(+)
> >
> > diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
> > index 6e8e572c2980..08606a52e1e2 100644
> > --- a/include/uapi/linux/usb/video.h
> > +++ b/include/uapi/linux/usb/video.h
> > @@ -179,6 +179,36 @@
> >   #define UVC_CONTROL_CAP_AUTOUPDATE			(1 << 3)
> >   #define UVC_CONTROL_CAP_ASYNCHRONOUS			(1 << 4)
> >   
> > +/* ref Color Matching Descriptor Values */
> 
> _Immediately_ noticed that I forgot to replace the placeholder with the 
> actual reference to the document - sorry...I'll fix that in the v3

Conditionally-Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

with this fixed.

> > +enum uvc_color_primaries_values {
> > +	UVC_COLOR_PRIMARIES_UNSPECIFIED,
> > +	UVC_COLOR_PRIMARIES_BT_709_SRGB,
> > +	UVC_COLOR_PRIMARIES_BT_470_2_M,
> > +	UVC_COLOR_PRIMARIES_BT_470_2_B_G,
> > +	UVC_COLOR_PRIMARIES_SMPTE_170M,
> > +	UVC_COLOR_PRIMARIES_SMPTE_240M,
> > +};
> > +
> > +enum uvc_transfer_characteristics_values {
> > +	UVC_TRANSFER_CHARACTERISTICS_UNSPECIFIED,
> > +	UVC_TRANSFER_CHARACTERISTICS_BT_709,
> > +	UVC_TRANSFER_CHARACTERISTICS_BT_470_2_M,
> > +	UVC_TRANSFER_CHARACTERISTICS_BT_470_2_B_G,
> > +	UVC_TRANSFER_CHARACTERISTICS_SMPTE_170M,
> > +	UVC_TRANSFER_CHARACTERISTICS_SMPTE_240M,
> > +	UVC_TRANSFER_CHARACTERISTICS_LINEAR,
> > +	UVC_TRANSFER_CHARACTERISTICS_SRGB,
> > +};
> > +
> > +enum uvc_matrix_coefficients {
> > +	UVC_MATRIX_COEFFICIENTS_UNSPECIFIED,
> > +	UVC_MATRIX_COEFFICIENTS_BT_709,
> > +	UVC_MATRIX_COEFFICIENTS_FCC,
> > +	UVC_MATRIX_COEFFICIENTS_BT_470_2_B_G,
> > +	UVC_MATRIX_COEFFICIENTS_SMPTE_170M,
> > +	UVC_MATRIX_COEFFICIENTS_SMPTE_240M,
> > +};
> > +
> >   /* ------------------------------------------------------------------------
> >    * UVC structures
> >    */
diff mbox series

Patch

diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
index 6e8e572c2980..08606a52e1e2 100644
--- a/include/uapi/linux/usb/video.h
+++ b/include/uapi/linux/usb/video.h
@@ -179,6 +179,36 @@ 
 #define UVC_CONTROL_CAP_AUTOUPDATE			(1 << 3)
 #define UVC_CONTROL_CAP_ASYNCHRONOUS			(1 << 4)
 
+/* ref Color Matching Descriptor Values */
+enum uvc_color_primaries_values {
+	UVC_COLOR_PRIMARIES_UNSPECIFIED,
+	UVC_COLOR_PRIMARIES_BT_709_SRGB,
+	UVC_COLOR_PRIMARIES_BT_470_2_M,
+	UVC_COLOR_PRIMARIES_BT_470_2_B_G,
+	UVC_COLOR_PRIMARIES_SMPTE_170M,
+	UVC_COLOR_PRIMARIES_SMPTE_240M,
+};
+
+enum uvc_transfer_characteristics_values {
+	UVC_TRANSFER_CHARACTERISTICS_UNSPECIFIED,
+	UVC_TRANSFER_CHARACTERISTICS_BT_709,
+	UVC_TRANSFER_CHARACTERISTICS_BT_470_2_M,
+	UVC_TRANSFER_CHARACTERISTICS_BT_470_2_B_G,
+	UVC_TRANSFER_CHARACTERISTICS_SMPTE_170M,
+	UVC_TRANSFER_CHARACTERISTICS_SMPTE_240M,
+	UVC_TRANSFER_CHARACTERISTICS_LINEAR,
+	UVC_TRANSFER_CHARACTERISTICS_SRGB,
+};
+
+enum uvc_matrix_coefficients {
+	UVC_MATRIX_COEFFICIENTS_UNSPECIFIED,
+	UVC_MATRIX_COEFFICIENTS_BT_709,
+	UVC_MATRIX_COEFFICIENTS_FCC,
+	UVC_MATRIX_COEFFICIENTS_BT_470_2_B_G,
+	UVC_MATRIX_COEFFICIENTS_SMPTE_170M,
+	UVC_MATRIX_COEFFICIENTS_SMPTE_240M,
+};
+
 /* ------------------------------------------------------------------------
  * UVC structures
  */