From patchwork Tue Jun 30 08:23:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 27134 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 1EE24C3264 for ; Tue, 30 Jun 2026 08:23:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id ED0D165F32; Tue, 30 Jun 2026 10:23:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="SjmUmY9v"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AA0CD658C5 for ; Tue, 30 Jun 2026 10:23:12 +0200 (CEST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-493bc160212so497385e9.3 for ; Tue, 30 Jun 2026 01:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1782807792; x=1783412592; 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:content-type; bh=nH+AYnUWMzDDibdUgb7myjOhPF/s1GlmNh72q5SfHbU=; b=SjmUmY9vVsfqt4Fa9dKYRdM5lz5ZZA5y5cinoUOkPDMZ2Ur1jj9KAivi6paltVFwBv fpxWKZ7xzHtF2mSLrZlj6cthUnWrRENLIpF6UHdFkj4qDGnUk9cfdwlGA2hyNbP169RP kdFML+MzGWeojWCPOSzJd+Q9fSM7kmvfP+y/3uau5dnlxIu9pXd1t3QHcP60blqr9wOu +hEy5MRU+TUyAtr7FTKOmEA0ziJ9QTawH4yhTEX2WDxoLu3uCkhkW4F2SQjJY2h0zPV2 qHRgJKYsJboSSoLBs3PBWAJFm0rqbHXxUnpV3qj6oYZx03xBkn3s2DWnGsrXjD/4htr9 AQ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782807792; x=1783412592; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=nH+AYnUWMzDDibdUgb7myjOhPF/s1GlmNh72q5SfHbU=; b=bdLoKx7F1mNIOxbgyC1+NKGSUHfr/uOQoGEqcdNa660d3kZLvKMq/kBqk7Luhcd4ef ZJBzgKyQnkkK2qXT7r3UZNZO1ZLZi02z/+TdB/Fr1vfgQN9/VkiseOjujNPjQbn3fUNm kdhi86OUvNvHr1Gt3/sN8JjekTW+Uo8jxQUbZpYwX+48Byl7MMNi79sW5/tA44WQFVHY xtbSsj8JuXIbq2RfPf9Fe7C3IMt8BDdPJjAyglOsdi2b2HBycMSRb1pfRu/fPv2opfwe pFMLGvqp0Hzru/SY6vOYHHo1AZESWs6TZchzVBbulst5wPJdbHZPu2dZADWevRiutC99 e7Pg== X-Gm-Message-State: AOJu0Yz9kVAWOpPC2litrt6+bUId6w3PEIoldEsxUd/QXFKUwRGrx3Ev naR5RjSJrAHkl1Bzl/LLQJhisB/pPaQ0QhxIOCizRDyJlVMbLFBqf+yjzT6I0Tz0bAEklJg9ku+ U/qM21D0= X-Gm-Gg: AfdE7cm3OnDKixql+Xo7FAd4P1kLe48ksFfB1/hRMs9cja4K1AdjMDUK0AKHlS9095x meHPlYYQDdsbe9tNMXpiSBLgXopwJgctcqbpO3SV7j6QG4L5MI9yIK3xceMHtius/PDNtdsNGhH pSa+6GcipEQsTL/SpLfnPvgr3d9LnQBd9eog9CSWisATIZg7qcCebnMYoKYKqCGe4nm5jQ2YYEu fL4/8dLsHvnm6w9oIqMSKuJtHPU31iRWsm9qZHJKhKkQR3Z8vaJQPM2n4HjX0eeRGa50gLQLI7D XvQvOW8tX7mAVH2HUJ2RG1PWq2raJrT0jsqGp7e19u7M/5D3mM/iOVGhB1mx8mcFE6bnnstQreC WuC/CIQow035ZifiULsgfBR9N/ZQUkVBUaulvUNelMcLFX9rbdUzp6Yq70IRPa4SAFYUs47VRAB BruaPpGu8mJFOnozLJjjmf724DdT9S8SpkRRLHda67uZxi2v/E9bKtvcyREeuwjrlZsr8XWaRoM MbPIhoPmSCHLiLP6DbKSyfH/xA/a6xKRLV3zroXnGqkK4XaIOs7cgazNzDCPlBaY9pgpDnR4MS+ IJ//ASaS+jc/zA24oIdP X-Received: by 2002:a05:6000:430a:b0:473:3f5f:16fe with SMTP id ffacd0b85a97d-47552788d5fmr1733193f8f.5.1782807792013; Tue, 30 Jun 2026 01:23:12 -0700 (PDT) Received: from naush-dell.pitowers.org ([2a00:1098:3142:1f:9aa7:43e2:6907:a5c1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4756636cf1asm5770067f8f.18.2026.06.30.01.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 01:23:11 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Dave Stevenson , Benjamin Mugnier , Naushir Patuck Subject: [PATCH v1] libcamera: sensor: Disable on-sensor auto-exposure where avilable Date: Tue, 30 Jun 2026 09:23:01 +0100 Message-ID: <20260630082309.804169-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.53.0 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" Some sensor device drivers (e.g, VD66GY and VD56G3) have sensor auto- exposure enabled by default. This interferes with the AGC algorithm running in the IPA. By default, disable the sensor auto-exposure on startup so that the IPA can control the sensor shutter time and gain. Signed-off-by: Naushir Patuck Tested-by: Dave Stevenson Tested-by: Benjamin Mugnier --- src/libcamera/sensor/camera_sensor_legacy.cpp | 14 ++++++++++++++ src/libcamera/sensor/camera_sensor_raw.cpp | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp index 6a683821f219..d86624dc4cc7 100644 --- a/src/libcamera/sensor/camera_sensor_legacy.cpp +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp @@ -295,6 +295,20 @@ int CameraSensorLegacy::init() return ret; } + /* + * Ensure auto-exposure is disabled in the sensor as the IPAs ought to + * handle that. + */ + const struct v4l2_query_ext_ctrl *exposureAuto = subdev_->controlInfo(V4L2_CID_EXPOSURE_AUTO); + if (exposureAuto && !(exposureAuto->flags & V4L2_CTRL_FLAG_READ_ONLY)) { + ControlList ctrl(subdev_->controls()); + + ctrl.set(V4L2_CID_EXPOSURE_AUTO, V4L2_EXPOSURE_MANUAL); + ret = subdev_->setControls(&ctrl); + if (ret) + return ret; + } + return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); } diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp index 10eba0331fe8..1c5ee80281ad 100644 --- a/src/libcamera/sensor/camera_sensor_raw.cpp +++ b/src/libcamera/sensor/camera_sensor_raw.cpp @@ -551,6 +551,20 @@ std::optional CameraSensorRaw::init() return ret; } + /* + * Ensure auto-exposure is disabled in the sensor as the IPAs ought to + * handle that. + */ + const struct v4l2_query_ext_ctrl *exposureAuto = subdev_->controlInfo(V4L2_CID_EXPOSURE_AUTO); + if (exposureAuto && !(exposureAuto->flags & V4L2_CTRL_FLAG_READ_ONLY)) { + ControlList ctrl(subdev_->controls()); + + ctrl.set(V4L2_CID_EXPOSURE_AUTO, V4L2_EXPOSURE_MANUAL); + ret = subdev_->setControls(&ctrl); + if (ret) + return ret; + } + ret = applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); if (ret) return { ret };