diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2008-07-24 00:30:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:35 -0400 |
commit | 6bdf1035602abf0564d24a7447eea1c149c4bcb1 (patch) | |
tree | b1bd248dd77804f6c9f29040b89f640f477a5ad3 /drivers | |
parent | c1724fecabfed504a4cfb87319ad3b9d3a8baa92 (diff) |
tridentfb: fix clock settings for older Trident 96XX chips
The Xorg code shows that Trident models 9660, 9680 and 9682 require a
different clock setting method. Add the second clock setting method for older
models.
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')
-rw-r--r-- | drivers/video/tridentfb.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index f3153a82f926..8ee4261abf3b 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -85,6 +85,11 @@ MODULE_PARM_DESC(fp, "Define if flatpanel is connected"); | |||
85 | module_param(crt, int, 0); | 85 | module_param(crt, int, 0); |
86 | MODULE_PARM_DESC(crt, "Define if CRT is connected"); | 86 | MODULE_PARM_DESC(crt, "Define if CRT is connected"); |
87 | 87 | ||
88 | static int is_oldclock(int id) | ||
89 | { | ||
90 | return (id == TGUI9660); | ||
91 | } | ||
92 | |||
88 | static int is_blade(int id) | 93 | static int is_blade(int id) |
89 | { | 94 | { |
90 | return (id == BLADE3D) || | 95 | return (id == BLADE3D) || |
@@ -659,23 +664,33 @@ static void set_screen_start(struct tridentfb_par *par, int base) | |||
659 | static void set_vclk(struct tridentfb_par *par, unsigned long freq) | 664 | static void set_vclk(struct tridentfb_par *par, unsigned long freq) |
660 | { | 665 | { |
661 | int m, n, k; | 666 | int m, n, k; |
662 | unsigned long f, fi, d, di; | 667 | unsigned long fi, d, di; |
663 | unsigned char lo = 0, hi = 0; | 668 | unsigned char best_m = 0, best_n = 0, best_k = 0; |
669 | unsigned char hi, lo; | ||
664 | 670 | ||
665 | d = 20000; | 671 | d = 20000; |
666 | for (k = 2; k >= 0; k--) | 672 | for (k = 1; k >= 0; k--) |
667 | for (m = 0; m < 63; m++) | 673 | for (m = 0; m < 32; m++) |
668 | for (n = 0; n < 128; n++) { | 674 | for (n = 0; n < 122; n++) { |
669 | fi = ((14318l * (n + 8)) / (m + 2)) >> k; | 675 | fi = ((14318l * (n + 8)) / (m + 2)) >> k; |
670 | if ((di = abs(fi - freq)) < d) { | 676 | if ((di = abs(fi - freq)) < d) { |
671 | d = di; | 677 | d = di; |
672 | f = fi; | 678 | best_n = n; |
673 | lo = n; | 679 | best_m = m; |
674 | hi = (k << 6) | m; | 680 | best_k = k; |
675 | } | 681 | } |
676 | if (fi > freq) | 682 | if (fi > freq) |
677 | break; | 683 | break; |
678 | } | 684 | } |
685 | |||
686 | if (is_oldclock(par->chip_id)) { | ||
687 | lo = best_n | (best_m << 7); | ||
688 | hi = (best_m >> 1) | (best_k << 4); | ||
689 | } else { | ||
690 | lo = best_n; | ||
691 | hi = best_m | (best_k << 6); | ||
692 | } | ||
693 | |||
679 | if (is3Dchip(par->chip_id)) { | 694 | if (is3Dchip(par->chip_id)) { |
680 | vga_mm_wseq(par->io_virt, ClockHigh, hi); | 695 | vga_mm_wseq(par->io_virt, ClockHigh, hi); |
681 | vga_mm_wseq(par->io_virt, ClockLow, lo); | 696 | vga_mm_wseq(par->io_virt, ClockLow, lo); |