[libcamera-devel,v5,04/10] ipa: libcamera: add support for ov8858 sensor
diff mbox series

Message ID 20221028031726.4849-5-nicholas@rothemail.net
State New
Headers show
Series
  • [libcamera-devel,v5,01/10] ipa: workaround libcxx duration limitation
Related show

Commit Message

Nicolas Dufresne via libcamera-devel Oct. 28, 2022, 3:17 a.m. UTC
From: Nicholas Roth <nicholas@rothemail.net>

Currently, libcamera does not have information for the ov8858 sensor
used in the PinePhone Pro, a phone designed to run Linux.

This commit adds metadata, especially that sensor gain is reported and
set in 1/16 discrete increments.

For more information, see "5.8 manual exposure compensation/ manual
gain compensation" in [0] and the driver in [1].

[0] http://www.ahdsensor.com/uploadfile/202008/55322e75316871.pdf
[1] https://github.com/megous/linux/blob/orange-pi-5.19/drivers/media/i2c/ov8858.c

Signed-off-by: Nicholas Roth <nicholas@rothemail.net>
---
 src/ipa/libipa/camera_sensor_helper.cpp    | 11 +++++++++++
 src/libcamera/camera_sensor_properties.cpp | 14 ++++++++++++++
 2 files changed, 25 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 35056bec..f2040cbd 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -476,6 +476,17 @@  public:
 };
 REGISTER_CAMERA_SENSOR_HELPER("ov5693", CameraSensorHelperOv5693)
 
+class CameraSensorHelperOv8858 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperOv8858()
+	{
+		gainType_ = AnalogueGainLinear;
+		gainConstants_.linear = { 1, 0, 0, 16 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("m00_f_ov8858", CameraSensorHelperOv8858)
+
 class CameraSensorHelperOv8865 : public CameraSensorHelper
 {
 public:
diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp
index e5f27f06..d0757c15 100644
--- a/src/libcamera/camera_sensor_properties.cpp
+++ b/src/libcamera/camera_sensor_properties.cpp
@@ -146,6 +146,20 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				 */
 			},
 		} },
+		{ "m00_f_ov8858", {
+			.unitCellSize = { 1200, 1200 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeColorBars, 1 },
+				/*
+				 * No best corresponding test pattern for:
+				 * 1: "Vertical Color Bar Type 1",
+				 * 2: "Vertical Color Bar Type 2",
+				 * 3: "Vertical Color Bar Type 3",
+				 * 4: "Vertical Color Bar Type 4"
+				 */
+			},
+		} },
 		{ "ov8865", {
 			.unitCellSize = { 1400, 1400 },
 			.testPatternModes = {