From patchwork Thu Feb 28 20:04:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 686 Return-Path: Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 85FDD610BB for ; Thu, 28 Feb 2019 21:03:51 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 17E2AE0005; Thu, 28 Feb 2019 20:03:50 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Feb 2019 21:04:08 +0100 Message-Id: <20190228200410.3022-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228200410.3022-1-jacopo@jmondi.org> References: <20190228200410.3022-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/10] libcamera: ipu3: Implement camera start/stop X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 20:03:52 -0000 Start and stop all video devices in the pipeline. Signed-off-by: Jacopo Mondi --- 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 */