diff mbox series

[1/2] media: v4l2: ctrls: Add ROLL_ABSOLUTE control

Message ID d4d606920a2e08fa468eb6c98f7f2f387ed58e16.1718216718.git.soyer@irl.hu
State New
Headers show
Series media: v4l2: map UVC_CT_ROLL_ABSOLUTE_CONTROL | expand

Commit Message

Gergo Koteles June 12, 2024, 6:31 p.m. UTC
Add V4L2_CID_ROLL_ABSOLUTE as an integer control to
retrieve and set the camera roll in degrees, and its
documentation.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
 Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst | 5 +++++
 drivers/media/v4l2-core/v4l2-ctrls-defs.c                  | 1 +
 include/uapi/linux/v4l2-controls.h                         | 2 ++
 3 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
index cdc515c60468..81bc31a4bf79 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
@@ -672,3 +672,8 @@  enum v4l2_scene_mode -
 
     As modes differ for each sensor, menu items are not standardized by this
     control and are left to the programmer.
+
+``V4L2_CID_ROLL_ABSOLUTE (integer)``
+    This control describes the camera rotation along the image viewing axis in
+    degrees. Values range from -180 to +180, the default is zero. Positive
+    values rotate the camera clockwise, negative values counter-clockwise.
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 8696eb1cdd61..0e8af56cb2a2 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -1086,6 +1086,7 @@  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_HDR_SENSOR_MODE:		return "HDR Sensor Mode";
+	case V4L2_CID_ROLL_ABSOLUTE:		return "Roll, Absolute";
 
 	/* FM Radio Modulator controls */
 	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 99c3f5e99da7..a6d28e54bbc0 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1087,6 +1087,8 @@  enum v4l2_auto_focus_range {
 
 #define V4L2_CID_HDR_SENSOR_MODE		(V4L2_CID_CAMERA_CLASS_BASE+36)
 
+#define V4L2_CID_ROLL_ABSOLUTE			(V4L2_CID_CAMERA_CLASS_BASE+37)
+
 /* FM Modulator class control IDs */
 
 #define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)