From patchwork Thu Jan 19 10:45:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18156 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 06662C3296 for ; Thu, 19 Jan 2023 10:46:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7684E625EE; Thu, 19 Jan 2023 11:46:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674125165; bh=PcJOx2ozPgn+/h3v+0I2TaOSD5ltLOc0B5wmR8i/Xn8=; 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=ilxntvHUO5cM1NsXZTbgjQzjEiAiipOFT6nHdUsijzjdXwE0TMquhQzbEB3fkQaZF UB+w8MorTCbaLx7X5wecI+bF3B7M0f9xfuxxmTE0PXossMBEAiMb+8Lz8ABs2wWTzh TiaORhCwvYCRcn/Ymkso5Is/2YYPSDX1ln8+7bXWuFsrs/srsLvipAHKH1usA/GJfa 4BW012DAGDHHI+8GSdeCTvzv6eTonZQQ/T2DLyRyn63PJAcoEjjpCvs9KCi9kDXBxq 3j6oYF5/lwqPQaYySuIcvYss+lxokfyY5Jijuz2xj7hgSWLtX4R/NcCCiz7K6mx3Cb 6AKwYJU0bARWg== 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 1B3FE625EF for ; Thu, 19 Jan 2023 11:45:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="H/zzEHaY"; dkim-atps=neutral Received: by mail-wm1-x32b.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so930970wmc.1 for ; Thu, 19 Jan 2023 02:45:58 -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=fcT0+/4kJR0MUVvFlrqUk7hrKyJnbDdSh57uN7PeygU=; b=H/zzEHaYwqm+peG4T6US9BXHmP8qdBPEJVKw6p2QyJLuUZmrqOLG7innUsne8KAJHU fFTNLw5D1wUyHdy1lx9eJBU5/iCnOT1WI2Dy7NVp+gYkSI8qAsWhL0GzaZhsDqoIioL3 tj5B2xyy8pQWLoWezefWJEqdRckbgw51FTzA9Wq1UezFhjhSqMuaPge9dLfkCh6sEg8T 3F4fbiRBRyX/FOaDFYW6SslVSQgibSRww4Tpipt+OUWI05t5JjoTRqrwb1y48FPtQTa0 XiuW8EZ+zp8gxOswAgAL7SG2NYzAOTxRc327QyQDgxAvOp6ntl5uU8XC1jRyOGkrtzIg bnaA== 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=fcT0+/4kJR0MUVvFlrqUk7hrKyJnbDdSh57uN7PeygU=; b=VjlwI24lVpqg9QRllJ+47xq6/lppZIeddpR4mxGIq5KEZUAb1ya/tUP/yfT2ZjLLs/ ELH1RzKOp/7CE5yv9F9d17++Zkk7EzWjqlEEUBfJWlq/Tp1g6oU4hIIYlRSYWvpVnI2r ThbXC1ZoloPiqMIdMhn7a5NBUcEQIv8RqaiI57BKLlkSZLNG0aoreDTVijVQcmIb/KMu +pBuKuzJhkepivSEIQSvU1wawxWXj4Ues0b9RDeonlLYGPSGUEiwabbWGHcBRh+7Vytr Jj4zt9734Mvnsw3X368fxZo3DgrJGj3cw1HceLSK2D6DOZId/qEUF6Iiz5xKljHTSnZo l/AA== X-Gm-Message-State: AFqh2kq5NBhtgv3Yam4FJwb04M2LAPlvGum3M4eZ6G+iJhicpPRXuo3s G6FDG22ZAIglfpJhPLot5uci/ZgX/ev1u29uP2U= X-Google-Smtp-Source: AMrXdXtic4aifSALl+aHsUN+8Bb3pCoHp745bh2BdTcz6wcDtyavpOyEdwn81XoQLDxyZPuE3YzzUQ== X-Received: by 2002:a05:600c:4d08:b0:3da:fef0:226b with SMTP id u8-20020a05600c4d0800b003dafef0226bmr9911553wmp.32.1674125157569; Thu, 19 Jan 2023 02:45:57 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 02:45:57 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 19 Jan 2023 10:45:38 +0000 Message-Id: <20230119104544.9456-9-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 08/14] ipa: raspberrypi: Include autofocus controls in the IPA ControlInfoMap 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" Add all the autofocus controls handled by the IPA into the ControlInfoMap if a controllable lens actuator is present. Signed-off-by: Nick Hollinghurst Signed-off-by: Naushir Patuck Reviewed-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/raspberrypi/raspberrypi.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 18549420445b..745c16f354ce 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -97,6 +97,18 @@ static const ControlInfoMap::Map ipaControls{ { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) } }; +/* IPA controls handled conditionally, if the lens has a focus control */ +static const ControlInfoMap::Map ipaAfControls{ + { &controls::AfMode, ControlInfo(controls::AfModeValues) }, + { &controls::AfRange, ControlInfo(controls::AfRangeValues) }, + { &controls::AfSpeed, ControlInfo(controls::AfSpeedValues) }, + { &controls::AfMetering, ControlInfo(controls::AfMeteringValues) }, + { &controls::AfWindows, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, + { &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) }, + { &controls::AfPause, ControlInfo(controls::AfPauseValues) }, + { &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) } +}; + LOG_DEFINE_CATEGORY(IPARPI) namespace ipa::RPi { @@ -248,6 +260,8 @@ int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *r /* Return the controls handled by the IPA */ ControlInfoMap::Map ctrlMap = ipaControls; + if (lensPresent_) + ctrlMap.merge(ControlInfoMap::Map(ipaAfControls)); result->controlInfo = ControlInfoMap(std::move(ctrlMap), controls::controls); return 0; @@ -489,6 +503,10 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ip ControlInfo(static_cast(helper_->exposure(exposureMin, mode_.minLineLength).get()), static_cast(maxShutter.get())); + /* Declare Autofocus controls, only if we have a controllable lens */ + if (lensPresent_) + ctrlMap.merge(ControlInfoMap::Map(ipaAfControls)); + result->controlInfo = ControlInfoMap(std::move(ctrlMap), controls::controls); return 0; }