diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-06-11 12:31:53 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-06-11 12:31:53 -0400 |
commit | 55fbdbae83d1563b472f49d0436c9298e390be66 (patch) | |
tree | 6090e89be91d733bb74ba0b471b902b11ad9735f /src/radeon_crtc.c | |
parent | 43374c7420e378918bec062f4cbd581f16adb6f0 (diff) |
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.
Diffstat (limited to 'src/radeon_crtc.c')
-rw-r--r-- | src/radeon_crtc.c | 6 |
1 files changed, 5 insertions, 1 deletions
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) || |