From patchwork Mon Jun 5 09:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18704 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 CF5DEC31E9 for ; Mon, 5 Jun 2023 09:14:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 956BF61EA2; Mon, 5 Jun 2023 11:14:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685956490; bh=rAPPRGIK7ergAYTWapdZD2yrLY0T1UiUdGaIuCtw1t4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xH7by0Ge0ezzRUdS4hWS5CE1BfkJgJFroR7OElsRDqdNIEJny+VDTa5tSuR8c6/PF 47qKjo6fy3ao4WGGfdQmccfWk8KdiKA6dA8dYt9K0oFTr+Dk9e2hgExhuc7zn3FSXs 6SAIE5Dix8k+yLTyB/bXbHlTZ0oRiCYup+ivU5aT90WakZGjjXv7lNDlyAzT4nwPLm KuL5GQMEycT6HuwnaVZRS/9BOrkSOgIy8XKpQQ1RbDZbehgcMZEskGm/12iAeGCJZR 1ujsLky+phzhrk7SXW1cqdwzew5jxh7UR1/wGcNJXhNvWAkX+ejIWKwcB46jCPh5e9 jGAKO4YDmPhQw== Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F33861EA2 for ; Mon, 5 Jun 2023 11:14:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="EfBciO9x"; dkim-atps=neutral Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4f4b384c09fso5560404e87.3 for ; Mon, 05 Jun 2023 02:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685956486; x=1688548486; 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=ywJGWkJ6oloWq9znNAk+rwVyBoiU6N9YCFeBpk7/Zk4=; b=EfBciO9xunCWWZvVZ5hWch9mYTCl6UCDzUTxGhbGgGiRwKBLI3u9E2pHgnDJiYauby Cj8da264e6m67PZaGRz15Jxj4GIufrdW6+e7WVVQQL/x6AuqM4oey7MGn7+fh7S5qWFY DJ3XdHltpxIIPj4VxuGJWmJ1T5Mf3SaOrkU4MLjLsqlIqqiDujXS+wyYHGMxg9B2LseH bq7H91IwDmmIdynEbwdrTli3ELjdDTnAdZEdh4/SUV0RQJ7aYCdt/PDYcFcwKQM0ipkT oRWQrKzVpSsyjlJNEtktebyiWpDYBCe9MUphI7Ft9fcQjiBg2kY5LVCtyZ/lJtDaY/IE qlkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685956486; x=1688548486; 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=ywJGWkJ6oloWq9znNAk+rwVyBoiU6N9YCFeBpk7/Zk4=; b=Fcg8RKDHh6lV/r2tL4kF6UJ8atSZsE2CYPlCsVjsJdKS0dmcsqB5IvMZC5lUkmvKp7 MPJcuNfx8wvKEdhpMjRC9KdSagomBG9EeCwBsHjt1yp88avmY6+w1PRRE9eBTCGWliHB RQgy37YUFUgwo2tYBp95qkSEfLYAhmgf+vK4dcaiA36LTJ3p5o5icJWa3vO/0QSFLxAI AI2PsNYGO9VUgxC9kcVhxn7ARPnO+QLvg8PuKFruc6ViWAnHAbA1hmT0qnVSv7BiawPs QWcYfAnt8nknH6zMLrpX/jnoyfm7ewaMZSRgKrhzZ40egjBT754/LSwcHNNNCrUMT3iD XsFA== X-Gm-Message-State: AC+VfDxLN1JwjgPKefOuNKNQraRNSGCPiEPCW40uOdxvMjjz/d5cUKK5 jS4W4fsvfOsLlWTVXRln3WwXpdVuFQC3zuBag3oaVQ== X-Google-Smtp-Source: ACHHUZ57rx5YLLGtpziINCbHbjBKvGO01057WjC0Qof9uMdtcW4H1atQ2ToguutuD+KXjqlUbMKgNw== X-Received: by 2002:ac2:5455:0:b0:4f3:a1fe:5b1c with SMTP id d21-20020ac25455000000b004f3a1fe5b1cmr4957148lfn.44.1685956486514; Mon, 05 Jun 2023 02:14:46 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id z16-20020a7bc7d0000000b003f605814850sm13776369wmk.37.2023.06.05.02.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 02:14:46 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Jun 2023 10:14:04 +0100 Message-Id: <20230605091406.31757-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605091406.31757-1-naush@raspberrypi.com> References: <20230605091406.31757-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/3] libcamera: controls: Define a default lens position behaviour 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 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Update the AfMode control description to explicitly define a startup/default behaviour. On startup, the camera will move the lens to the position given by the default value of the LensPosition control if operating in manual focus mode. Typically this would be the hyperfocal position of the lens. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index adea5f90acc5..765168e539a8 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -408,6 +408,13 @@ controls: LensPosition control. In this mode the AfState will always report AfStateIdle. + + If the camera is started in AfModeManual, it will move the focus + lens to the position specified by the LensPosition control. + + This mode is the recommended default value for the AfMode control. + External cameras (as reported by the Location property set to + CameraLocationExternal) may use a different default value. - name: AfModeAuto value: 1 description: | From patchwork Mon Jun 5 09:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18705 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 3F0B5C31E9 for ; Mon, 5 Jun 2023 09:14:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 26B5362891; Mon, 5 Jun 2023 11:14:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685956491; bh=Po+0B6OoR7x5A87nVYWv4E8Qv65qNKo51f4QNhZTqPk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=wYjTlo4afxp9zJvhcJbMGbESQBlLJ/ZQBd3rADEuZZesMuDhzZsam/8D6SkmNOZQH aDvt7TkBtN2MEYKG+9/8geAezx207K+nJe9m9QJcEBTl/g0sCOJK6tzozQUEEge1yM zEd+zzf3XVu0lcdBIltu2kBiyuApKehKNwp3aoiN6WyI7f2ebPTaUeRifLJmle0yeY 6kVcyA0z8Jk2uWyxL9e+jziURKK2awdlACGgmfG20xE0V+9//lhZKZ2XA3JGv0QFnK eDLHvolTvBsbxg/dkjKRV6xHZ2r1cUCpxaEdhN1drbxtxD/RD36tneZBWfCk0d+Y0I W/pmFBzf+Nh4g== Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DBB362880 for ; Mon, 5 Jun 2023 11:14:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qRU0nQ5G"; dkim-atps=neutral Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4f3ba703b67so5541731e87.1 for ; Mon, 05 Jun 2023 02:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685956487; x=1688548487; 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=5zZra2t06WVGkK/lCB01lQuXNNeuoe7W189Tj55Iz0A=; b=qRU0nQ5G0pnolaiQTWPuDji/D27zediNQl+xa8s6tyWo6AVPv4LNM7GPFw5/rMAqAp 4qs4tlSTReI4ij/5S+JZhMy2v7AR+RhMvQvy2FhxW6IbypVJPptAo+ZeXUhQOo9qLBcq Tq2IxAJNNvjPiU2L4wnKGNHLiVJIS2ZAoCzFD5sTSEtCl9kXWvXEhPfhcYzHjpqCn/gn LSqVwdWdNo0OQNPkMvABgyLdlzPsIHmS5Mpi6HLzGhn2x93BxP7f9sAcs/0A4BL6xclz 4ZRrcoRUgJrbDCQ+bo874BkQEudnuQCaZyEQ31fBuLFGXRjDQxuDLMJMvlmYF6VVsSiH Z2Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685956487; x=1688548487; 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=5zZra2t06WVGkK/lCB01lQuXNNeuoe7W189Tj55Iz0A=; b=SpwOgXh78GTKtb5eHL4kd9zaa/sLlZ7BpmaIB5v5IcLbVppRClN+94bnvq15QnZWHc WA04hxCFyEeRkkVD+xkzwM/gtPOPkrRz2/asbD4hvawf74tPEE2Bkmg5eFcpmUKlHoek g95WZiXs5SKX83+zr9EgamLrDTC3j9MHa+66FW6nUbTutInQnMW+az4uAmybzVCjpQZM xm0Qtf0/QNkPtjQJTkxVsQk9/+0TMit+niErziDolsxonO5XIRKabXz8UzSnWe7aTVGE 0GPYw+dfssMHr9WAGvSZxgX84pCVMx1ory/uePFgGZuDqXaFLVwnsJ7VjITGH2awjxJg YMRw== X-Gm-Message-State: AC+VfDy2OCXJk1MJoYdgvVgp5u7Ywy47XnE3SnNfyUBS33gD5P6NVteT e8yvsvpNYvDrXBdk4d2XU21YdMI1tlOoUGFXoULpyw== X-Google-Smtp-Source: ACHHUZ4ntxF5SQT7TEbaocioUQaeycmwK5vBnzuDhs1lt54p/Zb+6TBK/0wY+C1qPewvr92+GLU+GQ== X-Received: by 2002:a05:6512:6e:b0:4f6:259d:3d42 with SMTP id i14-20020a056512006e00b004f6259d3d42mr1363718lfo.3.1685956487340; Mon, 05 Jun 2023 02:14:47 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id z16-20020a7bc7d0000000b003f605814850sm13776369wmk.37.2023.06.05.02.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 02:14:46 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Jun 2023 10:14:05 +0100 Message-Id: <20230605091406.31757-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605091406.31757-1-naush@raspberrypi.com> References: <20230605091406.31757-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/3] pipeline: ipa: rpi: Return lens controls from ipa->configure() 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 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In addition to sensor controls, return lens controls from IpaBase::configure() back to the pipeline handler. If there are lens controls present in the ControlList, action them in the pipeline handler as part of the configure routine. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- include/libcamera/ipa/raspberrypi.mojom | 3 ++- src/ipa/rpi/common/ipa_base.cpp | 2 +- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index ba786e647ca1..4f20792e4679 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -46,7 +46,8 @@ struct ConfigParams { struct ConfigResult { float modeSensitivity; libcamera.ControlInfoMap controlInfo; - libcamera.ControlList controls; + libcamera.ControlList sensorControls; + libcamera.ControlList lensControls; }; struct StartResult { diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index db7a0eb3a1ca..599ad146a863 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -201,7 +201,7 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa applyAGC(&agcStatus, ctrls); } - result->controls = std::move(ctrls); + result->sensorControls = std::move(ctrls); /* * Apply the correct limits to the exposure, gain and frame duration controls diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 3bb5ec531e4f..2ab0b971149a 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1192,8 +1192,10 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config return -EPIPE; } - if (!result->controls.empty()) - setSensorControls(result->controls); + if (!result->sensorControls.empty()) + setSensorControls(result->sensorControls); + if (!result->lensControls.empty()) + setLensControls(result->lensControls); return 0; } From patchwork Mon Jun 5 09:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18706 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 C64D8C328F for ; Mon, 5 Jun 2023 09:14:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BAD9062894; Mon, 5 Jun 2023 11:14:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685956491; bh=ruCIXVqD07bh5LsU1/tK830Am0RiJr3CrtaFauP7UHQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nMI49ciidYFM5SMWklke7pyQSi/1pnoRnIQRUtlJYJWYU/LflFfnn4xIaHvwthZ60 UECydE9ZlWamiR/OXWf3cZNJVQ269SaLfKV4R0YwjDeHye6U4sJdxvlMv0zWS1x7jA LhI2nwPE9I5DNds+dRn4A8tfApruegAzpXwl2evRZcv8qWEqezh0vz+6A2IGNzIUQ7 iGxVFQFYiX1SjWlnmJJkY76iWy5v54YTEIhqluZZWQcpFXeWsU2N3zOEVBcnBT/3vG hLCQJ8W2IK4tk/azYdZyJHhK8QlubnV+PHp7+Go5aGQZkpZwEXPai3zMO/gdoJV6Uv 7oWgEvLyHqHcg== Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE7CA62885 for ; Mon, 5 Jun 2023 11:14:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="kAKuMK/O"; dkim-atps=neutral Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f6e1393f13so38020125e9.0 for ; Mon, 05 Jun 2023 02:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685956488; x=1688548488; 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=AFumYtvjDfTfPcCzPY8h7kvd3jEx3vvM8zqSEr5CJEM=; b=kAKuMK/O5Jj8Oncb5c5/Advdf99BYCnwoUeJBQ02Rb4Ntq0mcNwEnxODaOFjcpIvHX +K25sT6wrCerwPBvQBsCANw5UUT4RJ8JEXPJxZ5yxiFWxqI2o1N1NLl2u8XklgqZ3xxe Wgn5vUeSI7g5WNA30vbE/DHfO23sEgxQKXdmvu4MStKTQtdf5g94e+KZ9Sl9OhKBKCJ7 1mBwULQyeYxsv1CMUMkQ7VN/Ghug6qUXEzYENeW32bT+ubNMRRFkYSYuxYAktRQLGvF1 skbO4ZcCXPs1eYM1JhZG3nH/scKSU1r207gexkjWNw/gNR89/GlbFprq9jcHzAVHQsa2 AHbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685956488; x=1688548488; 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=AFumYtvjDfTfPcCzPY8h7kvd3jEx3vvM8zqSEr5CJEM=; b=FjkTZnlwsdsGXNGhQ8+zbaYhkK353pL6YL1Ra/QE4YyK+PPuo+DS91ztScyPd2KHGy UsKB6RWVxzzW4JhozGZ6Y7OzhWizv0IFzO/zUYR5CI6SCLBxc1NBbFLfU2ON+3Peftam vyCxWiVy8QdnygRORY4iv86+tNCXRmW/vhskEYaxELKAvyhCH4aSHKFvvr5zVsk2Oz/Y dTvhz2bJpZzHbe1N+WJiGV5Suwaj2lrp1jTr6gJiVwBM93Wo7+Dflvr1hwD0iveluMA/ jatdQqp2VgsebtxGfrbC04wQvDFNoLEMa0eYgOp05SElek6DER+Aq/teaeiIefY/atcj XU2g== X-Gm-Message-State: AC+VfDy9PjlqtDWwuJySvgSJBdgd2XQpJp7BOjoQ9fbel9/THQDSGw+e RWkl3u6kMIzrMDmSwySVMApA5+SwcQglWZkaW2h4cQ== X-Google-Smtp-Source: ACHHUZ4q3rwMV2xpaVL4b7gDqiyx96hwAobIckdCEIeYcT3I0AJ+XEREW31eM4s9kQJXD0FQGlCdUg== X-Received: by 2002:a1c:7405:0:b0:3f4:bb58:d174 with SMTP id p5-20020a1c7405000000b003f4bb58d174mr6303365wmc.22.1685956488167; Mon, 05 Jun 2023 02:14:48 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id z16-20020a7bc7d0000000b003f605814850sm13776369wmk.37.2023.06.05.02.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 02:14:47 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Jun 2023 10:14:06 +0100 Message-Id: <20230605091406.31757-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605091406.31757-1-naush@raspberrypi.com> References: <20230605091406.31757-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/3] ipa: rpi: Set lens position to hyperfocal on startup 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 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" On the first ipa->configure() call, set the lens position (if a lens is present) to the default position. Typically this would be the hyperfocal position based on the tuning data. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/ipa/rpi/common/ipa_base.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 599ad146a863..dbb95311ba51 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -199,6 +199,23 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa agcStatus.shutterTime = defaultExposureTime; agcStatus.analogueGain = defaultAnalogueGain; applyAGC(&agcStatus, ctrls); + + /* Set the lens to the default (typically hyperfocal) position on first start. */ + if (lensPresent_) { + RPiController::AfAlgorithm *af = + dynamic_cast(controller_.getAlgorithm("af")); + + if (af) { + float defaultPos = + ipaAfControls.at(&controls::LensPosition).def().get(); + ControlList lensCtrl(lensCtrls_); + int32_t hwpos; + + af->setLensPosition(defaultPos, &hwpos); + lensCtrl.set(V4L2_CID_FOCUS_ABSOLUTE, hwpos); + result->lensControls = std::move(lensCtrl); + } + } } result->sensorControls = std::move(ctrls);