dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Switch TGL-H DP-IN to dGFX when it's supported
@ 2022-08-16  2:52 Kai-Heng Feng
  2022-08-16  8:06 ` Jani Nikula
  2022-08-16 18:49 ` Karol Herbst
  0 siblings, 2 replies; 20+ messages in thread
From: Kai-Heng Feng @ 2022-08-16  2:52 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin
  Cc: Heikki Krogerus, David Airlie, intel-gfx, linux-kernel,
	dri-devel, Hans de Goede, Kai-Heng Feng, Zenghui Yu

On mobile workstations like HP ZBook Fury G8, iGFX's DP-IN can switch to
dGFX so external monitors are routed to dGFX, and more monitors can be
supported as result.

To switch the DP-IN to dGFX, the driver needs to invoke _DSM function 20
on intel_dsm_guid2. This method is described in Intel document 632107.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/gpu/drm/i915/display/intel_acpi.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c
index e78430001f077..3bd5930e2769b 100644
--- a/drivers/gpu/drm/i915/display/intel_acpi.c
+++ b/drivers/gpu/drm/i915/display/intel_acpi.c
@@ -20,6 +20,7 @@ static const guid_t intel_dsm_guid =
 		  0xa8, 0x54, 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c);
 
 #define INTEL_DSM_FN_GET_BIOS_DATA_FUNCS_SUPPORTED 0 /* No args */
+#define INTEL_DSM_FN_DP_IN_SWITCH_TO_DGFX 20 /* No args */
 
 static const guid_t intel_dsm_guid2 =
 	GUID_INIT(0x3e5b41c6, 0xeb1d, 0x4260,
@@ -187,6 +188,7 @@ void intel_dsm_get_bios_data_funcs_supported(struct drm_i915_private *i915)
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 	acpi_handle dhandle;
 	union acpi_object *obj;
+	int supported = 0;
 
 	dhandle = ACPI_HANDLE(&pdev->dev);
 	if (!dhandle)
@@ -194,8 +196,22 @@ void intel_dsm_get_bios_data_funcs_supported(struct drm_i915_private *i915)
 
 	obj = acpi_evaluate_dsm(dhandle, &intel_dsm_guid2, INTEL_DSM_REVISION_ID,
 				INTEL_DSM_FN_GET_BIOS_DATA_FUNCS_SUPPORTED, NULL);
-	if (obj)
+	if (obj) {
+		if (obj->type == ACPI_TYPE_INTEGER)
+			supported = obj->integer.value;
+
 		ACPI_FREE(obj);
+	}
+
+	/* Tiger Lake H DP-IN Boot Time Switching from iGfx to dGfx */
+	if (supported & BIT(20)) {
+		obj = acpi_evaluate_dsm(dhandle, &intel_dsm_guid2,
+					INTEL_DSM_REVISION_ID,
+					INTEL_DSM_FN_DP_IN_SWITCH_TO_DGFX,
+					NULL);
+		if (obj)
+			ACPI_FREE(obj);
+	}
 }
 
 /*
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-08-25 10:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16  2:52 [PATCH] drm/i915: Switch TGL-H DP-IN to dGFX when it's supported Kai-Heng Feng
2022-08-16  8:06 ` Jani Nikula
2022-08-16 11:29   ` Kai-Heng Feng
2022-08-16 18:24     ` Lyude Paul
2022-08-16 18:36       ` Lyude Paul
2022-08-17  1:08         ` Kai-Heng Feng
2022-08-17  1:02       ` Kai-Heng Feng
2022-08-17 17:56         ` Lyude Paul
2022-08-18 20:26           ` [External] " Mark Pearson
2022-08-24 18:33     ` Karol Herbst
2022-08-18 11:53   ` Lukas Wunner
2022-08-19 17:01     ` Karol Herbst
2022-08-24 14:22       ` Kai-Heng Feng
2022-08-16 18:49 ` Karol Herbst
2022-08-17  1:18   ` Kai-Heng Feng
2022-08-17  1:48     ` Karol Herbst
2022-08-17  3:04       ` Kai-Heng Feng
2022-08-17 11:59         ` [Intel-gfx] " Ville Syrjälä
2022-08-17 12:15           ` Kai-Heng Feng
2022-08-17 13:05             ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).