Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

Camera board • Re: V4L2 Subdevice Driver for imx477 Lens Actuator - Autofocus

$
0
0
The correct place for a lens driver is in the kernel.

In https://github.com/raspberrypi/linux/bl ... si#L30-L35 you'll find reference to a vcm_node (VCM = Voice Coil Module) which is the lens driver.
The compatible string "dongwoon,dw9817-vcm" matches against https://github.com/raspberrypi/linux/bl ... vcm.c#L315, and hence that driver will be loaded with the configuration from the dts file. The presence of the line at https://github.com/raspberrypi/linux/bl ... ay.dts#L46 means that the lens driver gets associated with that sensor driver.
You now have a sensor, lens driver, and CSI2 receiver associated in Media Controller to make one camera entity.

If you look at the imx219 overlay, you'll see there is a similar vcm_node setup, but it is disabled by default. Add the "vcm" override to make "dtoverlay=imx219,vcm" and you'd have an IMX219 with lens driver, intended for https://www.arducam.com/product/arducam ... on-camera/ or similar.

I thought there was a similar override for the imx477 overlay suitable for https://www.arducam.com/product/arducam ... pberry-pi/, but I can't see it.

If you're wanting to use your own motorised lens drive, then you'll want to create a new kernel module with suitable compatible string to drive it.

Please note that all AF algorithms to date have anticipated that they are driving VCMs which will move near instantaneously. If you've a slower motor drive, then there is currently no mechanism to tell libcamera that the lens hasn't got to the desired position as yet.
I've got a similar project planned using either stepper motor or lens + potentiometer position readout for a couple of lenses I have, and need to address that subject by having second V4L2 control for current lens position vs desired lens position.

Statistics: Posted by 6by9 — Mon Mar 17, 2025 9:49 pm



Viewing all articles
Browse latest Browse all 8609

Trending Articles