From: Jimmy Su <jimmy.su@intel.com>
To: linux-media@vger.kernel.org
Cc: sakari.ailus@linux.intel.com, jimmy.su@intel.com,
serin.yeh@intel.com, vicamo@gmail.com, sarang.sapre@intel.com
Subject: [PATCH v1 1/2] media: ipu-bridge: extend upside-down matching with DSM module IDs
Date: Wed, 7 Oct 2026 11:49:13 +0800 [thread overview]
Message-ID: <20261007034914.1654831-2-jimmy.su@intel.com> (raw)
In-Reply-To: <20261007034914.1654831-1-jimmy.su@intel.com>
The existing upside-down sensor detection relies on sensor HID matching.
However, some platforms may source camera modules from multiple vendors.
While the sensor HID remains the same, camera modules from different
vendors may be mounted in different orientations.
Extend the upside-down matching mechanism to support ACPI _DSM module
identifiers. The driver retrieves the module ID from the sensor device
and applies a 180-degree rotation quirk when a matching module ID is
found.
This allows platform-specific rotation handling for camera modules that
cannot be distinguished by sensor HID alone.
Link: https://github.com/intel/ipu6-drivers/pull/445
Link: https://bugs.launchpad.net/bugs/2155837
Co-developed-by: Vicamo Yang <vicamo@gmail.com>
Signed-off-by: Vicamo Yang <vicamo@gmail.com>
Signed-off-by: Jimmy Su <jimmy.su@intel.com>
---
drivers/media/pci/intel/ipu-bridge.c | 95 ++++++++++++++++++++++++----
1 file changed, 82 insertions(+), 13 deletions(-)
diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index 1bb3a3e98d6b..64caa4254e41 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -36,6 +36,15 @@
*/
#define IVSC_DEV_NAME "intel_vsc"
+/*
+ * 822ace8f-2814-4174-a56b-5f029fe079ee
+ * This _DSM GUID returns a string from the sensor device, which acts as a
+ * module identifier.
+ */
+static const guid_t sensor_module_guid =
+ GUID_INIT(0x822ace8f, 0x2814, 0x4174,
+ 0xa5, 0x6b, 0x5f, 0x02, 0x9f, 0xe0, 0x79, 0xee);
+
/*
* Extend this array with ACPI Hardware IDs of devices known to be working
* plus the number of link-frequencies expected by their drivers, along with
@@ -105,6 +114,36 @@ static const struct ipu_sensor_config ipu_supported_sensors[] = {
IPU_SENSOR_CONFIG("XMCC0003", 1, 321468000),
};
+/*
+ * Upside-down orientation can be determined by the Sensor HID or module ID.
+ * Camera modules from different vendors may be mounted in opposite
+ * orientations.
+ */
+enum upside_down_match_type {
+ UPSIDE_DOWN_MATCH_HID = 1,
+ UPSIDE_DOWN_MATCH_DSM,
+};
+
+struct upside_down_match_info {
+ enum upside_down_match_type type;
+ const char * const ids[2];
+};
+
+static struct upside_down_match_info ov02c10_match = {
+ .type = UPSIDE_DOWN_MATCH_HID,
+ .ids = { "OVTI02C1" },
+};
+
+static struct upside_down_match_info imx471_match = {
+ .type = UPSIDE_DOWN_MATCH_HID,
+ .ids = { "SONY471A" },
+};
+
+static struct upside_down_match_info ov02e10_match = {
+ .type = UPSIDE_DOWN_MATCH_HID,
+ .ids = { "OVTI02E1" },
+};
+
/*
* DMI matches for laptops which have their sensor mounted upside-down
* without reporting a rotation of 180° in neither the SSDB nor the _PLD.
@@ -115,35 +154,35 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 13 9340"),
},
- .driver_data = "OVTI02C1",
+ .driver_data = &ov02c10_match,
},
{
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 13 9350"),
},
- .driver_data = "OVTI02C1",
+ .driver_data = &ov02c10_match,
},
{
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 14 9440"),
},
- .driver_data = "OVTI02C1",
+ .driver_data = &ov02c10_match,
},
{
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 16 9640"),
},
- .driver_data = "OVTI02C1",
+ .driver_data = &ov02c10_match,
},
{
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 16 (Dell 16 Premium) DA16250"),
},
- .driver_data = "OVTI02C1",
+ .driver_data = &ov02c10_match,
},
/*
* The first four characters of DMI_BOARD_NAME identify the Lenovo
@@ -158,7 +197,7 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "21QA"),
},
- .driver_data = "SONY471A",
+ .driver_data = &imx471_match,
},
{
/* Lenovo X9-14 */
@@ -166,7 +205,7 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "21QB"),
},
- .driver_data = "SONY471A",
+ .driver_data = &imx471_match,
},
{
/* Lenovo X9-15 */
@@ -174,7 +213,7 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "21Q6"),
},
- .driver_data = "SONY471A",
+ .driver_data = &imx471_match,
},
{
/* Lenovo X9-15 */
@@ -182,7 +221,7 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "21Q7"),
},
- .driver_data = "SONY471A",
+ .driver_data = &imx471_match,
},
{
/* Samsung Galaxy Book5 Pro 360 */
@@ -190,7 +229,7 @@ static const struct dmi_system_id upside_down_sensor_dmi_ids[] = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "960QHA"),
},
- .driver_data = "OVTI02E1",
+ .driver_data = &ov02e10_match,
},
{} /* Terminating entry */
};
@@ -359,9 +398,39 @@ static u32 ipu_bridge_parse_rotation(struct acpi_device *adev,
/* A machine may have one entry per sensor, so check all matches. */
for (dmi_id = dmi_first_match(upside_down_sensor_dmi_ids); dmi_id;
- dmi_id = dmi_first_match(dmi_id + 1))
- if (acpi_dev_hid_match(adev, dmi_id->driver_data))
- return 180;
+ dmi_id = dmi_first_match(dmi_id + 1)) {
+ const struct upside_down_match_info *match =
+ dmi_id->driver_data;
+ union acpi_object *obj;
+ size_t i;
+
+ switch (match->type) {
+ case UPSIDE_DOWN_MATCH_HID:
+ for (i = 0; i < ARRAY_SIZE(match->ids) && match->ids[i];
+ i++)
+ if (acpi_dev_hid_match(adev, match->ids[i]))
+ return 180;
+ break;
+ case UPSIDE_DOWN_MATCH_DSM:
+ obj = acpi_evaluate_dsm_typed(adev->handle,
+ &sensor_module_guid, 0x00,
+ 0x01, NULL,
+ ACPI_TYPE_STRING);
+ if (!obj)
+ break;
+
+ for (i = 0; i < ARRAY_SIZE(match->ids) && match->ids[i];
+ i++)
+ if (!strcmp(match->ids[i],
+ obj->string.pointer)) {
+ ACPI_FREE(obj);
+ return 180;
+ }
+
+ ACPI_FREE(obj);
+ break;
+ }
+ }
switch (ssdb->degree) {
case IPU_SENSOR_ROTATION_NORMAL:
--
2.34.1
next prev parent reply other threads:[~2026-10-07 3:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 3:49 [PATCH v1 0/2] media: support upside-down camera mounting Jimmy Su
2026-10-07 3:49 ` Jimmy Su [this message]
2026-10-07 3:49 ` [PATCH v1 2/2] media: ipu-bridge: add upside-down quirks for Dell PA14260 & DA14260 Jimmy Su
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261007034914.1654831-2-jimmy.su@intel.com \
--to=jimmy.su@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sarang.sapre@intel.com \
--cc=serin.yeh@intel.com \
--cc=vicamo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox