Lines Matching +full:high +full:- +full:vt

4  *  Copyright (C) 2001-2003 Saito.K & Jeanne
8 * drivers/video/asiliantfb.c -- frame buffer device for
17 * chip, and to the twin-display mode of the 69030.
18 * Contains code from Thomas Hhenleitner <th@visuelle-maschinen.de> (thanks)
24 * And from the frame buffer device for Open Firmware-initialized devices:
48 #define mmio_base (p->screen_base + 0x400000)
143 ((Ftarget * n) - (Fref * m)) : ((Fref * m) - (Ftarget * n)); in asiliant_calc_dclk2()
152 /* remember there are still only 8-bits of precision in m, so in asiliant_calc_dclk2()
153 * avoid over-optimistic error calculations */ in asiliant_calc_dclk2()
155 ((Ftarget * n) - (Fref * (m & ~3))) : ((Fref * (m & ~3)) - (Ftarget * n)); in asiliant_calc_dclk2()
167 *dclk2_m = best_m - 2; in asiliant_calc_dclk2()
168 *dclk2_n = best_n - 2; in asiliant_calc_dclk2()
176 unsigned hd = p->var.xres / 8; in asiliant_set_timing()
177 unsigned hs = (p->var.xres + p->var.right_margin) / 8; in asiliant_set_timing()
178 unsigned he = (p->var.xres + p->var.right_margin + p->var.hsync_len) / 8; in asiliant_set_timing()
179 unsigned ht = (p->var.left_margin + p->var.xres + p->var.right_margin + p->var.hsync_len) / 8; in asiliant_set_timing()
180 unsigned vd = p->var.yres; in asiliant_set_timing()
181 unsigned vs = p->var.yres + p->var.lower_margin; in asiliant_set_timing()
182 unsigned ve = p->var.yres + p->var.lower_margin + p->var.vsync_len; in asiliant_set_timing()
183 unsigned vt = p->var.upper_margin + p->var.yres + p->var.lower_margin + p->var.vsync_len; in asiliant_set_timing() local
184 unsigned wd = (p->var.xres_virtual * ((p->var.bits_per_pixel+7)/8)) / 8; in asiliant_set_timing()
186 if ((p->var.xres == 640) && (p->var.yres == 480) && (p->var.pixclock == 39722)) { in asiliant_set_timing()
192 write_cr(0x11, (ve - 1) & 0x0f); in asiliant_set_timing()
193 write_cr(0x00, (ht - 5) & 0xff); in asiliant_set_timing()
194 write_cr(0x01, hd - 1); in asiliant_set_timing()
196 write_cr(0x03, ((ht - 1) & 0x1f) | 0x80); in asiliant_set_timing()
198 write_cr(0x05, (((ht - 1) & 0x20) <<2) | (he & 0x1f)); in asiliant_set_timing()
199 write_cr(0x3c, (ht - 1) & 0xc0); in asiliant_set_timing()
200 write_cr(0x06, (vt - 2) & 0xff); in asiliant_set_timing()
201 write_cr(0x30, (vt - 2) >> 8); in asiliant_set_timing()
205 write_cr(0x10, (vs - 1) & 0xff); in asiliant_set_timing()
206 write_cr(0x32, ((vs - 1) >> 8) & 0xf); in asiliant_set_timing()
207 write_cr(0x11, ((ve - 1) & 0x0f) | 0x80); in asiliant_set_timing()
208 write_cr(0x12, (vd - 1) & 0xff); in asiliant_set_timing()
209 write_cr(0x31, ((vd - 1) & 0xf00) >> 8); in asiliant_set_timing()
212 write_cr(0x15, (vs - 1) & 0xff); in asiliant_set_timing()
213 write_cr(0x33, ((vs - 1) >> 8) & 0xf); in asiliant_set_timing()
214 write_cr(0x38, ((ht - 5) & 0x100) >> 8); in asiliant_set_timing()
215 write_cr(0x16, (vt - 1) & 0xff); in asiliant_set_timing()
218 if (p->var.xres == 640) { in asiliant_set_timing()
230 ratio = 1000000 / var->pixclock; in asiliantfb_check_var()
231 remainder = 1000000 % var->pixclock; in asiliantfb_check_var()
232 Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock; in asiliantfb_check_var()
234 /* First check the constraint that the maximum post-VCO divisor is 32, in asiliantfb_check_var()
238 return -ENXIO; in asiliantfb_check_var()
240 var->xres_virtual = var->xres; in asiliantfb_check_var()
241 var->yres_virtual = var->yres; in asiliantfb_check_var()
243 if (var->bits_per_pixel == 24) { in asiliantfb_check_var()
244 var->red.offset = 16; in asiliantfb_check_var()
245 var->green.offset = 8; in asiliantfb_check_var()
246 var->blue.offset = 0; in asiliantfb_check_var()
247 var->red.length = var->blue.length = var->green.length = 8; in asiliantfb_check_var()
248 } else if (var->bits_per_pixel == 16) { in asiliantfb_check_var()
249 switch (var->red.offset) { in asiliantfb_check_var()
251 var->green.length = 6; in asiliantfb_check_var()
254 var->green.length = 5; in asiliantfb_check_var()
257 return -EINVAL; in asiliantfb_check_var()
259 var->green.offset = 5; in asiliantfb_check_var()
260 var->blue.offset = 0; in asiliantfb_check_var()
261 var->red.length = var->blue.length = 5; in asiliantfb_check_var()
262 } else if (var->bits_per_pixel == 8) { in asiliantfb_check_var()
263 var->red.offset = var->green.offset = var->blue.offset = 0; in asiliantfb_check_var()
264 var->red.length = var->green.length = var->blue.length = 8; in asiliantfb_check_var()
271 u8 dclk2_m; /* Holds m-2 value for register */ in asiliantfb_set_par()
272 u8 dclk2_n; /* Holds n-2 value for register */ in asiliantfb_set_par()
276 asiliant_calc_dclk2(&p->var.pixclock, &dclk2_m, &dclk2_n, &dclk2_div); in asiliantfb_set_par()
279 if (p->var.bits_per_pixel == 24) { in asiliantfb_set_par()
283 } else if (p->var.bits_per_pixel == 16) { in asiliantfb_set_par()
284 if (p->var.red.offset == 11) in asiliantfb_set_par()
290 } else if (p->var.bits_per_pixel == 8) { in asiliantfb_set_par()
296 p->fix.line_length = p->var.xres * (p->var.bits_per_pixel >> 3); in asiliantfb_set_par()
297 p->fix.visual = (p->var.bits_per_pixel == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; in asiliantfb_set_par()
323 switch(p->var.red.offset) { in asiliantfb_setcolreg()
325 ((u32 *)(p->pseudo_palette))[regno] = in asiliantfb_setcolreg()
331 ((u32 *)(p->pseudo_palette))[regno] = in asiliantfb_setcolreg()
337 ((u32 *)(p->pseudo_palette))[regno] = in asiliantfb_setcolreg()
379 {0x0c, 0x00}, /* Start address high */
442 {0x09, 0x01}, /* IO Control - CRT controller extensions */
495 .height = -1,
496 .width = -1,
511 p->fix = asiliantfb_fix; in init_asiliant()
512 p->fix.smem_start = addr; in init_asiliant()
513 p->var = asiliantfb_var; in init_asiliant()
514 p->fbops = &asiliantfb_ops; in init_asiliant()
515 p->flags = FBINFO_DEFAULT; in init_asiliant()
517 err = fb_alloc_cmap(&p->cmap, 256, 0); in init_asiliant()
526 fb_dealloc_cmap(&p->cmap); in init_asiliant()
531 p->fix.smem_len / 1024); in init_asiliant()
545 if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) in asiliantfb_pci_init()
546 return -ENODEV; in asiliantfb_pci_init()
550 return -ENODEV; in asiliantfb_pci_init()
552 return -EBUSY; in asiliantfb_pci_init()
554 p = framebuffer_alloc(sizeof(u32) * 16, &dp->dev); in asiliantfb_pci_init()
557 return -ENOMEM; in asiliantfb_pci_init()
559 p->pseudo_palette = p->par; in asiliantfb_pci_init()
560 p->par = NULL; in asiliantfb_pci_init()
562 p->screen_base = ioremap(addr, 0x800000); in asiliantfb_pci_init()
563 if (p->screen_base == NULL) { in asiliantfb_pci_init()
566 return -ENOMEM; in asiliantfb_pci_init()
570 writeb(3, p->screen_base + 0x400784); in asiliantfb_pci_init()
574 iounmap(p->screen_base); in asiliantfb_pci_init()
589 fb_dealloc_cmap(&p->cmap); in asiliantfb_remove()
590 iounmap(p->screen_base); in asiliantfb_remove()
612 return -ENODEV; in asiliantfb_init()