From patchwork Fri Jul 12 05:29:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 20649 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AAA9FBDB1C for ; Fri, 12 Jul 2024 05:29:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C643463374; Fri, 12 Jul 2024 07:29:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uy5FYBQy"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 94B8E619A9 for ; Fri, 12 Jul 2024 07:29:33 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 81BB5D50; Fri, 12 Jul 2024 07:28:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720762139; bh=d9nWrdKic1P+XVgN81WRUQs94uSk0gkUXefH13F5mfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uy5FYBQyYcXlofQPfjGA6ee+GVlD1LvIkNu/dYn5VlO0OEyGyOS1t0SaPeX0/nhz0 ZJZgzzRuEJz7RIaEfRMqBI9Iw8zGQnNYUYpZpQLTMY+RmD/jBu7Lvmi10Nu/ehI2Lc 6NhHdZ5DL1nmUYpSsgMhrWpWHV7QctDZS8adm9+o= From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Xavier Roumegue , Umang Jain Subject: [RFC PATCH 1/6] libcamera: v4l2_device: Add support for V4L2_CTRL_TYPE_U32 Date: Fri, 12 Jul 2024 10:59:15 +0530 Message-ID: <20240712052920.33396-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240712052920.33396-1-umang.jain@ideasonboard.com> References: <20240712052920.33396-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Support for the U16 and U32 compound control types is missing. U16 will require a new libcamera control type, but U32 maps to the existing ControlTypeInteger32 and can be added easily. Signed-off-by: Umang Jain --- include/libcamera/controls.h | 5 +++++ src/libcamera/v4l2_device.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 7c2bb287..c6db4ebb 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -57,6 +57,11 @@ struct control_type { static constexpr ControlType value = ControlTypeByte; }; +template<> +struct control_type { + static constexpr ControlType value = ControlTypeInteger32; +}; + template<> struct control_type { static constexpr ControlType value = ControlTypeInteger32; diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 4a2048cf..db20f31c 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -212,6 +212,10 @@ ControlList V4L2Device::getControls(const std::vector &ids) type = ControlTypeByte; break; + case V4L2_CTRL_TYPE_U32: + type = ControlTypeInteger32; + break; + default: LOG(V4L2, Error) << "Unsupported payload control type " @@ -491,6 +495,7 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType) return ControlTypeBool; case V4L2_CTRL_TYPE_INTEGER: + case V4L2_CTRL_TYPE_U32: return ControlTypeInteger32; case V4L2_CTRL_TYPE_INTEGER64: @@ -543,6 +548,11 @@ std::optional V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl static_cast(ctrl.maximum), static_cast(ctrl.default_value)); + case V4L2_CTRL_TYPE_U32: + return ControlInfo(static_cast(ctrl.minimum), + static_cast(ctrl.maximum), + static_cast(ctrl.default_value)); + case V4L2_CTRL_TYPE_INTEGER64: return ControlInfo(static_cast(ctrl.minimum), static_cast(ctrl.maximum), @@ -624,6 +634,7 @@ void V4L2Device::listControls() case V4L2_CTRL_TYPE_BITMASK: case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_U8: + case V4L2_CTRL_TYPE_U32: break; /* \todo Support other control types. */ default: