diff mbox

drm/radeon: hotplug of passive dp to dvi|hdmi|vga adaptor

Message ID 1342732342-3896-1-git-send-email-j.glisse@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jerome Glisse July 19, 2012, 9:12 p.m. UTC
From: Jerome Glisse <jglisse@redhat.com>

We should not turn off the connector neither try to retrain DP link
if a passive DP adaptor is connected to a DP port.

Cc: <stable@vger.kernel.org>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 2914c57..890cf1d 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -49,6 +49,7 @@  void radeon_connector_hotplug(struct drm_connector *connector)
 	struct drm_device *dev = connector->dev;
 	struct radeon_device *rdev = dev->dev_private;
 	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+	struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
 
 	/* bail if the connector does not have hpd pin, e.g.,
 	 * VGA, TV, etc.
@@ -62,15 +63,32 @@  void radeon_connector_hotplug(struct drm_connector *connector)
 	if (connector->dpms != DRM_MODE_DPMS_ON)
 		return;
 
+	/* don't do anything is sink is not display port
+	 * (passive dp->(dvi|hdmi|vga) adaptor
+	 */
+	if (radeon_dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT) {
+		return;
+	}
+
 	/* just deal with DP (not eDP) here. */
 	if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
 		int saved_dpms = connector->dpms;
 
 		/* Only turn off the display it it's physically disconnected */
-		if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
+		if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
 			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-		else if (radeon_dp_needs_link_train(radeon_connector))
+		} else if (radeon_dp_needs_link_train(radeon_connector)) {
+
+			/* first get sink type as it's reset after unplug */
+			radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
+			/* don't do anything is sink is not display port
+			 * (passive dp->(dvi|hdmi|vga) adaptor
+			 */
+			if (radeon_dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT) {
+				return;
+			}
 			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+		}
 		connector->dpms = saved_dpms;
 	}
 }