diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8154cdf796e4..a68728dbd41d 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -558,15 +558,17 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll, | |||
558 | current_freq = radeon_div(tmp, ref_div * post_div); | 558 | current_freq = radeon_div(tmp, ref_div * post_div); |
559 | 559 | ||
560 | if (pll->flags & RADEON_PLL_PREFER_CLOSEST_LOWER) { | 560 | if (pll->flags & RADEON_PLL_PREFER_CLOSEST_LOWER) { |
561 | error = freq - current_freq; | 561 | if (freq < current_freq) |
562 | error = error < 0 ? 0xffffffff : error; | 562 | error = 0xffffffff; |
563 | else | ||
564 | error = freq - current_freq; | ||
563 | } else | 565 | } else |
564 | error = abs(current_freq - freq); | 566 | error = abs(current_freq - freq); |
565 | vco_diff = abs(vco - best_vco); | 567 | vco_diff = abs(vco - best_vco); |
566 | 568 | ||
567 | if ((best_vco == 0 && error < best_error) || | 569 | if ((best_vco == 0 && error < best_error) || |
568 | (best_vco != 0 && | 570 | (best_vco != 0 && |
569 | (error < best_error - 100 || | 571 | ((best_error > 100 && error < best_error - 100) || |
570 | (abs(error - best_error) < 100 && vco_diff < best_vco_diff)))) { | 572 | (abs(error - best_error) < 100 && vco_diff < best_vco_diff)))) { |
571 | best_post_div = post_div; | 573 | best_post_div = post_div; |
572 | best_ref_div = ref_div; | 574 | best_ref_div = ref_div; |