diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 6c6846cdaa30..9151ded9c1cd 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -611,8 +611,7 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
611 | if ((best_vco == 0 && error < best_error) || | 611 | if ((best_vco == 0 && error < best_error) || |
612 | (best_vco != 0 && | 612 | (best_vco != 0 && |
613 | ((best_error > 100 && error < best_error - 100) || | 613 | ((best_error > 100 && error < best_error - 100) || |
614 | (abs(error - best_error) < 100 && | 614 | (abs(error - best_error) < 100 && vco_diff < best_vco_diff)))) { |
615 | vco_diff < best_vco_diff)))) { | ||
616 | best_post_div = post_div; | 615 | best_post_div = post_div; |
617 | best_ref_div = ref_div; | 616 | best_ref_div = ref_div; |
618 | best_feedback_div = feedback_div; | 617 | best_feedback_div = feedback_div; |
@@ -620,6 +619,29 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
620 | best_freq = current_freq; | 619 | best_freq = current_freq; |
621 | best_error = error; | 620 | best_error = error; |
622 | best_vco_diff = vco_diff; | 621 | best_vco_diff = vco_diff; |
622 | } else if (current_freq == freq) { | ||
623 | if (best_freq == -1) { | ||
624 | best_post_div = post_div; | ||
625 | best_ref_div = ref_div; | ||
626 | best_feedback_div = feedback_div; | ||
627 | best_frac_feedback_div = frac_feedback_div; | ||
628 | best_freq = current_freq; | ||
629 | best_error = error; | ||
630 | best_vco_diff = vco_diff; | ||
631 | } else if (((pll->flags & RADEON_PLL_PREFER_LOW_REF_DIV) && (ref_div < best_ref_div)) || | ||
632 | ((pll->flags & RADEON_PLL_PREFER_HIGH_REF_DIV) && (ref_div > best_ref_div)) || | ||
633 | ((pll->flags & RADEON_PLL_PREFER_LOW_FB_DIV) && (feedback_div < best_feedback_div)) || | ||
634 | ((pll->flags & RADEON_PLL_PREFER_HIGH_FB_DIV) && (feedback_div > best_feedback_div)) || | ||
635 | ((pll->flags & RADEON_PLL_PREFER_LOW_POST_DIV) && (post_div < best_post_div)) || | ||
636 | ((pll->flags & RADEON_PLL_PREFER_HIGH_POST_DIV) && (post_div > best_post_div))) { | ||
637 | best_post_div = post_div; | ||
638 | best_ref_div = ref_div; | ||
639 | best_feedback_div = feedback_div; | ||
640 | best_frac_feedback_div = frac_feedback_div; | ||
641 | best_freq = current_freq; | ||
642 | best_error = error; | ||
643 | best_vco_diff = vco_diff; | ||
644 | } | ||
623 | } | 645 | } |
624 | if (current_freq < freq) | 646 | if (current_freq < freq) |
625 | min_frac_feed_div = frac_feedback_div + 1; | 647 | min_frac_feed_div = frac_feedback_div + 1; |