libcamera: Power down the lens while the camera is idle
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Laurent,
Quoted 1 line · Laurent Pinchart
I want this discussion to involve the kernel side.
Agreed, adding linux-media and Sakari.
For the kernel side, the problem in short: lens (VCM) drivers such as dw9714, dw9719 and ak7375 power the lens up on subdev open() and down on close(). On ACPI platforms ipu-bridge also adds a DL_FLAG_PM_RUNTIME device link from the VCM to its sensor, which Hans confirmed earlier in this thread is needed because of shared power rails and I2C gating. libcamera opens the lens subdev when it enumerates the cameras and keeps it open, and the WirePlumber camera monitor keeps the CameraManager alive for the whole session. On IPU3 and IPU6 Surface devices the rear sensor therefore stays powered for as long as a user is logged in.
The options I can see:
1. userspace opens the lens subdev only while the camera runs (this RFC, and Harvey's patch [1]), which works with current kernels;
2. the kernel powers the VCM together with its sensor's stream (Hans' series [2], or calling .enable_streams() on the VCM as Jacopo suggested), with VCM drivers no longer powering up on open().
They are not exclusive: 1 fixes current kernels and stays correct once 2 is in place.
I can test either on a Surface Pro 5 (IPU3, ov8865 + dw9719).
[1] https://patchwork.libcamera.org/patch/21649/
[2] https://lore.kernel.org/linux-media/[email protected]/
Regards,
Marco