From patchwork Tue Nov 30 10:51:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanlin Chen X-Patchwork-Id: 14890 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 2B819BDB13 for ; Tue, 30 Nov 2021 10:52:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DA022605B4; Tue, 30 Nov 2021 11:52:15 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Zn4uEUBq"; dkim-atps=neutral Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 27F5F605B4 for ; Tue, 30 Nov 2021 11:52:12 +0100 (CET) Received: by mail-pl1-x630.google.com with SMTP id v19so14590812plo.7 for ; Tue, 30 Nov 2021 02:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mIKd6VTNdAEOYNVDMVnDc05R76+FTwUSTeL7x6XXBVw=; b=Zn4uEUBqWXQ+LrH1lnSo7+3wZTJzMsYIv1SiMplinHHPRDvVe8vyFHs2O7yeQWQOpX h2M/z6phvTmsFvV0Q1jW2BTpzonYz3OvqQ9bdj6I07y68jQCAwulCE16EhoG2l28Nt9Q 8TLnQKFkR5E/gWZe9DuRYlGHk4XZ9UwY0scjM= 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=mIKd6VTNdAEOYNVDMVnDc05R76+FTwUSTeL7x6XXBVw=; b=74w+RhgEcB0DRx8xHl42cRlxVDLeKtFTgzRnV0w5P69Tg9y4tEE/zlTWBW3J698z31 LAM82HGvsbQiyS0umUzSI0k8rQPrvbFlCd81fC3an/X0fxb0VPZrd7TjaC7f/75vJZRI K25vxvpaYGalPh9+g1e7F7V838jquZokHGlqZBd3o0SGlTUQEHNJE2QF+mJRD5Hmgj/X GN5Ls7lNUqFnX2tuaiHeWodKWQnvImt/aD46PIzn8SNZCmNL4TsykMyWBZe70aiqlHPQ RoIv3/HyzGl0iJ7t9gWIhk+aBRqFSL2QBAwrEbbKxR3UoCOqk48ePH4osUt5qoUozsAe HBEA== X-Gm-Message-State: AOAM533ozuVaorhKfUbnKx/RvEOfS3RFuvIWjYRWYP+cnKWWmoizlhIV tdB4ddPbHrlhbsL88GRMsdqF1FPoCFsc0g== X-Google-Smtp-Source: ABdhPJy1m6MS2MTAlKoDmfK/bsPdt1VfDcqCRtlFBuGN4CGktcoPYhC3DIyFITTh7xrQJYFPLDE/XA== X-Received: by 2002:a17:902:e741:b0:141:f9a7:4995 with SMTP id p1-20020a170902e74100b00141f9a74995mr66943009plf.49.1638269530583; Tue, 30 Nov 2021 02:52:10 -0800 (PST) Received: from localhost ([2401:fa00:1:10:1659:cd3d:a00c:fa38]) by smtp.gmail.com with UTF8SMTPSA id mn15sm2045591pjb.35.2021.11.30.02.52.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Nov 2021 02:52:10 -0800 (PST) From: Han-Lin Chen To: libcamera-devel@lists.libcamera.org Date: Tue, 30 Nov 2021 18:51:57 +0800 Message-Id: <20211130105157.203856-5-hanlinchen@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211130105157.203856-1-hanlinchen@chromium.org> References: <20211130105157.203856-1-hanlinchen@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 4/4] ipu3: ipa: Allow IPA to apply controls to the lens device 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Allow IPA to apply controls to the lens device. Signed-off-by: Han-Lin Chen Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/cio2.cpp | 1 + src/libcamera/pipeline/ipu3/cio2.h | 3 +++ src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index 59dda56b..ff795310 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -16,6 +16,7 @@ #include #include +#include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/media_device.h" diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h index ba8f0052..635566c8 100644 --- a/src/libcamera/pipeline/ipu3/cio2.h +++ b/src/libcamera/pipeline/ipu3/cio2.h @@ -18,6 +18,7 @@ namespace libcamera { +class CameraLens; class CameraSensor; class FrameBuffer; class MediaDevice; @@ -52,6 +53,7 @@ public: int stop(); CameraSensor *sensor() { return sensor_.get(); } + CameraLens *lens() { return lens_.get(); } const CameraSensor *sensor() const { return sensor_.get(); } FrameBuffer *queueBuffer(Request *request, FrameBuffer *rawBuffer); @@ -67,6 +69,7 @@ private: void cio2BufferReady(FrameBuffer *buffer); std::unique_ptr sensor_; + std::unique_ptr lens_; std::unique_ptr csi2_; std::unique_ptr output_; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index c65afdb2..6e04ec8f 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -24,6 +24,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" @@ -1238,8 +1239,15 @@ void IPU3CameraData::queueFrameAction(unsigned int id, { switch (action.op) { case ipa::ipu3::ActionSetSensorControls: { - const ControlList &controls = action.sensorControls; - delayedCtrls_->push(controls); + const ControlList &sensorControls = action.sensorControls; + delayedCtrls_->push(sensorControls); + + const ControlList lensControls = action.lensControls; + const ControlValue &focusValue = + lensControls.get(V4L2_CID_FOCUS_ABSOLUTE); + if (!focusValue.isNone() && cio2_.lens()) + cio2_.lens()->setFocusPostion(focusValue.get()); + break; } case ipa::ipu3::ActionParamFilled: {