Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96473
b: refs/heads/master
c: 3f275ea
h: refs/heads/master
i:
  96471: c71b3ac
v: v3
  • Loading branch information
Krzysztof Helt authored and Linus Torvalds committed May 13, 2008
1 parent 8ebf510 commit 7c7d24b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6fb488239cd8750cc818197d6c346409c0e8d330
refs/heads/master: 3f275ea3086054205795972b8e87f2046fd3de98
24 changes: 12 additions & 12 deletions trunk/drivers/video/tridentfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define VERSION "0.7.8-NEWAPI"

struct tridentfb_par {
int vclk; /* in MHz */
void __iomem *io_virt; /* iospace virtual memory address */
};

Expand Down Expand Up @@ -669,27 +668,26 @@ static void set_screen_start(int base)
(read3X4(CRTHiOrd) & 0xF8) | ((base & 0xE0000) >> 17));
}

/* Use 20.12 fixed-point for NTSC value and frequency calculation */
#define calc_freq(n, m, k) ( ((unsigned long)0xE517 * (n + 8) / ((m + 2) * (1 << k))) >> 12 )

/* Set dotclock frequency */
static void set_vclk(int freq)
static void set_vclk(unsigned long freq)
{
int m, n, k;
int f, fi, d, di;
unsigned long f, fi, d, di;
unsigned char lo = 0, hi = 0;

d = 20;
d = 20000;
for (k = 2; k >= 0; k--)
for (m = 0; m < 63; m++)
for (n = 0; n < 128; n++) {
fi = calc_freq(n, m, k);
fi = ((14318l * (n + 8)) / (m + 2)) >> k;
if ((di = abs(fi - freq)) < d) {
d = di;
f = fi;
lo = n;
hi = (k << 6) | m;
}
if (fi > freq)
break;
}
if (chip3D) {
write3C4(ClockHigh, hi);
Expand Down Expand Up @@ -888,6 +886,8 @@ static int tridentfb_set_par(struct fb_info *info)
struct fb_var_screeninfo *var = &info->var;
int bpp = var->bits_per_pixel;
unsigned char tmp;
unsigned long vclk;

debug("enter\n");
hdispend = var->xres / 8 - 1;
hsyncstart = (var->xres + var->right_margin) / 8;
Expand Down Expand Up @@ -1014,11 +1014,11 @@ static int tridentfb_set_par(struct fb_info *info)
write3X4(Performance, 0x92);
write3X4(PCIReg, 0x07); /* MMIO & PCI read and write burst enable */

/* convert from picoseconds to MHz */
par->vclk = 1000000 / info->var.pixclock;
/* convert from picoseconds to kHz */
vclk = PICOS2KHZ(info->var.pixclock);
if (bpp == 32)
par->vclk *= 2;
set_vclk(par->vclk);
vclk *= 2;
set_vclk(vclk);

write3C4(0, 3);
write3C4(1, 1); /* set char clock 8 dots wide */
Expand Down

0 comments on commit 7c7d24b

Please sign in to comment.