Skip to content

Conversation

@kleinweby
Copy link

I've encountered frontend timeouts with the ov5647 on a Raspberry PI 3+ when using a longer cable (~30cm-ish). None of the odd suggestions on the internet worked to fix that, but it suggests that the problem gets worse with longer cables. I did not test a short cable, however an imx477 works just fine with my setup.

After some trail-and-error I've stumbled across the fact, that the clock-noncontinuous parameter specified in the device tree was not honoured. Fixing this, and therefore enabling the non-continuous clock mode fixed the frontend timeouts in my setup.

@6by9
Copy link
Contributor

6by9 commented Apr 22, 2024

Thanks for the patch.
I've never liked that the transmitter and receiver have to match in DT for these flags, as errors are bound to creep in. However that is the way that mainline media devs have decided it should work. (DRM devs have decided the opposite for DSI displays)

As you say, there is the get_mbus_config API call to allow the receiver to ask the transmitter what mode it is in, but very few sensor drivers implement it. I recall having the discussion over this when getting the TC358743 to work and setting clocking mode being dismissed - ah https://patchwork.kernel.org/project/linux-media/patch/20190316154801.20460-2-jacopo+renesas@jmondi.org/#22535719 appears to have gone nowhere.

get_mbus_config is implemented for video-mux as the different inputs can have different numbers of data lanes and different clocking modes, but you appear to be correct that the unicam driver isn't looking at the flags field for clock mode - that ought to get fixed. The camera-mux-2port and camera-mux-4port overlays also ought to get fixed for this missing clock-noncontinuous flag on ov5647 too.

I'm happy to take this as is, but if you fancied fixing up the camera-mux overlays too, then you'd have my gratitude.
I'll have to look again at get_mbus_config in unicam.

The OV5647 declares that it wants a non-continuous clock in its endpoint
configuration. However, it does not expose this information via
get_mbus_config. Even if it would implement get_mbus_config the
bcm2835-unicam driver would not evaluate the flags field of it.

By also specifying clock-noncontinuous on the CSI endpoint itself, the
CSI driver properly picks up the requests and enables the non-continuous
clock mode.

Signed-off-by: Christian Speich <christian@spei.ch>
@kleinweby kleinweby force-pushed the ov5647-overlay-fix branch from 01a2809 to a1dea93 Compare April 26, 2024 15:17
@kleinweby
Copy link
Author

Sorry for the late reply. Yeah the whole thing is somewhat confusing and redundant looking.

The camera-mux-2port and camera-mux-4port overlays also ought to get fixed for this missing clock-noncontinuous flag on ov5647 too.

Sure. I hope I deduced the correct solution, as I cannot test it.

@6by9
Copy link
Contributor

6by9 commented Apr 26, 2024

Thanks for the updates - it just saves me a little time.
I totally agree with the changes as they all match imx219, imx477, etc.

Now I just need to fix up unicam to abide by the updated clock mode....

@pelwell
Copy link
Contributor

pelwell commented Apr 26, 2024

Is this good to merge now?

@6by9
Copy link
Contributor

6by9 commented Apr 26, 2024

Is this good to merge now?

As far as I'm concerned, yes.
Fixing up Unicam is my task.

@pelwell pelwell merged commit 6d523c0 into raspberrypi:rpi-6.6.y Apr 26, 2024
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Apr 29, 2024
kernel: drm: rp1: vec: Support more video modes in the RP1 VEC driver
See: raspberrypi/linux#6105

kernel: dts: overlay: ov5647: Specify clock-noncontinuous on CSI endpoint
See: raspberrypi/linux#6121

kernel: configs: Add IP_NF_TARGET_SYNPROXY=m
See: raspberrypi/linux#6127
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Apr 29, 2024
kernel: drm: rp1: vec: Support more video modes in the RP1 VEC driver
See: raspberrypi/linux#6105

kernel: dts: overlay: ov5647: Specify clock-noncontinuous on CSI endpoint
See: raspberrypi/linux#6121

kernel: configs: Add IP_NF_TARGET_SYNPROXY=m
See: raspberrypi/linux#6127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants