Skip to contentSkip to conversation

media: ipu-bridge: Mark the Surface Pro 8 front sensor as upside down

PATCH Superseded Emfox Zhou 1 participant 2 messages Nov 11 – Nov 12 Media (V4L/DVB)

lore
Share & tools
lore

Emfox Zhou

author
#0 lore raw

PATCH 1/1 media: ipu-bridge: Mark the Surface Pro 8 front sensor as upside down

The OV5693 front sensor of the Surface Pro 8 is mounted upside down, but the machine does not report that: neither the SSDB nor the _PLD carries a rotation, so the sensor is advertised with a rotation of 0 and every application receives an image rotated by 180 degrees.

The ACPI HID of this sensor is INT33BE, not OVTI5693 as on the Surface Pro 9, so add an entry matching that one.

On the machine the read-only camera_sensor_rotation control now reports 180, and libcamera turns the reported rotation into a transform for the default image orientation, so a capture that used to come out rotated by 180 degrees is now upright.

---
 drivers/media/pci/intel/ipu-bridge.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/media/pci/intel/ipu-bridge.c +8 -0
@@ -265,6 +265,14 @@
 		.driver_data = "OVTI02C1",
 	},
 	{
+		/* Microsoft Surface Pro 8, front sensor */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 8"),
+		},
+		.driver_data = "INT33BE",
+	},
+	{
 		/* Microsoft Surface Pro 9, front sensor */
 		.matches = {
 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
author
#1 lore raw

PATCH v2 1/1 media: ipu-bridge: Mark the Surface Pro 8 sensors as upside down

Both camera sensors of the Surface Pro 8 are mounted upside down, but the machine does not report that: neither the SSDB nor the _PLD carries a rotation, so both are advertised with a rotation of 0 and every application receives an image rotated by 180 degrees.

The front sensor has the ACPI HID INT33BE, not OVTI5693 as on the Surface Pro 9, and the rear one is OVTID858. Add one entry for each, the same way the two Surface Pro 9 sensors are already handled.

On the machine both read-only camera_sensor_rotation controls now report 180, and libcamera turns the reported rotation into a transform for the default image orientation, so captures that used to come out rotated by 180 degrees are now upright. Checked with a 2592x1944 capture from the front sensor and a 1056x784 one from the rear.

v2: cover the rear sensor too. v1 only added the front one, which was the
only sensor that could stream at the time.

---
 drivers/media/pci/intel/ipu-bridge.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/media/pci/intel/ipu-bridge.c +16 -0
index 78ff2560a..220f450e9 100644
@@ -280,6 +280,22 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
 		},
 		.driver_data = "OVTID858",
 	},
+	{
+		/* Microsoft Surface Pro 8, front sensor */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 8"),
+		},
+		.driver_data = "INT33BE",
+	},
+	{
+		/* Microsoft Surface Pro 8, rear sensor */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 8"),
+		},
+		.driver_data = "OVTID858",
+	},
 	{} /* Terminating entry */
 };