[libcamera-devel] [PATCH v7 4/5] libcamera: camera_lens: add CameraLens as a member of CameraSensor

Umang Jain umang.jain at ideasonboard.com
Thu Dec 2 18:17:14 CET 2021


Hello,

On 12/2/21 8:08 PM, Kieran Bingham wrote:
> Hi Han-Lin,
>
> Thanks, I think this is a better place/way to model the Lens.


Yeah, I was thinking of Pipeline-handlers but this seems okay to me as well,

unless some pipeline-handler wants to manage it on its own (quirks).

>
> Quoting Han-Lin Chen (2021-12-02 14:03:16)
>> Add CameraLens as a member of CameraSenosr. The patch does not implement how
> /CameraSenosr/CameraSensor/
>
>> to link the lens to the specific sensor yet. Only to provide an interface for
>> pipeline handler's usage.
> And I think that's fine while we wait for the links to land. It means
> the plumbing is in place, and a CameraSensor just needs to
> construct/initialise a CameraLens when it is constructed based on its
> links.
>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>


Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>

>
>> Signed-off-by: Han-Lin Chen <hanlinchen at chromium.org>
>> ---
>>   include/libcamera/internal/camera_sensor.h | 5 +++++
>>   src/libcamera/camera_sensor.cpp            | 8 ++++++++
>>   2 files changed, 13 insertions(+)
>>
>> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
>> index d25a1165..8e97a80e 100644
>> --- a/include/libcamera/internal/camera_sensor.h
>> +++ b/include/libcamera/internal/camera_sensor.h
>> @@ -24,6 +24,7 @@
>>   namespace libcamera {
>>   
>>   class BayerFormat;
>> +class CameraLens;
>>   class MediaEntity;
>>   
>>   class CameraSensor : protected Loggable
>> @@ -60,6 +61,8 @@ public:
>>   
>>          void updateControlInfo();
>>   
>> +       CameraLens *lens() { return lens_.get(); }
>> +
>>   protected:
>>          std::string logPrefix() const override;
>>   
>> @@ -91,6 +94,8 @@ private:
>>          const BayerFormat *bayerFormat_;
>>   
>>          ControlList properties_;
>> +
>> +       std::unique_ptr<CameraLens> lens_;
>>   };
>>   
>>   } /* namespace libcamera */
>> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
>> index 6151b32e..b386e7b0 100644
>> --- a/src/libcamera/camera_sensor.cpp
>> +++ b/src/libcamera/camera_sensor.cpp
>> @@ -20,6 +20,7 @@
>>   #include <libcamera/base/utils.h>
>>   
>>   #include "libcamera/internal/bayer_format.h"
>> +#include "libcamera/internal/camera_lens.h"
>>   #include "libcamera/internal/camera_sensor_properties.h"
>>   #include "libcamera/internal/formats.h"
>>   #include "libcamera/internal/sysfs.h"
>> @@ -787,6 +788,13 @@ void CameraSensor::updateControlInfo()
>>          subdev_->updateControlInfo();
>>   }
>>   
>> +/**
>> + * \fn CameraSensor::lens()
>> + * \brief Retrieve the lens controller
>> + *
>> + * \return The lens controller. nullptr if no lens is connected to the sensor
>> + */
>> +
>>   std::string CameraSensor::logPrefix() const
>>   {
>>          return "'" + entity_->name() + "'";
>> -- 
>> 2.34.1.400.ga245620fadb-goog
>>


More information about the libcamera-devel mailing list