All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yunke Cao <yunkec@google.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Nicolas Dufresne <nicolas@ndufresne.ca>
Cc: Tomasz Figa <tfiga@chromium.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Ricardo Ribalda <ribalda@chromium.org>,
	linux-media@vger.kernel.org, Yunke Cao <yunkec@google.com>
Subject: [PATCH v3 2/6] media: v4l2_ctrl: Add region of interest auto control
Date: Wed, 18 May 2022 15:24:08 +0900	[thread overview]
Message-ID: <20220518062412.2375586-3-yunkec@google.com> (raw)
In-Reply-To: <20220518062412.2375586-1-yunkec@google.com>

Follows the UVC v1.5 class specification.

Signed-off-by: Yunke Cao <yunkec@google.com>
---
Changelog since v2:
- Better documentation.
- Rename V4L2_CID_REGION_OF_INTEREST_AUTO_EXPOSURE to
  V4L2_REGION_OF_INTEREST_AUTO_EXPOSURE, etc. The bit masks shouldn't
  have "CID" in it.

 .../media/v4l/ext-ctrls-camera.rst            | 39 +++++++++++++++++++
 drivers/media/v4l2-core/v4l2-ctrls-defs.c     |  3 ++
 include/uapi/linux/v4l2-controls.h            |  9 +++++
 3 files changed, 51 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
index c988a72b97b2..c26c28cfcf6a 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
@@ -671,3 +671,42 @@ enum v4l2_scene_mode -
    Setting a region of interest allows the camera to optimize the capture for
    the region. The value of ``V4L2_CID_REGION_OF_INTEREST_AUTO`` control
    determines the detailed behavior.
+
+``V4L2_CID_REGION_OF_INTEREST_AUTO (bitmask)``
+    This determines which, if any, on board features should track to the
+    Region of Interest specified by the current value of
+    ``V4L2_CID_REGION_OF_INTEREST_RECT``.
+
+    Max value is a mask indicating all supported Auto
+    Controls.
+
+.. flat-table::
+    :header-rows:  0
+    :stub-columns: 0
+
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_EXPOSURE``
+      - Setting this to true enables automatic exposure time for the specified
+  	region.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_IRIS``
+      - Setting this to true enables automatic iris aperture for the specified
+	region.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_WHITE_BALANCE``
+      - Setting this to true enables automatic white balance adjustment for the
+	specified region.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_FOCUS``
+      - Setting this to true enables automatic focus adjustment for the
+	specified region.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_FACE_DETECT``
+      - Setting this to true enables automatic face detection for the
+	specified region.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_DETECT_AND_TRACK``
+      - Setting this to true enables automatic detection and tracking. The
+	current value of ``V4L2_CID_REGION_OF_INTEREST_RECT`` may be updated by
+	the firmware.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_IMAGE_STABILIZATION``
+      - Setting this to true enables automatic image stabilization. The
+	current value of ``V4L2_CID_REGION_OF_INTEREST_RECT`` may be updated by
+	the firmware.
+    * - ``V4L2_REGION_OF_INTEREST_AUTO_HIGHER_QUALITY``
+      - Setting this to true enables automatically capture the specified region
+	with higher quality if possible.
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 95f39a2d2ad2..220afc4d5244 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -1043,6 +1043,8 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_CAMERA_ORIENTATION:	return "Camera Orientation";
 	case V4L2_CID_CAMERA_SENSOR_ROTATION:	return "Camera Sensor Rotation";
 	case V4L2_CID_REGION_OF_INTEREST_RECT:  return "Region Of Interest Rectangle";
+	case V4L2_CID_REGION_OF_INTEREST_AUTO:  return "Region Of Interest Auto Controls";
+
 
 	/* FM Radio Modulator controls */
 	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
@@ -1415,6 +1417,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_JPEG_ACTIVE_MARKER:
 	case V4L2_CID_3A_LOCK:
 	case V4L2_CID_AUTO_FOCUS_STATUS:
+	case V4L2_CID_REGION_OF_INTEREST_AUTO:
 	case V4L2_CID_DV_TX_HOTPLUG:
 	case V4L2_CID_DV_TX_RXSENSE:
 	case V4L2_CID_DV_TX_EDID_PRESENT:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 499fcddb6254..13db0638533c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1009,6 +1009,15 @@ enum v4l2_auto_focus_range {
 #define V4L2_CID_CAMERA_SENSOR_ROTATION		(V4L2_CID_CAMERA_CLASS_BASE+35)
 
 #define V4L2_CID_REGION_OF_INTEREST_RECT	(V4L2_CID_CAMERA_CLASS_BASE+36)
+#define V4L2_CID_REGION_OF_INTEREST_AUTO	(V4L2_CID_CAMERA_CLASS_BASE+37)
+#define V4L2_REGION_OF_INTEREST_AUTO_EXPOSURE			(1 << 0)
+#define V4L2_REGION_OF_INTEREST_AUTO_IRIS			(1 << 1)
+#define V4L2_REGION_OF_INTEREST_AUTO_WHITE_BALANCE		(1 << 2)
+#define V4L2_REGION_OF_INTEREST_AUTO_FOCUS			(1 << 3)
+#define V4L2_REGION_OF_INTEREST_AUTO_FACE_DETECT		(1 << 4)
+#define V4L2_REGION_OF_INTEREST_AUTO_DETECT_AND_TRACK		(1 << 5)
+#define V4L2_REGION_OF_INTEREST_AUTO_IMAGE_STABILIZATION	(1 << 6)
+#define V4L2_REGION_OF_INTEREST_AUTO_HIGHER_QUALITY		(1 << 7)
 
 /* FM Modulator class control IDs */
 
-- 
2.36.0.550.gb090851708-goog


  parent reply	other threads:[~2022-05-18  6:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  6:24 [PATCH v3 0/6] media: Implement UVC v1.5 ROI Yunke Cao
2022-05-18  6:24 ` [PATCH v3 1/6] media: v4l2_ctrl: Add region of interest rectangle control Yunke Cao
2022-05-19  7:49   ` Hans Verkuil
2022-05-19  8:14   ` Hans Verkuil
2022-05-19 10:39     ` Laurent Pinchart
2022-05-19 10:55       ` Hans Verkuil
2022-05-23  9:32         ` Yunke Cao
2022-05-18  6:24 ` Yunke Cao [this message]
2022-05-19  7:52   ` [PATCH v3 2/6] media: v4l2_ctrl: Add region of interest auto control Hans Verkuil
2022-05-18  6:24 ` [PATCH v3 3/6] media: v4l2_ctrl: Add V4L2_CTRL_WHICH_MIN/MAX_VAL Yunke Cao
2022-05-18  6:24 ` [PATCH v3 4/6] media: uvcvideo: implement UVC v1.5 ROI Yunke Cao
2022-05-18  6:24 ` [PATCH v3 5/6] media: uvcvideo: Initialize roi to default value Yunke Cao
2022-05-18  6:24 ` [PATCH v3 6/6] media: vivid: Add a roi rectangle control Yunke Cao
2022-05-19  8:29   ` Hans Verkuil
2022-05-19 18:29 ` [PATCH v3 0/6] media: Implement UVC v1.5 ROI Nicolas Dufresne
2022-05-19 23:55   ` Yunke Cao

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=20220518062412.2375586-3-yunkec@google.com \
    --to=yunkec@google.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=ribalda@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.