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 04/18] drm/radeon/kms: fix up DP clock programming on DCE4/5
Date: Fri, 20 May 2011 04:34:17 -0400	[thread overview]
Message-ID: <1305880471-1472-4-git-send-email-alexdeucher@gmail.com> (raw)
In-Reply-To: <1305880471-1472-1-git-send-email-alexdeucher@gmail.com>

In DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock,
depending on the asic.  The crtc virtual pixel clock is derived from
the DP ref clock.

- DCE4: PPLL or ext clock
- DCE5: DCPLL or ext clock

Setting ATOM_PPLL_INVALID will cause SetPixelClock to skip
PPLL/DCPLL programming and only program the DP DTO for the
crtc virtual pixel clock.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
---
 drivers/gpu/drm/radeon/atombios_crtc.c   |   12 ++++++++++--
 drivers/gpu/drm/radeon/radeon_encoders.c |   11 ++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index ff0d1ca..9770aff 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1443,11 +1443,19 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
 	uint32_t pll_in_use = 0;
 
 	if (ASIC_IS_DCE4(rdev)) {
-		/* if crtc is driving DP and we have an ext clock, use that */
 		list_for_each_entry(test_encoder, &dev->mode_config.encoder_list, head) {
 			if (test_encoder->crtc && (test_encoder->crtc == crtc)) {
+				/* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock,
+				 * depending on the asic:
+				 * DCE4: PPLL or ext clock
+				 * DCE5: DCPLL or ext clock
+				 *
+				 * Setting ATOM_PPLL_INVALID will cause SetPixelClock to skip
+				 * PPLL/DCPLL programming and only program the DP DTO for the
+				 * crtc virtual pixel clock.
+				 */
 				if (atombios_get_encoder_mode(test_encoder) == ATOM_ENCODER_MODE_DP) {
-					if (rdev->clock.dp_extclk)
+					if (ASIC_IS_DCE5(rdev) || rdev->clock.dp_extclk)
 						return ATOM_PPLL_INVALID;
 				}
 			}
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 6c6793e..4d66e24 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -988,11 +988,16 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
 		}
 
 		if (ASIC_IS_DCE5(rdev)) {
-			if (is_dp && rdev->clock.dp_extclk)
-				args.v4.acConfig.ucRefClkSource = 3; /* external src */
-			else
+			/* On DCE5 DCPLL usually generates the DP ref clock */
+			if (is_dp) {
+				if (rdev->clock.dp_extclk)
+					args.v4.acConfig.ucRefClkSource = ENCODER_REFCLK_SRC_EXTCLK;
+				else
+					args.v4.acConfig.ucRefClkSource = ENCODER_REFCLK_SRC_DCPLL;
+			} else
 				args.v4.acConfig.ucRefClkSource = pll_id;
 		} else {
+			/* On DCE4, if there is an external clock, it generates the DP ref clock */
 			if (is_dp && rdev->clock.dp_extclk)
 				args.v3.acConfig.ucRefClkSource = 2; /* external src */
 			else
-- 
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 ` Alex Deucher [this message]
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 ` [PATCH 16/18] drm/radeon/kms: simplify hotplug handler logic Alex Deucher
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-4-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.