From patchwork Thu Mar 26 14:59:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 3333 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 943BF60414 for ; Thu, 26 Mar 2020 15:56:35 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from localhost.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 599DD20006 for ; Thu, 26 Mar 2020 14:56:35 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 26 Mar 2020 15:59:26 +0100 Message-Id: <20200326145927.324919-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200326145927.324919-1-jacopo@jmondi.org> References: <20200326145927.324919-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 5/6] libcamera: sensor: Add OV5670 camera sensor X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2020 14:56:36 -0000 Add an OV5670 class to handle the Omnivision OV5670 image sensor and register it to the camera sensor factory and initialize its pixel array properties by overriding CameraSensor::initProperties() method. Add the newly created src/libcamera/sensor/ directory to the Doxygen exclude paths, as the documentation of each CameraSensor sub-class does not belong to the library core documentation. Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- Documentation/Doxyfile.in | 3 +- src/libcamera/meson.build | 1 + src/libcamera/sensor/meson.build | 3 ++ src/libcamera/sensor/ov5670.cpp | 54 ++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/libcamera/sensor/meson.build create mode 100644 src/libcamera/sensor/ov5670.cpp diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in index 3dffbf823398..0df93d593b25 100644 --- a/Documentation/Doxyfile.in +++ b/Documentation/Doxyfile.in @@ -846,7 +846,8 @@ EXCLUDE = @TOP_SRCDIR@/include/libcamera/span.h \ @TOP_SRCDIR@/src/libcamera/include/device_enumerator_sysfs.h \ @TOP_SRCDIR@/src/libcamera/include/device_enumerator_udev.h \ @TOP_SRCDIR@/src/libcamera/pipeline/ \ - @TOP_SRCDIR@/src/libcamera/proxy/ + @TOP_SRCDIR@/src/libcamera/proxy/ \ + @TOP_SRCDIR@/src/libcamera/sensor/ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 87fa09cde63d..358c784baa20 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -57,6 +57,7 @@ includes = [ subdir('pipeline') subdir('proxy') +subdir('sensor') libatomic = cc.find_library('atomic', required : false) libdl = cc.find_library('dl') diff --git a/src/libcamera/sensor/meson.build b/src/libcamera/sensor/meson.build new file mode 100644 index 000000000000..7af70370cf5c --- /dev/null +++ b/src/libcamera/sensor/meson.build @@ -0,0 +1,3 @@ +libcamera_sources += files([ + 'ov5670.cpp', +]) diff --git a/src/libcamera/sensor/ov5670.cpp b/src/libcamera/sensor/ov5670.cpp new file mode 100644 index 000000000000..d7339b9792e1 --- /dev/null +++ b/src/libcamera/sensor/ov5670.cpp @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Google Inc. + * + * ov5670.cpp - OV5670 camera sensor + */ + +#include + +#include "camera_sensor.h" + +namespace libcamera { + +class OV5670 final : public CameraSensor +{ +public: + OV5670(const MediaEntity *entity); + int initProperties(); +}; + +/* + * \class OV5670 + * \brief Camera sensor class for Omnivision OV5670 image sensor + */ + +/* + * \brief Construct the ov5670 sensor class + * \param[in] entity The media entity representing the sensor + */ +OV5670::OV5670(const MediaEntity *entity) + : CameraSensor(entity) +{ +} + +/* + * \brief Initialize Camera properties with ov5670 specific values + * \return 0 on success, a negative error code otherwise + */ +int OV5670::initProperties() +{ + /* Pixel Array Properties. */ + properties_.set(properties::PixelArraySize, { 2.9457f, 2.214f }); + properties_.set(properties::PixelArray, { 2592, 1944 }); + properties_.set(properties::ActiveAreas, { 16, 6, 2560, 1920 }); + properties_.set(properties::BayerFilterArrangement, + properties::BayerFilterGRBG); + properties_.set(properties::ISOSensitivityRange, { 50, 800 }); + + return CameraSensor::initProperties(); +} + +REGISTER_CAMERA_SENSOR(OV5670, "ov5670"); + +}; /* namespace libcamera */