From patchwork Wed Jul 29 14:43:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Cronin X-Patchwork-Id: 27521 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 E8C27C32FE for ; Wed, 29 Jul 2026 14:43:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B94CB67FAF; Wed, 29 Jul 2026 16:43:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=stromback-com.20251104.gappssmtp.com header.i=@stromback-com.20251104.gappssmtp.com header.b="RQZfraa6"; dkim-atps=neutral Received: from mail-yx1-xb135.google.com (mail-yx1-xb135.google.com [IPv6:2607:f8b0:4864:20::b135]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D4DDF67FA9 for ; Wed, 29 Jul 2026 16:43:34 +0200 (CEST) Received: by mail-yx1-xb135.google.com with SMTP id 956f58d0204a3-66899fe9077so1396821d50.1 for ; Wed, 29 Jul 2026 07:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1785336213; cv=none; d=google.com; s=arc-20260327; b=braekP9F7EGz9sTL0HhzRtPfknjkF7zhLY1pMENJ5WubNsomCeyEyJX1jscBdRmt9T jCO0FkIwQvpxIqTBTmDtZw0YDOixm85FD7YFWZwsBclxTlMGuWs+N8CbzaVarsKjqRBK AndTVDGqfMxKDm+gNcQHbSvtbNX7dFlZe0P9iwRt7Apmg+h0BwaIN4pdbtouihOBlOeF jjTQ6Tl70eg5dpxMHVfoRKBeH3gLeeogOsVD7hHusFJWU5Gc1ckpOvjbN6Tm2XSVCSki mMuHb6PbUbW68mW6fg1q0JkslpInJKV7HpL7mqhHN1SyPnsE/qqt2cGy4Q64yk7r2eQu CsYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=KBB4hh3CPkb8MfngEFEu2CoxNfm2wy6QvZOjz/VGOm8=; fh=8fmqAynsXLJdjJ4QlnoP1T39WQbBLOq6I+TqiUNWVms=; b=WjYVGL/XjB7itmdtsIyfS6Hl1MdlpaVKszw9NVAx+WHloXP5qVA/vsTGz0QgBM2pb2 6RbvstI1DdXMpJf1WD5nqqjsz3H0hiE1VBbVqvqBhut/PYEV781ZGhUgwjas0YtaEilp wGMyjzr/s+v/fGHLVEYwKoHN3yyYxLEK8Wm33oQyv3aQgacLWtm5ZwBiIYccnZ4d/UAc GObZB2FhhY+oKYYk9k0Y+D1iQHCGtiqBgsOOgDGQeRF0Clqq0yXLUhldbsUbjqfQvekj P8TLsZFLcJ0ZtnbcjOodr4ppUB7UKN1hez8ZJZvSijsldo19/elyve0wa072gZ3++6S+ KNgQ==; darn=lists.libcamera.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stromback-com.20251104.gappssmtp.com; s=20251104; t=1785336213; x=1785941013; darn=lists.libcamera.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:references:in-reply-to:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=KBB4hh3CPkb8MfngEFEu2CoxNfm2wy6QvZOjz/VGOm8=; b=RQZfraa6MQpWPkjt5HtdhI4qkRWSS+2DJhs7SCBlvJApvxDzyGI6aqdcLWNLaljoiQ uavwvoZhsJvKoGW7i+sWTOb7n6ymribB1FXyza7SfW2mSU9T6gIZnRWhiQHjHNhBRt+u 6clTldfKKLCGJi5ATOu8L4G8kMBndcbtrPeu9By6uSQem2fNnOtZA0AGLafX8wMzAYQL LSAhdQTygE7oBbgVjNniZ/xkGU6B9OOKGIoExXBlXnrw8RHOWNwxuuAoh+nC3pkxeV9u 1u1g9xdNF5Y+gyIEK21awDZocLcgxpLa6qzp/lOii4xmk27LeNb5zbxeaw8dZbh2VpjF F/Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785336213; x=1785941013; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:references:in-reply-to:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=KBB4hh3CPkb8MfngEFEu2CoxNfm2wy6QvZOjz/VGOm8=; b=Prd70wiBoxwzFYbCjb49LsSrOE6hSX3OzUVHD2hNfQ2O56MLMT7SV6dcTU7YRgT6Ac IS/2TMFBpqzAnWeD5zJJSwtLUIJ5VZjJ3qK6Xi9k6P4/T2U4yjYAPTRpoCpR+CKIoG4C sSK6YIr4yd0UDKtfkbJB9wryvWHn9xLiu2J/LmyMUX74pseR98KIdQco2Cd6zV2O77MO ZHXfDDBnJAUOMMGjvITqqEWIRMKD8BmY/H+Cth+wdI4XKiJ72agdzZpAnZVnYx4m8DX1 fkD4c1sIFPoSkUBk5r3sgb2k0TxeJkPj+Rs1OkycnYOzikP5jZl/u0OgYPrDaLFKtMB5 gmUg== X-Gm-Message-State: AOJu0Yw66ZOgQuY91wjEJhxvzrmsp6RSvvZS82Hi4FW39oHrawzS8u+R qYi/iEm55B67nPJKCkbPnf+pd8CP4KPwnM17C69LqG8nQ0dhOV3YfHLq7L97ohRRjiQUQqsW1VN PRmmx/fq4tQi6vVxad8NsA1mg4OKudfetmc8HxSfj29yjE2i1eCNaO0w= X-Gm-Gg: AR+sD1128fWK2exJjIsPXyKz46OT9yoJLlRkZ2qfg7njQ/josNPXp0xNdVGS39a9Hfp 7tCBn7vsZnqmlpPEPXNvDX6F9Ze/w4owBmJwoPqRfAjl/h1Gzy+l4UBQfg0PhCuaqQixhmR5olc dDt6MJnhmzGTwb7vMz0Q475hczJGxVL57mhr/Pkbc1qn5Lw49+iOOSPMHWHg297bomf32nY2BCl g7vSxkdbDNsY9ls9XY9U8lGGs5ql0MYzsvFd7tTyXtZ2PVarMaTBhWaSw1syNUHpIJCbk6L3yOk hvsCMVhyiTiQiINjjLLMgsBeDcaNdc7XzUAv+qr5uvmnvtyet6Mb9vg7gNROyq1YfAnmO+u5aGR K6A+vIj6gqJC4/XQ7d9D0urd4C8vpP+BJv23v73nOTqvnDpmIsjCSdLdWAKv8vGuKG2Qd0/xhHP ZAeC4RanpNxFW7epNhQBsHh+gFhaUVSrNyCWDu+W/TJOa5uA4obT+jC0XDeVXdGAuAzwySb/FjQ xNqTE7jcEOEg5VPlbdM5j+rFHmaSwWFwzvSk5WioQ== X-Received: by 2002:a05:690c:f10:b0:7fe:1333:c745 with SMTP id 00721157ae682-81f99242bfdmr35202777b3.27.1785336213431; Wed, 29 Jul 2026 07:43:33 -0700 (PDT) Received: from 313336824172 named unknown by gmailapi.google.com with HTTPREST; Wed, 29 Jul 2026 10:43:32 -0400 Received: from 313336824172 named unknown by gmailapi.google.com with HTTPREST; Wed, 29 Jul 2026 10:43:32 -0400 MIME-Version: 1.0 In-Reply-To: <178532114379.1788834.11075609312135567537@ping.linuxembedded.co.uk> References: <178532114379.1788834.11075609312135567537@ping.linuxembedded.co.uk> From: John Cronin Date: Wed, 29 Jul 2026 10:43:32 -0400 X-Gm-Features: AUfX_mwetmCJ2d6LwC44n_0cn_VsuDZF2BT4nU-GV20DhVdGDhO1xPqj8A2Neuk Message-ID: Subject: [PATCH v2] libipa: camera_sensor_helper: Add imx471 To: libcamera-devel@lists.libcamera.org Cc: kieran.bingham@ideasonboard.com 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" Add CameraSensorHelper for Sony IMX471 (SONY471A), used on Lenovo ThinkPad X9-15 and related IPU7 platforms. The kernel imx471 driver programs analogue gain code 0..800 into register 0x0204. Use the common Sony linear model G = 1024/(1024-code) (matching imx355/imx477/imx708) and a 10-bit pedestal of 64 (4096 at 16-bit). Also register static sensor properties so soft-ISP AGC no longer warns about missing delays/properties for this model. Tested on Fedora 44 / ThinkPad X9-15 Gen 1 (kernel 7.1.5, imx471 bound via IPU7 ISYS). Soft-ISP loads without "Failed to create camera sensor helper for imx471"; AGC reports gain range 1.0-4.57x and adjusts exposure under capture. Signed-off-by: John Cronin Tested-by: John Cronin --- Changes in v2: - Fix mangled diff --git b/ path from the previous mail (copy error in MUA send). ---/+++ paths and hunk contents were already correct; pure apply-ready form now. src/ipa/libipa/camera_sensor_helper.cpp | 24 +++++++++++++++++++ .../sensor/camera_sensor_properties.cpp | 17 +++++++++++++ 2 files changed, 41 insertions(+) .testPatternModes = {}, diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index cc16e25..5fb545a 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -644,6 +644,30 @@ class CameraSensorHelperImx462 : public CameraSensorHelperImx290 }; REGISTER_CAMERA_SENSOR_HELPER("imx462", CameraSensorHelperImx462) +class CameraSensorHelperImx471 : public CameraSensorHelper +{ +public: + CameraSensorHelperImx471() + { + /* + * Sony IMX471 (IPU7 / ThinkPad X9, X1 Carbon Gen14). + * + * Analogue gain is programmed via V4L2_CID_ANALOGUE_GAIN to + * register 0x0204. The kernel driver (imx471) exposes range + * 0..800 and writes the code directly. + * + * Sony linear gain model used by several IMX sensors: + * G = 1024 / (1024 - code) + * so code 0 → 1.0x and code 800 → ~4.57x. + * + * 10-bit optical black pedestal is typically 64 → 4096 at 16-bit. + */ + blackLevel_ = 4096; + gain_ = AnalogueGainLinear{ 0, 1024, -1, 1024 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("imx471", CameraSensorHelperImx471) + class CameraSensorHelperImx477 : public CameraSensorHelper { public: diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp index fc9e184..7ba55dc 100644 --- a/src/libcamera/sensor/camera_sensor_properties.cpp +++ b/src/libcamera/sensor/camera_sensor_properties.cpp @@ -297,6 +297,23 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen .hblankDelay = 2 }, } }, + { "imx471", { + /* 1/2.3-type; ~1.4 µm pixels (nm). Delays unverified. */ + .unitCellSize = { 1400, 1400 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeSolidColor, 1 }, + { controls::draft::TestPatternModeColorBars, 2 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, + { controls::draft::TestPatternModePn9, 4 }, + }, + .sensorDelays = { + .exposureDelay = 2, + .gainDelay = 2, + .vblankDelay = 2, + .hblankDelay = 2 + }, + } }, { "imx477", { .unitCellSize = { 1550, 1550 },