From patchwork Mon Jun 24 14:28:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 1508 Return-Path: Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 00C1C61617 for ; Mon, 24 Jun 2019 16:27:53 +0200 (CEST) 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 relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 3CB4A20006; Mon, 24 Jun 2019 14:27:53 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 24 Jun 2019 16:28:58 +0200 Message-Id: <20190624142859.19313-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624142859.19313-1-jacopo@jmondi.org> References: <20190624142859.19313-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 5/6] libcamera: ipu3: Set pipe_mode based on stream configuration 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: Mon, 24 Jun 2019 14:27:54 -0000 Set the ImgU pipe_mode control based on the active stream configuration. Use 'Video' pipe mode unless the viewfinder stream is not active. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/ipu3.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1c0a9825b4cd..0fb044ba5513 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -22,6 +22,7 @@ #include "media_device.h" #include "pipeline_handler.h" #include "utils.h" +#include "v4l2_controls.h" #include "v4l2_subdevice.h" #include "v4l2_videodevice.h" @@ -194,6 +195,12 @@ private: class PipelineHandlerIPU3 : public PipelineHandler { public: + static constexpr unsigned int V4L2_CID_IPU3_PIPE_MODE = 0x009819c1; + enum IPU3PipeModes { + IPU3PipeModeVideo = 0, + IPU3PipeModeStillCapture = 1, + }; + PipelineHandlerIPU3(CameraManager *manager); CameraConfiguration *generateConfiguration(Camera *camera, @@ -559,6 +566,17 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) if (ret) return ret; + /* Apply the "pipe_mode" control to the ImgU subdevice. */ + V4L2ControlList ctrls; + ctrls.add(V4L2_CID_IPU3_PIPE_MODE, vfStream->active_ ? + IPU3PipeModeVideo : + IPU3PipeModeStillCapture); + ret = imgu->imgu_->setControls(&ctrls); + if (ret) { + LOG(IPU3, Error) << "Unable to set pipe_mode control"; + return ret; + } + return 0; }