From patchwork Wed Mar 23 16:01:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 15528 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 0B39AC0F1B for ; Wed, 23 Mar 2022 16:01:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24C99632E6; Wed, 23 Mar 2022 17:01:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648051314; bh=EA287Hwt5glVUgdzaeQKWcbKnnGZWRTVqjWta/B9euI=; 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=I4TRJqnWapOn8EOaWcrHPpYxvvp0jehnOIKzQGtlIlWb77ywBmIXLEhj0Qiq3hAuE fVDJIfK1AfB+QJWG1u+hD2v1Pa/QyNsoyvnG+cXAWdVIgnvBRosTGmNQM4WgmVm0LK ybjoXvCDinRYpysxIF6GoQ5M2VrYE/P9N1sE8LP5znp9Hf5ykaXOLheJ/lTc5CcYe7 yZe1uL5T10y0RNBtR3LXxKfyxqMZK7eKiyspcBkh++7uAaBAxYkEV4evvuQM6w3FEw P/tMHAASDimfb/LgiC7AT7qwzRjO/GdkLLvGKtFW0zPlttzfcSZxqJacSDOpAu/2nA g3TAbl3WO/gEg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E5542604DA for ; Wed, 23 Mar 2022 17:01:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="j6z6CtRy"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:2e05:b10:1542:d51b]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A83359DE; Wed, 23 Mar 2022 17:01:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648051309; bh=EA287Hwt5glVUgdzaeQKWcbKnnGZWRTVqjWta/B9euI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j6z6CtRy4lT4kjGPxh/3YE2LlmIpozupwbmdUEsb3L6Hcc9+PDiPbo4O4gsIfs4DQ DNR11Jj/hSu5Y9VVZPvI7MtKZmJR4XDItFUN1WlP/bIPDPok1OlLVFWfoHqbnsiDC1 wDhh5wOOQiU9LBXz4apbauQVZO3nH7lk33WKUI40= To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Mar 2022 17:01:44 +0100 Message-Id: <20220323160145.90606-4-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220323160145.90606-1-jeanmichel.hautbois@ideasonboard.com> References: <20220323160145.90606-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 3/4] 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: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 acd3cafe..0c3922b0 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -125,4 +125,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 c2230199..970f9fe7 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -33,6 +33,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" @@ -202,6 +203,7 @@ public: void setIspControls(const ControlList &controls); void setDelayedControls(const ControlList &controls); void setSensorControls(ControlList &controls); + void setLensControls(const ControlList &controls); /* bufferComplete signal handlers. */ void unicamBufferDequeue(FrameBuffer *buffer); @@ -1483,6 +1485,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig) 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 @@ -1519,6 +1522,10 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) 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); @@ -1735,6 +1742,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) { /*