From patchwork Thu Jan 19 10:45:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18153 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 7B8BBBD87C for ; Thu, 19 Jan 2023 10:46:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 36BC0625E7; Thu, 19 Jan 2023 11:46:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674125163; bh=Z7uwyphfvKrxAl1sUiyXPfIEf0yE2/sei9hxLIxwL5s=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OuKzBUjrG4WZXamBBWfPD33BJjyiifQ1G0Q+cvZRDgfR+yU+J+y7xyZaAqR+FdWuD E6UhNTp/dM3BQsaodm2GCHEafCFwuzpkXr/E9r76YaJ2R30TOqdzTz08SFf594C6T5 NjpyPPAoEf6Oymiwee8zaT4vTjodudlycyCNGnT1noMoHfHZPy9DQ7GOmTmDuMPw+H Ov3r5gZhlyqVJ1MxbIQ8C2Vdt+4RHOKtzS9ynHJjSGffwCvEAi+94y9sdRZiayJU4D ahUljIQwcAV25Bw63/ur8uFDx2ndzOez8a+G8YuaESnNkIO02Zp9nfNf3OioJuuFGg NfBD5RUa/i2OA== Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC884625D8 for ; Thu, 19 Jan 2023 11:45:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="F00HXyhx"; dkim-atps=neutral Received: by mail-wm1-x32b.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so930893wmc.1 for ; Thu, 19 Jan 2023 02:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U1bnmtoEMhqsz9Hz00T1Qcn/t0Zjag+OzSmEPXGAjYY=; b=F00HXyhxa4U3TNhhneHXu8krzt3WvunE0DuiITPxiwnzV39JVPqew09ZckTUSy9UbO DDE3lfh9EGLWAaUrjWUZNUl52pS8zX8z0/ve9TqvTmJpny5jk3ACl7iGG4gISLHq5YSY wjJDYFSbyxLRGXdDMbsVLPLVHxG0A25TYTSEOgjSruNMzYJ0azJA9I+O48AopHjr6hf0 3j8L065HSGkTLYu62R0YJJmChg55cMFHryXXz4zmQl9DMKM7RrcDFTFLaVUc3bPazi0l gqyz/9am5olcemRPIwMPY5e0bCg2z94ek1qrnTCtZaRUYKcNxZ54Kp32eztTVbL7g8o7 MM0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U1bnmtoEMhqsz9Hz00T1Qcn/t0Zjag+OzSmEPXGAjYY=; b=FN3WCLsL4o9kRp/7sESScr2qmomblNoec4vIUX1aRJY9NBjtDqakkiaRBW+FMA+/Cu /9rsMHpFp9eorvYHCZKCgeCh3b3ZF9uNh1KXbOtieOdfHAKXtwzNMtr8LEl2ofSKwcu3 1SsmdUn12nWQxHJzIg//Ckrmc3JtbRWahgylgmiJhSV8wZtXK2bs7wQYJulml7oEo2/b mIEQrmBGMpbbE+4o1rJ0YcqR6j5m5piYKMfufC0F4J3SlWPCLOhoLJ1GxeZC4w6hci+1 oD9uETNjr9peYCemy1qm5FMen+3/ZjRtTz5cunaUGhgk+4k2vPr3U7Zcd/CJFSYhvoUa b1Cg== X-Gm-Message-State: AFqh2koVwh3QMYBHaPnhJEYeWVFKquF0dUyykY7aca3ydBy819yluWBX rQoPLC3R9oK6wnPdo/hQ+Yki8ot6Qe5yahN2Jrs= X-Google-Smtp-Source: AMrXdXuacn+Spk4enVBpqsE/97tITtDC01cjIZmvbcFnYs/eN8A4xj19HMapxQi5R+uzbP4a60OIrA== X-Received: by 2002:a1c:7415:0:b0:3da:fd07:1e3 with SMTP id p21-20020a1c7415000000b003dafd0701e3mr9417615wmc.22.1674125155200; Thu, 19 Jan 2023 02:45:55 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id be12-20020a05600c1e8c00b003db06224953sm5332029wmb.41.2023.01.19.02.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 02:45:54 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 19 Jan 2023 10:45:35 +0000 Message-Id: <20230119104544.9456-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230119104544.9456-1-naush@raspberrypi.com> References: <20230119104544.9456-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 05/14] ipa: mojom: raspberrypi: Add setLensControls() function 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Cc: Nick Hollinghurst Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nick Hollinghurst Add a setLensControls() function to the IPA/pipeline handler interface. This will be used in a future commit to control the lens actuator position from an autofocus algorithm. Signed-off-by: Nick Hollinghurst Signed-off-by: Naushir Patuck Reviewed-by: Naushir Patuck Reviewed-by: David Plowman --- include/libcamera/ipa/raspberrypi.mojom | 1 + src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index bfacd1275bfb..8e78f167f179 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -131,4 +131,5 @@ interface IPARPiEventInterface { embeddedComplete(uint32 bufferId); setIspControls(libcamera.ControlList controls); setDelayedControls(libcamera.ControlList controls, uint32 delayContext); + setLensControls(libcamera.ControlList controls); }; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 249dedcd8c09..77719db57e44 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -208,6 +208,7 @@ public: void embeddedComplete(uint32_t bufferId); void setIspControls(const ControlList &controls); void setDelayedControls(const ControlList &controls, uint32_t delayContext); + void setLensControls(const ControlList &controls); void setSensorControls(ControlList &controls); void unicamTimeout(); @@ -1589,6 +1590,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 @@ -1835,6 +1837,16 @@ void RPiCameraData::setDelayedControls(const ControlList &controls, uint32_t del handleState(); } +void RPiCameraData::setLensControls(const ControlList &controls) +{ + CameraLens *lens = sensor_->focusLens(); + + if (lens && controls.contains(V4L2_CID_FOCUS_ABSOLUTE)) { + ControlValue const &focusValue = controls.get(V4L2_CID_FOCUS_ABSOLUTE); + lens->setFocusPosition(focusValue.get()); + } +} + void RPiCameraData::setSensorControls(ControlList &controls) { /*