summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-12-17 12:47:51 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-09-30 11:13:03 +0300
commit674828e35f823433ab5469510359bea21ccd26de (patch)
tree2c260875c4a2010c1262add0653431f64e615bdf /src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
parent72e8139dd21d5c9edd54db362f6a6f5841bf1a23 (diff)
libcamera: camera_sensor: Introduce CameraSensorFactory
Introduce a factory to create CameraSensor derived classes instances by inspecting the sensor media entity name and provide a convenience macro to register specialized sensor handlers. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> --- Changes since combined RFC: - Fix indentation in REGISTER_CAMERA_SENSOR() macro
Diffstat (limited to 'src/libcamera/pipeline/imx8-isi/imx8-isi.cpp')
-rw-r--r--src/libcamera/pipeline/imx8-isi/imx8-isi.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
index 72aa6c75..4e66b336 100644
--- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
+++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
@@ -157,11 +157,10 @@ PipelineHandlerISI *ISICameraData::pipe()
/* Open and initialize pipe components. */
int ISICameraData::init()
{
- int ret = sensor_->init();
- if (ret)
- return ret;
+ if (!sensor_)
+ return -ENODEV;
- ret = csis_->open();
+ int ret = csis_->open();
if (ret)
return ret;
@@ -1057,7 +1056,7 @@ bool PipelineHandlerISI::match(DeviceEnumerator *enumerator)
std::unique_ptr<ISICameraData> data =
std::make_unique<ISICameraData>(this);
- data->sensor_ = std::make_unique<CameraSensor>(sensor);
+ data->sensor_ = CameraSensorFactoryBase::create(sensor);
data->csis_ = std::make_unique<V4L2Subdevice>(csi);
data->xbarSink_ = sink;