[v3,1/2] libipa: camera_sensor_helper: Add imx471
diff mbox series

Message ID CALr1FG9fxSqkZNpejfc2D--VzoJ37LS=G+zAE1T9ESg9MAoVmg@mail.gmail.com
State New
Headers show
Series
  • Add imx471 soft-ISP sensor support
Related show

Commit Message

John Cronin July 31, 2026, 2:45 p.m. UTC
Add CameraSensorHelper for Sony IMX471 (SONY471A), used on Lenovo
ThinkPad X9 / X1 Carbon Gen14 and related IPU7 platforms.

The kernel imx471 driver writes V4L2_CID_ANALOGUE_GAIN codes 0..800
directly to register 0x0204 and does not document a gain formula. Use
the same Sony linear model G = 1024/(1024-code) already used for
imx355/imx477/imx708. Under that model code 800 implies ~4.57x; that
figure is derived from the V4L2 range, not a datasheet max-gain claim
(no public datasheet available here).

Black level 4096 (64 DN at 10-bit, scaled to 16-bit) follows the same
pedestal convention as imx355. It has not yet been measured on a covered
lens on this hardware.

Soft-ISP loads without "Failed to create camera sensor helper for
imx471" on Fedora 44 / ThinkPad X9-15 Gen 1 (kernel 7.1.5).

Signed-off-by: John Cronin <john.cronin@opcenter.com>
---
 src/ipa/libipa/camera_sensor_helper.cpp | 30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

 public:

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp
b/src/ipa/libipa/camera_sensor_helper.cpp
index cc16e25..bae2603 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -644,6 +644,36 @@  class CameraSensorHelperImx462 : public
CameraSensorHelperImx290
 };
 REGISTER_CAMERA_SENSOR_HELPER("imx462", CameraSensorHelperImx462)

+class CameraSensorHelperImx471 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperImx471()
+	{
+		/*
+		 * Sony IMX471 (IPU7 platforms: ThinkPad X9 / X1 Carbon Gen14,
+		 * ACPI SONY471A).
+		 *
+		 * Kernel imx471 writes V4L2_CID_ANALOGUE_GAIN directly to
+		 * register 0x0204 with range 0..800 (IMX471_ANA_GAIN_MIN/MAX).
+		 * The driver does not document a conversion formula.
+		 *
+		 * Use the same Sony linear model as imx355/imx477/imx708:
+		 *   G = 1024 / (1024 - code)
+		 * which yields code 0 -> 1.0x and code 800 -> ~4.57x. That max
+		 * is a consequence of the V4L2 code range under this model,
+		 * not an independent datasheet claim (no public datasheet
+		 * available to this author).
+		 *
+		 * Black level: 64 DN at 10-bit -> 4096 at 16-bit, same pedestal
+		 * convention as imx355 ("From datasheet: 64 at 10bits"). Not
+		 * independently measured on a covered lens yet.
+		 */
+		blackLevel_ = 4096;
+		gain_ = AnalogueGainLinear{ 0, 1024, -1, 1024 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("imx471", CameraSensorHelperImx471)
+
 class CameraSensorHelperImx477 : public CameraSensorHelper
 {