[PATCH 4/5] drm/i915: Check live status before reading edid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding this for SKL onwards.

Signed-off-by: Sonika Jindal <sonika.jindal@xxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_hdmi.c |   49 ++++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 1fb6919..769cf4f 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1300,6 +1300,46 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
 	to_intel_connector(connector)->detect_edid = NULL;
 }
 
+static bool intel_hdmi_live_status(struct intel_digital_port *intel_dig_port)
+{
+	struct drm_device *dev = intel_dig_port->base.base.dev;
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	enum port port = intel_dig_port->port;
+
+	if (IS_SKYLAKE(dev)) {
+		u32 temp = I915_READ(SDEISR);
+
+		switch (port) {
+		case PORT_B:
+			return temp & SDE_PORTB_HOTPLUG_CPT;
+
+		case PORT_C:
+			return temp & SDE_PORTC_HOTPLUG_CPT;
+
+		case PORT_D:
+			return temp & SDE_PORTD_HOTPLUG_CPT;
+
+		default:
+			return false;
+		}
+	} else if (IS_BROXTON(dev)) {
+		u32 temp = I915_READ(GEN8_DE_PORT_ISR);
+
+		switch (port) {
+		case PORT_B:
+			return temp & BXT_DE_PORT_HP_DDIB;
+
+		case PORT_C:
+			return temp & BXT_DE_PORT_HP_DDIC;
+
+		default:
+			return false;
+
+		}
+	}
+	return true;
+}
+
 static bool
 intel_hdmi_set_edid(struct drm_connector *connector)
 {
@@ -1308,15 +1348,16 @@ intel_hdmi_set_edid(struct drm_connector *connector)
 	struct intel_encoder *intel_encoder =
 		&hdmi_to_dig_port(intel_hdmi)->base;
 	enum intel_display_power_domain power_domain;
-	struct edid *edid;
+	struct edid *edid = NULL;
 	bool connected = false;
 
 	power_domain = intel_display_port_power_domain(intel_encoder);
 	intel_display_power_get(dev_priv, power_domain);
 
-	edid = drm_get_edid(connector,
-			    intel_gmbus_get_adapter(dev_priv,
-						    intel_hdmi->ddc_bus));
+	if (intel_hdmi_live_status(hdmi_to_dig_port(intel_hdmi)))
+		edid = drm_get_edid(connector,
+				intel_gmbus_get_adapter(dev_priv,
+					intel_hdmi->ddc_bus));
 
 	intel_display_power_put(dev_priv, power_domain);
 
-- 
1.7.10.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux