drm/radeon/kms: simplify hotplug handler logic
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 20 May 2011 08:34:29 +0000 (04:34 -0400)
committerDave Airlie <airlied@redhat.com>
Fri, 20 May 2011 10:02:33 +0000 (20:02 +1000)
In the hotplug handler, just use the drm dpms functions.
If the monitor is plugged in, turn it on, if it's not,
turn it off.  This also reduces power usage by turning
off the encoder and crtc when the monitor is unplugged.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/atombios_dp.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/radeon/radeon_mode.h

index 5f2ddcd5f1e4fd05eea91a6b407cb05bd49a7536..8c0f9e36ff8e1ee452db546d6b88611991a518ea 100644 (file)
@@ -613,18 +613,6 @@ static bool radeon_dp_get_link_status(struct radeon_connector *radeon_connector,
        return true;
 }
 
-bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector)
-{
-       struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv;
-       u8 link_status[DP_LINK_STATUS_SIZE];
-
-       if (!radeon_dp_get_link_status(radeon_connector, link_status))
-               return false;
-       if (dp_channel_eq_ok(link_status, dig_connector->dp_lane_count))
-               return false;
-       return true;
-}
-
 struct radeon_dp_link_train_info {
        struct radeon_device *rdev;
        struct drm_encoder *encoder;
index 6c9e17f3970ed984367468bd021f56ab59b84a22..5947871e10623d7a0b71a9229d4a00a7a75f16a2 100644 (file)
@@ -50,20 +50,15 @@ void radeon_connector_hotplug(struct drm_connector *connector)
        struct radeon_device *rdev = dev->dev_private;
        struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 
-       if (radeon_connector->hpd.hpd != RADEON_HPD_NONE)
-               radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
-
-       if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
-           (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) {
-               if ((radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-                   (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_eDP)) {
-                       if (radeon_dp_needs_link_train(radeon_connector)) {
-                               if (connector->encoder)
-                                       radeon_dp_link_train(connector->encoder, connector);
-                       }
-               }
-       }
+       radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 
+       /* pre-r600 did not always have the hpd pins mapped accurately to connectors */
+       if (rdev->family >= CHIP_R600) {
+               if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
+                       drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+               else
+                       drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
+       }
 }
 
 static void radeon_property_change_mode(struct drm_encoder *encoder)
index 37f57baa68f880c12f65113e2f4dc998a308e02d..88257bc5729b8f1e18b24a4853a0e46b3c090c88 100644 (file)
@@ -470,7 +470,6 @@ extern bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector);
 extern bool radeon_connector_is_dp12_capable(struct drm_connector *connector);
 
 extern void radeon_connector_hotplug(struct drm_connector *connector);
-extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
 extern int radeon_dp_mode_valid_helper(struct drm_connector *connector,
                                       struct drm_display_mode *mode);
 extern void radeon_dp_set_link_config(struct drm_connector *connector,