aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2011-01-31 16:48:53 -0500
committerDave Airlie <airlied@redhat.com>2011-02-01 21:49:43 -0500
commit619efb105924d8cafa0c1dd9389e9ab506f5425d (patch)
treed610de4c3488bbd539b7e449745c646299b48b19
parentf523f74eac1897b13c05c88ce6e5de0a7c34578b (diff)
drm/radeon/kms: Enable new pll calculation for avivo+ asics
New algo is used for r5xx+ and legacy is used for r1xx-r4xx, rv515. I've tested on all relevant GPUs and monitors that I have access to and have found no problems. Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=26562 https://bugzilla.kernel.org/show_bug.cgi?id=26552 May fix: https://bugs.freedesktop.org/show_bug.cgi?id=32556 Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Cc: stable@kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c3
3 files changed, 19 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 4374168b75b8..b1537000a104 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -555,6 +555,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
555 dp_clock = dig_connector->dp_clock; 555 dp_clock = dig_connector->dp_clock;
556 } 556 }
557 } 557 }
558/* this might work properly with the new pll algo */
558#if 0 /* doesn't work properly on some laptops */ 559#if 0 /* doesn't work properly on some laptops */
559 /* use recommended ref_div for ss */ 560 /* use recommended ref_div for ss */
560 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 561 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
@@ -572,6 +573,11 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
572 adjusted_clock = mode->clock * 2; 573 adjusted_clock = mode->clock * 2;
573 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) 574 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
574 pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; 575 pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER;
576 /* rv515 needs more testing with this option */
577 if (rdev->family != CHIP_RV515) {
578 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
579 pll->flags |= RADEON_PLL_IS_LCD;
580 }
575 } else { 581 } else {
576 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) 582 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC)
577 pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; 583 pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
@@ -951,8 +957,16 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
951 /* adjust pixel clock as needed */ 957 /* adjust pixel clock as needed */
952 adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); 958 adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss);
953 959
954 radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, 960 /* rv515 seems happier with the old algo */
955 &ref_div, &post_div); 961 if (rdev->family == CHIP_RV515)
962 radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
963 &ref_div, &post_div);
964 else if (ASIC_IS_AVIVO(rdev))
965 radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
966 &ref_div, &post_div);
967 else
968 radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
969 &ref_div, &post_div);
956 970
957 atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); 971 atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss);
958 972
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 52777902bbcc..4dc9c518c2fe 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1163,16 +1163,6 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)
1163 p1pll->pll_out_min = 64800; 1163 p1pll->pll_out_min = 64800;
1164 else 1164 else
1165 p1pll->pll_out_min = 20000; 1165 p1pll->pll_out_min = 20000;
1166 } else if (p1pll->pll_out_min > 64800) {
1167 /* Limiting the pll output range is a good thing generally as
1168 * it limits the number of possible pll combinations for a given
1169 * frequency presumably to the ones that work best on each card.
1170 * However, certain duallink DVI monitors seem to like
1171 * pll combinations that would be limited by this at least on
1172 * pre-DCE 3.0 r6xx hardware. This might need to be adjusted per
1173 * family.
1174 */
1175 p1pll->pll_out_min = 64800;
1176 } 1166 }
1177 1167
1178 p1pll->pll_in_min = 1168 p1pll->pll_in_min =
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 5fda820959ed..2eff98cfd728 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -935,6 +935,9 @@ void radeon_compute_pll_legacy(struct radeon_pll *pll,
935 pll_out_max = pll->pll_out_max; 935 pll_out_max = pll->pll_out_max;
936 } 936 }
937 937
938 if (pll_out_min > 64800)
939 pll_out_min = 64800;
940
938 if (pll->flags & RADEON_PLL_USE_REF_DIV) 941 if (pll->flags & RADEON_PLL_USE_REF_DIV)
939 min_ref_div = max_ref_div = pll->reference_div; 942 min_ref_div = max_ref_div = pll->reference_div;
940 else { 943 else {