From patchwork Sat Feb 12 23:34:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15362 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 53C4BBE08A for ; Sat, 12 Feb 2022 23:34:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E70A61109; Sun, 13 Feb 2022 00:34:17 +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="rAM30W0E"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CD72610B3 for ; Sun, 13 Feb 2022 00:34:15 +0100 (CET) Received: from Monstersaurus.ksquared.org.uk.beta.tailscale.net (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9A6D65D; Sun, 13 Feb 2022 00:34:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1644708854; bh=37MdcEUn06WLMCqNjnCAD5V+Dkt55/Ojt3A6Yk+5xQQ=; h=From:To:Cc:Subject:Date:From; b=rAM30W0ElqDcqA+AkBQcjoGg0jIYqEg4Xc1TVJhsWhLwZudBQoQ7eb4HGnSH9U/WS h+P2S8PeawnR1yIu1KHnslS7d+JM5++jlVcTr2qPIvIPZj14NOmFNWyXr5Rc5gEu1Q J/a82YEFswsG864xYETr2uIi1Ff9nDK0TDJWTqeA= From: Kieran Bingham To: libcamera devel Date: Sat, 12 Feb 2022 23:34:07 +0000 Message-Id: <20220212233407.3309708-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: camera_sensor: Do not initialise unsupported test patterns 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" After the CameraSensor class has initialised properties, a default setting is applied to ensure that test pattern modes are disabled unless explicitly requested. This does not currently check to see if test patterns are supported on the CameraSensor and the applyTestPatternMode call will report a failure if it attempts to set a mode when not supported. Move the initialisation of the test pattern mode to the implementation of the control mappings to ensure that it is correctly reset at start up, while the code path will have already completed early if not supported. Bug: https://github.com/raspberrypi/libcamera-apps/issues/249 Signed-off-by: Kieran Bingham Reviewed-by: Naushir Patuck --- src/libcamera/camera_sensor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 345b4a170d47..3a6a1a6bca77 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -172,7 +172,7 @@ int CameraSensor::init() if (ret) return ret; - return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); + return 0; } int CameraSensor::validateSensorDriver() @@ -372,6 +372,9 @@ void CameraSensor::initTestPatternModes() testPatternModes_.push_back(it->second); } + + /* Initialise the sensor with test patterns disabled. */ + applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); } int CameraSensor::initProperties()