From patchwork Mon Jul 28 09:09:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Mugnier X-Patchwork-Id: 23988 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 228E0BDCC1 for ; Mon, 28 Jul 2025 09:11:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BE35B6914D; Mon, 28 Jul 2025 11:11:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="zkjO64nY"; dkim-atps=neutral Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D4BC269143 for ; Mon, 28 Jul 2025 11:11:51 +0200 (CEST) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56S96SDB020287; Mon, 28 Jul 2025 11:11:51 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= /V+7Rp43NhSo0jTFHnKsG+fX6Dxj/SiAJQYw8AFSKRU=; b=zkjO64nYIdqPTMXf 6JnMTJ1iQLOWvl3l3yU60eyJym7IGMRnM8qaIuu9IpgpAX/jhcpxgSRARCtgu0CP OAO28F9nZciZrYH2YGe8n0oHVv+Ns1pyhJ1HPLJf2YmcGpQi6Re1mChNCT6VQZrk 8P09BmUOXeVlSbIoI00JMwBPZBTOMFyb+RDfeZ4H2+vv/moXMbrNJAHZFcRV4x6y djK45D82i/iPdR0CmYtxK9Q92aWy9laq/g79FVgvdzJ4QdCg3pdA2RCZtPVqogAx dQTZ5EBuOJErMEbtyK2zt8UOxN8vAfFQ78Dc8zBpRXLdNl3Ksg7bM0DWkVLFJgBU HKVZ5Q== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 484nwgew7p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Jul 2025 11:11:51 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id EC30540057; Mon, 28 Jul 2025 11:10:57 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3FADC6C6162; Mon, 28 Jul 2025 11:10:26 +0200 (CEST) Received: from localhost (10.130.78.67) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 28 Jul 2025 11:10:26 +0200 From: Benjamin Mugnier Date: Mon, 28 Jul 2025 11:09:15 +0200 Subject: [PATCH v2 2/4] ipa: rpi: Add vd56g3 support for rpi MIME-Version: 1.0 Message-ID: <20250728-vd56g3_support-v2-2-cee5d5feac44@foss.st.com> References: <20250728-vd56g3_support-v2-0-cee5d5feac44@foss.st.com> In-Reply-To: <20250728-vd56g3_support-v2-0-cee5d5feac44@foss.st.com> To: CC: Naushir Patuck , Kieran Bingham , Sylvain Petinot , Cyril Liotard , "Jean Poire" , Benjamin Mugnier , Naushir Patuck , Laurent Pinchart X-Mailer: b4 0.14.2 X-Originating-IP: [10.130.78.67] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1099, Hydra:6.1.9, FMLib:17.12.80.40 definitions=2025-07-28_03,2025-07-24_01,2025-03-28_01 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" The cam_helper gain formula and frameIntegrationDiff can be found in the vd56g3 user manual. Signed-off-by: Benjamin Mugnier Reviewed-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/ipa/rpi/cam_helper/cam_helper_vd56g3.cpp | 49 ++++++++++++++++++++++++++++ src/ipa/rpi/cam_helper/meson.build | 1 + 2 files changed, 50 insertions(+) diff --git a/src/ipa/rpi/cam_helper/cam_helper_vd56g3.cpp b/src/ipa/rpi/cam_helper/cam_helper_vd56g3.cpp new file mode 100644 index 0000000000000000000000000000000000000000..140aabd802ade61fd785d21a73e46d88be8d1b96 --- /dev/null +++ b/src/ipa/rpi/cam_helper/cam_helper_vd56g3.cpp @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) STMicroelectronics SA 2025 + * + * Camera information for vd56g3 sensor + */ + +#include + +#include "cam_helper.h" + +using namespace RPiController; + +class CamHelperVd56g3 : public CamHelper +{ +public: + CamHelperVd56g3(); + uint32_t gainCode(double gain) const override; + double gain(uint32_t gainCode) const override; + +private: + /* + * Smallest difference between the frame length and integration time, + * in units of lines. + */ + static constexpr int frameIntegrationDiff = 61; +}; + +CamHelperVd56g3::CamHelperVd56g3() + : CamHelper({}, frameIntegrationDiff) +{ +} + +uint32_t CamHelperVd56g3::gainCode(double gain) const +{ + return static_cast(32.0 - 32.0 / gain); +} + +double CamHelperVd56g3::gain(uint32_t gainCode) const +{ + return static_cast(32.0 / (32 - gainCode)); +} + +static CamHelper *create() +{ + return new CamHelperVd56g3(); +} + +static RegisterCamHelper reg("vd56g3", &create); diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build index abf021474b5c226782b847c709de638b6e7635c1..b70acbee5fcaa94265da1f1ad75487563486679f 100644 --- a/src/ipa/rpi/cam_helper/meson.build +++ b/src/ipa/rpi/cam_helper/meson.build @@ -14,6 +14,7 @@ rpi_ipa_cam_helper_sources = files([ 'cam_helper_ov64a40.cpp', 'cam_helper_ov7251.cpp', 'cam_helper_ov9281.cpp', + 'cam_helper_vd56g3.cpp', 'md_parser_smia.cpp', ])