Skip to contentSkip to conversation

Detect DP displays based on sink count change

PATCH In review Sivakumar Thulasimani 1 participant 4 messages Aug 17, 2015 – Aug 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Detect DP displays based on sink count change

From: "Thulasimani,Sivakumar" <[email protected]>

These two patches together help detect DP displays on short pulse HPD and pass the respective compliance test case (4.2.2.8)

Thulasimani,Sivakumar (2):
drm/i915: Read sink_count dpcd always for short hpd drm/i915: Perform full detect on sink_count change

 drivers/gpu/drm/i915/intel_dp.c  |   43 ++++++++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_drv.h |    1 +
 2 files changed, 31 insertions(+), 13 deletions(-)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/2 drm/i915: Read sink_count dpcd always for short hpd

From: "Thulasimani,Sivakumar" <[email protected]>

Compliance test 4.2.2.8 requires driver to read the sink_count for short pulse interrupt even when the panel is not enabled. This patch performs the following
a) reading sink_count by reusing intel_dp_detect_dpcd instead of using intel_dp_get_dpcd
b) moving crtc enabled checks post sink_count read call

v2: avoid code movement with functionality changes (Ville)

---
 drivers/gpu/drm/i915/intel_dp.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +12 -8
index b905c19..0b73e98 100644
@@ -132,6 +132,8 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
 static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp);
 static void vlv_steal_power_sequencer(struct drm_device *dev,
 				      enum pipe pipe);
+static enum drm_connector_status
+intel_dp_detect_dpcd(struct intel_dp *intel_dp);
 
 static int
 intel_dp_max_link_bw(struct intel_dp  *intel_dp)
@@ -4362,21 +4364,23 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 
 	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
-	if (!intel_encoder->base.crtc)
+	/* 4.2.2.8 requires source to read link_status, 0 - 12 DPCD &
+	 * sink_count even for short pulse irrespective of the sink is
+	 * in use or not
+	 */
+	if (!intel_dp_get_link_status(intel_dp, link_status)) {
 		return;
+	}
 
-	if (!to_intel_crtc(intel_encoder->base.crtc)->active)
+	/* reuse to read both 0 - 12 DPCD & sink_count */
+	if (intel_dp_detect_dpcd(intel_dp) != connector_status_connected)
 		return;
 
-	/* Try to read receiver status if the link appears to be up */
-	if (!intel_dp_get_link_status(intel_dp, link_status)) {
+	if (!intel_encoder->base.crtc)
 		return;
-	}
 
-	/* Now read the DPCD to see if it's actually running */
-	if (!intel_dp_get_dpcd(intel_dp)) {
+	if (!to_intel_crtc(intel_encoder->base.crtc)->active)
 		return;
-	}
 
 	/* Try to read the source of the interrupt */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 1/2] drm/i915: Read sink_count dpcd always for short hpd

dropping this patch as i understood more about
SINK_COUNT dpcd and DOWNSTREAM_PORT_PRESENT dpcd.
will upload a new series with proper fix.

Quoted 61 lines · Sivakumar Thulasimani

From: "Thulasimani,Sivakumar" <[email protected]>

Compliance test 4.2.2.8 requires driver to read the sink_count for short pulse interrupt even when the panel is not enabled. This patch performs the following
a) reading sink_count by reusing intel_dp_detect_dpcd instead of using intel_dp_get_dpcd
b) moving crtc enabled checks post sink_count read call

v2: avoid code movement with functionality changes (Ville)

---
  drivers/gpu/drm/i915/intel_dp.c |   20 ++++++++++++--------
  1 file changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +12 -8
index b905c19..0b73e98 100644
@@ -132,6 +132,8 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
  static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp);
  static void vlv_steal_power_sequencer(struct drm_device *dev,
  				      enum pipe pipe);
+static enum drm_connector_status
+intel_dp_detect_dpcd(struct intel_dp *intel_dp);
 
  static int
  intel_dp_max_link_bw(struct intel_dp  *intel_dp)
@@ -4362,21 +4364,23 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 
  	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
