From patchwork Thu Aug 3 21:28:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gergo Koteles X-Patchwork-Id: 709821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2749EC001DB for ; Thu, 3 Aug 2023 21:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231821AbjHCV44 (ORCPT ); Thu, 3 Aug 2023 17:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbjHCV4y (ORCPT ); Thu, 3 Aug 2023 17:56:54 -0400 Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95763ABE; Thu, 3 Aug 2023 14:56:51 -0700 (PDT) Received: from fedori.lan (51b69adf.dsl.pool.telekom.hu [::ffff:81.182.154.223]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 0000000000072E37.0000000064CC1C4D.0001D183; Thu, 03 Aug 2023 23:29:42 +0200 From: =?utf-8?b?R2VyZ8WRIEvDtnRlbGVz?= To: Mauro Carvalho Chehab , Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?R2VyZ8WRIEvDtnRlbGVz?= Subject: [RFC PATCH 1/2] media: v4l2: ctrls: Add ROLL_ABSOLUTE control Date: Thu, 3 Aug 2023 23:28:57 +0200 Message-ID: <8eb0e251fb4f4ab4f3ed5472fbd26e94786b46ff.1691096157.git.soyer@irl.hu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add V4L2_CID_ROLL_ABSOLUTE as an integer control to retrieve and set the camera roll in degrees, and its documentation. Signed-off-by: Gergő Köteles --- 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 --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 c3604a0a3e30..5131711ea873 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1075,6 +1075,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) From patchwork Thu Aug 3 21:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gergo Koteles X-Patchwork-Id: 711443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FAD4C001DF for ; Thu, 3 Aug 2023 21:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbjHCVo5 (ORCPT ); Thu, 3 Aug 2023 17:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbjHCVo4 (ORCPT ); Thu, 3 Aug 2023 17:44:56 -0400 X-Greylist: delayed 603 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 03 Aug 2023 14:44:56 PDT Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB97D30F8; Thu, 3 Aug 2023 14:44:55 -0700 (PDT) Received: from fedori.lan (51b69adf.dsl.pool.telekom.hu [::ffff:81.182.154.223]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 0000000000072E3A.0000000064CC1C4F.0001D18F; Thu, 03 Aug 2023 23:29:50 +0200 From: =?utf-8?b?R2VyZ8WRIEvDtnRlbGVz?= To: Mauro Carvalho Chehab , Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?R2VyZ8WRIEvDtnRlbGVz?= Subject: [RFC PATCH 2/2] media: v4l2: map UVC_CT_ROLL_ABSOLUTE_CONTROL Date: Thu, 3 Aug 2023 23:28:58 +0200 Message-ID: <550bf1a9adf175a166163d696e667165ce7db79f.1691096157.git.soyer@irl.hu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Logitech Streamcam can be mounted in 'portrait mode' as well. It reports the current roll (-90, 0, 90, 180) with UVC_CT_ROLL_ABSOLUTE_CONTROL. Map UVC_CT_ROLL_ABSOLUTE_CONTROL to V4L2_CID_ROLL_ABSOLUTE to make it available to userspace. Signed-off-by: Gergő Köteles --- drivers/media/usb/uvc/uvc_ctrl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 5e9d3da862dd..2801a1ee04a2 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -748,6 +748,15 @@ 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_ROLL_ABSOLUTE, + .entity = UVC_GUID_UVC_CAMERA, + .selector = UVC_CT_ROLL_ABSOLUTE_CONTROL, + .size = 16, + .offset = 0, + .v4l2_type = V4L2_CTRL_TYPE_INTEGER, + .data_type = UVC_CTRL_DATA_TYPE_SIGNED, + }, }; const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {