[libcamera-devel] [PATCH v3 6/7] libcamera: sensor: ov5670: Register pixel array properties

Jacopo Mondi jacopo at jmondi.org
Tue Feb 18 12:27:51 CET 2020


Implement sensor specific pixel array properties initialization for the
OV5670 sensor driver by overriding CameraSensor::initProperties()
method.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/sensor/ov5670.cpp | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/src/libcamera/sensor/ov5670.cpp b/src/libcamera/sensor/ov5670.cpp
index 407a0d2967ae..c5fdffda7412 100644
--- a/src/libcamera/sensor/ov5670.cpp
+++ b/src/libcamera/sensor/ov5670.cpp
@@ -5,6 +5,11 @@
  * ov5670.cpp - OV5670 camera sensor
  */
 
+#include <array>
+
+#include <libcamera/controls.h>
+#include <libcamera/property_ids.h>
+
 #include "camera_sensor.h"
 
 /**
@@ -18,6 +23,7 @@ class OV5670 final : public CameraSensor
 {
 public:
 	OV5670(const MediaEntity *entity);
+	int initProperties();
 };
 
 /**
@@ -34,6 +40,39 @@ OV5670::OV5670(const MediaEntity *entity)
 {
 }
 
+/**
+ * \brief Initialize Camera properties with ov5670 specific values
+ * \return 0 on success, a negative error code otherwise
+ */
+int OV5670::initProperties()
+{
+	/* Pixel Array Properties. */
+	std::array<float, 2> pixelArraySize = { 2.9457f, 2.214f };
+	properties_.set(properties::PixelArraySize,
+			Span<float>{ pixelArraySize });
+
+	std::array<int32_t, 2> pixelArrayBounds = { 2592, 1944 };
+	properties_.set(properties::PixelArrayBounds,
+			Span<int32_t>{ pixelArrayBounds });
+
+	std::array<int32_t, 2> pixelArrays = { 2592, 1944 };
+	properties_.set(properties::PixelArrays,
+			Span<int32_t>{ pixelArrays });
+
+	std::array<int32_t, 4> activeAreaSize = { 16, 6, 2560, 1920 };
+	properties_.set(properties::ActiveAreaSize,
+			Span<int32_t>{ activeAreaSize });
+
+	int32_t bayerFilter = properties::BayerFilterGRBG;
+	properties_.set(properties::BayerFilterArrangement, bayerFilter);
+
+	std::array<int32_t, 2> isoSensitivities = { 50, 800 };
+	properties_.set(properties::ISOSensitivityRange,
+			Span<int32_t>{ isoSensitivities });
+
+	return CameraSensor::initProperties();
+}
+
 REGISTER_CAMERA_SENSOR(OV5670, "ov5670");
 
 }; /* namespace libcamera */
-- 
2.25.0



More information about the libcamera-devel mailing list