[libcamera-devel] [PATCH 08/10] libcamera: ipu3: Implement camera start/stop
Jacopo Mondi
jacopo at jmondi.org
Thu Feb 28 21:04:08 CET 2019
Start and stop all video devices in the pipeline.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/pipeline/ipu3/ipu3.cpp | 57 ++++++++++++++++++++++++----
1 file changed, 49 insertions(+), 8 deletions(-)
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 8ce661e27f62..b9bc992879f5 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -146,6 +146,8 @@ private:
void registerCameras();
int releaseBuffers(V4L2Device *dev);
+ int startDevice(V4L2Device *dev);
+ int stopDevice(V4L2Device *dev);
ImguDevice imgu0_;
ImguDevice imgu1_;
@@ -410,14 +412,27 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)
int PipelineHandlerIPU3::start(const Camera *camera)
{
IPU3CameraData *data = cameraData(camera);
- V4L2Device *cio2 = data->cio2.output;
int ret;
- ret = cio2->streamOn();
- if (ret) {
- LOG(IPU3, Info) << "Failed to start camera " << camera->name();
+ ret = startDevice(data->imgu->output);
+ if (ret)
+ return ret;
+
+ ret = startDevice(data->imgu->viewfinder);
+ if (ret)
+ return ret;
+
+ ret = startDevice(data->imgu->stat);
+ if (ret)
+ return ret;
+
+ ret = startDevice(data->imgu->input);
+ if (ret)
+ return ret;
+
+ ret = startDevice(data->cio2.output);
+ if (ret)
return ret;
- }
return 0;
}
@@ -425,10 +440,12 @@ int PipelineHandlerIPU3::start(const Camera *camera)
void PipelineHandlerIPU3::stop(const Camera *camera)
{
IPU3CameraData *data = cameraData(camera);
- V4L2Device *cio2 = data->cio2.output;
- if (cio2->streamOff())
- LOG(IPU3, Info) << "Failed to stop camera " << camera->name();
+ stopDevice(data->imgu->output);
+ stopDevice(data->imgu->viewfinder);
+ stopDevice(data->imgu->stat);
+ stopDevice(data->imgu->input);
+ stopDevice(data->cio2.output);
}
int PipelineHandlerIPU3::queueRequest(const Camera *camera, Request *request)
@@ -934,6 +951,30 @@ int PipelineHandlerIPU3::releaseBuffers(V4L2Device *dev)
return 0;
}
+int PipelineHandlerIPU3::startDevice(V4L2Device *dev)
+{
+ int ret = dev->streamOn();
+ if (ret) {
+ LOG(IPU3, Info)
+ << "Failed to start video device:" << dev->deviceNode();
+ return ret;
+ }
+
+ return 0;
+}
+
+int PipelineHandlerIPU3::stopDevice(V4L2Device *dev)
+{
+ int ret = dev->streamOff();
+ if (ret) {
+ LOG(IPU3, Info)
+ << "Failed to stop video device:" << dev->deviceNode();
+ return ret;
+ }
+
+ return 0;
+}
+
REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);
} /* namespace libcamera */
--
2.20.1
More information about the libcamera-devel
mailing list