{"id":16211,"url":"https://patchwork.libcamera.org/api/patches/16211/?format=json","web_url":"https://patchwork.libcamera.org/patch/16211/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220613142853.98484-3-jeanmichel.hautbois@ideasonboard.com>","date":"2022-06-13T14:28:45","name":"[libcamera-devel,02/10] libcamera: raspberrypi: Control the lens from pipeline","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9ae84e0af53fd3a4d063ad9f0a18659e550c0d65","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16211/mbox/","series":[{"id":3174,"url":"https://patchwork.libcamera.org/api/series/3174/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3174","date":"2022-06-13T14:28:43","name":"ipa: raspberrypi: Introduce an autofocus algorithm","version":1,"mbox":"https://patchwork.libcamera.org/series/3174/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16211/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16211/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0BE32C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jun 2022 14:29:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ABD5365641;\n\tMon, 13 Jun 2022 16:29:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6856065632\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jun 2022 16:29:00 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:a1c7:c28c:7720:9b30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C1C0835;\n\tMon, 13 Jun 2022 16:29:00 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655130544;\n\tbh=BfG8mLPyRgMbK5UtRblM/WXf8sFjwr0mQ1tQGW7PjHc=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=3Q77JQfaakhU1Eh7Lc+pJtXEQootR7K93ouqUcXYv5gBS2Df6Zo68DuPPuny/qjpx\n\tg85eSr0WitQNXvkrgNUT96dK+n0k1clK4Pb6EtYDufakoHZdohACo1LyomTcUUwxck\n\tGwCXzN/tj0+3H/1AmT6bBCHdivQ5u9W8X66aiXJKVVEmNOTBwxLHDss6PbHrktfjoC\n\tj9gzcSwE5PcU4DtySEtjte8E9uZR/FqP/tHF8uc/JOcKg6RAiLaIuJ3Kn/grmt/kPd\n\tkK7cxRoMnNUZKgaYqDW0Io8082udBOO3FMErCL0awbzEsMrG8nnD8V8u0C7REdSby2\n\tLjPy6+7nm/wCA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655130540;\n\tbh=BfG8mLPyRgMbK5UtRblM/WXf8sFjwr0mQ1tQGW7PjHc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=azF//k2jiqtbH5oG0BrbHpssj4XwCo3m4+DWMi7DjeswzkZH9q5o6QCsg4F1pFhlU\n\tdsTzYF0EpmzyX0VeTtqE6NCn3y2TEd+SLp6MLhiYE+kd2bAhS9VrpdMTXUfC5NWLNn\n\tCrVdwoSFBHdPmpj0LhT6qFqORplxKmSdGp6RVM7M="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"azF//k2j\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 13 Jun 2022 16:28:45 +0200","Message-Id":"<20220613142853.98484-3-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 02/10] libcamera: raspberrypi: Control the\n\tlens from pipeline","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The lens focus is controled by a VCM, which is linked to the sensor\nusing the ancillary links.\nPass the control to the config info structure and make it possible to\nupdate by the IPA.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.mojom         |  1 +\n .../pipeline/raspberrypi/raspberrypi.cpp        | 17 +++++++++++++++++\n 2 files changed, 18 insertions(+)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex a60c3bb4..42c5134b 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -131,4 +131,5 @@ interface IPARPiEventInterface {\n \tembeddedComplete(uint32 bufferId);\n \tsetIspControls(libcamera.ControlList controls);\n \tsetDelayedControls(libcamera.ControlList controls);\n+\tsetLensControls(libcamera.ControlList controls);\n };\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex adc397e8..90ea7eaa 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -33,6 +33,7 @@\n \n #include \"libcamera/internal/bayer_format.h\"\n #include \"libcamera/internal/camera.h\"\n+#include \"libcamera/internal/camera_lens.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n #include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n@@ -211,6 +212,7 @@ public:\n \tvoid setDelayedControls(const ControlList &controls);\n \tvoid setSensorControls(ControlList &controls);\n \tvoid unicamTimeout();\n+\tvoid setLensControls(const ControlList &controls);\n \n \t/* bufferComplete signal handlers. */\n \tvoid unicamBufferDequeue(FrameBuffer *buffer);\n@@ -1521,6 +1523,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n \tipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete);\n \tipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);\n \tipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);\n+\tipa_->setLensControls.connect(this, &RPiCameraData::setLensControls);\n \n \t/*\n \t * The configuration (tuning file) is made from the sensor name unless\n@@ -1557,6 +1560,10 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA\n \tentityControls.emplace(0, sensor_->controls());\n \tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n \n+\tCameraLens *lens = sensor_->focusLens();\n+\tif (lens)\n+\t\tentityControls.emplace(2, lens->controls());\n+\n \t/* Always send the user transform to the IPA. */\n \tipaConfig.transform = static_cast<unsigned int>(config->transform);\n \n@@ -1773,6 +1780,16 @@ void RPiCameraData::setDelayedControls(const ControlList &controls)\n \thandleState();\n }\n \n+void RPiCameraData::setLensControls(const ControlList &ctrls)\n+{\n+\tCameraLens *lens = sensor_->focusLens();\n+\tif (!lens)\n+\t\treturn;\n+\n+\t/* \\todo Should we keep track of the latest value applied ? */\n+\tlens->setFocusPosition(ctrls.get(V4L2_CID_FOCUS_ABSOLUTE).get<int32_t>());\n+}\n+\n void RPiCameraData::setSensorControls(ControlList &controls)\n {\n \t/*\n","prefixes":["libcamera-devel","02/10"]}