From cdfcb05bedd22670f42581188d9ffd07a283fb4c Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Fri, 18 Dec 2020 11:47:52 +0100 Subject: libcamera: camera_sensor: Register static properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Register static properties in the CameraSensor class by inspecting the camera sensor properties database. Static properties are overridden by properties retrieved from the kernel interface at run-time if any overlap between the two sets occurs. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- src/libcamera/camera_sensor.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/libcamera/camera_sensor.cpp') diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 2887bb69..1db263cf 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -19,6 +19,7 @@ #include #include "libcamera/internal/bayer_format.h" +#include "libcamera/internal/camera_sensor_properties.h" #include "libcamera/internal/formats.h" #include "libcamera/internal/sysfs.h" #include "libcamera/internal/utils.h" @@ -407,6 +408,16 @@ void CameraSensor::initVimcDefaultProperties() activeArea_ = Rectangle(pixelArraySize_); } +void CameraSensor::initStaticProperties() +{ + const CameraSensorProperties *props = CameraSensorProperties::get(model_); + if (!props) + return; + + /* Register the properties retrieved from the sensor database. */ + properties_.set(properties::UnitCellSize, props->unitCellSize); +} + int CameraSensor::initProperties() { /* @@ -444,7 +455,10 @@ int CameraSensor::initProperties() if (ret) return ret; - /* Retrieve and store the camera sensor properties. */ + /* Initialize the static properties from the sensor database. */ + initStaticProperties(); + + /* Retrieve and register properties from the kernel interface. */ const ControlInfoMap &controls = subdev_->controls(); int32_t propertyValue; -- cgit v1.2.1