Skip to content

Surface Pro 9: fix rear camera rotation - #170

Open
jmmartinf wants to merge 2 commits into
linux-surface:v6.19-surface-develfrom
jmmartinf:sp9-rear-camera-rotation
Open

Surface Pro 9: fix rear camera rotation#170
jmmartinf wants to merge 2 commits into
linux-surface:v6.19-surface-develfrom
jmmartinf:sp9-rear-camera-rotation

Conversation

@jmmartinf

Copy link
Copy Markdown

The rear OV13858 camera (OVTID858) of the Surface Pro 9 comes out rotated 180°: the firmware SSDB reports degree=0, and the existing DMI quirk in ipu-bridge only covers the front OVTI5693 camera (added in #160).

Fixing it takes two commits:

  1. media: ipu-bridge: check all DMI entries when overriding sensor rotationipu_bridge_parse_rotation() uses dmi_first_match(), which always stops at the first entry matching the running machine, so a second entry for the same machine (needed for a second sensor) is unreachable. Walk the whole table and match each entry for the running machine against the sensor's ACPI HID instead. This is a general fix, not SP9-specific; I intend to send it to linux-media mainline as well.
  2. media: ipu-bridge: fix rear camera rotation on Surface Pro 9 — add the Surface Pro 9OVTID858 quirk entry, next to the existing front-camera one.

Tested on a Surface Pro 9 (kernel 6.19.8-3.surface.fc43, module rebuilt from v6.19-surface):

  • libcamera now reports Rotation = 180 for the rear camera (was 0) and the image renders upright in GNOME Snapshot.
  • No regression on the front camera: still Rotation = 180, upright image, cold first-open works.
  • Both cameras keep delivering frames (cam --capture), no new ipu-bridge/ov5693/ov13858 errors in dmesg.

A machine can have more than one sensor whose rotation needs to be
overridden, listed as one upside_down_sensor_dmi_ids[] entry per sensor
sharing the same DMI match, e.g. the front (OVTI5693) and rear
(OVTID858) cameras of the Microsoft Surface Pro 9.

ipu_bridge_parse_rotation() uses dmi_first_match(), which always stops
at the first entry matching the running machine, so any further entry
for the same machine is unreachable and only one sensor per machine can
ever be corrected.

Walk the whole table and match every entry for the running machine
against the sensor's ACPI HID instead.

Signed-off-by: Jose Maria Martin <jmmartinf@hotmail.com>
The SSDB provided by the firmware for the rear OV13858 camera
(OVTID858) of the Microsoft Surface Pro 9 reports degree=0, but the
module is mounted upside down, so the image comes out rotated 180
degrees. Add a DMI quirk entry for it, next to the existing one for
the front OVTI5693 camera of the same machine.

Tested on a Surface Pro 9: both cameras now report Rotation = 180 and
render upright in libcamera clients, with no regression on the front
camera.

Signed-off-by: Jose Maria Martin <jmmartinf@hotmail.com>
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