From patchwork Mon Jan 23 15:49:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18183 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 DB28CC3296 for ; Mon, 23 Jan 2023 15:49:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9521762606; Mon, 23 Jan 2023 16:49:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674488999; 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=G9YJs+FhzdJM3kwXWAOB7jjapNtgLc/K/kJ/nt9fFdRYOmpplOReXfDyHccIIndgm MyoCTgQE3C1mOtZmyggEKQnF7m99TsWVMdJBc6K6t+jsZJMlkWsBKkCDx9MXsnTCp6 3fI47iHCLC7Op7Jf/EZByZdaC6NSDbXcJJ92WcwQfMOUseCgxkCXWr8MvXdqmX+nB5 9d15J17CoQjVNwMl8O5lwtRKnoJYcZ+Z9aHqYdkB8sSc8eaNXywZyBpdF4frM2xh61 Ys4osXX2crBIolpL9V88ATsqehXj3i4YfQFj7ENiB8iOUA/VoFOWQNjIX3weDbo4hH NmqxcSf57JtfQ== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 82F69625EB for ; Mon, 23 Jan 2023 16:49:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="bKSGdDCU"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so8900154wmc.1 for ; Mon, 23 Jan 2023 07:49:53 -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=bKSGdDCU5MDgYH0nFv29R6aVXiR2PNeVY/LJmCUZIruw4FOOXegiROAt/2AWK//0RR 2ACnOnyUMiRfs+X01PJ97xp5iAz4AvDkkX2Z/W834piFp8bNYVL0gol1zt+/J81+BvGO BnopC+dEcdVtkDnGqbdfJkuhUQN1f7UPe+mvwC375yzxD3+RaNJkGq1u2TCOjsdAzqFF okHzA2IZ86MSeRzel4wCTSjl8HihsASdgBjYhC0q7evCDxYrNFS+FrWEoFccSdqHxv4l xmHSSYLCxRHHxdBC7JTPc9CvrXLAADZLVRACmL76VEsHxRAkrzR+Tyzo6dn5LZHQiuT1 jTeA== 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=mmjOJomZcfPS/TZVBvh9tvs0SY5d4hPfmXo5apFUKvtSqlBteTQUqKaT3DX+OL2nfR XwPL5cUyCNxI+ORYJRwLYVZDNojHvUtmS08RavUqJ2IJegYXmpQTmEMyDX7x+qkFDhC5 1vwLNqR/Zj5OoZulemY5iuApY66bR1FkyGFAF2aB8Ff+9H72SCPCzNRvReAakb2BtHFD 5NIhSk5QLB3/WpMg6L91Y0gnJyTK3EG/S8S0PYPGidoXcz2r8iqJ0mlI3KeQYr8WUAYW P9K6vItw8zZHTAjIXDMGWLXFUsrmAEFR+04g0vkV4AIX/hXFD56sQNCpnVjGyxEXxG9I gjkw== X-Gm-Message-State: AFqh2krdLyWpat23SViL8Q9Z5feO5/LBQ2U++Ifc7puNpV2rRtMLdj/c 5n6PPTSypHw5zp7O+3xD3R/U+fYmcv056mllxZ0= X-Google-Smtp-Source: AMrXdXtXvDSd01Yw+Ma3W1uF0hjU7OKEVIbEQF6h7qWmcU5LTK+lRKnJ+Fazxg6zBICDOl0bc2B31w== X-Received: by 2002:a05:600c:5386:b0:3cf:9844:7b11 with SMTP id hg6-20020a05600c538600b003cf98447b11mr25528114wmb.23.1674488992601; Mon, 23 Jan 2023 07:49:52 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:49:52 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Jan 2023 15:49:28 +0000 Message-Id: <20230123154934.27803-9-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 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; }