{"id":18706,"url":"https://patchwork.libcamera.org/api/1.1/patches/18706/?format=json","web_url":"https://patchwork.libcamera.org/patch/18706/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230605091406.31757-4-naush@raspberrypi.com>","date":"2023-06-05T09:14:06","name":"[libcamera-devel,v3,3/3] ipa: rpi: Set lens position to hyperfocal on startup","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a18e74dc8d852c78b85a3285370aa755e4604f18","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18706/mbox/","series":[{"id":3907,"url":"https://patchwork.libcamera.org/api/1.1/series/3907/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3907","date":"2023-06-05T09:14:03","name":"Default lens behaviour","version":3,"mbox":"https://patchwork.libcamera.org/series/3907/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18706/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18706/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C64D8C328F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jun 2023 09:14:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BAD9062894;\n\tMon,  5 Jun 2023 11:14:51 +0200 (CEST)","from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AE7CA62885\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jun 2023 11:14:48 +0200 (CEST)","by mail-wm1-x334.google.com with SMTP id\n\t5b1f17b1804b1-3f6e1393f13so38020125e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 05 Jun 2023 02:14:48 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tz16-20020a7bc7d0000000b003f605814850sm13776369wmk.37.2023.06.05.02.14.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 05 Jun 2023 02:14:47 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685956491;\n\tbh=ruCIXVqD07bh5LsU1/tK830Am0RiJr3CrtaFauP7UHQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=nMI49ciidYFM5SMWklke7pyQSi/1pnoRnIQRUtlJYJWYU/LflFfnn4xIaHvwthZ60\n\tUECydE9ZlWamiR/OXWf3cZNJVQ269SaLfKV4R0YwjDeHye6U4sJdxvlMv0zWS1x7jA\n\tLhI2nwPE9I5DNds+dRn4A8tfApruegAzpXwl2evRZcv8qWEqezh0vz+6A2IGNzIUQ7\n\tiGxVFQFYiX1SjWlnmJJkY76iWy5v54YTEIhqluZZWQcpFXeWsU2N3zOEVBcnBT/3vG\n\thLCQJ8W2IK4tk/azYdZyJHhK8QlubnV+PHp7+Go5aGQZkpZwEXPai3zMO/gdoJV6Uv\n\t7oWgEvLyHqHcg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1685956488; x=1688548488;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=AFumYtvjDfTfPcCzPY8h7kvd3jEx3vvM8zqSEr5CJEM=;\n\tb=kAKuMK/O5Jj8Oncb5c5/Advdf99BYCnwoUeJBQ02Rb4Ntq0mcNwEnxODaOFjcpIvHX\n\t+K25sT6wrCerwPBvQBsCANw5UUT4RJ8JEXPJxZ5yxiFWxqI2o1N1NLl2u8XklgqZ3xxe\n\tWgn5vUeSI7g5WNA30vbE/DHfO23sEgxQKXdmvu4MStKTQtdf5g94e+KZ9Sl9OhKBKCJ7\n\t1mBwULQyeYxsv1CMUMkQ7VN/Ghug6qUXEzYENeW32bT+ubNMRRFkYSYuxYAktRQLGvF1\n\tskbO4ZcCXPs1eYM1JhZG3nH/scKSU1r207gexkjWNw/gNR89/GlbFprq9jcHzAVHQsa2\n\tAHbQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"kAKuMK/O\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1685956488; x=1688548488;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=AFumYtvjDfTfPcCzPY8h7kvd3jEx3vvM8zqSEr5CJEM=;\n\tb=FjkTZnlwsdsGXNGhQ8+zbaYhkK353pL6YL1Ra/QE4YyK+PPuo+DS91ztScyPd2KHGy\n\tUsKB6RWVxzzW4JhozGZ6Y7OzhWizv0IFzO/zUYR5CI6SCLBxc1NBbFLfU2ON+3Peftam\n\tvyCxWiVy8QdnygRORY4iv86+tNCXRmW/vhskEYaxELKAvyhCH4aSHKFvvr5zVsk2Oz/Y\n\tdTvhz2bJpZzHbe1N+WJiGV5Suwaj2lrp1jTr6gJiVwBM93Wo7+Dflvr1hwD0iveluMA/\n\tjatdQqp2VgsebtxGfrbC04wQvDFNoLEMa0eYgOp05SElek6DER+Aq/teaeiIefY/atcj\n\tXU2g==","X-Gm-Message-State":"AC+VfDy9PjlqtDWwuJySvgSJBdgd2XQpJp7BOjoQ9fbel9/THQDSGw+e\n\tRWkl3u6kMIzrMDmSwySVMApA5+SwcQglWZkaW2h4cQ==","X-Google-Smtp-Source":"ACHHUZ4q3rwMV2xpaVL4b7gDqiyx96hwAobIckdCEIeYcT3I0AJ+XEREW31eM4s9kQJXD0FQGlCdUg==","X-Received":"by 2002:a1c:7405:0:b0:3f4:bb58:d174 with SMTP id\n\tp5-20020a1c7405000000b003f4bb58d174mr6303365wmc.22.1685956488167; \n\tMon, 05 Jun 2023 02:14:48 -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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 3/3] ipa: rpi: Set lens position to\n\thyperfocal on startup","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"On the first ipa->configure() call, set the lens position (if a lens is\npresent) to the default position. Typically this would be the hyperfocal\nposition based on the tuning data.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 599ad146a863..dbb95311ba51 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -199,6 +199,23 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa\n \t\tagcStatus.shutterTime = defaultExposureTime;\n \t\tagcStatus.analogueGain = defaultAnalogueGain;\n \t\tapplyAGC(&agcStatus, ctrls);\n+\n+\t\t/* Set the lens to the default (typically hyperfocal) position on first start. */\n+\t\tif (lensPresent_) {\n+\t\t\tRPiController::AfAlgorithm *af =\n+\t\t\t\tdynamic_cast<RPiController::AfAlgorithm *>(controller_.getAlgorithm(\"af\"));\n+\n+\t\t\tif (af) {\n+\t\t\t\tfloat defaultPos =\n+\t\t\t\t\tipaAfControls.at(&controls::LensPosition).def().get<float>();\n+\t\t\t\tControlList lensCtrl(lensCtrls_);\n+\t\t\t\tint32_t hwpos;\n+\n+\t\t\t\taf->setLensPosition(defaultPos, &hwpos);\n+\t\t\t\tlensCtrl.set(V4L2_CID_FOCUS_ABSOLUTE, hwpos);\n+\t\t\t\tresult->lensControls = std::move(lensCtrl);\n+\t\t\t}\n+\t\t}\n \t}\n \n \tresult->sensorControls = std::move(ctrls);\n","prefixes":["libcamera-devel","v3","3/3"]}