diff options
author | Christian König <christian.koenig@amd.com> | 2014-04-24 12:39:59 -0400 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2014-05-01 06:28:08 -0400 |
commit | 3b333c55485fef0089ae7398906599d000df195e (patch) | |
tree | c1ad1aa8dd3e419a50a320cf3b051d7cfb586516 | |
parent | 695daf1a8e731a4b5b89de89a61f32a4d7ad7094 (diff) |
drm/radeon: avoid high jitter with small frac divs
Signed-off-by: Christian König <christian.koenig@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 14bd701e316c..9ff0e2f1be6a 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -830,14 +830,14 @@ static void avivo_reduce_ratio(unsigned *nom, unsigned *den, | |||
830 | 830 | ||
831 | /* make sure nominator is large enough */ | 831 | /* make sure nominator is large enough */ |
832 | if (*nom < nom_min) { | 832 | if (*nom < nom_min) { |
833 | tmp = (nom_min + *nom - 1) / *nom; | 833 | tmp = DIV_ROUND_UP(nom_min, *nom); |
834 | *nom *= tmp; | 834 | *nom *= tmp; |
835 | *den *= tmp; | 835 | *den *= tmp; |
836 | } | 836 | } |
837 | 837 | ||
838 | /* make sure the denominator is large enough */ | 838 | /* make sure the denominator is large enough */ |
839 | if (*den < den_min) { | 839 | if (*den < den_min) { |
840 | tmp = (den_min + *den - 1) / *den; | 840 | tmp = DIV_ROUND_UP(den_min, *den); |
841 | *nom *= tmp; | 841 | *nom *= tmp; |
842 | *den *= tmp; | 842 | *den *= tmp; |
843 | } | 843 | } |
@@ -997,6 +997,16 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
997 | /* this also makes sure that the reference divider is large enough */ | 997 | /* this also makes sure that the reference divider is large enough */ |
998 | avivo_reduce_ratio(&fb_div, &ref_div, fb_div_min, ref_div_min); | 998 | avivo_reduce_ratio(&fb_div, &ref_div, fb_div_min, ref_div_min); |
999 | 999 | ||
1000 | /* avoid high jitter with small fractional dividers */ | ||
1001 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV && (fb_div % 10)) { | ||
1002 | fb_div_min = max(fb_div_min, (9 - (fb_div % 10)) * 20 + 60); | ||
1003 | if (fb_div < fb_div_min) { | ||
1004 | unsigned tmp = DIV_ROUND_UP(fb_div_min, fb_div); | ||
1005 | fb_div *= tmp; | ||
1006 | ref_div *= tmp; | ||
1007 | } | ||
1008 | } | ||
1009 | |||
1000 | /* and finally save the result */ | 1010 | /* and finally save the result */ |
1001 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { | 1011 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { |
1002 | *fb_div_p = fb_div / 10; | 1012 | *fb_div_p = fb_div / 10; |