From patchwork Tue Feb 18 11:27:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 2855 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 362B861F57 for ; Tue, 18 Feb 2020 12:25:18 +0100 (CET) X-Originating-IP: 93.34.114.233 Received: from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id D737860002; Tue, 18 Feb 2020 11:25:17 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 18 Feb 2020 12:27:51 +0100 Message-Id: <20200218112752.3910410-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218112752.3910410-1-jacopo@jmondi.org> References: <20200218112752.3910410-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 6/7] libcamera: sensor: ov5670: Register pixel array properties 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: Tue, 18 Feb 2020 11:25:18 -0000 Implement sensor specific pixel array properties initialization for the OV5670 sensor driver by overriding CameraSensor::initProperties() method. Signed-off-by: Jacopo Mondi --- 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 + +#include +#include + #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 pixelArraySize = { 2.9457f, 2.214f }; + properties_.set(properties::PixelArraySize, + Span{ pixelArraySize }); + + std::array pixelArrayBounds = { 2592, 1944 }; + properties_.set(properties::PixelArrayBounds, + Span{ pixelArrayBounds }); + + std::array pixelArrays = { 2592, 1944 }; + properties_.set(properties::PixelArrays, + Span{ pixelArrays }); + + std::array activeAreaSize = { 16, 6, 2560, 1920 }; + properties_.set(properties::ActiveAreaSize, + Span{ activeAreaSize }); + + int32_t bayerFilter = properties::BayerFilterGRBG; + properties_.set(properties::BayerFilterArrangement, bayerFilter); + + std::array isoSensitivities = { 50, 800 }; + properties_.set(properties::ISOSensitivityRange, + Span{ isoSensitivities }); + + return CameraSensor::initProperties(); +} + REGISTER_CAMERA_SENSOR(OV5670, "ov5670"); }; /* namespace libcamera */