From patchwork Tue Jun 28 09:06:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16401 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 74429BE173 for ; Tue, 28 Jun 2022 09:07:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F5BC65638; Tue, 28 Jun 2022 11:07:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656407232; bh=sbnH6DeiWmVmShudASLtOyHMJp9Y2I7iCrW1cASfX88=; 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=kVld9aYnvT9szJdb1eYL6vELkW2TF2CGpcdgNFIAZe+bxAXAS9hvg55dzKFKLsifB gVb5aOA61k99y3cDTVel78g30neGLXgUWJtJP9gDSr//I1MQB6RFwjgYVEv4eRXUgk hjqpX0FHf4nHheRIV8ItNXYQOWbAClY4OT0Tidl8Qjw5YZjIngx5/awlKc+Cpn60CR OxPBYt1j+O83Z9ADdRUl7pAQNURS7pZpk7YGQFeQoMG5vXYgcU93EoxQvGo93zbFmL tu+MifLNmoUHT+CDsu36TS1gDCCzSw7eP3EGxHVUJG51t/vb0nxPLZfyKaopvlGrBJ gFk/Jyp1snrkg== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F06836559A for ; Tue, 28 Jun 2022 11:07:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=thaumatec-com.20210112.gappssmtp.com header.i=@thaumatec-com.20210112.gappssmtp.com header.b="6biJQSSJ"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so7137974wmb.5 for ; Tue, 28 Jun 2022 02:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=isqQCtca+id/lggpU5IKMGvQbHwvkY2hggxC5WD7M+c=; b=6biJQSSJcieqRiTiOoyBvLOlPpmHvglVspHCXrcn2sopP840fzDrn1Jsi1Ny4rrM95 26RCjOPXb0KTHrWGZ8tWW0Fs/aIfANQZ3E6pTNDcZ6iSLogJfh/OTVKQT9YNJaNMw1Gb zoKy6Fc2TOaEjuQE1PtPvdvi8NBrKFHZg03Wjgpg4CRtAmzwLY68yhLIgDN5XpFy6oqA E+5LI/59D/TmFtufReGVtbT0B8mpEFipF6gFMOOtQhlo/tnAoL3VWJmlebYE+MeoNTHZ 1PzI8p16ofmEAAwozo3OKJlihMbw4wUsiOSkjHJxsRj7BBt1yCtN/GXQrrSfEG0upltp s1MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=isqQCtca+id/lggpU5IKMGvQbHwvkY2hggxC5WD7M+c=; b=OcBNtrGVkLvq2UUnKQ7qBXA9O33jt5tq0G6JQHuOatztjGBAObpG7FRzbqxMUNomjK aA+gGXcBuucfiIpoTVSSPyjZ88kg9YE9NQfb0oiG3lhNWdnPS17YAip7j/Vc7Ukx3C8Q 4okjaAhYcQ/JuRD77CML9PXJj6ohJNlLZnb1H0KZ00/PlS4yeHlBwqW7aeUVFEwvYzd7 t+EAXqhRlhyArcwjAwv+sVnTV0HeP0h6Pexn7elyxxbe+TSsIu4hbxpx70UXtm24lEuF U1GHLxeJjlli2kmK6Uz/r1bxHqQKNpU/cF/kZvjNx8a+DhpVMQq0CH2ZxO4ZyWNUSKfe QYYQ== X-Gm-Message-State: AJIora9sBgHEDMPLL5rOZAu/Gf4d+6kxExSMxTNQEjgIcFMctUcSsthA /gOjJKlf8yakzQjKt/TuTY91WvENEvcmOw== X-Google-Smtp-Source: AGRyM1sujJFUgqo8jOnHGJ2J4gzF2ECPYgYlBB5rXxdnV7nrZeaWeU/6yyPzXHrkrC4W9vVXm7rZaA== X-Received: by 2002:a1c:2b05:0:b0:3a0:2ae2:5277 with SMTP id r5-20020a1c2b05000000b003a02ae25277mr20826809wmr.30.1656407230661; Tue, 28 Jun 2022 02:07:10 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id r68-20020a1c2b47000000b0039c4b518df4sm20126972wmr.5.2022.06.28.02.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 02:07:10 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 28 Jun 2022 11:06:54 +0200 Message-Id: <20220628090656.19572-2-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628090656.19572-1-dse@thaumatec.com> References: <20220628090656.19572-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] libcamera: rkisp1: Control the lens from pipeline 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: Daniel Semkowicz via libcamera-devel From: Daniel Semkowicz Reply-To: Daniel Semkowicz Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Control lens focus from rkisp1 pipeline, using CameraLens controller and expose lens controls to the IPA during configure(). Signed-off-by: Daniel Semkowicz --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 7cf36524..363273b2 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -28,6 +28,7 @@ #include #include "libcamera/internal/camera.h" +#include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -107,6 +108,7 @@ private: void paramFilled(unsigned int frame); void setSensorControls(unsigned int frame, const ControlList &sensorControls); + void setLensControls(const ControlList &lensControls); void metadataReady(unsigned int frame, const ControlList &metadata); }; @@ -353,6 +355,20 @@ void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame, delayedCtrls_->push(sensorControls); } +void RkISP1CameraData::setLensControls(const ControlList &lensControls) +{ + CameraLens *focusLens = sensor_->focusLens(); + if (!focusLens) + return; + + if (!lensControls.contains(V4L2_CID_FOCUS_ABSOLUTE)) + return; + + const ControlValue &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE); + + focusLens->setFocusPosition(focusValue.get()); +} + void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata) { RkISP1FrameInfo *info = frameInfo_.find(frame); @@ -654,6 +670,10 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) std::map entityControls; entityControls.emplace(0, data->sensor_->controls()); + CameraLens *lens = data->sensor_->focusLens(); + if (lens) + entityControls.emplace(1, lens->controls()); + ret = data->ipa_->configure(sensorInfo, streamConfig, entityControls); if (ret) { LOG(RkISP1, Error) << "failed configuring IPA (" << ret << ")";