[{"id":39934,"web_url":"https://patchwork.libcamera.org/comment/39934/","msgid":"<amzCOD7YwA3kcOED@zed>","date":"2026-07-31T15:42:38","subject":"Re: [PATCH v4 1/2] libipa: camera_sensor_helper: Add imx471","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi John\n\nOn Fri, Jul 31, 2026 at 08:15:47AM -0700, John Cronin wrote:\n> Add CameraSensorHelper for Sony IMX471 (SONY471A), used on Lenovo\n> ThinkPad X9 / X1 Carbon Gen14 and related IPU7 platforms.\n>\n> The kernel imx471 driver writes V4L2_CID_ANALOGUE_GAIN codes 0..800\n> directly to register 0x0204.\n>\n> Analogue gain model (measured on ThinkPad X9-15 Gen 1, Fedora 44,\n> kernel 7.1.5): fixed-exposure raw Bayer means track\n>\n>   G = 1024 / (1024 - code)\n>\n> within ~1.5% over codes 0..800 (best-fit k≈1023 for G=k/(k-code)).\n> Code 800 implies ~4.57x; that is the driver's V4L2 max under this\n> model, not a full-scale datasheet claim. Other IMX helpers using the\n> same formula expose higher max codes (e.g. imx355 960 → ~16x).\n>\n> Black level measured ~64 DN at 10-bit on min exposure/gain raw frames\n> (mean ≈ 64.1, p50 = 64) → 4096 at 16-bit.\n>\n> Soft-ISP loads without \"Failed to create camera sensor helper for\n> imx471\".\n>\n> Signed-off-by: John Cronin <john.cronin@opcenter.com>\n> ---\n>  src/ipa/libipa/camera_sensor_helper.cpp | 29 +++++++++++++++++++++++++\n>  1 file changed, 29 insertions(+)\n>\n> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp\n> b/src/ipa/libipa/camera_sensor_helper.cpp\n> index cc16e25..31d8169 100644\n> --- a/src/ipa/libipa/camera_sensor_helper.cpp\n> +++ b/src/ipa/libipa/camera_sensor_helper.cpp\n> @@ -644,6 +644,35 @@ class CameraSensorHelperImx462 : public\n> CameraSensorHelperImx290\n>  };\n>  REGISTER_CAMERA_SENSOR_HELPER(\"imx462\", CameraSensorHelperImx462)\n>\n> +class CameraSensorHelperImx471 : public CameraSensorHelper\n> +{\n> +public:\n> +\tCameraSensorHelperImx471()\n> +\t{\n> +\t\t/*\n> +\t\t * Sony IMX471 (IPU7 platforms: ThinkPad X9 / X1 Carbon Gen14,\n> +\t\t * ACPI SONY471A).\n> +\t\t *\n> +\t\t * Kernel imx471 writes V4L2_CID_ANALOGUE_GAIN directly to\n> +\t\t * register 0x0204 with range 0..800 (IMX471_ANA_GAIN_MIN/MAX).\n> +\t\t *\n> +\t\t * Analogue gain model (measured on ThinkPad X9-15 Gen 1):\n> +\t\t *   G = 1024 / (1024 - code)\n> +\t\t * Fixed exposure raw Bayer means (black-subtracted) track this\n> +\t\t * model within ~1.5% over codes 0..800 (best-fit k≈1023 for\n> +\t\t * G=k/(k-code)). Code 800 → ~4.57x is the driver max, not a\n> +\t\t * datasheet \"full range\" claim; other IMX helpers with the same\n> +\t\t * formula use higher max codes (e.g. imx355 code 960 → ~16x).\n> +\t\t *\n> +\t\t * Black level: measured ~64 DN at 10-bit on min exposure/gain\n> +\t\t * raw frames (mean≈64.1, p50=64) → 4096 at 16-bit.\n> +\t\t */\n\nThis kind of repeats the commit message content, and I think it's\nbetter placed there.\n\nWith your permission, I'll drop the comment when applying the patch!\n\nThanks\n  j\n\n> +\t\tblackLevel_ = 4096;\n> +\t\tgain_ = AnalogueGainLinear{ 0, 1024, -1, 1024 };\n> +\t}\n> +};\n> +REGISTER_CAMERA_SENSOR_HELPER(\"imx471\", CameraSensorHelperImx471)\n> +\n>  class CameraSensorHelperImx477 : public CameraSensorHelper\n>  {\n>  public:\n> --\n> 2.55.0","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 56F88BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Jul 2026 15:42:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D04F67FDD;\n\tFri, 31 Jul 2026 17:42:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA20E65F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Jul 2026 17:42:41 +0200 (CEST)","from ideasonboard.com (mob-109-113-25-35.net.vodafone.it\n\t[109.113.25.35])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C5EE6BE;\n\tFri, 31 Jul 2026 17:41:34 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lyhZ6rGu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1785512494;\n\tbh=XCbeOm+MdphJYWYZBbA68bumvsVChj+nbhdi4fQWpWI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lyhZ6rGuM10jbRgr+d8e2gYgROha4W4kTA7zWZDlOkCXumKIjsHJNyWCrf2zE6sZj\n\teepXbhlVYyYcjqCZGGQvhhNY6XXekx/MP7ozyoQ4NEJsxoRnZkyeiaxqj+pEqqBcBK\n\ts3XPXKRuBPXPcxBdVhxdkCJgvQMwCnvMWi2xnj5w=","Date":"Fri, 31 Jul 2026 17:42:38 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"John Cronin <john@stromback.com>","Cc":"libcamera-devel@lists.libcamera.org, jacopo.mondi@ideasonboard.com, \n\tkieran.bingham@ideasonboard.com","Subject":"Re: [PATCH v4 1/2] libipa: camera_sensor_helper: Add imx471","Message-ID":"<amzCOD7YwA3kcOED@zed>","References":"<CALr1FG__gS_agbUnB5iWZ8wQypxdJch_UHziw2xuuG5Axp3vtQ@mail.gmail.com>\n\t<CALr1FG-kFkSwsXtwCegRtHcCcD1Q+-483g_FFAVWabpa1fD49Q@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<CALr1FG-kFkSwsXtwCegRtHcCcD1Q+-483g_FFAVWabpa1fD49Q@mail.gmail.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]