Repository navigation
Add front camera support for Surface Laptop 1/2 (OV9734) - #186
Open
GuyliandeJong wants to merge 2 commits into
Open
GuyliandeJong wants to merge 2 commits into
GuyliandeJong wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):\_SB_.PCI0.I2C2.CAMF, HIDOVTI9734(OV9734), I2C address 0x36, with_DEPonSKC1SKC1is a discrete INT3472 with three GPIOs:0x78clock enable,0x4Dreset,0x16privacy LED. There is no power-enable GPIO.INT347E, OV7251) on link 2 behindSKC2already worked before this change.Changes
resetGPIO and theavdd/dovdd/dvddsupplies, powers the sensor on before identifying it, and uses the power functions as runtime PM callbacks.OVTI9734with the 180 MHz link frequency required by the driver. Without this, probing fails withfailed to check HW configuration: -6.Testing (Surface Laptop 2, 7.2.14-arch1-1-surface with these two modules rebuilt)
ov9734 2-0036is linked toipu3-csi2 1, and raw capture from the CIO2 gives correct 1296x734 SGRBG10 frames.camand 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:
ov9734CameraSensorHelper (linear gain{1, 0, 0, 16}, black level 64 at 10 bits)testPatternMode_inCameraSensorLegacy/CameraSensorRaw. It is uninitialised, sostart()fails at random for sensors without a test pattern map.calculateBDSHeight(). For sensors shorter than 1080 lines it inverts thestd::clampbounds and aborts. Also cap the advertised viewfinder size to whatvalidate()actually allows.🤖 Generated with Claude Code