From 55fbdbae83d1563b472f49d0436c9298e390be66 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 11 Jun 2009 12:31:53 -0400 Subject: Add PLL flag to prefer frequencies <= the target freq This appears to be needed when using fractional feedback dividers. Based on a patch from Tom Hirst. See fdo bug 22229 for more details. --- src/radeon_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/radeon_crtc.c') diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index c78ac43b..3899064f 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -230,7 +230,11 @@ RADEONComputePLL(RADEONPLLPtr pll, tmp += (CARD64)pll->reference_freq * 1000 * frac_feedback_div; current_freq = RADEONDiv(tmp, ref_div * post_div); - error = abs(current_freq - freq); + if (flags & RADEON_PLL_PREFER_CLOSEST_LOWER) { + error = freq - current_freq; + error = error < 0 ? 0xffffffff : error; + } else + error = abs(current_freq - freq); vco_diff = abs(vco - best_vco); if ((best_vco == 0 && error < best_error) || -- cgit v1.2.3