From patchwork Thu Apr 14 07:43:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15673 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 C5ECDC3256 for ; Thu, 14 Apr 2022 07:44:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90D2765648; Thu, 14 Apr 2022 09:44:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922253; bh=5WrnUPfv19o/t1MFDhkrcQ1eGxdOFEDaclVjh/Fk94M=; 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=FsKWaOfpZmCV7nhlUr3lUkmxm9eIV5q6ihDV7Wnqmaqth5H9DK1FgVnvgWwdvOboG M9HTFGl/WlTR6/ghSu+OvwWh/21N3FXBa+kCKItefIPmDsibyB5m5ts5vMgH+9LTjB ef2aIwTh1bgDhmQBw9v+oBQjxHsFoscgRq1ODJCbForJzfIOCoEwM0wKKdagiN9eCq ZeRU1MqURuvjJLsYiFytF/rTxzLKx39k37J0qsS3ftwmzomhNOI7umYe6vZnqpI5pQ OxagMrW3Aj2yxA3Oo5S5Kd7/1Xwxq8B+An0PY+5f5YXZGNMCsfxWHOZU19UoRtNbTC cFq1Xm9DlgzBQ== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A5D6B604B6 for ; Thu, 14 Apr 2022 09:44:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="YF4Q63Gq"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h/X8ab9dNzFIsJJFINlvfhZZ1bxiqednUkqjJ2P7aFE=; b=YF4Q63GqBzT5T85/b0eDZ1G7Tki0SME1IRnJ+gy7wHx4h5IUzwtGLnVKtFTq/xZscJ5vG8 2OPMGFughZhxjjaTkdYz0TKSROSNFT36LuLWEHqGED0p+zdQ981/nTo+3Yv7t1RmsdSikj f/dlOW7V1hOd8GvQgNCi37GAscpzwbk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-474-OSy-dEgUPpOWKJlL_2GTWg-1; Thu, 14 Apr 2022 03:44:09 -0400 X-MC-Unique: OSy-dEgUPpOWKJlL_2GTWg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28420805F6B for ; Thu, 14 Apr 2022 07:44:09 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CC88111E3EA; Thu, 14 Apr 2022 07:44:07 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:39 +0800 Message-Id: <20220414074342.7455-3-hpa@redhat.com> In-Reply-To: <20220414074342.7455-1-hpa@redhat.com> References: <20220414074342.7455-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [RFC v1 2/5] libcamera: camera_lens: Get maximum VCM steps 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: Kate Hsuan via libcamera-devel From: Kate Hsuan Reply-To: Kate Hsuan Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It allows other components to get the maximum VCM steps. It first creates a control list and set V4L2_CID_FOCUS_ABSOLUTE control to it. Then, it calls a lower layer call, getAttributes() to get the maximum VCM steps from the kernel. Signed-off-by: Kate Hsuan --- include/libcamera/internal/camera_lens.h | 1 + src/libcamera/camera_lens.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h index 277417da..48761d68 100644 --- a/include/libcamera/internal/camera_lens.h +++ b/include/libcamera/internal/camera_lens.h @@ -27,6 +27,7 @@ public: int init(); int setFocusPosition(int32_t position); + int getFocusCapabilityies(); const std::string &model() const { return model_; } diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp index b3d48199..5d00652d 100644 --- a/src/libcamera/camera_lens.cpp +++ b/src/libcamera/camera_lens.cpp @@ -73,6 +73,10 @@ int CameraLens::init() return ret; model_ = subdev_->model(); + + ControlList lensCtrls(subdev_->controls()); + subdev_->getAttributes(&lensCtrls); + return 0; } @@ -95,6 +99,20 @@ int CameraLens::setFocusPosition(int32_t position) return 0; } +int CameraLens::getFocusCapabilityies() +{ + ControlValue retVal; + ControlList lensCtrls(subdev_->controls()); + int32_t ret = 2023; + + lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast(ret)); + subdev_->getAttributes(&lensCtrls); + retVal = lensCtrls.get(V4L2_CID_FOCUS_ABSOLUTE); + ret = retVal.get(); + + return ret; +} + int CameraLens::validateLensDriver() { int ret = 0;