From patchwork Tue Aug 25 16:44:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 28090 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 3F277C0F1B for ; Tue, 25 Aug 2026 16:45:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E5AB868421; Tue, 25 Aug 2026 18:44:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="CHKGPyqS"; 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 ECA54683E4 for ; Tue, 25 Aug 2026 18:44:55 +0200 (CEST) Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6FF206DC; Tue, 25 Aug 2026 18:43:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1787676210; bh=wHROv0Jn7QCdrE4X4VtluJIQUIykO+O6Y1dXdu5SesE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CHKGPyqSFugKRhNN+cEXoGmznBcVjSxLFmHEsQwlUrFFWpevxMAwSfOhzoopyZELr FWMDqsZWYeUi3Z7hQ9r4xodyfMjlbYTWhMS9y+JI37nUoS/tzquldORsiuvDyjLICa 8rq85MzEyA2KvCorTzQl08jnO0oOEKR8jQc2Y0+M= From: Jacopo Mondi Date: Tue, 25 Aug 2026 18:44:44 +0200 Subject: [PATCH v3 1/5] ipa: rpi: cam_helper: Add Mira220 cam helper MIME-Version: 1.0 Message-Id: <20260825-mira220-v3-1-7dad83521699@ideasonboard.com> References: <20260825-mira220-v3-0-7dad83521699@ideasonboard.com> In-Reply-To: <20260825-mira220-v3-0-7dad83521699@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Philippe Baetens , Naushir Patuck X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2808; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=RZNV0ZEVPq91s9sK+JqfszrIDG5kd/t1DTAe3OHqFtg=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqjcaGbo4v08HWTUMllp6z72/DDZUi++Cjqa44y ayrfmKcac6JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCao3GhgAKCRByNAaPFqFW PNulEAC/ndeWlT2SUfvz2p/wL0fO8qV+3fYKie+b/z0z4r/5mp0b4D9sjpqEuFLds1ISTEn7r62 eLFw3mfnQhpeLQKI/QCK0ycwVlegAYcqabbo8HhrlMl77xOms0DfJROHqlx2Sx+T+TEswcoW/7g lC8wg0O2r2xcWVe9k51drVYa4O2mIOASIkW/bc1UfpBLJyZd4iuhCYxAtFgkVhx247LqbUByR0t 91IThVGGLraFfYcHtd8dPz/oHspxTxLE/s7xpvTDf4s8ZbhNvNIqzyc1ImOkd18g5196w1oEZUO niKXRZYUgejMpkjuKjcOebLKrPvi5u+5Eyi6VZFrnn19OCODW9A+5Ccsz9GTO+OhbcIwgfqIdq5 zpoBNYmCurbyy82jEfV9oaoru8PBqry2D6LR2PcSOoMItlEDldMYXWAfBVqpsyKuw1LWp9sOJy/ d58Yaqd6iW2RH8U8GscLeW8Wr5TFX7xQC5YrOFLPBDf1qY8HIATaz5WGufO/pLdfSLAeYU9S0/O u7uRkCa9N0McJ4MRmVKigJyuZeonjdE1YsRSH7I5X6s6jwYCWbU8+OBqx+OXe7BdoYmCaZfQDk8 0S8CnuLdmUlOV1OqEbJowRpum5X/6NgFRqdqjmodoVoVZGJ1MaQ1O8CNsu5XgwRnS7i5f07NGUe 26vjAGlQJ052uQw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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" From: Philippe Baetens AMS-OSRAM Mira220 is a global shutter sensor with a maximum resolution of 1600x1400. Mira220 doesn't support embedded data metadata, and uses delayed controls which works by counting frames. Signed-off-by: Philippe Baetens Signed-off-by: Jacopo Mondi Acked-by: Naushir Patuck --- src/ipa/rpi/cam_helper/cam_helper_mira220.cpp | 59 +++++++++++++++++++++++++++ src/ipa/rpi/cam_helper/meson.build | 1 + 2 files changed, 60 insertions(+) diff --git a/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp new file mode 100644 index 000000000000..c884b853b0c1 --- /dev/null +++ b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2026, ams-OSRAM + * + * Camera helper for Mira220 sensor + */ + +#include + +#include "cam_helper.h" + +using namespace RPiController; + +class CamHelperMira220 : public CamHelper +{ +public: + CamHelperMira220(); + uint32_t gainCode(double gain) const override; + double gain(uint32_t gainCode) const override; + unsigned int hideFramesModeSwitch() const override; + +private: + /* + * Smallest difference between the frame length and integration time, + * in units of lines. + * + * The integration diff is expressed as + * Tframe - 1928 / row_length + * + * row_length controls the line timings and varies according to the + * number of data lanes in use and the D-PHY data rate. Use an + * integration diff calculated using the value of 304, which represents + * the minimum row_length for a 2 data lanes configuration running at + * 1.5Gbps. + */ + static constexpr int frameIntegrationDiff = 6; +}; + +CamHelperMira220::CamHelperMira220() + : CamHelper({}, frameIntegrationDiff) +{ +} + +uint32_t CamHelperMira220::gainCode(double gain) const +{ + return static_cast(2048.0 - 2048.0 / gain); +} + +double CamHelperMira220::gain(uint32_t gainCode) const +{ + return static_cast(2048.0 / (2048 - gainCode)); +} + +static CamHelper *create() +{ + return new CamHelperMira220(); +} + +static RegisterCamHelper reg("mira220", &create); diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build index 0aa8c3dc2e2f..cc71bacb2c6a 100644 --- a/src/ipa/rpi/cam_helper/meson.build +++ b/src/ipa/rpi/cam_helper/meson.build @@ -13,6 +13,7 @@ rpi_ipa_cam_helper_sources = files([ 'cam_helper_imx519.cpp', 'cam_helper_imx678.cpp', 'cam_helper_imx708.cpp', + 'cam_helper_mira220.cpp', 'cam_helper_ov64a40.cpp', 'cam_helper_ov7251.cpp', 'cam_helper_ov9281.cpp',