[libcamera-devel] [PATCH v2 8/9] libcamera: camera_sensor: Register static properties
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Dec 23 06:24:57 CET 2020
Hi Jacopo,
Thank you for the patch.
On Fri, Dec 18, 2020 at 05:47:53PM +0100, Jacopo Mondi wrote:
> Register static properties, retrieved inspecting the sensor
> database, in the CameraSensor class.
>
> 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 <jacopo at jmondi.org>
> ---
> include/libcamera/internal/camera_sensor.h | 1 +
> src/libcamera/camera_sensor.cpp | 21 ++++++++++++++++++++-
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index f80d836161a5..1b3a17f2ce77 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -69,6 +69,7 @@ protected:
>
> private:
> int generateId();
> + void initStaticProperties();
> int initProperties();
>
> const MediaEntity *entity_;
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index 2b78eb4cb530..18079da2e4b5 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -19,6 +19,7 @@
>
> #include "libcamera/internal/bayer_format.h"
> #include "libcamera/internal/formats.h"
> +#include "libcamera/internal/sensor_database.h"
> #include "libcamera/internal/sysfs.h"
> #include "libcamera/internal/utils.h"
>
> @@ -214,6 +215,21 @@ int CameraSensor::init()
> return 0;
> }
>
> +void CameraSensor::initStaticProperties()
> +{
> + if (!sensorDatabase.contains(model_)) {
> + LOG(CameraSensor, Info)
> + << "No static properties available for '" << model_ << "'";
> + LOG(CameraSensor, Info)
> + << "Please consider updating the sensor database";
I'd upgrade this to a warning at least.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> + return;
> + }
> +
> + const ControlList &staticProperties = sensorDatabase.properties(model_);
> + for (const auto &prop : staticProperties)
> + properties_.set(prop.first, prop.second);
> +}
> +
> int CameraSensor::initProperties()
> {
> /*
> @@ -251,7 +267,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;
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list