From patchwork Fri Dec 3 12:53:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15012 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 6CAD5BF415 for ; Fri, 3 Dec 2021 12:54:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BC0BD607DE; Fri, 3 Dec 2021 13:54:11 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kiKZASOs"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 55C1860725 for ; Fri, 3 Dec 2021 13:54:10 +0100 (CET) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D0C472A5; Fri, 3 Dec 2021 13:54:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638536049; bh=hXlDwnNj0EiemImTazlCvHHMRiS1HG4QzuljboKzJY4=; h=From:To:Cc:Subject:Date:From; b=kiKZASOs7AHbyY8fH6C9j1m0xqodFw7Us/1z1F+i4pTdZv58XbTkM2Rc34rbGtIJW Y96kLnNL3DAYO/BznqKoVRAdzMobiXW3OGVnFc83L4Bk3/Y2k1YwQAzsRPMB/JLOq+ qcE05Z9SW7K8XPNrbHjoPF/1m3pEbYVqdZ0Cq+W4= From: Kieran Bingham To: libcamera devel Date: Fri, 3 Dec 2021 12:53:59 +0000 Message-Id: <20211203125359.25191-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: ipu3: Only process focus if we have a lens 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" If there is no lens detected by the system, then we will not be able to set the control, so we can skip processing of the list. Furthermore, if the IPA has not set a V4L2_CID_FOCUS_ABSOLUTE control, then a warning will be printed as the lensControls.get() will not succeed. Break out of the control parsing when there is no CameraLens device, or if there is no absolute focus control set by the IPA. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1215bdb84224..16380d2091b2 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1242,13 +1242,19 @@ void IPU3CameraData::queueFrameAction(unsigned int id, const ControlList &sensorControls = action.sensorControls; delayedCtrls_->push(sensorControls); + CameraLens *focusLens = cio2_.sensor()->focusLens(); + if (!focusLens) + break; + const ControlList lensControls = action.lensControls; + if (!lensControls.contains(V4L2_CID_FOCUS_ABSOLUTE)) + break; + const ControlValue &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE); - CameraLens *focusLens = cio2_.sensor()->focusLens(); - if (focusLens && !focusValue.isNone()) - focusLens->setFocusPostion(focusValue.get()); + focusLens->setFocusPostion(focusValue.get()); + break; } case ipa::ipu3::ActionParamFilled: {