diff mbox series

[6/6] i915: bail out of eDP link training while mux-switched away

Message ID 20200727205112.27698-7-ddadap@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [1/6] vga-switcheroo: add new "immediate" switch event type | expand

Commit Message

Daniel Dadap July 27, 2020, 8:51 p.m. UTC
It is not possible to train a Displayport link while the lanes are
physically disconnected by a display mux. In order to prevent problems
associated with attempting to train a disconnected link, abort eDP
link training if the i915 GPU is not an active vga-switcheroo client.
This short circuit is eDP-specific, as normal DP (e.g. for external
displays) should be able to detect that the link is not physically
connected, while eDP is usually assumed to be always connected.

Signed-off-by: Daniel Dadap <ddadap@nvidia.com>
---
 drivers/gpu/drm/i915/display/intel_dp_link_training.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index a7defb37ab00..a1c61db8a228 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -24,6 +24,7 @@ 
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_dp_link_training.h"
+#include "linux/vga_switcheroo.h"
 
 static void
 intel_dp_dump_link_status(const u8 link_status[DP_LINK_STATUS_SIZE])
@@ -371,6 +372,14 @@  void
 intel_dp_start_link_train(struct intel_dp *intel_dp)
 {
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
+	struct device *dev = dp_to_dig_port(intel_dp)->base.base.dev->dev;
+
+	if (intel_dp_is_edp(intel_dp) &&
+	    !vga_switcheroo_is_client_active(to_pci_dev(dev))) {
+		drm_dbg_kms(&dp_to_i915(intel_dp)->drm,
+			"eDP link training not allowed when muxed away.");
+		return;
+	}
 
 	if (!intel_dp_link_training_clock_recovery(intel_dp))
 		goto failure_handling;