From patchwork Thu Oct 17 07:39:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 21649 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 1E30CC32FC for ; Thu, 17 Oct 2024 07:39:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8F0B665383; Thu, 17 Oct 2024 09:39:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TzMo8brM"; dkim-atps=neutral Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EA6CE6537C for ; Thu, 17 Oct 2024 09:39:54 +0200 (CEST) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20ce5e3b116so5051795ad.1 for ; Thu, 17 Oct 2024 00:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729150793; x=1729755593; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VM/WKi9FVow28rYGay+0y/3QPGhUCP41RYICm5TFSWA=; b=TzMo8brM63jJrZzMIBC9tQePTqGNKVCEZav4IThUPbG63FBfqUdVMfDPM84e4/rBUJ mQv8XNaUEqv6WMaH14Yt/1/W0tDxCxNqOw02t6TznphTiLqN9FWQwC2OvwRDucuL8yyi gA6vO7XSN4o6WbrqPoQRvgiC8DdZIuVfUuVNM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729150793; x=1729755593; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VM/WKi9FVow28rYGay+0y/3QPGhUCP41RYICm5TFSWA=; b=EaAh17Hjy8QilgWGLeCKAYMxISwQ3n4cuhhvs17Ls+djtdHnOZvsJM/J7P2k0G3HXV Zs/xdf3hVUTI/eaIbTquYwgu19K76c1vZfxpk6wtypNQxoQ4p7Abmto+8jwvrEr4uGSl dVPUJThsA+iRgU7sc89Eh4UnfZ8i1bCsHsVXnT4MvGtE8z8pL7AN0vy9SaSPKDD3FJ7y DbKwGmO1zYZ+U0IrPQh/6fHlORGCGIgedEaZcxrdsNO0qIiSe1GRdxW+rxr69L8xP8/7 FxwDWNeVhOCLtE6IB4h97T+rm84MoHh1l73yPxfYavvZT/kpzswmKkdcg+UOv+cWS8y5 tNFQ== X-Gm-Message-State: AOJu0Yyekc7Oz4oSivtuwih7KVK7IuaUWr763H17l327D/ouZxHn4CoP oHrfDoJG4yvw2pDz74//GY3vHNVYBFkajumiIiSEP39hOEdj0XMhgOe81OsQiVMLdYdi0qgvu70 = X-Google-Smtp-Source: AGHT+IHce183lWT/qqAv1nNLbVztaqi2WVx2DKR0ipPKfL3AVvbqmrUtSHOfZz4Tq8W/maaMQ20o/Q== X-Received: by 2002:a17:90b:1914:b0:2e3:b168:70f5 with SMTP id 98e67ed59e1d1-2e3b168726dmr6296736a91.21.1729150792946; Thu, 17 Oct 2024 00:39:52 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (199.211.81.34.bc.googleusercontent.com. [34.81.211.199]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e3e090857esm1140882a91.52.2024.10.17.00.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 00:39:52 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Han-Lin Chen , Harvey Yang Subject: [PATCH] libcamera: Add open() and close() in CameraLens Date: Thu, 17 Oct 2024 07:39:47 +0000 Message-ID: <20241017073948.353346-1-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog MIME-Version: 1.0 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" From: Han-Lin Chen This allows pipeline handlers to save some power when a camera is close. Signed-off-by: Han-Lin Chen Co-developed-by: Harvey Yang Signed-off-by: Harvey Yang --- include/libcamera/internal/camera_lens.h | 4 ++++ src/libcamera/camera_lens.cpp | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h index 5a4b993bb..095056791 100644 --- a/include/libcamera/internal/camera_lens.h +++ b/include/libcamera/internal/camera_lens.h @@ -26,6 +26,10 @@ public: ~CameraLens(); int init(); + + int open(); + void close(); + int setFocusPosition(int32_t position); const std::string &model() const { return model_; } diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp index ccc2a6a65..039f5ad2a 100644 --- a/src/libcamera/camera_lens.cpp +++ b/src/libcamera/camera_lens.cpp @@ -76,6 +76,23 @@ int CameraLens::init() return 0; } +/** + * \brief Open the subdev + * \return 0 on success or a negative error code otherwise + */ +int CameraLens::open() +{ + return subdev_->open(); +} + +/** + * \brief Close the subdev + */ +void CameraLens::close() +{ + subdev_->close(); +} + /** * \brief This function sets the focal point of the lens to a specific position. * \param[in] position The focal point of the lens