arducam-pivariety: missing V4L2_CID_LINK_FREQ causes DPHY "Datarate out of range" on Pi 5 (RP1)

Open
#7,310 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
c, linux

Research direction

Start in arducam-pivariety.c, especially pivariety_parse_dt() and pivariety_enum_controls(), and inspect how v4l2_fwnode_endpoint_alloc_parse() and v4l2_fwnode_endpoint_free() handle the endpoint data. Reproduce with rpicam-hello on a Raspberry Pi 5 while watching journalctl -f. Done means the 496 MHz device-tree link frequency is exposed to V4L2 and the RP1 log no longer reports a 1920 Mbps rate or an out-of-range DPHY datarate.

Written by the indexing model from the issue text.

Description

Describe the bug

The arducam-pivariety.c driver does not implement V4L2_CID_LINK_FREQ.
When libcamera opens the camera, v4l2_get_link_freq() finds no control,
falls back to estimating from pixel rate, and arrives at 1920 Mbps (even though I am not using over 14Mbps). The
RP1 DPHY only supports 80–1500 Mbps, so it is programmed at the wrong
rate, causing unstable frame delivery and periodic multi-second frame gaps.

The correct link frequency (496 MHz) is already present in the device tree
overlay (arducam-pivariety.dtbo) but pivariety_parse_dt() discards it after
parsing — ep_cfg.link_frequencies[0] is never saved or exposed as a V4L2
control.

Additional context includes my working theory — happy to hear if others have seen the same or can confirm the root cause.

Steps to reproduce the behaviour
  1. Attach an Arducam Pivariety camera to Raspberry Pi 5
  2. Load the overlay: dtoverlay=arducam-pivariety in /boot/firmware/config.txt
  3. Open the camera with any libcamera app:
    4. rpicam-hello --camera 0
  4. Observe kernel log:
    journalctl -f
Device (s)

Raspberry Pi 5

System

https://paste.debian.net/hidden/25cb6979

Logs
Apr 09 16:00:29 raspberrypi kernel: v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
Apr 09 16:00:29 raspberrypi kernel: v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver
Apr 09 16:00:29 raspberrypi kernel: rp1-cfe 1f00110000.csi: Using a link rate of 1920 Mbps
Apr 09 16:00:29 raspberrypi kernel: rp1-cfe 1f00110000.csi: DPHY: Datarate 1920 Mbps out of range
Apr 09 16:00:31 raspberrypi kernel: v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
Apr 09 16:00:31 raspberrypi kernel: v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver
Apr 09 16:00:31 raspberrypi kernel: rp1-cfe 1f00128000.csi: Using a link rate of 1920 Mbps
Apr 09 16:00:31 raspberrypi kernel: rp1-cfe 1f00128000.csi: DPHY: Datarate 1920 Mbps out of range

Additional context

From looking at the driver:
It appears in pivariety_parse_dt() (arducam-pivariety.c):
v4l2_fwnode_endpoint_alloc_parse() correctly populates
ep_cfg.link_frequencies[0] = 496000000 from the DT overlay, but
v4l2_fwnode_endpoint_free() is called immediately after without
saving the value. V4L2_CID_LINK_FREQ is never registered in
pivariety_enum_controls() either.

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.