From patchwork Wed Sep 2 19:15:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Neiva de Carvalho X-Patchwork-Id: 28174 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 F1C99C3344 for ; Wed, 2 Sep 2026 20:04:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6BA9C685E3; Wed, 2 Sep 2026 22:04:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TEkV+2Bk"; dkim-atps=neutral Received: from mail-ua1-x930.google.com (mail-ua1-x930.google.com [IPv6:2607:f8b0:4864:20::930]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D817685BA for ; Wed, 2 Sep 2026 21:16:05 +0200 (CEST) Received: by mail-ua1-x930.google.com with SMTP id a1e0cc1a2514c-97ca74bd6e0so420341241.1 for ; Wed, 02 Sep 2026 12:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788376564; x=1788981364; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BzaQLorpqZ6Wd+W6fzUyGU4VxdGo/QG+xwxii7NCHt4=; b=TEkV+2BkfEtgSr7lehdwL5KgISUPKMbIDS60kGu67Utb3YrF0RaTJWdsC7ui5Y51ax RBRm8XfL7+3ULf/T72etI4A8fjHitbXwXGTR8lppaVTnPuj/vhDMrP+VWD5W3x6/oTvI A/REc4qwSpH6nrmrqpK6lE0De89ZdBWuV6PBrvZmf72VIzbSu7KsOix6VzMkLqR64/eM DnmuHd1fcKNl/xpUxzTHJ/rkNX9EFcEhoy3JheUU4Dbfe5enDToi7TDNV3NxVn5TPZeD SqOR8QVg8HaiDdWkgEryA11C3kygbxGEJoqt9SBaZ/WYI/uBmxtww+JxJPBpA2ubJXTl wP4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788376564; x=1788981364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=BzaQLorpqZ6Wd+W6fzUyGU4VxdGo/QG+xwxii7NCHt4=; b=jbkTLyHk4yMxBKPC+jftJX92oH0/sWhBD5hJPba8c9mSk5Pvnvpycy3xvuLufeH9F8 pIlNe007qlD4dJSjoP7z5xHM9C9Vojugm/45rKe1Qvnn58Lmyxxlxg4m90AeN8nDxx5c Z54gTbyAQMKoFib8QEOZUo11awK75hGO69+QYCb4X/F+qimSvjAdVLEtQMhxlEvCBxhV CZRM/dwCgb4nn3u+HiJ5VsdyyJqzCjChV5VdiE8GaEaLvN12Lnz47FomapoU20yJR8RX velegV9SJpToGiMQMXR5/zBDgc3yuoa0Iw7DjZU3si7KV7s6UpvBj9n8wPOwDO5VKxLb FaSg== X-Gm-Message-State: AFuF++lS2VtpeXTSMX7mYi9a8Hz8yADzqhOLvH8W5kJZcthnv5gmuFRo DnRdUewP8aiCMeo0mBSdwsvwK6TC94EF6w6Zkg1wlk26BHlqGC+FfzvzKxvcoI/NYs4= X-Gm-Gg: AYBFou1AhXukaxXPymIS6dKCe7Km1y24+VvCEWPXT6aBbpy+UrrYQJk5wKmokTGlzLh QRMO8aB6Xpqy1P8jlr7/LMkfByezSDPS1xPD/m1E9wfyHNIjIizpP+nuOSipYpOx1efkIBXwx0Q AJTOXmPBwuldvFrO9GvoCd1WkMPeLCgN88i+rRvcQrnnBBC1m7n86ryLNyhz1b8qWdt0C/YKuXD 9u/1vCtSSVzQSI0D23K1Xg7sGvWTFj/OqQneev/D3J36t4zRbx3jnJJKqp5Sv5ccz3jQpBaH8Dw 4dkZOud+OV5/5JukmJDjx2ZySOQV9/edNjnPVtDS4CgPNzmmyX++8Xvav6TEf5YPO/MvLDU4p7v MyBzVoeASb7Td7HHZn2OxuSH/Yj3RTxvypiU3FvUFN6/nqovN+SEypBu1CU7y++/nz4K5IKH0cI Rubawzxxqw++u1HBXHkp2Uidtfm/lZVm9D0dcijUPUK5TBAPxBvOIrgGrGCoc= X-Received: by 2002:a05:6102:6d2:b0:77b:2881:580b with SMTP id ada2fe7eead31-78a1f1aff84mr2288362137.4.1788376563702; Wed, 02 Sep 2026 12:16:03 -0700 (PDT) Received: from laptop ([45.184.68.165]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-78a1a1feac0sm3003754137.2.2026.09.02.12.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2026 12:16:03 -0700 (PDT) From: Martin Neiva de Carvalho To: libcamera-devel@lists.libcamera.org Cc: Martin Neiva de Carvalho Subject: [PATCH 1/5] ipa: libipa: camera_sensor_helper: Add OV02C10 Date: Wed, 2 Sep 2026 16:15:50 -0300 Message-ID: <20260902191554.84922-2-martincarvalho@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260902191554.84922-1-martincarvalho@gmail.com> References: <20260902191554.84922-1-martincarvalho@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 02 Sep 2026 22:04:26 +0200 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 OmniVision OV02C10 is used as the front sensor on several Intel IPU6 laptops, where it is driven by the software ISP and so depends on this helper to make sense of its gain control. V4L2_CID_ANALOGUE_GAIN on this sensor has a minimum and a default of 0x10, which is unity gain, so the code is expressed in 1/16th steps. Without a helper the default one-to-one mapping is used, and the AGC reads the smallest gain the sensor will accept as 16x. It then believes the sensor is already amplifying heavily when it is not, and never raises the gain, leaving the image dark in anything but bright light. Verified by measurement on a Samsung Galaxy Book (NP960XGL): with the helper in place the AGC drives the control across its whole range and the resulting image level tracks the requested gain. The black level matches the 0x40 at 10 bits that the kernel driver programs as its BLC target. Signed-off-by: Martin Neiva de Carvalho --- src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 82bf255d2..d382d3e4f 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -714,6 +714,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: