Skip to contentSkip to conversation

drm/radeon: on hotplug force link training to happen

PATCH In review [email protected] 2 participants 3 messages Jul 17, 2012 – Jul 18, 2012

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

PATCH 1/1 drm/radeon: on hotplug force link training to happen

From: Jerome Glisse <[email protected]>

To have kernel behave like VGA/DVI we need to retrain link on hotplug. For this to happen with need to report that we need to link training to happen if we fail to get link status and we need to force link training to happen by setting connector dpms to off before asking it on.

---
 drivers/gpu/drm/radeon/atombios_dp.c       |    2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +1 -1
index 5131b3b..7bb5d7e 100644
@@ -670,7 +670,7 @@ bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector)
 	struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
 
 	if (!radeon_dp_get_link_status(radeon_connector, link_status))
-		return false;
+		return true;
 	if (dp_channel_eq_ok(link_status, dig->dp_lane_count))
 		return false;
 	return true;
drivers/gpu/drm/radeon/radeon_connectors.c +5 -2
index 2914c57..4b42c9f 100644
@@ -67,10 +67,13 @@ void radeon_connector_hotplug(struct drm_connector *connector)
 		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)) {
+			/* force a mode on to trigger dp link training */
+			connector->dpms = DRM_MODE_DPMS_OFF;
 			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+		}
 		connector->dpms = saved_dpms;
 	}
 }
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 19 lines · On Tue, Jul 17, 2012 at 4:54 PM, <[email protected]> wrote:

From: Jerome Glisse <[email protected]>

To have kernel behave like VGA/DVI we need to retrain link on hotplug. For this to happen with need to report that we need to link training to happen if we fail to get link status and we need to force link training to happen by setting connector dpms to off before asking it on.

---
 drivers/gpu/drm/radeon/atombios_dp.c       |    2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +0 -0
index 5131b3b..7bb5d7e 100644

drivers/gpu/drm/radeon/atombios_dp.c bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector) · line 673

Quoted 5 lines
drivers/gpu/drm/radeon/atombios_dp.c +1 -1
@@ -670,7 +670,7 @@ bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector)
        struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
 
        if (!radeon_dp_get_link_status(radeon_connector, link_status))
-               return false;
+               return true;

I'm not sure we want to change the logic here. The idea was that if we failed to get the link status, the monitor is most likely not attached so there's no need to retrain the link.

Alex

Quoted 30 lines
drivers/gpu/drm/radeon/atombios_dp.c +0 -0
        if (dp_channel_eq_ok(link_status, dig->dp_lane_count))
                return false;
        return true;
drivers/gpu/drm/radeon/radeon_connectors.c +5 -3
index 2914c57..4b42c9f 100644
@@ -67,10 +67,13 @@ void radeon_connector_hotplug(struct drm_connector *connector)
                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)) {
+                       /* force a mode on to trigger dp link training */
+                       connector->dpms = DRM_MODE_DPMS_OFF;
                        drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+               }
                connector->dpms = saved_dpms;
        }
 }
--

1.7.10.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 30 lines · Alex Deucher
Quoted 19 lines · On Tue, Jul 17, 2012 at 4:54 PM, <[email protected]> wrote:

From: Jerome Glisse <[email protected]>

To have kernel behave like VGA/DVI we need to retrain link on hotplug. For this to happen with need to report that we need to link training to happen if we fail to get link status and we need to force link training to happen by setting connector dpms to off before asking it on.

---
 drivers/gpu/drm/radeon/atombios_dp.c       |    2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +0 -0
index 5131b3b..7bb5d7e 100644

drivers/gpu/drm/radeon/atombios_dp.c bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector) · line 673

Quoted 5 lines
drivers/gpu/drm/radeon/atombios_dp.c +1 -1
@@ -670,7 +670,7 @@ bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector)
        struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
 
        if (!radeon_dp_get_link_status(radeon_connector, link_status))
-               return false;
+               return true;

I'm not sure we want to change the logic here. The idea was that if we failed to get the link status, the monitor is most likely not attached so there's no need to retrain the link.

Quoted 1 line

Alex

Well not if you disconnect reconnect, the link goes down and link status fails even with something connected. At least this is what i get with couple different dp monitor

Cheers,
Jerome

Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/radeon/atombios_dp.c +0 -0
        if (dp_channel_eq_ok(link_status, dig->dp_lane_count))
                return false;
        return true;
drivers/gpu/drm/radeon/radeon_connectors.c +5 -3
index 2914c57..4b42c9f 100644
@@ -67,10 +67,13 @@ void radeon_connector_hotplug(struct drm_connector *connector)
                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)) {
+                       /* force a mode on to trigger dp link training */
+                       connector->dpms = DRM_MODE_DPMS_OFF;
                        drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+               }
                connector->dpms = saved_dpms;
        }
 }
--

1.7.10.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel