IMX519 camera focus control not working on Raspberry Pi 4B with libcamera

Hi all. I’m having trouble with an IMX519 module on a Raspberry Pi 4B (8GB). I can get a picture, but there’s no focus control at all — autofocus does nothing and I can’t move the lens manually either. I followed the Arducam IMX519 native camera guide (16MP IMX519 - Arducam Wiki). I’ve tested on Raspbian Bookworm (6.6.31+rpt-rpi-v8) and Bullseye (6.1.21-v8+).

Can you run libcamera-still -t 0 -n and paste the full terminal output? I want to see whether the focus motor driver is being loaded at all.

Sure, here’s the output:

[0:01:56.145856945] [938] INFO Camera camera_manager.cpp:313 libcamera v0.3.0+89-e0a93d12-dirty (2024-08-19T08:49:19+01:00)
[0:01:56.166484342] [955] ERROR V4L2 v4l2_device.cpp:93 ‘ak7375 10-000c’: Failed to open V4L2 device ‘/dev/v4l-subdev1’: Invalid argument
[0:01:56.166553343] [955] ERROR CameraSensor camera_sensor.cpp:556 ‘imx519 10-001a’: Lens initialisation failed, lens disabled
[0:01:56.206938633] [955] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:01:56.208880812] [955] INFO RPI vc4.cpp:454 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media4 and ISP device /dev/media1
[0:01:56.208986757] [955] INFO RPI pipeline_base.cpp:1129 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Mode selection for 2328:1748:12:P
SRGGB10_CSI2P,1280x720/0 - Score: 5319.24
SRGGB10_CSI2P,1920x1080/0 - Score: 3319.24
SRGGB10_CSI2P,2328x1748/0 - Score: 1000
SRGGB10_CSI2P,3840x2160/0 - Score: 1648.24
SRGGB10_CSI2P,4656x3496/0 - Score: 2019
Stream configuration adjusted
[0:01:56.212135723] [938] INFO Camera camera.cpp:1183 configuring streams: (0) 2328x1748-YUV420 (1) 2328x1748-SRGGB10_CSI2P
[0:01:56.212756986] [955] INFO RPI vc4.cpp:629 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-p

Thanks. The relevant part is these two lines:

[0:01:56.166484342] [955] ERROR V4L2 v4l2_device.cpp:93 'ak7375 10-000c': Failed to open V4L2 device '/dev/v4l-subdev1': Invalid argument
[0:01:56.166553343] [955] ERROR CameraSensor camera_sensor.cpp:556 'imx519 10-001a': Lens initialisation failed, lens disabled

The IMX519 uses an ak7375 VCM driver for the focus motor. libcamera tries to open /dev/v4l-subdev1, gets ‘Invalid argument’, and then disables the lens completely — that’s why you lose both autofocus and manual focus. Can you also post the output of dpkg -l | grep libcamera so we can see which libcamera version is installed?

Here you go:

ii libcamera-dev:arm64 0.3.0+rpt20240618-1 arm64 complex camera support library (development files)
ii libcamera-ipa:arm64 0.3.0+rpt20240618-1 arm64 complex camera support library (IPA modules)
ii libcamera0.3:arm64 0.3.0+rpt20240618-1 arm64 complex camera support library
ii python3-libcamera:arm64 0.3.0+rpt20240617-1 arm64 complex camera support library (Python bindings)

Also, I’ve already tried a bunch of things: two different IMX519 modules, several Pi 4Bs, Bookworm and Bullseye, full and lite images, 32-bit and 64-bit. A Hawkeye camera focuses fine on the same Pi, so I don’t think the Pi side is broken.

That’s useful. Since the Hawkeye focus works but both IMX519s fail, it points toward the IMX519/ak7375 path rather than a general Pi problem. Could you share the hardware revision markings and front/back photos of both IMX519 boards? I’d like to confirm what revisions we’re dealing with.

Sure. One board is marked rev D and the other is rev C. I’ve attached front and back photos of both.

Thanks for the photos. Can you run the same libcamera-still -t 0 -n on each module and confirm whether both show these exact lines?

[0:01:56.166484342] [955] ERROR V4L2 v4l2_device.cpp:93 'ak7375 10-000c': Failed to open V4L2 device '/dev/v4l-subdev1': Invalid argument
[0:01:56.166553343] [955] ERROR CameraSensor camera_sensor.cpp:556 'imx519 10-001a': Lens initialisation failed, lens disabled

I’m trying to determine if this is limited to one hardware revision or common to both.

Confirmed — both cameras give exactly the same two errors. I also tried libcamera-still --info-text="%lp" and it reports the lens position as -1 on both.

Thanks for confirming. The identical failure on both rev C and rev D makes this look like a driver/software compatibility issue rather than a single bad module. The %lp value of -1 matches what we’d expect when lens init fails and libcamera disables the lens. For now the sensor still captures images, but focus control won’t be available until the ak7375 subdevice open failure is resolved. No fix yet on our side, but I’ll update this thread when there’s more.