ipa: libipa: camera_sensor_helper: Add OV2680 support
diff mbox series

Message ID CAH9gcag=gxBNGOcWBVN9Pw3faRYDSLp+Y_tH_5_36z2xhru4sQ@mail.gmail.com
State New
Headers show
Series
  • ipa: libipa: camera_sensor_helper: Add OV2680 support
Related show

Commit Message

Crissc Linux Nov. 5, 2026, 8:37 p.m. UTC
Hello,

Transparency note: I am a user, not a camera or kernel developer. The
investigation and the attached patch were done with an AI coding
assistant (Claude Code, by Anthropic), running on my machine. I ran the
tests on my hardware and can run more, but I may need guidance on
detailed technical questions.

The front camera of the CHUWI UBook XPro (Intel IPU3, Kaby Lake) is an
OmniVision OV2680 (ACPI HID OVTI2680). With a recent kernel (Linux 7.0),
the ov2680 driver binds through ipu-bridge and exposes all the controls
libcamera requires. However, libcamera does not list the camera because
there is no camera sensor helper for the OV2680:

  ERROR IPAIPU3 ipu3.cpp:307 ipu3: Failed to create camera sensor
helper for ov2680
  ERROR IPU3 ipu3.cpp:1196 Failed to initialise the IPU3 IPA

The attached patch adds a sensor helper and static properties for the
OV2680:
- analogue gain: linear { 1, 0, 0, 16 } (registers 0x350a/0x350b,
  0x10 = 1x, range 0..1023 as exposed by the kernel driver)
- pixel size: 1.75 um
- test pattern: Color Bars = 1, matching the kernel driver menu

Testing: I applied the same change as a backport to libcamera 0.2.0
(the version shipped by Ubuntu 24.04 / Linux Mint 22.1). The camera is
then detected ("Internal front camera") and streams 1280x720 NV12 at
30 fps with cam, GStreamer libcamerasrc and PipeWire. I have not
compiled the attached patch against current master, so please let me
know if anything needs adjusting. The uncalibrated.yaml tuning file
is used, and image quality is reasonable for that file.

Hardware:
- Machine: CHUWI UBook XPro, BIOS ZW-BI-13-SF133KR300-KB60C-066-E (11/05/2021)
- IPU3 ImgU [8086:1919], CIO2 [8086:9d32]
- Sensor: ov2680 on i2c-2 address 0x10, 19.2 MHz clock from INT3472 (discrete)
- Kernel: 7.0.0-42-generic (Ubuntu HWE)

I can test further patches on this hardware if needed.

Thanks,
Christophe Schleicher

(attachment: 0001-ipa-libipa-camera_sensor_helper-Add-OV2680-support.patch)

Patch
diff mbox series

From 045f16a0f3c4893fe64670f5b75368af94fc8d58 Mon Sep 17 00:00:00 2001
From: Christophe Schleicher <crissc.linux@gmail.com>
Date: Thu, 5 Nov 2026 21:06:34 +0100
Subject: [PATCH] ipa: libipa: camera_sensor_helper: Add OV2680 support

Add a camera sensor helper and static sensor properties for the
OmniVision OV2680, as found as the front camera of the CHUWI UBook XPro
(Intel IPU3, ACPI HID OVTI2680).

The OV2680 analogue gain is programmed in registers 0x350a/0x350b with
a 1/16 step (0x10 = 1x), which maps to a linear gain model of
{ 1, 0, 0, 16 }. The pixel size is 1.75um. The test pattern menu
indices follow the upstream kernel ov2680 driver.

Without the helper, the IPU3 IPA fails to initialise with
"Failed to create camera sensor helper for ov2680" and the camera is not
exposed.

Tested on a CHUWI UBook XPro with Linux 7.0 and a backport of this
change to libcamera 0.2.0: the IPU3 pipeline exposes the camera and
streams 1280x720 NV12 at 30 fps (cam, GStreamer libcamerasrc,
PipeWire).

This patch was written with the help of an AI coding assistant
(Claude Code, Anthropic), which did the analysis and wrote the code.
I tested the result on my hardware, reviewed it and submit it under my
responsibility.

Signed-off-by: Christophe Schleicher <crissc.linux@gmail.com>
---
 src/ipa/libipa/camera_sensor_helper.cpp           | 11 +++++++++++
 src/libcamera/sensor/camera_sensor_properties.cpp | 14 ++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 359040e..ded0bf1 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -748,6 +748,17 @@  public:
 };
 REGISTER_CAMERA_SENSOR_HELPER("mira220", CameraSensorHelperMira220)
 
+class CameraSensorHelperOv2680 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperOv2680()
+	{
+		/* Analogue gain register 0x350a/0x350b, 1/16 step (0x10 = 1x). */
+		gain_ = AnalogueGainLinear{ 1, 0, 0, 16 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("ov2680", CameraSensorHelperOv2680)
+
 class CameraSensorHelperOv2685 : public CameraSensorHelper
 {
 public:
diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
index 20cfd0b..5cf824c 100644
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -403,6 +403,20 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				.hblankDelay = 1
 			},
 		} },
+		{ "ov2680", {
+			.unitCellSize = { 1750, 1750 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeColorBars, 1 },
+				/*
+				 * No corresponding test pattern mode for:
+				 * 2: "Random Data"
+				 * 3: "Square"
+				 * 4: "Black Image"
+				 */
+			},
+			.sensorDelays = { },
+		} },
 		{ "ov2685", {
 			.unitCellSize = { 1750, 1750 },
 			.testPatternModes = {
-- 
2.43.0