aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_display.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-02-02 12:05:01 -0500
committerDave Airlie <airlied@redhat.com>2010-02-08 18:31:21 -0500
commit7c27f87d2bde885e9bcda74c208a7aae8bef8e76 (patch)
tree5490fe9d6ed83bc36c2ac3da7dedee4de3730806 /drivers/gpu/drm/radeon/radeon_display.c
parent4612dc97991a09e1a9e4d5d981e16589d7cb150c (diff)
drm/radeon/kms: rework pll algo selection
Rework the pll algo selection so that the pll algo in use can be selected more easily. This allows us to select different pll divider selection algos for specific monitors that work better with one algo or the other. This is needed for the next patch which adds an LVDS pll quirk for a specific notebook. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 79634da7c311..62fe66c02341 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -405,13 +405,13 @@ static inline uint32_t radeon_div(uint64_t n, uint32_t d)
405 return n; 405 return n;
406} 406}
407 407
408void radeon_compute_pll(struct radeon_pll *pll, 408static void radeon_compute_pll_legacy(struct radeon_pll *pll,
409 uint64_t freq, 409 uint64_t freq,
410 uint32_t *dot_clock_p, 410 uint32_t *dot_clock_p,
411 uint32_t *fb_div_p, 411 uint32_t *fb_div_p,
412 uint32_t *frac_fb_div_p, 412 uint32_t *frac_fb_div_p,
413 uint32_t *ref_div_p, 413 uint32_t *ref_div_p,
414 uint32_t *post_div_p) 414 uint32_t *post_div_p)
415{ 415{
416 uint32_t min_ref_div = pll->min_ref_div; 416 uint32_t min_ref_div = pll->min_ref_div;
417 uint32_t max_ref_div = pll->max_ref_div; 417 uint32_t max_ref_div = pll->max_ref_div;
@@ -571,13 +571,13 @@ void radeon_compute_pll(struct radeon_pll *pll,
571 *post_div_p = best_post_div; 571 *post_div_p = best_post_div;
572} 572}
573 573
574void radeon_compute_pll_avivo(struct radeon_pll *pll, 574static void radeon_compute_pll_avivo(struct radeon_pll *pll,
575 uint64_t freq, 575 uint64_t freq,
576 uint32_t *dot_clock_p, 576 uint32_t *dot_clock_p,
577 uint32_t *fb_div_p, 577 uint32_t *fb_div_p,
578 uint32_t *frac_fb_div_p, 578 uint32_t *frac_fb_div_p,
579 uint32_t *ref_div_p, 579 uint32_t *ref_div_p,
580 uint32_t *post_div_p) 580 uint32_t *post_div_p)
581{ 581{
582 fixed20_12 m, n, frac_n, p, f_vco, f_pclk, best_freq; 582 fixed20_12 m, n, frac_n, p, f_vco, f_pclk, best_freq;
583 fixed20_12 pll_out_max, pll_out_min; 583 fixed20_12 pll_out_max, pll_out_min;
@@ -662,6 +662,27 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll,
662 DRM_DEBUG("%u %d.%d, %d, %d\n", *dot_clock_p * 10, *fb_div_p, *frac_fb_div_p, *ref_div_p, *post_div_p); 662 DRM_DEBUG("%u %d.%d, %d, %d\n", *dot_clock_p * 10, *fb_div_p, *frac_fb_div_p, *ref_div_p, *post_div_p);
663} 663}
664 664
665void radeon_compute_pll(struct radeon_pll *pll,
666 uint64_t freq,
667 uint32_t *dot_clock_p,
668 uint32_t *fb_div_p,
669 uint32_t *frac_fb_div_p,
670 uint32_t *ref_div_p,
671 uint32_t *post_div_p)
672{
673 switch (pll->algo) {
674 case PLL_ALGO_AVIVO:
675 radeon_compute_pll_avivo(pll, freq, dot_clock_p, fb_div_p,
676 frac_fb_div_p, ref_div_p, post_div_p);
677 break;
678 case PLL_ALGO_LEGACY:
679 default:
680 radeon_compute_pll_legacy(pll, freq, dot_clock_p, fb_div_p,
681 frac_fb_div_p, ref_div_p, post_div_p);
682 break;
683 }
684}
685
665static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) 686static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
666{ 687{
667 struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb); 688 struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb);