From patchwork Fri Oct 9 08:25:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Roux?= X-Patchwork-Id: 28423 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 17B2BBDCB6 for ; Fri, 9 Oct 2026 08:25:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4290268A0F; Fri, 9 Oct 2026 10:25:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=humanlearning.ch header.i=@humanlearning.ch header.b="LpcTs9wH"; dkim-atps=neutral Received: from smtp-1908.mail.infomaniak.ch (smtp-1908.mail.infomaniak.ch [185.125.25.8]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 87E88689E7 for ; Fri, 9 Oct 2026 10:25:21 +0200 (CEST) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:4:17::246b]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4j1Kg51NQdzgxM for ; Fri, 9 Oct 2026 10:25:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=humanlearning.ch; s=20250828; t=1791534321; bh=biw9you2EhQCQLPh4GuKXRfnQIl2HmOWxhBkvNl8EkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpcTs9wHtCSSDJ4i0/7FWMLdw8XFx+h53r6EzWWMS5y0WGh0gubs9v7fX1DRZ0Qng r0mIvr11uUkirKP6i+FhzKeri1HYh/h6lMxTmTjyulcMvAZkH/BnI1XKl7r/8lzGYM GNfQ8/OPruzyYssAhN8eVzO45I8yfRvgQJYRVaQMIZeZ5k+aVnP/k9AgZmiq2ba4CC k91FtRBCCoOutyN3kPo4iktVk6rKRuhoYCT3l00laqJJfBO3zcVrayIqQ19BvFLRe0 Zq/E/xKR48FDaTns6YNIWqXy2atZ2KUhLUzhu2jl5enulNuIu3e2AEIeFxYirAlCSj qxNDwn/YzoFKQ== Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4j1Kg42BCvzJsV; Fri, 9 Oct 2026 10:25:20 +0200 (CEST) From: =?utf-8?q?Fran=C3=A7ois_Roux?= To: libcamera-devel@lists.libcamera.org Cc: barnabas.pocze@ideasonboard.com Subject: [PATCH v2] ipa: libipa: camera_sensor_helper: add ov02c10 Date: Fri, 9 Oct 2026 10:25:19 +0200 Message-ID: <20261009082519.348785-1-info@humanlearning.ch> X-Mailer: git-send-email 2.56.0 In-Reply-To: <35a59ca1-a166-482b-be5d-4ae24f58c36e@ideasonboard.com> References: <35a59ca1-a166-482b-be5d-4ae24f58c36e@ideasonboard.com> MIME-Version: 1.0 X-Infomaniak-Routing: alpha 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" Without an entry for ov02c10, the software ISP used by the simple pipeline handler has no gain model or black level for this sensor and logs: IPASoft: Failed to create camera sensor helper for ov02c10 AGC then still runs, but on raw analogue-gain register values instead of a linear gain, which makes it converge poorly. The kernel driver (drivers/media/i2c/ov02c10.c) advertises analogue-gain register values in the range 0x10..0xf8 with a default of 0x10, and writes them to the 16-bit register at 0x3508 as (val << 4). That register is graded in 1/256 steps, so both the control range and the register encoding agree on 1/16 steps: the default of 0x10 is unity gain and the maximum of 0xf8 is 15.5x. The sensor outputs 10-bit Bayer data (MEDIA_BUS_FMT_SGRBG10_1X10). The driver programs a black level target of 0x40 in the BLC registers 0x4002/0x4003, which scales to 4096 at the 16-bit width expected by blackLevel(), as for the other OmniVision sensors in this file. A dark-frame measurement matches it: the mean pedestal is 64.2 LSB, and changing the target to 0x80 while streaming moves it to 128.2 LSB on all four colour channels from the next frame. Tested on the front camera of a Microsoft Surface Pro 12 (Qualcomm X1P42100) driven by the qcom CAMSS pipeline. Before the change the IPA reported "Exposure 4-2320, gain 16-248 (1)"; after it reports "Exposure 4-2320, gain 1-15.5 (0.145)". Signed-off-by: François Roux --- Changes in v2: - Take the black level from the BLC target the driver programs (0x4002/0x4003), as suggested by Barnabás, and keep the dark-frame measurement only as confirmation (target 0x40 -> 0x80 moves the pedestal by exactly 64 LSB). - AGC does run without the helper, just poorly: reword the commit message accordingly. - Rebased on master: the helper now sits between ov01a10 and ov08d10. The same values were posted earlier by Martin Neiva de Carvalho as patch 1/5 of "softisp: Five fixes found on a camera with no hardware ISP". src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) base-commit: 8103c3f29fba61dbd1d3bbf1a099280c5f3217e3 diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 359040e..72f974e 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -713,6 +713,18 @@ public: }; REGISTER_CAMERA_SENSOR_HELPER("ov01a10", CameraSensorHelperOv01a10) +class CameraSensorHelperOv02c10 : public CameraSensorHelper +{ +public: + CameraSensorHelperOv02c10() + { + /* From Linux kernel driver: 0x40 at 10bits. */ + blackLevel_ = 4096; + gain_ = AnalogueGainLinear{ 1, 0, 0, 16 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("ov02c10", CameraSensorHelperOv02c10) + class CameraSensorHelperOv08d10 : public CameraSensorHelper { public: