Skip to contentSkip to conversation

drm/i915: Improve DP downstream HPD handling

PATCH In review [email protected] 3 participants 10 messages Jul 6, 2015 – Jul 8, 2015

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

PATCH 1/1 drm/i915: Improve DP downstream HPD handling

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
 drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
 	}
 }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
 static void intel_disable_dp(struct intel_encoder *encoder)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
 	 * ensure that we have vdd while we switch off the panel. */
 	intel_edp_panel_vdd_on(intel_dp);
 	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 	intel_edp_panel_off(intel_dp);
 
 	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
 			intel_dp_check_link_status(intel_dp);
 			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
 		}
 	}
 
Signature · 6 lines
2.3.6

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 48 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
  drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
  1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +10 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
  	}
  }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
  static void intel_disable_dp(struct intel_encoder *encoder)
  {
  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
  	 * ensure that we have vdd while we switch off the panel. */
  	intel_edp_panel_vdd_on(intel_dp);
  	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
  	intel_edp_panel_off(intel_dp);
 
  	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
  			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
  			intel_dp_check_link_status(intel_dp);
  			drm_modeset_unlock(&dev->mode_config.connection_mutex);

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4965

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
  		}
  	}
 

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

Signature · 7 lines
regards,
Sivakumar

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 58 lines · Sivakumar Thulasimani
Quoted 55 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
  drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
  1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
  	}
  }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
  static void intel_disable_dp(struct intel_encoder *encoder)
  {
  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
  	 * ensure that we have vdd while we switch off the panel. */
  	intel_edp_panel_vdd_on(intel_dp);
  	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
  	intel_edp_panel_off(intel_dp);
 
  	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
  			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
  			intel_dp_check_link_status(intel_dp);
  			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4965

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
  		}
  	}
 

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

->detect() will be called from the hotplug work and that will check SINK_COUNT.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 66 lines · Ville Syrjälä
Quoted 57 lines · Sivakumar Thulasimani
Quoted 55 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
   drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
   1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
   	}
   }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
   static void intel_disable_dp(struct intel_encoder *encoder)
   {
   	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
   	 * ensure that we have vdd while we switch off the panel. */
   	intel_edp_panel_vdd_on(intel_dp);
   	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
   	intel_edp_panel_off(intel_dp);
 
   	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
   			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
   			intel_dp_check_link_status(intel_dp);
   			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4965

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
   		}
   	}
 

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

Quoted 3 lines

->detect() will be called from the hotplug work and that will check SINK_COUNT.

No, the Compliance Sink tool, will not set the DP_DS_PORT_HPD resulting in detect not getting executed for the short pulse generated. The spec requires the sink to set only the sink count so it is not a must for the sink to update the DP_DOWNSTREAM_PORT_0. so only a check for SINK_COUNT will pass the compliance test.

Signature · 7 lines
regards,
Sivakumar

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 72 lines · Sivakumar Thulasimani
Quoted 66 lines · Ville Syrjälä
Quoted 57 lines · Sivakumar Thulasimani
Quoted 55 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
   drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
   1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
   	}
   }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
   static void intel_disable_dp(struct intel_encoder *encoder)
   {
   	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
   	 * ensure that we have vdd while we switch off the panel. */
   	intel_edp_panel_vdd_on(intel_dp);
   	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
   	intel_edp_panel_off(intel_dp);
 
   	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
   			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
   			intel_dp_check_link_status(intel_dp);
   			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4965

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
   		}
   	}
 

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

Quoted 3 lines

->detect() will be called from the hotplug work and that will check SINK_COUNT.

Quoted 7 lines

No, the Compliance Sink tool, will not set the DP_DS_PORT_HPD resulting in detect not getting executed for
the short pulse generated. The spec requires the sink to set only the sink count so it is not a must for
the sink to update the DP_DOWNSTREAM_PORT_0. so only a check for SINK_COUNT will pass the
compliance test.

That seems stupid. If the downstream port isn't HPD capable then we have no reason to check SINK_COUNT after a short HPD as the short HPD coudln't have been caused by a downstram HPD. Obviuously we still check SINK_COUNT after a long HPD to figure out if anything is connected when the branch device itself gets connected to the source.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 81 lines · Ville Syrjälä
Quoted 72 lines · Sivakumar Thulasimani
Quoted 66 lines · Ville Syrjälä
Quoted 57 lines · Sivakumar Thulasimani
Quoted 55 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
   drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
   1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
   	}
   }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
   static void intel_disable_dp(struct intel_encoder *encoder)
   {
   	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
   	 * ensure that we have vdd while we switch off the panel. */
   	intel_edp_panel_vdd_on(intel_dp);
   	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
   	intel_edp_panel_off(intel_dp);
 
   	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
   			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
   			intel_dp_check_link_status(intel_dp);
   			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4965

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
   		}
   	}
 

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

Quoted 3 lines

->detect() will be called from the hotplug work and that will check SINK_COUNT.

Quoted 7 lines

No, the Compliance Sink tool, will not set the DP_DS_PORT_HPD resulting in detect not getting executed for
the short pulse generated. The spec requires the sink to set only the sink count so it is not a must for
the sink to update the DP_DOWNSTREAM_PORT_0. so only a check for SINK_COUNT will pass the
compliance test.

Quoted 5 lines

That seems stupid. If the downstream port isn't HPD capable then we have no reason to check SINK_COUNT after a short HPD as the short HPD coudln't have been caused by a downstram HPD. Obviuously we still check SINK_COUNT after a long HPD to figure out if anything is connected when the branch device itself gets connected to the source.

Actually that's not correct. We don't check SINK_COUNT unless the downstream port is HPD capable.

The spec says:
"If the DFP does not provide for means for plug/unplug detection, the adaptor must set the SINK_COUNT field bits, as if those Sink devices were all permanently plugged."

So according to the there can't be any changes in SINK_COUNT if the downstream port is not HPD capable.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 87 lines · Ville Syrjälä
Quoted 78 lines · Ville Syrjälä
Quoted 70 lines · Sivakumar Thulasimani
Quoted 65 lines · Ville Syrjälä
Quoted 56 lines · Sivakumar Thulasimani
Quoted 55 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
    drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
    1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +17 -1
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
    	}
    }
 
+static bool intel_dp_has_downstream_hpd(struct intel_dp *intel_dp)
+{
+	return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT &&
+		intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+		intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
    static void intel_disable_dp(struct intel_encoder *encoder)
    {
    	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
    	 * ensure that we have vdd while we switch off the panel. */
    	intel_edp_panel_vdd_on(intel_dp);
    	intel_edp_backlight_off(intel_dp);
-	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	/* Skip power down to keep downstream HPD working */
+	if (!intel_dp_has_downstream_hpd(intel_dp))
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
    	intel_edp_panel_off(intel_dp);
 
    	/* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
    			drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
    			intel_dp_check_link_status(intel_dp);
    			drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+			/*
+			 * Downstream HPD will generate a short HPD,
+			 * so we want full hotplug processing here.
+			 */
+			if (intel_dp_has_downstream_hpd(intel_dp))
+				goto put_power;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4965

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
    		}
    	}
 

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

Quoted 3 lines

->detect() will be called from the hotplug work and that will check SINK_COUNT.

Quoted 7 lines

No, the Compliance Sink tool, will not set the DP_DS_PORT_HPD resulting in detect not getting executed for
the short pulse generated. The spec requires the sink to set only the sink count so it is not a must for
the sink to update the DP_DOWNSTREAM_PORT_0. so only a check for SINK_COUNT will pass the
compliance test.

Quoted 5 lines

That seems stupid. If the downstream port isn't HPD capable then we have no reason to check SINK_COUNT after a short HPD as the short HPD coudln't have been caused by a downstram HPD. Obviuously we still check SINK_COUNT after a long HPD to figure out if anything is connected when the branch device itself gets connected to the source.

Actually that's not correct. We don't check SINK_COUNT unless the downstream port is HPD capable.

Quoted 10 lines

The spec says:
"If the DFP does not provide for means for plug/unplug detection, the adaptor must set the SINK_COUNT field bits, as if those Sink devices were all permanently plugged."

So according to the there can't be any changes in SINK_COUNT if the downstream port is not HPD capable.

yes, agree on the no changes for SINK_COUNT if HPD is 0. i'll check with DP Compliance test tomorrow and confirm the exact reason for its failure may be my understanding of it was incorrect.

Signature · 8 lines
regards,
Sivakumar


_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 99 lines · Sivakumar Thulasimani
Quoted 96 lines · Ville Syrjälä
Quoted 82 lines · Ville Syrjälä
Quoted 74 lines · Sivakumar Thulasimani
Quoted 69 lines · Ville Syrjälä
Quoted 60 lines · Sivakumar Thulasimani
Quoted 59 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know the device has a HPD capable downstream port, make sure we kick off the full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
    drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
    1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +2 -0
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct 
 intel_encoder *encoder,
        }
    }
    +static bool intel_dp_has_downstream_hpd(struct intel_dp 
 *intel_dp)
+{
+    return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & 

DP_DWN_STRM_PORT_PRESENT &&

drivers/gpu/drm/i915/intel_dp.c +4 -0
+        intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+        intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
    static void intel_disable_dp(struct intel_encoder *encoder)
    {
        struct intel_dp *intel_dp = 

enc_to_intel_dp(&encoder->base);

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct 
 intel_encoder *encoder)
         * ensure that we have vdd while we switch off the 

panel. */

        intel_edp_panel_vdd_on(intel_dp);
        intel_edp_backlight_off(intel_dp);
drivers/gpu/drm/i915/intel_dp.c +9 -1
-    intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+    /* Skip power down to keep downstream HPD working */
+    if (!intel_dp_has_downstream_hpd(intel_dp))
+        intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
        intel_edp_panel_off(intel_dp);
            /* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct 
 intel_digital_port *intel_dig_port, bool long_hpd)
 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
                intel_dp_check_link_status(intel_dp);
 drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+            /*
+             * Downstream HPD will generate a short HPD,
+             * so we want full hotplug processing here.
+             */
+            if (intel_dp_has_downstream_hpd(intel_dp))
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct · line 4965

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+                goto put_power;
            }
        }

I am looking into compliance changes for DP and this seems a relevant change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8, we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just check SINK_COUNT and do full detect ?

Quoted 3 lines

->detect() will be called from the hotplug work and that will check SINK_COUNT.

Quoted 7 lines

No, the Compliance Sink tool, will not set the DP_DS_PORT_HPD resulting in detect not getting executed for
the short pulse generated. The spec requires the sink to set only the sink count so it is not a must for
the sink to update the DP_DOWNSTREAM_PORT_0. so only a check for SINK_COUNT will pass the
compliance test.

Quoted 5 lines

That seems stupid. If the downstream port isn't HPD capable then we have no reason to check SINK_COUNT after a short HPD as the short HPD coudln't have been caused by a downstram HPD. Obviuously we still check SINK_COUNT after a long HPD to figure out if anything is connected when the branch device itself gets connected to the source.

Actually that's not correct. We don't check SINK_COUNT unless the downstream port is HPD capable.

The spec says:
"If the DFP does not provide for means for plug/unplug detection, the adaptor must set the SINK_COUNT field bits, as if those Sink devices were all permanently plugged."

Quoted 8 lines
Quoted 5 lines

So according to the there can't be any changes in SINK_COUNT if the downstream port is not HPD capable.

yes, agree on the no changes for SINK_COUNT if HPD is 0. i'll check with DP Compliance test tomorrow and confirm the exact reason for its failure may be my understanding of it was incorrect.

confirmed that the compliance sink is not setting HPD bit during detect. so this looks to be a bug in the sink tool. i'll file a bug with their team instead.

coming back to this patch, i will get back once i understand the complex scenario of all short pulse is treated as long pulse post this change, for example: we will do full detection even if the sink requested retraining of link.

Signature · 7 lines
regards,
Sivakumar

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 129 lines · Sivakumar Thulasimani
Quoted 117 lines · Sivakumar Thulasimani
Quoted 103 lines · Ville Syrjälä
Quoted 91 lines · Ville Syrjälä
Quoted 82 lines · Sivakumar Thulasimani
Quoted 77 lines · Ville Syrjälä
Quoted 67 lines · Sivakumar Thulasimani
Quoted 56 lines · On 7/6/2015 5:42 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

DP dongles may signal downstream HPD via short HPD pulses. If we know
the device has a HPD capable downstream port, make sure we kick off the
full hotplug processing even for short HPDs.

Additonally setting the sink to DPMS off kills the downstream HPD (at
least on my DP->VGA dongle), so skip the DPMS off for such dongles when we turn off the port.

---
    drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++++++++++-
    1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +2 -0
index e88cec2..f424833 100644
@@ -2324,6 +2324,13 @@ static void intel_dp_get_config(struct 
 intel_encoder *encoder,
        }
    }
    +static bool intel_dp_has_downstream_hpd(struct intel_dp 
 *intel_dp)
+{
+    return intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & 

DP_DWN_STRM_PORT_PRESENT &&

drivers/gpu/drm/i915/intel_dp.c +4 -0
+        intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
+        intel_dp->downstream_ports[0] & DP_DS_PORT_HPD;
+}
+
    static void intel_disable_dp(struct intel_encoder *encoder)
    {
        struct intel_dp *intel_dp = 

enc_to_intel_dp(&encoder->base);

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -2340,7 +2347,9 @@ static void intel_disable_dp(struct 
 intel_encoder *encoder)
         * ensure that we have vdd while we switch off the 

panel. */

        intel_edp_panel_vdd_on(intel_dp);
        intel_edp_backlight_off(intel_dp);
drivers/gpu/drm/i915/intel_dp.c +3 -1
-    intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+    /* Skip power down to keep downstream HPD working */
+    if (!intel_dp_has_downstream_hpd(intel_dp))
+        intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
        intel_edp_panel_off(intel_dp);
            /* disable the port before the pipe on g4x */
@@ -4944,6 +4953,13 @@ intel_dp_hpd_pulse(struct 
 intel_digital_port *intel_dig_port, bool long_hpd)
 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
                intel_dp_check_link_status(intel_dp);

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct · line 4965

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
 drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
+            /*
+             * Downstream HPD will generate a short HPD,
+             * so we want full hotplug processing here.
+             */
+            if (intel_dp_has_downstream_hpd(intel_dp))
+                goto put_power;
            }
        }
Quoted 8 lines

I am looking into compliance changes for DP and this seems a relevant
change for compliance as well. but as per Link CTS 1.2 section 4.2.2.8,
we are supposed to read the sink_count and do full detection if sink_count is >1. So instead of checking for DP_DS_PORT_HPD can we just
check SINK_COUNT and do full detect ?

Quoted 3 lines

->detect() will be called from the hotplug work and that will check SINK_COUNT.

Quoted 8 lines

No, the Compliance Sink tool, will not set the DP_DS_PORT_HPD resulting
in detect not getting executed for
the short pulse generated. The spec requires the sink to set only the sink count so it is not a must for
the sink to update the DP_DOWNSTREAM_PORT_0. so only a check for SINK_COUNT will pass the
compliance test.

Quoted 7 lines

That seems stupid. If the downstream port isn't HPD capable then we have
no reason to check SINK_COUNT after a short HPD as the short HPD coudln't have been caused by a downstram HPD. Obviuously we still check SINK_COUNT after a long HPD to figure out if anything is connected
when the branch device itself gets connected to the source.

Actually that's not correct. We don't check SINK_COUNT unless the downstream
port is HPD capable.

Quoted 11 lines

The spec says:
"If the DFP does not provide for means for plug/unplug detection, the adaptor must set the SINK_COUNT field bits, as if those Sink devices were
all permanently plugged."

So according to the there can't be any changes in SINK_COUNT if the downstream port is not HPD capable.

Quoted 5 lines

yes, agree on the no changes for SINK_COUNT if HPD is 0. i'll check with DP Compliance test
tomorrow and confirm the exact reason for its failure may be my understanding of it was incorrect.

confirmed that the compliance sink is not setting HPD bit during detect. so this looks to be a bug in
the sink tool. i'll file a bug with their team instead.

Quoted 5 lines

coming back to this patch, i will get back once i understand the complex scenario of all short pulse
is treated as long pulse post this change, for example: we will do full detection even if the sink requested
retraining of link.

I suppose we should read the reason for the short HPD from some DPCD register, assuming one exists. I've not trawled the spec for such a thing so can't say for sure.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#9 lore raw
In reply to [email protected]

Task id: 6728 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK -1 302/302 301/302

SNB                                  312/316              312/316
IVB                                  345/345              345/345

BYT -1 289/289 288/289
HSW 382/382 382/382
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@flip-vs-rmfb-interruptible PASS(1) DMESG_WARN(1)
(dmesg patch applied)drm:intel_pch_fifo_underrun_irq_handler[i915]]*ERROR*PCH_transcoder_A_FIFO_underrun@PCH transcoder A FIFO underrun
*BYT igt@gem_partial_pwrite_pread@reads-uncached PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx