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 = {