[v2,1/3] libipa: camera_sensor_helper: Add OV9734
diff mbox series

Message ID 20261112085159.14289-2-guyliandejong@proton.me
State New
Headers show
Series
  • ipu3: Fix support for small sensors such as the OV9734
Related show

Commit Message

GuyliandeJong Nov. 12, 2026, 8:52 a.m. UTC
Add a camera sensor helper for the OmniVision OV9734, used as the front
camera of the Microsoft Surface Laptop 2.

The kernel ov9734 driver writes V4L2_CID_ANALOGUE_GAIN directly to the
0x350a gain register, with a range of 16 to 248. The register is a Q4
fixed point value, so 16 is unity gain, giving a linear model of
gain = code / 16.

The driver doesn't program the black level calibration target, so the
sensor default of 0x10 at 10 bits applies, which is 1024 at 16 bits.
This matches raw frames captured with the lens covered, which average
16.7 to 17.0 in all four Bayer channels at minimum exposure and unity
gain.

Without a helper the IPU3 IPA can't be used with this sensor.

Signed-off-by: GuyliandeJong <guyliandejong@proton.me>
Tested-by: Afonso Figuinha <afonso.figuinha@gmail.com>
---
 src/ipa/libipa/camera_sensor_helper.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 608937d4..4de1a1f3 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -942,6 +942,19 @@  public:
 };
 REGISTER_CAMERA_SENSOR_HELPER("ov8865", CameraSensorHelperOv8865)
 
+class CameraSensorHelperOv9734 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperOv9734()
+	{
+		/* Sensor default black level target: 0x10 at 10 bits. */
+		blackLevel_ = 1024;
+		/* Analogue gain is a Q4 value, 16 is unity gain. */
+		gain_ = AnalogueGainLinear{ 1, 0, 0, 16 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("ov9734", CameraSensorHelperOv9734)
+
 class CameraSensorHelperOv13858 : public CameraSensorHelper
 {
 public: