{"id":17839,"url":"https://patchwork.libcamera.org/api/patches/17839/?format=json","web_url":"https://patchwork.libcamera.org/patch/17839/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221122120343.4825-2-david.plowman@raspberrypi.com>","date":"2022-11-22T12:03:41","name":"[libcamera-devel,1/3] libcamera: camera_sensor: Add a function to reset the HBLANK interval","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"7d2ef4d2a41076fa6bbf1538f85460a57c9fab34","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17839/mbox/","series":[{"id":3629,"url":"https://patchwork.libcamera.org/api/series/3629/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3629","date":"2022-11-22T12:03:40","name":"Resolve invalid attempt to set sensor HBLANK control","version":1,"mbox":"https://patchwork.libcamera.org/series/3629/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17839/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17839/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 93BFCBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Nov 2022 12:03:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46A0761F2B;\n\tTue, 22 Nov 2022 13:03:52 +0100 (CET)","from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 437D6603CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 13:03:50 +0100 (CET)","by mail-wm1-x332.google.com with SMTP id p16so10555779wmc.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 04:03:50 -0800 (PST)","from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:e4a2:3070:eea4:e434])\n\tby smtp.gmail.com with ESMTPSA id\n\tp18-20020adfe612000000b002366a624bd4sm12119141wrm.28.2022.11.22.04.03.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Nov 2022 04:03:49 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669118632;\n\tbh=D6hGiSrlAsmyAEZZHB0ByVnwKlmYVX+dIGEZupbGkkU=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=fUiB4IM58bBmqJpDbSmUlkTtqMv2xXK9/xr8ubs3wvUuJx9G/1AUvP5Fq6DDICtrR\n\tOWxpM4ftV10xZh1utuXlbhfurrGo2kE0o4n8EIV2dk9WZOAgfYhm2k81tT/1zLDDYh\n\tXTNKEn0kflvXJgj6rXFlDXdujQ91NE8ybudsAqBSuPD9iiux0+BGiMc2Ueg9U7e6A3\n\tlLupi1GZ5kQkDO6baVEnaFb+4jFus66CTRvFBsjtIjMGUfRRt3wHpEqJ6kY9bkrZJT\n\tEmfU/dn4JqrAIiq8OMfUGEYlpN7GcTyM4Xb1Yi8XgNvQTWUHSKO3ukHn2XN0zeshhO\n\te3HHTY5FLAuaw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=sFU0Gg/wNt18KDrjME9o7kh6pYcn2Lz9x0Cmmv2WCwg=;\n\tb=qIFqPl5frT9rs6kDWkI91UVaspFdwQ15mMb+YriXSAY/S/yZL9CrnGZFxRZycbaSG2\n\tq+kptQTURFEEQEPmSe0j5HAJbNVxd5L/dD6bpRl/iBZ0MAvX7zDZVH6IAWTp3x1V2KKi\n\tIJBqVVdfs3ty8vyxvOCKW4BR1BXhKfvsU57Fm5dCEKWLaZCeW0qxzONS3sN83DCmfHKS\n\tzxpI/AlVnDhg1EPZ0r7VIHN7POozqM8rumfiAUWB2wfsi1DfK4W49z8+Ig/ilss+RT4E\n\t9m7wC/PBx+/TudNgvB5QfpJzwEeg8Vji6xiGHflxHH+dNdi3KUWvNptKo8RotXnZwUzb\n\t4TbA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"qIFqPl5f\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=sFU0Gg/wNt18KDrjME9o7kh6pYcn2Lz9x0Cmmv2WCwg=;\n\tb=VyUYGlSBm2Selh2nzETGSPMHe1PV7aCqv5d2HxdmGwNsYgpZF2xJ4XhmbAkuHRC6j9\n\tEuGo88lFS+4tp2aIYu7MDrX3JAv43qPEzGAaXNd+4uYF2okMS7PJgksMpKNuE1fyGnJI\n\tdNaoaYjqhfOzvwfQ7T9DdXuAF82S+R8hu8eNaasjMLzR6N1hBlpuhoowTTDV5MBOy+AP\n\tXskOO7ffAwYRtO2laL92px6uWTS/0rF6sl2j97ScD28kN0R4NidGmK2MOoJ1bQORAsSY\n\tAnFsJFt9FmcGes0nmb4tTSMdUlV8PMkle0FThouX4mDBZeWuXTxVFfutAMyhTlYrFfBG\n\tTexA==","X-Gm-Message-State":"ANoB5pmJvxhVFc/tmyQbYEUmlEcgq2bv06mXWBwyUt0Pgd1IduKa7r0h\n\tAytWCNlWHg1EPHb0viiAN/7WqCj3RJQi3Q==","X-Google-Smtp-Source":"AA0mqf4RBGDZo2umTdHtH29/MSCufiN1kqD+qQUX3DYsz1LDMSpkKL23uxjExmzPd8IGckMgZr7oFQ==","X-Received":"by 2002:a1c:f006:0:b0:3cf:7b68:631 with SMTP id\n\ta6-20020a1cf006000000b003cf7b680631mr20137307wmb.55.1669118629588; \n\tTue, 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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/3] libcamera: camera_sensor: Add a\n\tfunction to reset the HBLANK interval","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The existing code to reset the HBLANK interval to the minimum value\n(in the init method) is moved into a separate function that pipeline\nhandlers will be able to call.\n\nWe no longer reset the HBLANK in init because we may not own the\ncamera and the operation may fail, so pipeline handlers will have to\ncall the new method for themselves. These calls will be added in\nsubsequent commits.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/camera_sensor.h |  2 ++\n src/libcamera/camera_sensor.cpp            | 10 +++++++---\n 2 files changed, 9 insertions(+), 3 deletions(-)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex b9f4d786..c97b5698 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -68,6 +68,8 @@ public:\n \n \tCameraLens *focusLens() { return focusLens_.get(); }\n \n+\tint resetHblank();\n+\n protected:\n \tstd::string logPrefix() const override;\n \ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 572a313a..589e9736 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -176,6 +176,11 @@ int CameraSensor::init()\n \tif (ret)\n \t\treturn ret;\n \n+\treturn applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);\n+}\n+\n+int CameraSensor::resetHblank()\n+{\n \t/*\n \t * Set HBLANK to the minimum to start with a well-defined line length,\n \t * allowing IPA modules that do not modify HBLANK to use the sensor\n@@ -192,17 +197,16 @@ int CameraSensor::init()\n \tconst ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);\n \tconst int32_t hblankMin = hblank.min().get<int32_t>();\n \tconst int32_t hblankMax = hblank.max().get<int32_t>();\n+\tint ret = 0;\n \n \tif (hblankMin != hblankMax) {\n \t\tControlList ctrl(subdev_->controls());\n \n \t\tctrl.set(V4L2_CID_HBLANK, hblankMin);\n \t\tret = subdev_->setControls(&ctrl);\n-\t\tif (ret)\n-\t\t\treturn ret;\n \t}\n \n-\treturn applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);\n+\treturn ret;\n }\n \n int CameraSensor::validateSensorDriver()\n","prefixes":["libcamera-devel","1/3"]}