mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	senozhatsky@chromium.org
Cc: Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH 05/10] media: uvcvideo: Define Control and GUIDs for class ctrls
Date: Thu, 11 Mar 2021 13:20:35 +0100	[thread overview]
Message-ID: <20210311122040.1264410-7-ribalda@chromium.org> (raw)
In-Reply-To: <20210311122040.1264410-1-ribalda@chromium.org>

Add new bindings for class controls. This controls will be implemented
by a virtual entity.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 34 ++++++++++++++++++++++++++++++++
 drivers/media/usb/uvc/uvcvideo.h |  8 ++++++++
 2 files changed, 42 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 08877897dc5a..fd4d5ad098b9 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -355,6 +355,20 @@ static const struct uvc_control_info uvc_ctrls[] = {
 		.flags		= UVC_CTRL_FLAG_GET_CUR
 				| UVC_CTRL_FLAG_AUTO_UPDATE,
 	},
+	{
+		.entity		= UVC_GUID_CTRL_CLASS,
+		.selector	= UVC_CC_CAMERA_CLASS,
+		.index		= 0,
+		.size		= 1,
+		.flags		= 0,
+	},
+	{
+		.entity		= UVC_GUID_CTRL_CLASS,
+		.selector	= UVC_CC_USER_CLASS,
+		.index		= 1,
+		.size		= 1,
+		.flags		= 0,
+	},
 };
 
 static const struct uvc_menu_info power_line_frequency_controls[] = {
@@ -753,6 +767,26 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
 		.v4l2_type	= V4L2_CTRL_TYPE_BOOLEAN,
 		.data_type	= UVC_CTRL_DATA_TYPE_BOOLEAN,
 	},
+	{
+		.id		= V4L2_CID_CAMERA_CLASS,
+		.name		= "Camera Controls",
+		.entity		= UVC_GUID_CTRL_CLASS,
+		.selector	= UVC_CC_CAMERA_CLASS,
+		.size		= 1,
+		.offset		= 0,
+		.v4l2_type	= V4L2_CTRL_TYPE_CTRL_CLASS,
+		.data_type	= UVC_CTRL_DATA_TYPE_BOOLEAN,
+	},
+	{
+		.id		= V4L2_CID_USER_CLASS,
+		.name		= "User Controls",
+		.entity		= UVC_GUID_CTRL_CLASS,
+		.selector	= UVC_CC_USER_CLASS,
+		.size		= 1,
+		.offset		= 0,
+		.v4l2_type	= V4L2_CTRL_TYPE_CTRL_CLASS,
+		.data_type	= UVC_CTRL_DATA_TYPE_BOOLEAN,
+	},
 };
 
 /* ------------------------------------------------------------------------
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 97df5ecd66c9..5792232ed312 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -62,6 +62,9 @@
 #define UVC_GUID_EXT_GPIO_CONTROLLER \
 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03}
+#define UVC_GUID_CTRL_CLASS \
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04}
 
 #define UVC_GUID_FORMAT_MJPEG \
 	{ 'M',  'J',  'P',  'G', 0x00, 0x00, 0x10, 0x00, \
@@ -175,6 +178,11 @@
 	{ 'H',  'E',  'V',  'C', 0x00, 0x00, 0x10, 0x00, \
 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 
+/* ------------------------------------------------------------------------
+ * Control Class Constants
+ */
+#define UVC_CC_CAMERA_CLASS	0
+#define UVC_CC_USER_CLASS	1
 
 /* ------------------------------------------------------------------------
  * Driver specific constants.
-- 
2.31.0.rc2.261.g7f71774620-goog


  parent reply	other threads:[~2021-03-11 12:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 12:20 [PATCH 00/10] uvcvideo: Pass v4l2-compliance test Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 01/10] media: uvcvideo: Return -EINVAL for REQUEST API Ricardo Ribalda
2021-03-11 12:20 ` [PATCH] media: videobuf2: Explicitly state max size of planes Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 02/10] media: uvcvideo: Set capability in s_param Ricardo Ribalda
2021-03-11 15:42   ` Laurent Pinchart
2021-03-11 12:20 ` [PATCH 03/10] media: uvcvideo: Return -EIO for control errors Ricardo Ribalda
2021-03-11 14:08   ` Ricardo Ribalda
2021-03-11 15:57     ` Laurent Pinchart
2021-03-11 21:56       ` Ricardo Ribalda Delgado
2021-03-11 14:08   ` Hans Verkuil
2021-03-11 12:20 ` [PATCH 04/10] media: uvcvideo: Add support for V4L2_CTRL_TYPE_CTRL_CLASS Ricardo Ribalda
2021-03-11 12:20 ` Ricardo Ribalda [this message]
2021-03-11 12:20 ` [PATCH 06/10] media: uvcvideo: Implement UVC_CTRL_CLASS_UNIT Ricardo Ribalda
2021-03-11 16:06   ` Laurent Pinchart
2021-03-11 12:20 ` [PATCH 07/10] media: uvcvideo: set error_idx to count on EACCESS Ricardo Ribalda
2021-03-11 16:18   ` Laurent Pinchart
2021-03-11 21:51     ` Ricardo Ribalda Delgado
2021-03-11 12:20 ` [PATCH 08/10] media: uvcvideo: Always return a value on V4L2_CTRL_WHICH_DEF_VAL Ricardo Ribalda
2021-03-11 16:21   ` Laurent Pinchart
2021-03-11 12:20 ` [PATCH 09/10] media: uvcvideo: Do not create initial events for class ctrls Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 10/10] media: uvcvideo: Populate only active control classes Ricardo Ribalda
2021-03-11 14:31   ` Hans Verkuil
2021-03-11 15:21     ` Ricardo Ribalda Delgado
2021-03-11 15:59       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210311122040.1264410-7-ribalda@chromium.org \
    --to=ribalda@chromium.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®