aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2012-11-27 16:12:29 -0500
committerAlex Deucher <alexander.deucher@amd.com>2012-11-27 16:59:03 -0500
commitfc58acdbf153f12783b80cb19c04cc9de121b518 (patch)
tree86858bab64651546ce132f8640ae52fdbf050097 /drivers/gpu
parent452f19201f35d20a1a6c9009acbcfa6799163c6a (diff)
radeon: fix pll/ctrc mapping on dce2 and dce3 hardware
This fix black screen on resume issue that some people are experiencing. There is a bug in the atombios code regarding pll/crtc mapping. The atombios code reverse the logic for the pll and crtc mapping. agd5f: drop unnecessary crtc id check, cc stable in case we miss 3.7. This fixes the root cause that was worked around by commits: drm/radeon: allocate PPLLs from low to high drm/radeon/dce3: switch back to old pll allocation order for discrete Signed-off-by: Jerome Glisse <jglisse@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c48
1 files changed, 14 insertions, 34 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 3bce0299f64a..24d932f53203 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1696,42 +1696,22 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
1696 return ATOM_PPLL2; 1696 return ATOM_PPLL2;
1697 DRM_ERROR("unable to allocate a PPLL\n"); 1697 DRM_ERROR("unable to allocate a PPLL\n");
1698 return ATOM_PPLL_INVALID; 1698 return ATOM_PPLL_INVALID;
1699 } else if (ASIC_IS_AVIVO(rdev)) {
1700 /* in DP mode, the DP ref clock can come from either PPLL
1701 * depending on the asic:
1702 * DCE3: PPLL1 or PPLL2
1703 */
1704 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
1705 /* use the same PPLL for all DP monitors */
1706 pll = radeon_get_shared_dp_ppll(crtc);
1707 if (pll != ATOM_PPLL_INVALID)
1708 return pll;
1709 } else {
1710 /* use the same PPLL for all monitors with the same clock */
1711 pll = radeon_get_shared_nondp_ppll(crtc);
1712 if (pll != ATOM_PPLL_INVALID)
1713 return pll;
1714 }
1715 /* all other cases */
1716 pll_in_use = radeon_get_pll_use_mask(crtc);
1717 /* the order shouldn't matter here, but we probably
1718 * need this until we have atomic modeset
1719 */
1720 if (rdev->flags & RADEON_IS_IGP) {
1721 if (!(pll_in_use & (1 << ATOM_PPLL1)))
1722 return ATOM_PPLL1;
1723 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1724 return ATOM_PPLL2;
1725 } else {
1726 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1727 return ATOM_PPLL2;
1728 if (!(pll_in_use & (1 << ATOM_PPLL1)))
1729 return ATOM_PPLL1;
1730 }
1731 DRM_ERROR("unable to allocate a PPLL\n");
1732 return ATOM_PPLL_INVALID;
1733 } else { 1699 } else {
1734 /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */ 1700 /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */
1701 /* some atombios (observed in some DCE2/DCE3) code have a bug,
1702 * the matching btw pll and crtc is done through
1703 * PCLK_CRTC[1|2]_CNTL (0x480/0x484) but atombios code use the
1704 * pll (1 or 2) to select which register to write. ie if using
1705 * pll1 it will use PCLK_CRTC1_CNTL (0x480) and if using pll2
1706 * it will use PCLK_CRTC2_CNTL (0x484), it then use crtc id to
1707 * choose which value to write. Which is reverse order from
1708 * register logic. So only case that works is when pllid is
1709 * same as crtcid or when both pll and crtc are enabled and
1710 * both use same clock.
1711 *
1712 * So just return crtc id as if crtc and pll were hard linked
1713 * together even if they aren't
1714 */
1735 return radeon_crtc->crtc_id; 1715 return radeon_crtc->crtc_id;
1736 } 1716 }
1737} 1717}