From patchwork Tue Oct 27 21:32:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Ziliani X-Patchwork-Id: 28655 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 0C8DEC3302 for ; Tue, 27 Oct 2026 22:05:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 478686906A; Tue, 27 Oct 2026 23:05:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kHnq2TPo"; dkim-atps=neutral Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7691369061 for ; Tue, 27 Oct 2026 22:32:45 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-48c4d870d54so208530f8f.2 for ; Tue, 27 Oct 2026 14:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793136765; x=1793741565; darn=lists.libcamera.org; 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:content-type; bh=kZyBcEPTlOemuzMTcx6r+1FhK8nUGE7rr0fNDLF3x0s=; b=kHnq2TPoAiq2TKYdAT/Xyi5fitfYybHQmOQB8o4eYTSU+ITMwxEiDU1vTVjannUI5V 81ImKYGkRJUmZr7Wcx69OUUSzmwLf2ZYfan76A5fN9l5qc3re8jTlsYOOXdMB38MJ4io L0n+cOdOqF1xnEEg4z3YjfNrdV/VGO592y6xoc14f0FBCNq2OI04C7c9/e7lHVMTSXEb r+rTwwRqJNo0wsRWZ32IYYLDKWWh8nwvdLch8ZdZV3GsO52IK84KxHD6gdt0Z9tplh86 N2ImEBOU3DLWBurc2ZLjHalJbxLXlNrfqTCjQfrjRmyksHeX2KKYg8tNihmtGlfT/Xrw NYRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793136765; x=1793741565; h=content-transfer-encoding:mime-version:references:in-reply-to :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=kZyBcEPTlOemuzMTcx6r+1FhK8nUGE7rr0fNDLF3x0s=; b=nP+4JieS9G6mGTV6LKRFO6qe17AxcQ1vDdJHray7Py3UuZ+sJDok78y2uOmrfG7Y69 g4jHDLFr9755BiWQOZ9Ljng26GlisxCh/b6d7eSQp/lb0lr+yUeCl4y3lqAZBx+DAks5 4wDuqXhmCYllULYaQvwSLnPm+9oG3/1rRfKD7wwfSoygwWZWgBJLQYETAeWX/++HCi+Y NbQdyCq7JXJgIq734oTH79gqSbB4zqA0tTfJ4rddhlRJXWSf+myEIL6JvOe/FYD7TxBE zclYdp7iEsYkrFTuhJiyvZ4spoJriZ7PjxiIgaKsYe1rHrwCWHGpqAxsLhVaXrgZ/Vk8 6xow== X-Gm-Message-State: AFq9FYJ51dHmk4j2efIROIvMhdykSjjUjfAda1g8jbEDai16a5+zejzX kOAmJYXua2tE6EAMCFBgfC9gdGgSv8ZmtdO0JpuWV7QuMnPTqUXb013JZ7CG1f8i X-Gm-Gg: AYBFou1DUS4yHqASbI1vbqYj7hDFmBa4RYgf66DMGQERKKvyS4ewnsm06XDg10HcDck hxAzt1rullkCgd0pzKlAvxbqQrOKyOWYs//dEso33jAnxXzS47QzJze/lnJ1KDUv2rlC1Q9ppz8 /t7FNs0YHG353x0ThdajI5fegFKh84WTTUeu5yF+9ox0fxkvIVxVnGBReagZKTgxVGeTlybj5kH 1S3MeuDHcnTJ5uoeflTUsOb9CecmM7JoLrwbPmqGtJ3HZH/sKrbkRZJWmAssRaGEZEA2JGLtYkI SIK1gL4JZ7XLu2BY3MpAZ24keVyNRO65SAOpo/KYwwmRbODVCMMlPCUnwlDaoD0a4l1EttMjNZf XiUzpjeDQIOjePlCq5RYc7TPd13nOkY7V2seaIZxEhxtoXG3uS2Sa0r+3rsSl0iicqOmdwOdTOj ak189R7dNxxO2ZsEiPUBrxq9JTwGVGe7eWwEkvEn+afAsUDYGnBkP0fCNwDliqlA+bmD1JGpYRd ATf6ttLjPAOJk7hNzD9W0sHkFJ9S3cOvyASPIlVVaMReSxqKnNepvNbKg7Xia0vqna3hlPKVlEz 3WDXdMKHZSWNM+QTjgT3s5YETeVvdoIkbN1C6LMZUb3pT+W4T3AVgIXhojcVm91CYcHVSmyIufr gFUOhG6ZoxrRGj9Rz X-Received: by 2002:a05:6000:2502:b0:488:7496:15b5 with SMTP id ffacd0b85a97d-48e5d5ada48mr1423823f8f.47.1793136764829; Tue, 27 Oct 2026 14:32:44 -0700 (PDT) Received: from PC-Marco.lan ([151.59.114.42]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebd48eesm24920507f8f.30.2026.10.27.14.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 14:32:44 -0700 (PDT) From: Marco Ziliani To: libcamera-devel@lists.libcamera.org Cc: Laurent Pinchart , Kieran Bingham , Hans de Goede , Harvey Yang , Daniel Scally Subject: [RFC PATCH 2/2] libcamera: pipeline: ipu3: Power the lens only while the camera runs Date: Tue, 27 Oct 2026 22:32:40 +0100 Message-ID: <20261027213240.140663-3-rylos78@gmail.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261027213240.140663-1-rylos78@gmail.com> References: <20261027213240.140663-1-rylos78@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 27 Oct 2026 23:05:09 +0100 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" Open the lens subdev when the camera starts and close it when the camera stops, so that the lens, and through the runtime PM device link the camera sensor, can be powered down while the camera is idle. On the Microsoft Surface Pro 5 the rear ov8865 sensor with its dw9719 lens otherwise stays powered permanently as soon as WirePlumber is running. With this change both are runtime suspended while the camera is idle, are resumed when it starts, autofocus moves the lens as before, and both are suspended again about one second after the camera stops. Signed-off-by: Marco Ziliani --- src/libcamera/pipeline/ipu3/ipu3.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 14cab9e5..3935d639 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -731,10 +731,18 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis if (ret) return ret; + /* Power the lens, if any, for the duration of the capture session. */ + CameraLens *lens = cio2->sensor()->focusLens(); + if (lens) { + ret = lens->open(); + if (ret) + return ret; + } + /* Allocate buffers for internal pipeline usage. */ ret = allocateBuffers(camera); if (ret) - return ret; + goto error_lens; ret = data->ipa_->start(); if (ret) @@ -761,6 +769,9 @@ error: cio2->stop(); data->ipa_->stop(); freeBuffers(camera); +error_lens: + if (lens) + lens->close(); LOG(IPU3, Error) << "Failed to start camera " << camera->id(); return ret; @@ -781,6 +792,10 @@ void PipelineHandlerIPU3::stopDevice(Camera *camera) LOG(IPU3, Warning) << "Failed to stop camera " << camera->id(); freeBuffers(camera); + + CameraLens *lens = data->cio2_.sensor()->focusLens(); + if (lens) + lens->close(); } void IPU3CameraData::cancelPendingRequests()