From patchwork Mon Jan 23 15:49:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18180 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 28FDABEFBE for ; Mon, 23 Jan 2023 15:49:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BE556625F1; Mon, 23 Jan 2023 16:49:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674488994; bh=nrqFYopn5EitpyaiZsHGEphiMjIcZmS2iJQTy0OrNjo=; 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=RvU65ru4SHvivYkpLQRpiY4d36IdNT0bz5tFKELEmzrNBHWrzX8HBwjXrxB1xgkIu e0zi/XjVujPjSgYbpi4TlttleubOtblaMNjdY4Mr5HgUdJ6T/L0K5TfWAOkttYVgAF lGUVSKUfu7OGn03zM7JZq7+wizTQaMVOmrI0XnkvCItnbVrOMOdxrInNTnejM3ug10 bA6i1NXMaA+JJFNADTb+Psw64T6N/oKFZ39+TtlO1eS0E5aYmNH5DLFcoCjVrbcWxC Ah2PBvXK53OR/0DRaZIFAqnlARspui+IfCt3f31bMgroB2qsFyGQdCK5QwiHLgsP++ +tSCN9E5PN3eQ== Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F115625D8 for ; Mon, 23 Jan 2023 16:49:51 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="FwikU4am"; dkim-atps=neutral Received: by mail-wm1-x32c.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so10952987wmb.0 for ; Mon, 23 Jan 2023 07:49:51 -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=FdgUpNeuXRgy7Jb4386K7B9G95evIDYxvmfu/ug4LlQ=; b=FwikU4amUmCwyROGIqpb1hzzBF1SYv/HX9J/1JmsbhPzKOEyJ6jEzaw36GEB6qtEfH v15M+WCV9OhSkhh0ZPOZAasIU9XNke8W4B0+ffJIdgmzXxEZKGrCnX5lx/DUvz7SVxOI Sf2tb0ZCWkNMUzFoN6y7rdvscAaPSMESiGll2dKe8/TwHiUZTwbRTJO4NQH3628EjjBh i4/PkO0jZzp6+E2WOBTvoskfXaqFIZH/izWvDfErmz7Q5bhi6/91p8GLNA1Q2sdlxv9O Q9w8ugaUo0V2nKMnFkJkp/zoQZSjJgEx8oVQOTvwROcIEw/+liuO9LLVwDK9yxHVEQ1O xkQA== 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=FdgUpNeuXRgy7Jb4386K7B9G95evIDYxvmfu/ug4LlQ=; b=UuCJS7LDgidbVYnUCI5lRa7jgG3pOV/UD+VTgaDdDu0Ov4CppD2RELgjZXk3N9ybhA tpS/to+YUta8qUKs2lsswiUDCTv4tGbB5YUdndDcrz5jObEgmrNJduj3wF3VwkVjDjT7 w+pIIXceKnZZmG/H+oKaza2zdwrt6Ppvzm/Pb9LK+OY1T08UAzBLIqrgBj7WvfVF2Ehm 5bfWu6tVYBgYtWOsfpn3JTDLD9xAU+SVxRWFSZU2AjgBtHKRI3XPJndtiHEgP+jUX212 Sc/XqvFUPHSTp4iBasbAL5ofKU7FKe3SLwsMujiUxmSkz8vG2EQe1m9nL4wra6odjZUL lqdQ== X-Gm-Message-State: AFqh2kopab6WqmHtvSvl96C9cLdNOi2adc6mb1eVFigept7/G/WkdNSv bxwK+KcazmczUNA1rOzz/ClFLP4BEGTRpH3d3mM= X-Google-Smtp-Source: AMrXdXu4mNluacxYqVC0XfGICKEs0RfeLsMlKKpupAGq6lCat+0ZppVw5eFKoWAMNR8L00EnEXadoQ== X-Received: by 2002:a05:600c:1613:b0:3d0:2485:c046 with SMTP id m19-20020a05600c161300b003d02485c046mr24168597wmn.27.1674488990630; Mon, 23 Jan 2023 07:49:50 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id n16-20020a05600c181000b003d1de805de5sm10339689wmp.16.2023.01.23.07.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:49:50 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Jan 2023 15:49:25 +0000 Message-Id: <20230123154934.27803-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123154934.27803-1-naush@raspberrypi.com> References: <20230123154934.27803-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 b0f4930c6f1b..d1fd93292652 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 @@ -1836,6 +1838,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) { /*