-	if (!intel_encoder->base.crtc)
+	/* 4.2.2.8 requires source to read link_status, 0 - 12 DPCD &
+	 * sink_count even for short pulse irrespective of the sink is
+	 * in use or not
+	 */
+	if (!intel_dp_get_link_status(intel_dp, link_status)) {
  		return;
+	}
 
-	if (!to_intel_crtc(intel_encoder->base.crtc)->active)
+	/* reuse to read both 0 - 12 DPCD & sink_count */
+	if (intel_dp_detect_dpcd(intel_dp) != connector_status_connected)
  		return;
 
-	/* Try to read receiver status if the link appears to be up */
-	if (!intel_dp_get_link_status(intel_dp, link_status)) {
+	if (!intel_encoder->base.crtc)
  		return;
-	}
 
-	/* Now read the DPCD to see if it's actually running */
-	if (!intel_dp_get_dpcd(intel_dp)) {
+	if (!to_intel_crtc(intel_encoder->base.crtc)->active)
  		return;
-	}
 
  	/* Try to read the source of the interrupt */
  	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
Signature · 7 lines
regards,
Sivakumar

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 2/2 drm/i915: Perform full detect on sink_count change

In reply to Sivakumar Thulasimani

From: "Thulasimani,Sivakumar" <[email protected]>

This patch checks for changes in sink_count during short pulse hpd in check_link_status and forces full detect when sink_count changes. Compliance test 4.2.2.8 expects this behavior in compliant driver.

---
 drivers/gpu/drm/i915/intel_dp.c  |   25 +++++++++++++++++++------
 drivers/gpu/drm/i915/intel_drv.h |    1 +
 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +19 -6
index 0b73e98..067f9ee 100644
@@ -4353,17 +4353,20 @@ go_again:
  *  4. Check link status on receipt of hot-plug interrupt
  */
 static void
-intel_dp_check_link_status(struct intel_dp *intel_dp)
+intel_dp_check_link_status(struct intel_dp *intel_dp, bool *need_full_detect)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
 	struct intel_crtc *crtc =
 		to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc);
 	u8 sink_irq_vector;
+	u8 old_sink_count = intel_dp->sink_count;
 	u8 link_status[DP_LINK_STATUS_SIZE];
 
 	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
+	*need_full_detect = false;
+
 	/* 4.2.2.8 requires source to read link_status, 0 - 12 DPCD &
 	 * sink_count even for short pulse irrespective of the sink is
 	 * in use or not
@@ -4376,6 +4379,12 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 	if (intel_dp_detect_dpcd(intel_dp) != connector_status_connected)
 		return;
 
+	if (old_sink_count != intel_dp->sink_count) {
+		DRM_ERROR("forcing full detect\n");
+		*need_full_detect = true;
+		return;
+	}
+
 	if (!intel_encoder->base.crtc)
 		return;
 
@@ -4422,14 +4431,13 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
 	/* If we're HPD-aware, SINK_COUNT changes dynamically */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
 	    intel_dp->downstream_ports[0] & DP_DS_PORT_HPD) {
-		uint8_t reg;
 
 		if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_SINK_COUNT,
-					    &reg, 1) < 0)
+					    &intel_dp->sink_count, 1) < 0)
 			return connector_status_unknown;
 
-		return DP_GET_SINK_COUNT(reg) ? connector_status_connected
-					      : connector_status_disconnected;
+		return DP_GET_SINK_COUNT(intel_dp->sink_count) ?
+		    connector_status_connected : connector_status_disconnected;
 	}
 
 	/* If no HPD, poke DDC gently */
@@ -5029,13 +5037,18 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 		}
 
 		if (!intel_dp->is_mst) {
+			bool full_detect = false;
+
 			/*
 			 * we'll check the link status via the normal hot plug path later -
 			 * but for short hpds we should check it now
 			 */
 			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
-			intel_dp_check_link_status(intel_dp);
+			intel_dp_check_link_status(intel_dp, &full_detect);
 			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			if (full_detect)
+				goto put_power;
 		}
 	}
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 81b7d77..8aca5bb 100644
@@ -712,6 +712,7 @@ struct intel_dp {
 	enum hdmi_force_audio force_audio;
 	bool limited_color_range;
 	bool color_range_auto;
+	uint8_t sink_count;
 	uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
 	uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx