From patchwork Thu Feb 6 18:52:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 2799 Return-Path: Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E132360969 for ; Thu, 6 Feb 2020 19:50:20 +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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id B4ECAFF802 for ; Thu, 6 Feb 2020 18:50:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 6 Feb 2020 19:52:46 +0100 Message-Id: <20200206185247.202233-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200206185247.202233-1-jacopo@jmondi.org> References: <20200206185247.202233-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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: Thu, 06 Feb 2020 18:50:22 -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 | 41 +++++++++++++++++++++++++++++++++ src/libcamera/sensor/ov5670.h | 3 +++ 2 files changed, 44 insertions(+) diff --git a/src/libcamera/sensor/ov5670.cpp b/src/libcamera/sensor/ov5670.cpp index de6011875a2d..a49fcebb2d9d 100644 --- a/src/libcamera/sensor/ov5670.cpp +++ b/src/libcamera/sensor/ov5670.cpp @@ -6,6 +6,12 @@ */ #include "ov5670.h" + +#include + +#include +#include + #include "camera_sensor.h" /** @@ -38,6 +44,41 @@ OV5670CameraSensor::OV5670CameraSensor(const MediaEntity *entity) { } +/** + * \brief Initialize Camera properties with ov5670 specific values + * \param[in] controlMap The map of control information provided by the sensor + * \return 0 on success, a negative error code otherwise + */ +int OV5670CameraSensor::initProperties(const ControlInfoMap &controlMap) +{ + /* Pixel Array Properties. */ + std::array pixelArraySize = { 2.9f, 1.18f }; + 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(controlMap); +} + REGISTER_CAMERA_SENSOR(OV5670); }; /* namespace libcamera */ + diff --git a/src/libcamera/sensor/ov5670.h b/src/libcamera/sensor/ov5670.h index 4acf02a8b06b..a66bdb6ae276 100644 --- a/src/libcamera/sensor/ov5670.h +++ b/src/libcamera/sensor/ov5670.h @@ -11,12 +11,15 @@ namespace libcamera { +class ControlInfoMap; + class OV5670CameraSensor final : public CameraSensor { public: static const char *entityName(); OV5670CameraSensor(const MediaEntity *entity); + int initProperties(const ControlInfoMap &controlMap); }; }; /* namespace libcamera */