From patchwork Tue Nov 22 12:03:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17839 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 93BFCBE08B for ; Tue, 22 Nov 2022 12:03:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 46A0761F2B; Tue, 22 Nov 2022 13:03:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1669118632; bh=D6hGiSrlAsmyAEZZHB0ByVnwKlmYVX+dIGEZupbGkkU=; 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=fUiB4IM58bBmqJpDbSmUlkTtqMv2xXK9/xr8ubs3wvUuJx9G/1AUvP5Fq6DDICtrR OWxpM4ftV10xZh1utuXlbhfurrGo2kE0o4n8EIV2dk9WZOAgfYhm2k81tT/1zLDDYh XTNKEn0kflvXJgj6rXFlDXdujQ91NE8ybudsAqBSuPD9iiux0+BGiMc2Ueg9U7e6A3 lLupi1GZ5kQkDO6baVEnaFb+4jFus66CTRvFBsjtIjMGUfRRt3wHpEqJ6kY9bkrZJT EmfU/dn4JqrAIiq8OMfUGEYlpN7GcTyM4Xb1Yi8XgNvQTWUHSKO3ukHn2XN0zeshhO e3HHTY5FLAuaw== Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 437D6603CE for ; Tue, 22 Nov 2022 13:03:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qIFqPl5f"; dkim-atps=neutral Received: by mail-wm1-x332.google.com with SMTP id p16so10555779wmc.3 for ; Tue, 22 Nov 2022 04:03:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sFU0Gg/wNt18KDrjME9o7kh6pYcn2Lz9x0Cmmv2WCwg=; b=qIFqPl5frT9rs6kDWkI91UVaspFdwQ15mMb+YriXSAY/S/yZL9CrnGZFxRZycbaSG2 q+kptQTURFEEQEPmSe0j5HAJbNVxd5L/dD6bpRl/iBZ0MAvX7zDZVH6IAWTp3x1V2KKi IJBqVVdfs3ty8vyxvOCKW4BR1BXhKfvsU57Fm5dCEKWLaZCeW0qxzONS3sN83DCmfHKS zxpI/AlVnDhg1EPZ0r7VIHN7POozqM8rumfiAUWB2wfsi1DfK4W49z8+Ig/ilss+RT4E 9m7wC/PBx+/TudNgvB5QfpJzwEeg8Vji6xiGHflxHH+dNdi3KUWvNptKo8RotXnZwUzb 4TbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sFU0Gg/wNt18KDrjME9o7kh6pYcn2Lz9x0Cmmv2WCwg=; b=VyUYGlSBm2Selh2nzETGSPMHe1PV7aCqv5d2HxdmGwNsYgpZF2xJ4XhmbAkuHRC6j9 EuGo88lFS+4tp2aIYu7MDrX3JAv43qPEzGAaXNd+4uYF2okMS7PJgksMpKNuE1fyGnJI dNaoaYjqhfOzvwfQ7T9DdXuAF82S+R8hu8eNaasjMLzR6N1hBlpuhoowTTDV5MBOy+AP XskOO7ffAwYRtO2laL92px6uWTS/0rF6sl2j97ScD28kN0R4NidGmK2MOoJ1bQORAsSY AnFsJFt9FmcGes0nmb4tTSMdUlV8PMkle0FThouX4mDBZeWuXTxVFfutAMyhTlYrFfBG TexA== X-Gm-Message-State: ANoB5pmJvxhVFc/tmyQbYEUmlEcgq2bv06mXWBwyUt0Pgd1IduKa7r0h AytWCNlWHg1EPHb0viiAN/7WqCj3RJQi3Q== X-Google-Smtp-Source: AA0mqf4RBGDZo2umTdHtH29/MSCufiN1kqD+qQUX3DYsz1LDMSpkKL23uxjExmzPd8IGckMgZr7oFQ== X-Received: by 2002:a1c:f006:0:b0:3cf:7b68:631 with SMTP id a6-20020a1cf006000000b003cf7b680631mr20137307wmb.55.1669118629588; Tue, 22 Nov 2022 04:03:49 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id p18-20020adfe612000000b002366a624bd4sm12119141wrm.28.2022.11.22.04.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 04:03:49 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Nov 2022 12:03:41 +0000 Message-Id: <20221122120343.4825-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221122120343.4825-1-david.plowman@raspberrypi.com> References: <20221122120343.4825-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] libcamera: camera_sensor: Add a function to reset the HBLANK interval 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: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The existing code to reset the HBLANK interval to the minimum value (in the init method) is moved into a separate function that pipeline handlers will be able to call. We no longer reset the HBLANK in init because we may not own the camera and the operation may fail, so pipeline handlers will have to call the new method for themselves. These calls will be added in subsequent commits. Signed-off-by: David Plowman --- include/libcamera/internal/camera_sensor.h | 2 ++ src/libcamera/camera_sensor.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index b9f4d786..c97b5698 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -68,6 +68,8 @@ public: CameraLens *focusLens() { return focusLens_.get(); } + int resetHblank(); + protected: std::string logPrefix() const override; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 572a313a..589e9736 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -176,6 +176,11 @@ int CameraSensor::init() if (ret) return ret; + return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); +} + +int CameraSensor::resetHblank() +{ /* * Set HBLANK to the minimum to start with a well-defined line length, * allowing IPA modules that do not modify HBLANK to use the sensor @@ -192,17 +197,16 @@ int CameraSensor::init() const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK); const int32_t hblankMin = hblank.min().get(); const int32_t hblankMax = hblank.max().get(); + int ret = 0; if (hblankMin != hblankMax) { ControlList ctrl(subdev_->controls()); ctrl.set(V4L2_CID_HBLANK, hblankMin); ret = subdev_->setControls(&ctrl); - if (ret) - return ret; } - return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); + return ret; } int CameraSensor::validateSensorDriver()