Skip to content

media: i2c: ov5693: Gate the MIPI clock lane for IPU6 Surface front cameras - #180

Open
loisBreant wants to merge 1 commit into
linux-surface:v7.2-surface-develfrom
loisBreant:sp9-ov5693-mipi-clock-lane-gating
Open

loisBreant wants to merge 1 commit into
linux-surface:v7.2-surface-develfrom
loisBreant:sp9-ov5693-mipi-clock-lane-gating

Conversation

@loisBreant

Copy link
Copy Markdown

The front camera of the IPU6 Surface devices (Pro 8, Pro 9, Go 4) still does not stream on the 7.2 kernels. The ov5693 driver starts the sensor, but the IPU6 CSI-2 receiver never gets a frame.

This sets MIPI_CTRL00 (0x4800) bit 5 (clock lane gate) before stream-on when the link is non-continuous. Because this kernel's ipu-bridge does not set clock-noncontinuous yet, it is also enabled for the OVTI5693 HID, which only appears on IPU6 Surfaces. Only that bit is changed, and a clock_ncont module parameter (-1 auto, 0, 1) can force it either way.

Relation to other work

  • It uses the same approach as the upstream series "media: Enable the OV5693 front camera on IPU6 Surface devices" (Fernando Rimoli, in media next), which also gates bit 5 only. Once that series reaches a release, this commit can be dropped in favour of a backport, which moves the decision into ipu-bridge per IPU PCI ID. I can prepare that backport if you prefer it now.
  • cameras: ov5693: make the IPU6 Surface front cameras stream (Pro 8/9, Go 4) linux-surface#2171 fixes the same problem for 6.19 by writing the full vendor value (0x2d). This PR targets 7.2, where nothing fixes it yet.

Testing: Surface Pro 9 (i7-1255U, IPU6 8086:465d), 7.2.11-surface-1, Ubuntu 24.04, libcamera 0.7.2 software ISP:

Without With
Frames received (2592×1944) none 28.6 fps
CSI-2 errors while streaming n/a none
Chrome via v4l2loopback (MediaStreamTrack.stats) n/a 28.6 fps delivered, 0 discarded

On this branch's ov5693.c (identical to 7.2.11-surface-1's), the result builds to exactly the same machine code as the module I have been running (same srcversion, identical disassembly).

The full userspace setup for the Surface Pro 9 (libcamera, v4l2loopback, browser support) is documented in https://github.com/loisBreant/surface-pro-9-camera.

Transparency: I developed this with the help of an AI assistant (Claude). It was built, run and verified on real hardware, and the kernel change was reviewed separately for safety before I used it.

…ameras

On the IPU6 Surface devices (Pro 8, Pro 9, Go 4) the front ov5693 starts
streaming but the IPU6 CSI-2 receiver never gets a frame: the receiver
needs the sensor to gate its clock lane when idle (non-continuous clock),
which the driver never configures.

Set MIPI_CTRL00 (0x4800) bit 5 (clock lane gate) before stream-on when
the endpoint is non-continuous. As this kernel's ipu-bridge does not set
"clock-noncontinuous" yet, also enable it for the OVTI5693 HID, which is
only used on IPU6 Surface devices. Only that bit is touched; the
clock_ncont module parameter can force it on or off.

This follows the approach of the upstream series "media: Enable the
OV5693 front camera on IPU6 Surface devices" (in media next), which
gates bit 5 only. Linux-surface PR #2171 writes the whole register (0x2d)
on 6.19 instead.

Tested on a Surface Pro 9 (i7-1255U, IPU6 8086:465d), 7.2.11-surface-1,
Ubuntu 24.04, libcamera 0.7.2 software ISP: 2592x1944 at 28.6 fps, no
CSI-2 errors while streaming, 28.6 fps delivered in Chrome through
v4l2loopback. Without the change no frame is received.

Developed with the help of an AI assistant (Claude); tested on hardware.

Link: https://patchew.org/linux/20260717132021.18034-1-fernandorimoli11@gmail.com/
Link: linux-surface/linux-surface#2171
Link: https://github.com/loisBreant/surface-pro-9-camera
Patchset: cameras
Signed-off-by: Lois Breant <185382558+loisBreant@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fildunsky

Copy link
Copy Markdown

Surface Pro 8 (IPU6 Tiger Lake, 8086:9a19) supports the bit 5 only approach.

I tested Fernando Rimoli's series at v5 on this machine. It gates only bit 5 of 0x4800 (through clock-noncontinuous from ipu-bridge), and the front camera streamed. That series is now in media next (0e12587945f6), so this PR matches what upstream will ship. Dropping it later in favour of the backport, as you suggest, makes sense.

One thing to watch when testing on the Pro 8: here, the first capture after a cold boot often succeeds even without any 0x4800 write. Only the captures after that fail. So capture at least twice before concluding the fix is present or absent.

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.

2 participants