aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tridentfb.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-24 00:31:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:36 -0400
commit6280fd4f9c2683a4d2f096320dd74ded4e5106ad (patch)
tree2cbb1ccf0c923cf35be3bb6c239cb9b0a43cc8f6 /drivers/video/tridentfb.c
parentf330c4b1961d730ef15ac184e4b7f1c25847d0ae (diff)
tridentfb: Blade3D clock fixes
This patch fixes following problems: - does not allow the m parameter to reach 0 as it locks the graphics core (power cycle needed) - for the newer chips (with new clock registers) does not allow of n / m ratio below 4 as it gives unstable image on the Blade3D core - extend shift parameter (k) range to 2 for the newer chips to cope with the n /m >= 4 limit at low resolution (bandwidth) modes - prefer modes with higher n / m ratio (higher k values) Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/tridentfb.c')
-rw-r--r--drivers/video/tridentfb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index 138140bdb495..854e2e5af582 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -672,15 +672,16 @@ static void set_vclk(struct tridentfb_par *par, unsigned long freq)
672 unsigned long fi, d, di; 672 unsigned long fi, d, di;
673 unsigned char best_m = 0, best_n = 0, best_k = 0; 673 unsigned char best_m = 0, best_n = 0, best_k = 0;
674 unsigned char hi, lo; 674 unsigned char hi, lo;
675 unsigned char shift = !is_oldclock(par->chip_id) ? 2 : 1;
675 676
676 d = 20000; 677 d = 20000;
677 for (k = 1; k >= 0; k--) 678 for (k = shift; k >= 0; k--)
678 for (m = 0; m < 32; m++) { 679 for (m = 1; m < 32; m++) {
679 n = 2 * (m + 2) - 8; 680 n = ((m + 2) << shift) - 8;
680 for (n = (n < 0 ? 0 : n); n < 122; n++) { 681 for (n = (n < 0 ? 0 : n); n < 122; n++) {
681 fi = ((14318l * (n + 8)) / (m + 2)) >> k; 682 fi = ((14318l * (n + 8)) / (m + 2)) >> k;
682 di = abs(fi - freq); 683 di = abs(fi - freq);
683 if (di <= d) { 684 if (di < d || (di == d && k == best_k)) {
684 d = di; 685 d = di;
685 best_n = n; 686 best_n = n;
686 best_m = m; 687 best_m = m;