From patchwork Tue Oct 27 21:32:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Ziliani X-Patchwork-Id: 28653 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 7FD0EC324C for ; Tue, 27 Oct 2026 22:05:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3E4C269065; Tue, 27 Oct 2026 23:05:11 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KO2trxbg"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 328C869056 for ; Tue, 27 Oct 2026 22:32:43 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-48e09aa5264so146178f8f.2 for ; Tue, 27 Oct 2026 14:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793136763; x=1793741563; 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=HsUH7H/JwlgNl3Dao7ExV01bZtv2gO3+cSJCmCMAQ/Q=; b=KO2trxbg4A2jZMGm8SR6kJ6YrX1YGgNQYrH2O7CbxdpnmKknd6HEDdxxhiJu63nBkO k8PVyHXWZcvCHwi2HJpp+o5SPP+hZ4SPLubr5qHPG8+ERrWXBQUQknDuQF64v0kE6pau Q0llD3Xc7aWKE++scRYazE/9wLZSGktVlOwXYyvlWvTWDJhQJRCPebp4vo6eYifN3yA4 0muany/H5q2wrbVbn1sLbHcFI6FtBaH186N3l9gu2598Dp/Pw8pctyrE2HHFWGbObw/j QA0ALh8ZPChar9+FMQWl39rKYVGuYaiBy8uMiPeznqSQ0tYXlc+aHmldF+Qdh/HsoM81 a7FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793136763; x=1793741563; 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=HsUH7H/JwlgNl3Dao7ExV01bZtv2gO3+cSJCmCMAQ/Q=; b=rVYse7Um7nMnORgeKFQ98k1ieNTt8F/K/OLV2HmVP+INanIlVbiRq3+sVLh9VWtV5K czKSbmXYjN6LalCOrEu8BWacIWDX5/ExGMpYss7JcTTWOCjWwOCBBv8Ahv5gOW+b1pqz b6Bv9lRr4KHgOUBFx3sA1hsxon237MT0Remvx6mf4LkrIzkJC5/OHWzFtSqz6W/7NyOV KO2dE4pLeTX7/wVkX0ri32YpjvqTOZ9Dz3Yx1CihdWCsEi9e3+B1ghA/EZsudG36tqN0 DDleOveuKNOvmQkjLiWRXbDVZ1gdPHcBuigJ+y3IXOqB01BJeS44o9RkE1YwcPNKFvnf PHaA== X-Gm-Message-State: AFq9FYIZBhBUo9FJRWWNh+J1gXh2aTw8aW3GBUPL038FvVPgqqnjTF3l mWtQMYRT0ctOH7RK9tG6oCQGkG1QUJwtpcMeEID6rs4XMkGi17Qn7shIEE+VfNil X-Gm-Gg: AYBFou2WZ5LUJPPbnUbmd+a+Ey5TyJ+5EzqEp04BMQOiLMkJua9jBupTcLYyi086639 7JrvtE0MegzwA9eeIIvPzB8B9slZ5ENb9G5vAf0XswfsoNrP5+/eUrN5Uw1vWYVTDxchgAcDE4g 2kqrYXk2up9Hv+5rxbEEyHVRvUhjSy7wQ1cMBXpfDaDIjYujDpLblBjxj+Vz/uBSul1QWKeHLt8 J/pyRQy8ldqqM2Xu2yaCsJpWgjtqc9Ek62r1EjoVM/ksRSh72GwFwEnLvBTyubIbTEKqSWXOC+5 Zeybf4lR3q9YPcPqpCYncFH39AfaOASxgS9A9loCXqwPRQeAoUFsbxs+pHfDU776z07PASrjP3f 8WmjGhcZcjjNsnFPyMQ9Jj/K/udy0Uc2PgL9XhKpkcAdiltMvaCAVdchtoXimaozauRBTajEf6K TeqjA7ukhHDs7P84GsxHRbudFOH9MTW2zHp6Z9/L3e/N8KAzs26Q2BNwXzJymj5rEuHk9SLwov1 dEnitvItYalzV90QEyhqW07TG5p/zZKR+h03OrfeD8tQMFkSV9riwIZSGcjvPDqKQ6qIRaUqkgy RlkNQwdsTwoe+ZrJwYdoZkYTUo3xSUhACIyErmapkzyDaCBT53FagEBKdvYT9CKEVbRY8jsdYY3 lZTRsk9yGgmr91cFS X-Received: by 2002:a05:6000:208a:b0:48a:efed:ac97 with SMTP id ffacd0b85a97d-48e5d5c41dbmr1322316f8f.33.1793136762548; Tue, 27 Oct 2026 14:32:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 14:32:42 -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 0/2] libcamera: Power down the lens while the camera is idle Date: Tue, 27 Oct 2026 22:32:38 +0100 Message-ID: <20261027213240.140663-1-rylos78@gmail.com> X-Mailer: git-send-email 2.56.0 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" Lens drivers power the lens up when their subdev is opened, and on ACPI platforms ipu-bridge links the lens to its sensor with a runtime PM device link. CameraLens opens the lens subdev in init() and never closes it, so with a long-lived CameraManager such as the WirePlumber libcamera monitor the lens and the sensor stay powered all the time. On a Surface Pro 5 (IPU3) the rear ov8865 and its dw9719 lens are active for as long as WirePlumber runs, while the front ov5693, which has no lens, is runtime suspended when idle. Patch 1 closes the lens subdev at the end of CameraLens::init(), adds open() and close(), and makes setFocusPosition() reopen the subdev on demand, so pipeline handlers that are not converted keep working. Patch 2 converts the IPU3 pipeline handler to open the lens on start() and close it on stop. I'm sending this as an RFC because the topic has been discussed before. Harvey Yang proposed open() and close() in CameraLens in October 2024 [1], and Laurent preferred to address lens power management in the kernel, where Hans de Goede had proposed powering the VCM along with its sensor [2]. As far as I can tell neither approach has landed. This series only uses the existing kernel behaviour and fixes the idle power draw on IPU3 systems today. If the preferred direction is still the kernel one, I'm happy to help test that instead on the Surface Pro 5. Tested on a Surface Pro 5 with kernel 7.2 and libcamera 0.7.2 with the same changes: - idle with WirePlumber running: ov8865 and dw9719 runtime suspended (before: both active); - cam -c 1 --capture: both active, autofocus moves the lens (focus_absolute 60 -> 268), 30 fps; - about 1 s after the capture stops: both runtime suspended again; - front camera (ov5693, no lens) unchanged. On master the series builds with the ipu3 and rpi/vc4 pipelines; the Raspberry Pi pipeline handler is not converted and was not tested on hardware. [1] https://patchwork.libcamera.org/patch/21649/ [2] https://lore.kernel.org/linux-media/20240901211834.145186-1-hdegoede@redhat.com/ Marco Ziliani (2): libcamera: camera_lens: Close the lens subdev when not in use libcamera: pipeline: ipu3: Power the lens only while the camera runs include/libcamera/internal/camera_lens.h | 2 ++ src/libcamera/camera_lens.cpp | 42 ++++++++++++++++++++++++ src/libcamera/pipeline/ipu3/ipu3.cpp | 17 +++++++++- 3 files changed, 60 insertions(+), 1 deletion(-)