libipa, sensor: Add OV8856 camera sensor helper and properties
diff mbox series

Message ID 20260527023954.947576-1-elmo_git@todurov.eu
State New
Headers show
Series
  • libipa, sensor: Add OV8856 camera sensor helper and properties
Related show

Commit Message

Elmo Todurov May 27, 2026, 2:39 a.m. UTC
The OV8856 is supported by the in-tree V4L2 driver
drivers/media/i2c/ov8856.c (CONFIG_VIDEO_OV8856) and is shipped on
Chromebooks (mt8183-kodama, sc7180-trogdor-coachz) and on Xiaomi
Poco X3 Pro (Qualcomm sm8150) as the rear ultrawide.

Register the sensor in the libipa CameraSensorHelper database and in
the sensor properties database so SoftIPA can drive AE/AGC and so
applications get correct pixel-array metadata.

Provenance of the values:

  - Analogue gain model: the kernel driver writes V4L2_CID_ANALOGUE_GAIN
    (range 128..2047, default 128, step 1) directly to the sensor's
    OV8856_REG_ANALOG_GAIN, placing unity gain at code 128 and a
    maximum of 15.99x at code 2047. This is the same 7-bit linear
    1/128-step model used by the existing OV8858 helper.
    Reference: drivers/media/i2c/ov8856.c, OV8856_ANAL_GAIN_*.

  - Pixel pitch 1.12 µm: OmniVision OV8856 datasheet (1/4" 8 MP RAW
    sensor, 3264 x 2448 active, 1.12 µm pixel).

  - Test pattern modes: the kernel driver registers a 5-entry menu
    (ov8856_test_pattern_menu[]). Index 0 is "Disabled" and index 1
    is "Standard Color Bar", matching TestPatternModeOff and
    TestPatternModeColorBars. Indices 2..4 are "Top-Bottom",
    "Right-Left" and "Bottom-Top Darker Color Bar" with no
    corresponding libcamera TestPatternMode (the OV8858 entry omits
    them for the same reason).

  - Sensor delays: left as the default-constructed value. The kernel
    driver does not use group hold; the actual exposure/gain apply
    latency has not been measured on this sensor. Matches the OV8858
    entry.

Tested with the simple pipeline + SoftwareIsp at 1640 x 1232 / 30 fps
on Xiaomi Poco X3 Pro (sm8150 CAMSS).

Signed-off-by: Elmo Todurov <elmo_git@todurov.eu>
---
 src/ipa/libipa/camera_sensor_helper.cpp           | 11 +++++++++++
 src/libcamera/sensor/camera_sensor_properties.cpp | 13 +++++++++++++
 2 files changed, 24 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 3028197e1..ccb0bf085 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -755,6 +755,17 @@  public:
 };
 REGISTER_CAMERA_SENSOR_HELPER("ov64a40", CameraSensorHelperOv64a40)
 
+class CameraSensorHelperOv8856 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperOv8856()
+	{
+		/* OV8856 uses the same 7-bit 1/128 step linear gain as OV8858. */
+		gain_ = AnalogueGainLinear{ 1, 0, 0, 128 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("ov8856", CameraSensorHelperOv8856)
+
 class CameraSensorHelperOv8858 : public CameraSensorHelper
 {
 public:
diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
index b217363d8..b915ad5b6 100644
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -446,6 +446,19 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				.hblankDelay = 2
 			},
 		} },
+		{ "ov8856", {
+			.unitCellSize = { 1120, 1120 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeColorBars, 1 },
+			},
+			.sensorDelays = {
+				.exposureDelay = 2,
+				.gainDelay = 2,
+				.vblankDelay = 2,
+				.hblankDelay = 2,
+			},
+		} },
 		{ "ov8858", {
 			.unitCellSize = { 1120, 1120 },
 			.testPatternModes = {