All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: airlied@gmail.com, dri-devel@lists.freedesktop.org
Subject: [PATCH 16/18] drm/radeon/kms: simplify hotplug handler logic
Date: Fri, 20 May 2011 04:34:29 -0400	[thread overview]
Message-ID: <1305880471-1472-16-git-send-email-alexdeucher@gmail.com> (raw)
In-Reply-To: <1305880471-1472-1-git-send-email-alexdeucher@gmail.com>

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>
---
 drivers/gpu/drm/radeon/atombios_dp.c       |   12 ------------
 drivers/gpu/drm/radeon/radeon_connectors.c |   19 +++++++------------
 drivers/gpu/drm/radeon/radeon_mode.h       |    1 -
 3 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 5f2ddcd..8c0f9e3 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -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;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 6c9e17f..5947871 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -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)
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 37f57ba..88257bc 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -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,
-- 
1.7.1.1

  parent reply	other threads:[~2011-05-20  8:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20  8:34 [PATCH 01/18] drm/radeon/kms: DCE4.1 DIG encoders are fully routeable just like DCE3.2 Alex Deucher
2011-05-20  8:34 ` [PATCH 02/18] drm/radeon/kms: properly handle bpc >8 in atom command tables Alex Deucher
2011-05-20  8:34 ` [PATCH 03/18] drm/radeon/kms: spread spectrum fixes Alex Deucher
2011-05-20  8:34 ` [PATCH 04/18] drm/radeon/kms: fix up DP clock programming on DCE4/5 Alex Deucher
2011-05-20  8:34 ` [PATCH 05/18] drm/radeon/kms: adjust eDP handling (v2) Alex Deucher
2011-05-20  8:34 ` [PATCH 06/18] drm/radeon/kms: fix eDP panel power function Alex Deucher
2011-05-20  8:34 ` [PATCH 07/18] drm/radeon/kms: make sure eDP panel is on for modesetting Alex Deucher
2011-05-20  8:34 ` [PATCH 08/18] drm/radeon/kms: add some dp encoder/connector helper funcs Alex Deucher
2011-05-20  8:34 ` [PATCH 09/18] drm/radeon/kms: handle DP bridges Alex Deucher
2011-05-20  8:34 ` [PATCH 10/18] drm/radeon/kms: improve DP detect logic Alex Deucher
2011-05-20  8:34 ` [PATCH 11/18] drm/radeon/kms: improve aux error handling Alex Deucher
2011-05-20  8:34 ` [PATCH 12/18] drm/dp: add some new DP regs for DP 1.2 Alex Deucher
2011-05-20  8:34 ` [PATCH 13/18] drm/radeon/kms: atombios.h updates for DP panel mode Alex Deucher
2011-05-20  8:34 ` [PATCH 14/18] drm/radeon/kms/atom: add support for setting " Alex Deucher
2011-05-20  8:34 ` [PATCH 15/18] drm/radeon/kms: rewrite DP handling Alex Deucher
2011-05-20  8:34 ` Alex Deucher [this message]
2011-05-20  8:34 ` [PATCH 17/18] drm/radeon/kms: bail early for eDP in hotplug callback Alex Deucher
2011-05-20  8:34 ` [PATCH 18/18] drm/radeon/kms: fixup eDP connector handling Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305880471-1472-16-git-send-email-alexdeucher@gmail.com \
    --to=alexdeucher@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.