From patchwork Thu Dec 1 14:51:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 17931 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E054ABE08B for ; Thu, 1 Dec 2022 14:52:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C2D76333F; Thu, 1 Dec 2022 15:52:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1669906365; bh=sRr+TVmkOtBZrmMpxPYURb0t1dQR+ieK7x5VMfVjpD0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=cDtZvMxuQaQMEIr91CrqlMV/7JY2HSuxIfRTTxpzsGzCOQ0qTrHAtEnAOe1y6M5ry umJJY01RaCnXSlEg7QbVpkG8YCC/Mz6syScv+wkae/BFDup29OfOn8mmLyijgf2Yu7 7lb9oou/9pAAdAewAmzdMYFvHpjavsIZnUyutZrgAWapzWuPfJx3iCE+Tqwbma5eqy 6txBCnFZGIm7bFr72+jgwTXF/YW09JuXmMk7uNm2kz7Yb/tM8q0HCPjmXniJi33h8H aujHaUKgxf6frJV1y+KbZENvtA0K+tHEjkmgVp3N2Mz0pOBKVCz8nfQFcTVf4nEgOA 0zmjz2c6oLVqQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CF67163336 for ; Thu, 1 Dec 2022 15:52:43 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZRPkYmI6"; dkim-atps=neutral Received: from umang.jainideasonboard.com (unknown [210.186.188.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BDCE06D0; Thu, 1 Dec 2022 15:52:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1669906363; bh=sRr+TVmkOtBZrmMpxPYURb0t1dQR+ieK7x5VMfVjpD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZRPkYmI6mgmhn5Zz4BOj9YpJkDYxaJmlH9MMdG17A9cFPQar/42cjyeJRWP1obO7/ 11MXaqSYKUZP3z24kfz6PstcJinzdYkHJkM7icwQhS7t15UcCogvfbcX5vLV7qpoh8 exqrjJGG5ha+ZraTI3xWVNR0qlI7KZm2GHxskSoI= To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Dec 2022 22:51:30 +0800 Message-Id: <20221201145133.479794-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221201145133.479794-1-umang.jain@ideasonboard.com> References: <20221201145133.479794-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/5] libcamera: raspberrypi: Control the lens from pipeline X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Jean-Michel Hautbois The lens focus is controled by a VCM, which is linked to the sensor using the ancillary links. Pass the control to the config info structure and make it possible to update by the IPA. Signed-off-by: Jean-Michel Hautbois --- include/libcamera/ipa/raspberrypi.mojom | 1 + .../pipeline/raspberrypi/raspberrypi.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index d53644fe..e01f0b2b 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -130,4 +130,5 @@ interface IPARPiEventInterface { embeddedComplete(uint32 bufferId); setIspControls(libcamera.ControlList controls); setDelayedControls(libcamera.ControlList controls); + setLensControls(libcamera.ControlList controls); }; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 0e0b7194..911d5b55 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -32,6 +32,7 @@ #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/camera.h" +#include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -209,6 +210,7 @@ public: void setDelayedControls(const ControlList &controls); void setSensorControls(ControlList &controls); void unicamTimeout(); + void setLensControls(const ControlList &controls); /* bufferComplete signal handlers. */ void unicamBufferDequeue(FrameBuffer *buffer); @@ -1551,6 +1553,7 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result) ipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete); ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls); ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls); + ipa_->setLensControls.connect(this, &RPiCameraData::setLensControls); /* * The configuration (tuning file) is made from the sensor name unless @@ -1591,6 +1594,10 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA entityControls.emplace(0, sensor_->controls()); entityControls.emplace(1, isp_[Isp::Input].dev()->controls()); + CameraLens *lens = sensor_->focusLens(); + if (lens) + entityControls.emplace(2, lens->controls()); + /* Always send the user transform to the IPA. */ ipaConfig.transform = static_cast(config->transform); @@ -1807,6 +1814,16 @@ void RPiCameraData::setDelayedControls(const ControlList &controls) handleState(); } +void RPiCameraData::setLensControls(const ControlList &ctrls) +{ + CameraLens *lens = sensor_->focusLens(); + if (!lens) + return; + + /* \todo Should we keep track of the latest value applied ? */ + lens->setFocusPosition(ctrls.get(V4L2_CID_FOCUS_ABSOLUTE).get()); +} + void RPiCameraData::setSensorControls(ControlList &controls) { /*