Surface Pro 9: fix rear camera rotation - #170
Conversation
|
Maybe we could combine all the surface devices with this rear sensor? Surface Pro 12 for Business Intel needs the same fix: linux-surface/linux-surface#2144 (comment) SP12 uses the same mechanism for see #175 |
A machine can have more than one sensor whose rotation needs to be overridden, which takes one upside_down_sensor_dmi_ids[] entry per sensor, all sharing the same DMI match but with different ACPI HIDs in driver_data. 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. Fixes: b757101 ("media: ipu-bridge: Add DMI quirk for Dell XPS laptops with upside down sensors") Cc: stable@vger.kernel.org Signed-off-by: José María Martín <jmmartinf@hotmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> (cherry picked from commit 4900cad020c0580dfb1be27776ff10a4ef110cfa)
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: José María Martín <jmmartinf@hotmail.com>
ec19192 to
e357c42
Compare
|
Hi @zR-JB, thanks for the pointer. Good to hear the SP12 has its rear sensor mounted upside down just like the SP9 does — same mounting, same fix, which makes this a lot less lonely a corner than it looked. Small update on part 1 of this PR (the On combining the devices into one entry: the entries themselves can't be folded together, unfortunately. Inside a single Which leaves the question of SP10 and SP11. I'd rather not add entries for machines nobody has run the code on: the table is matched against the live machine, so a wrong entry doesn't fail loudly — it silently flips a camera that was fine. You tested the SP12 and I tested the SP9, and I think those two are what we can honestly claim today. That said, the barrier is lower than it looks, so this is an open invitation to anyone on linux-surface/linux-surface#2144 with an SP10 or SP11. Finding out whether your machine needs it takes no building at all — Worth noting for #175: it works today without part 1 because the SP12 currently has a single entry in the table — the same situation as the Pro 10. As soon as a front-camera entry is added for the SP12, it would hit exactly the I've just refreshed this PR so that its first commit is byte-identical to the one that went into Both PRs insert just before the terminating entry, so whichever lands second needs a trivial rebase — happy to do that on my side. And once the upstream fix reaches this branch on its own, the first commit here can simply be dropped, leaving only the SP9 quirk; for now both are needed for the rear camera to come out upright. For anyone who doesn't want to wait for the kernel to come around,
It has to be redone after every kernel update, which is the whole reason for getting the quirk merged. |
|
Sp12 and sp11 do not have the omnivision front sensor but a Sony one and I think this one ist not mounted upside down! So I think the two sensors in list issue does not matter here! |
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 inipu-bridgeonly covers the front OVTI5693 camera (added in #160).Fixing it takes two commits:
media: ipu-bridge: check all DMI entries when overriding sensor rotation—ipu_bridge_parse_rotation()usesdmi_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.media: ipu-bridge: fix rear camera rotation on Surface Pro 9— add theSurface Pro 9→OVTID858quirk entry, next to the existing front-camera one.Tested on a Surface Pro 9 (kernel
6.19.8-3.surface.fc43, module rebuilt fromv6.19-surface):libcameranow reportsRotation = 180for the rear camera (was 0) and the image renders upright in GNOME Snapshot.Rotation = 180, upright image, cold first-open works.cam --capture), no newipu-bridge/ov5693/ov13858errors in dmesg.