13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/string.h>
18 #include <asm/types.h>
28 regval = vga_rcrt(regbase, regset->
regnum);
30 while (bitnum <= regset->highbit) {
32 regval = regval & ~bitval;
33 if (value & 1) regval = regval | bitval;
37 vga_wcrt(regbase, regset->
regnum, regval);
48 regval = vga_rseq(regbase, regset->
regnum);
50 while (bitnum <= regset->highbit) {
52 regval = regval & ~bitval;
53 if (value & 1) regval = regval | bitval;
57 vga_wseq(regbase, regset->
regnum, regval);
62 static unsigned int svga_regset_size(
const struct vga_regset *regset)
100 vga_r(regbase, 0x3DA);
104 for (count = 0; count <= 0xF; count ++)
105 svga_wattr(regbase, count, count);
114 vga_r(regbase, 0x3DA);
133 svga_wcrt_mask(regbase, 0x03, 0x80, 0x80);
159 vga_r(regbase, 0x3DA);
162 svga_wattr(regbase, 0x10, 0x0C);
163 svga_wattr(regbase, 0x13, 0x08);
165 vga_r(regbase, 0x3DA);
195 const u8 *font = map->data;
199 if ((map->width != 8) || (map->height != 16) ||
200 (map->depth != 1) || (map->length != 256)) {
201 printk(
KERN_ERR "fb%d: unsupported font parameters: width %d, height %d, depth %d, length %d\n",
202 info->
node, map->width, map->height, map->depth, map->length);
207 for (
c = 0;
c < map->length;
c++) {
208 for (i = 0; i < map->height; i++) {
223 int rowstride = colstride * (info->
var.xres_virtual / 8);
227 if ((area->sy > area->dy) ||
228 ((area->sy == area->dy) && (area->sx > area->dx))) {
229 src = fb + area->sx * colstride + area->sy * rowstride;
230 dst = fb + area->dx * colstride + area->dy * rowstride;
232 src = fb + (area->sx + area->width - 1) * colstride
233 + (area->sy + area->height - 1) * rowstride;
234 dst = fb + (area->dx + area->width - 1) * colstride
235 + (area->dy + area->height - 1) * rowstride;
237 colstride = -colstride;
238 rowstride = -rowstride;
241 for (dy = 0; dy < area->height; dy++) {
244 for (dx = 0; dx < area->width; dx++) {
260 int rowstride = colstride * (info->
var.xres_virtual / 8);
261 int attr = (0x0F & rect->bg) << 4 | (0x0F & rect->fg);
263 fb += rect->sx * colstride + rect->sy * rowstride;
265 for (dy = 0; dy < rect->height; dy++) {
267 for (dx = 0; dx < rect->width; dx++) {
281 int rowstride = colstride * (info->
var.xres_virtual / 8);
282 int attr = (0x0F & blit->bg) << 4 | (0x0F & blit->fg);
284 fb += blit->sx * colstride + blit->sy * rowstride;
287 for (dy=0; dy < blit->height; dy ++) {
289 for (dx = 0; dx < blit->width; dx ++) {
294 if (i == blit->length)
return;
306 u16 pos = cursor->sx + (info->
var.xoffset / 8)
307 + (cursor->sy + (info->
var.yoffset / 16))
308 * (info->
var.xres_virtual / 8);
310 if (! cursor ->
mode)
313 svga_wcrt_mask(regbase, 0x0A, 0x20, 0x20);
315 if (cursor -> shape == FB_TILE_CURSOR_NONE)
318 switch (cursor -> shape) {
319 case FB_TILE_CURSOR_UNDERLINE:
322 case FB_TILE_CURSOR_LOWER_THIRD:
325 case FB_TILE_CURSOR_LOWER_HALF:
328 case FB_TILE_CURSOR_TWO_THIRDS:
331 case FB_TILE_CURSOR_BLOCK:
337 vga_wcrt(regbase, 0x0E, pos >> 8);
338 vga_wcrt(regbase, 0x0F, pos & 0xFF);
340 vga_wcrt(regbase, 0x0B, ce);
341 vga_wcrt(regbase, 0x0A, cs);
356 caps->
x = 1 << (8 - 1);
357 caps->
y = 1 << (16 - 1);
378 return (a > b) ? (a -
b) : (b - a);
384 u32 f_vco, f_current, delta_current, delta_best;
386 pr_debug(
"fb%d: ideal frequency: %d kHz\n", node, (
unsigned int) f_wanted);
389 f_vco = f_wanted <<
ar;
392 if ((f_vco >> ar) != f_wanted)
404 if ((f_vco < pll->f_vco_min) || (f_vco > pll->
f_vco_max))
407 delta_best = 0xFFFFFFFF;
415 while ((am <= pll->m_max) && (an <= pll->n_max)) {
416 f_current = (pll->
f_base * am) / an;
417 delta_current = abs_diff (f_current, f_vco);
419 if (delta_current < delta_best) {
420 delta_best = delta_current;
425 if (f_current <= f_vco) {
432 f_current = (pll->
f_base * *
m) / *n;
433 pr_debug(
"fb%d: found frequency: %d kHz (VCO %d kHz)\n", node, (
int) (f_current >> ar), (
int) f_current);
434 pr_debug(
"fb%d: m = %d n = %d r = %d\n", node, (
unsigned int) *m, (
unsigned int) *n, (
unsigned int) *r);
454 if (((value / 8) - 5) >= svga_regset_size (tm->
h_total_regs))
471 if ((value == 0) || ((value / 8) >= svga_regset_size (tm->
h_blank_end_regs)))
476 if ((value == 0) || ((value / 8) >= svga_regset_size (tm->
h_sync_end_regs)))
518 value = (value * hmul) / hdiv;
519 pr_debug(
"fb%d: horizontal total : %d\n", node, value);
523 value = (value * hmul) / hdiv;
524 pr_debug(
"fb%d: horizontal display : %d\n", node, value);
528 value = (value * hmul) / hdiv;
529 pr_debug(
"fb%d: horizontal blank start: %d\n", node, value);
533 value = (value * hmul) / hdiv;
534 pr_debug(
"fb%d: horizontal blank end : %d\n", node, value);
538 value = (value * hmul) / hdiv;
539 pr_debug(
"fb%d: horizontal sync start : %d\n", node, value);
543 value = (value * hmul) / hdiv;
544 pr_debug(
"fb%d: horizontal sync end : %d\n", node, value);
548 value = (value * vmul) / vdiv;
549 pr_debug(
"fb%d: vertical total : %d\n", node, value);
553 value = (value * vmul) / vdiv;
554 pr_debug(
"fb%d: vertical display : %d\n", node, value);
558 value = (value * vmul) / vdiv;
559 pr_debug(
"fb%d: vertical blank start : %d\n", node, value);
563 value = (value * vmul) / vdiv;
564 pr_debug(
"fb%d: vertical blank end : %d\n", node, value);
568 value = (value * vmul) / vdiv;
569 pr_debug(
"fb%d: vertical sync start : %d\n", node, value);
573 value = (value * vmul) / vdiv;
574 pr_debug(
"fb%d: vertical sync end : %d\n", node, value);
581 pr_debug(
"fb%d: positive horizontal sync\n", node);
582 regval = regval & ~0x80;
584 pr_debug(
"fb%d: negative horizontal sync\n", node);
585 regval = regval | 0x80;
588 pr_debug(
"fb%d: positive vertical sync\n", node);
589 regval = regval & ~0x40;
591 pr_debug(
"fb%d: negative vertical sync\n\n", node);
592 regval = regval | 0x40;
610 (var->
red.length <= frm->
red.length) &&
612 (var->
blue.length <= frm->
blue.length) &&
628 int i = match_format(frm, var);