Skip to content

Add front camera support for Surface Laptop 1/2 (OV9734) - #186

Open
GuyliandeJong wants to merge 2 commits into
linux-surface:v7.2-surface-develfrom
GuyliandeJong:surface-laptop-2-front-camera
Open

GuyliandeJong wants to merge 2 commits into
linux-surface:v7.2-surface-develfrom
GuyliandeJong:surface-laptop-2-front-camera

Conversation

@GuyliandeJong

Copy link
Copy Markdown

This adds front camera support for the Surface Laptop 2 (and, by the same ACPI layout, most likely the Surface Laptop 1). The feature matrix currently lists cameras as unsupported on both.

Hardware

From the DSDT of a Surface Laptop 2 (Surface_Laptop_2_1769_Consumer):

  • Front camera: \_SB_.PCI0.I2C2.CAMF, HID OVTI9734 (OV9734), I2C address 0x36, with _DEP on SKC1
  • SSDB: CSI-2 link 1, 1 lane, 19.2 MHz MCLK, degree 0, privacy LED present
  • SKC1 is a discrete INT3472 with three GPIOs: 0x78 clock enable, 0x4D reset, 0x16 privacy LED. There is no power-enable GPIO.
  • The IR camera (INT347E, OV7251) on link 2 behind SKC2 already worked before this change.

Changes

  1. ov9734: add reset GPIO, regulator and clock handling. The driver never enabled its clock or released reset, so the sensor did not answer on I2C. It now requests the optional reset GPIO and the avdd/dovdd/dvdd supplies, powers the sensor on before identifying it, and uses the power functions as runtime PM callbacks.
  2. ipu-bridge: add OVTI9734 with the 180 MHz link frequency required by the driver. Without this, probing fails with failed to check HW configuration: -6.

Testing (Surface Laptop 2, 7.2.14-arch1-1-surface with these two modules rebuilt)

ipu3-cio2 0000:00:14.3: Found supported sensor INT347E:00
ipu3-cio2 0000:00:14.3: Found supported sensor OVTI9734:00
ipu3-cio2 0000:00:14.3: Connected 2 cameras
  • ov9734 2-0036 is linked to ipu3-csi2 1, and raw capture from the CIO2 gives correct 1296x734 SGRBG10 frames.
  • Runtime PM suspend and resume work across repeated captures.
  • With libcamera's IPU3 pipeline, it streams at about 30 fps via cam and via PipeWire. Tested at 320x240, 640x480, 1024x576 and 1280x704.

Userspace note

libcamera 0.7.2 also needs changes before the camera is usable by apps. I plan to send these to libcamera upstream separately:

  • an ov9734 CameraSensorHelper (linear gain {1, 0, 0, 16}, black level 64 at 10 bits)
  • initialise testPatternMode_ in CameraSensorLegacy/CameraSensorRaw. It is uninitialised, so start() fails at random for sensors without a test pattern map.
  • avoid an unsigned underflow in the IPU3 calculateBDSHeight(). For sensors shorter than 1080 lines it inverts the std::clamp bounds and aborts. Also cap the advertised viewfinder size to what validate() actually allows.

🤖 Generated with Claude Code

GuyliandeJong and others added 2 commits November 3, 2026 08:44
The ov9734 driver assumes the sensor is already powered by ACPI domain
PM and never drives a reset line or enables its clock. On the Surface
Laptop 1 and 2, the sensor (OVTI9734) is powered through a discrete
INT3472 device (SKC1) which exposes a clock-enable GPIO, a reset GPIO
and a privacy LED. Without toggling these, the sensor never answers on
I2C.

Request the optional "reset" GPIO and the avdd/dovdd/dvdd supplies, and
add power on/off functions that enable the regulators and the clock and
release the reset line. Power the sensor on before identifying it and
hook the functions up as runtime PM callbacks.

Tested on a Surface Laptop 2: the sensor is identified and streams via
the IPU3 CIO2 and ImgU with libcamera.

Signed-off-by: GuyliandeJong <109021171+GuyliandeJong@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Patchset: cameras
The front camera of the Surface Laptop 1 and 2 is an OmniVision OV9734
(ACPI HID OVTI9734), connected to CSI-2 port 1 of the IPU3 with one
data lane. Without an entry in the supported sensor list, the bridge
does not build the fwnode graph for it and the ov9734 driver fails to
probe with "failed to check HW configuration: -6".

Add the sensor with the 180 MHz link frequency required by the ov9734
driver.

Tested on a Surface Laptop 2 together with the ov9734 power handling
change: the bridge reports two connected cameras and the front camera
streams with libcamera.

Signed-off-by: GuyliandeJong <109021171+GuyliandeJong@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Patchset: cameras
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.

1 participant