aboutsummaryrefslogtreecommitdiffci
path: root/patches/0001-libipa-camera_sensor-add-ov02c10.patch
blob: c917c1df53c7f0d8acd01c2e96b7033cf2cf4180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
libipa: camera_sensor: Add support for the OV02C10

The OV02C10 is the front camera of the Microsoft Surface Pro 12in. Without
a CameraSensorHelper the software ISP cannot map the V4L2_CID_ANALOGUE_GAIN
control value onto a real gain, so its AGC has no usable gain model and just
ramps the control to its maximum. The preview stays close to black regardless
of the scene:

  WARN IPASoft soft_simple.cpp:104 IPASoft: Failed to create camera sensor helper for ov02c10
  WARN CameraSensorProperties camera_sensor_properties.cpp:548 No static properties available for 'ov02c10'

The kernel driver programs the analogue gain into the 16 bit register pair at
0x3508 with a range of 0x10 to 0xf8, i.e. 4 fractional bits and 1x to 15.5x,
so the gain is simply code / 16.

The black level was measured on a Surface Pro 12in from raw frames captured
off the CAMSS RDI video node: the 1st percentile of a dark frame sits at code
64 in 10 bits, matching the usual OmniVision 0x40.

Pixel size and optical format (1.116 um, 1/7.25") are from the OMNIVISION
product page for the OV02C10.

--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -677,6 +677,18 @@
 };
 REGISTER_CAMERA_SENSOR_HELPER("ov01a10", CameraSensorHelperOv01a10)
 
+class CameraSensorHelperOv02c10 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperOv02c10()
+	{
+		/* From dark frame measurement: 0x40 at 10bits. */
+		blackLevel_ = 4096;
+		gain_ = AnalogueGainLinear{ 1, 0, 0, 16 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("ov02c10", CameraSensorHelperOv02c10)
+
 class CameraSensorHelperOv08x40 : public CameraSensorHelper
 {
 public:
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -335,6 +335,21 @@
 				.hblankDelay = 3
 			},
 		} },
+		{ "ov02c10", {
+			.unitCellSize = { 1116, 1116 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeColorBars, 1 },
+				/*
+				 * No corresponding test patterns in
+				 * MIPI CCS specification for sensor's
+				 * 2: "Top-Bottom Darker Color Bar"
+				 * 3: "Right-Left Darker Color Bar"
+				 * 4: "Color Bar type 4"
+				 */
+			},
+			.sensorDelays = { },
+		} },
 		{ "ov2685", {
 			.unitCellSize = { 1750, 1750 },
 			.testPatternModes = {