102 #include <linux/version.h>
114 #include <linux/slab.h>
117 #ifdef CONFIG_PPC_PMAC
118 #include <asm/machdep.h>
124 static void matroxfb_unregister_device(
struct matrox_fb_info* minfo);
147 39721
L,48L,16L,33L,10L,
160 if (info && (info->
fbcon.var.bits_per_pixel == minfo->
fbcon.var.bits_per_pixel)
161 && (info->
fbcon.var.xres_virtual == minfo->
fbcon.var.xres_virtual)
162 && (info->
fbcon.var.green.length == minfo->
fbcon.var.green.length)
164 switch (minfo->
fbcon.var.bits_per_pixel) {
170 mga_outl(0x3C28, pos + minfo->
fbcon.var.xres_virtual * minfo->
fbcon.var.bits_per_pixel / 8);
181 if (minfo->
crtc1.panpos >= 0) {
186 panpos = minfo->
crtc1.panpos;
188 unsigned int extvga_reg;
190 minfo->
crtc1.panpos = -1;
193 if (extvga_reg != 0x00) {
211 minfo->
crtc1.vsync.cnt++;
212 matroxfb_crtc1_panpos(minfo);
216 if (status & 0x200) {
218 minfo->
crtc2.vsync.cnt++;
243 }
else if (reenable) {
247 if ((ien & bm) != bm) {
259 matroxfb_crtc1_panpos(minfo);
276 vs = &minfo->
crtc1.vsync;
282 vs = &minfo->
crtc2.vsync;
310 unsigned short p0,
p1, p2;
322 minfo->fbcon.var.xoffset = var->xoffset;
323 minfo->fbcon.var.yoffset = var->yoffset;
324 pos = (minfo->fbcon.var.yoffset * minfo->fbcon.var.xres_virtual + minfo->fbcon.var.xoffset) * minfo->
curr.final_bppShift / 32;
325 pos += minfo->
curr.ydstorg.chunks;
326 p0 = minfo->
hw.CRTC[0x0D] = pos & 0xFF;
327 p1 = minfo->
hw.CRTC[0x0C] = (pos & 0xFF00) >> 8;
328 p2 = minfo->
hw.CRTCEXT[0] = (minfo->
hw.CRTCEXT[0] & 0xB0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40);
329 p3 = minfo->
hw.CRTCEXT[8] = pos >> 21;
339 if (minfo->devflags.support32MB)
342 minfo->crtc1.panpos = p2;
345 minfo->
crtc1.panpos = -1;
350 update_crtc2(minfo, pos);
370 matroxfb_unregister_device(minfo);
374 if (minfo->mtrr.vram_valid)
377 mga_iounmap(minfo->
mmio.vbase);
378 mga_iounmap(minfo->
video.vbase);
388 static int matroxfb_open(
struct fb_info *info,
int user)
404 static int matroxfb_release(
struct fb_info *info,
int user)
412 matroxfb_disable_irq(minfo);
416 matroxfb_remove(minfo, 0);
427 matrox_pan_var(minfo, var);
444 if (minfo->devflags.video64bits)
449 static int matroxfb_test_and_set_rounding(
const struct matrox_fb_info *minfo,
459 case 4: rounding = 128;
461 case 8: rounding = 64;
463 case 16: rounding = 32;
465 case 24: rounding = 64;
467 default: rounding = 16;
478 xres += rounding-over;
482 static int matroxfb_pitch_adjust(
const struct matrox_fb_info *minfo,
int xres,
496 if ((*width >= xres) && (matroxfb_test_and_set_rounding(minfo, *width, bpp) == *width)) {
503 xres_new = matroxfb_test_and_set_rounding(minfo, xres, bpp);
530 static int matroxfb_decode_var(
const struct matrox_fb_info *minfo,
532 int *video_cmap_len,
unsigned int*
ydstorg)
545 static const struct RGBT
table[]= {
546 { 8,{ 0,8},{0,8},{0,8},{ 0,0},
MX_VISUAL_PSEUDOCOLOR},
547 {15,{10,5},{5,5},{0,5},{15,1},
MX_VISUAL_DIRECTCOLOR},
548 {16,{11,5},{5,6},{0,5},{ 0,0},
MX_VISUAL_DIRECTCOLOR},
549 {24,{16,8},{8,8},{0,8},{ 0,0},
MX_VISUAL_DIRECTCOLOR},
552 struct RGBT
const *rgbt;
554 unsigned int vramlen;
569 vramlen = minfo->
video.len_usable;
577 if (memlen > vramlen) {
584 if (!minfo->
capable.cross4MB && (memlen > 0x400000)) {
588 unsigned int linelen;
589 unsigned int m1 = linelen = var->
xres_virtual * bpp / 8;
591 unsigned int max_yres;
596 while (m2 >= m1) m2 -= m1;
602 *ydstorg = m2 = 0x400000 % m2;
603 max_yres = (vramlen - m2) / linelen;
622 if (bpp == 16 && var->
green.length == 5) {
626 for (rgbt = table; rgbt->bpp <
bpp; rgbt++);
628 var->clr.offset = rgbt->clr.offset;\
629 var->clr.length = rgbt->clr.length
635 *visual = rgbt->visual;
638 dprintk(
"matroxfb: truecolor: "
639 "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
643 *video_cmap_len = matroxfb_get_cmap_len(var);
649 static int matroxfb_setcolreg(
unsigned regno,
unsigned red,
unsigned green,
664 if (regno >= minfo->
curr.cmap_len)
667 if (minfo->
fbcon.var.grayscale) {
669 red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
677 switch (minfo->
fbcon.var.bits_per_pixel) {
690 (red << minfo->
fbcon.var.red.offset) |
691 (green << minfo->
fbcon.var.green.offset) |
692 (blue << minfo->
fbcon.var.blue.offset) |
693 (transp << minfo->
fbcon.var.transp.offset);
694 minfo->
cmap[regno] = col | (col << 16);
702 (red << minfo->
fbcon.var.red.offset) |
703 (green << minfo->
fbcon.var.green.offset) |
704 (blue << minfo->
fbcon.var.blue.offset) |
705 (transp << minfo->
fbcon.var.transp.offset);
723 fix->
accel = minfo->devflags.accelerator;
733 fix->
smem_len = minfo->video.len_usable - minfo->
curr.ydstorg.bytes;
742 unsigned int ydstorg;
748 if ((err = matroxfb_decode_var(minfo, var, &visual, &cmap_len, &ydstorg)) != 0)
753 static int matroxfb_set_par(
struct fb_info *info)
769 if ((err = matroxfb_decode_var(minfo, var, &visual, &cmap_len, &ydstorg)) != 0)
772 matroxfb_update_fix(minfo);
773 minfo->
fbcon.fix.visual = visual;
775 minfo->
fbcon.fix.type_aux = 0;
780 minfo->
curr.cmap_len = cmap_len;
797 case 0: mt.delay = 31 + 0;
break;
798 case 16: mt.delay = 21 + 8;
break;
799 case 24: mt.delay = 17 + 8;
break;
800 case 32: mt.delay = 16 + 8;
break;
801 default: mt.delay = 31 + 8;
break;
809 minfo->
outputs[out].output->compute) {
814 minfo->
crtc1.pixclock = mt.pixclock;
815 minfo->
crtc1.mnp = mt.mnp;
818 pos += minfo->
curr.ydstorg.chunks;
820 hw->
CRTC[0x0D] = pos & 0xFF;
821 hw->
CRTC[0x0C] = (pos & 0xFF00) >> 8;
822 hw->
CRTCEXT[0] = (hw->
CRTCEXT[0] & 0xF0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40);
825 update_crtc2(minfo, pos);
829 minfo->
outputs[out].output->program) {
835 minfo->
outputs[out].output->start) {
853 memset(vblank, 0,
sizeof(*vblank));
877 .name =
"Panellink output",
880 static int matroxfb_ioctl(
struct fb_info *info,
881 unsigned int cmd,
unsigned long arg)
898 err = matroxfb_get_vblank(minfo, &vblank);
922 if (mom.output >= MATROXFB_MAX_OUTPUTS)
925 oproc = minfo->
outputs[mom.output].output;
938 if (minfo->
outputs[mom.output].mode != mom.mode) {
939 minfo->
outputs[mom.output].mode = mom.mode;
946 switch (minfo->
outputs[mom.output].src) {
948 matroxfb_set_par(info);
955 crtc2 = minfo->
crtc2.info;
957 crtc2->
fbcon.fbops->fb_set_par(&crtc2->
fbcon);
972 if (mom.output >= MATROXFB_MAX_OUTPUTS)
975 oproc = minfo->
outputs[mom.output].output;
979 mom.mode = minfo->
outputs[mom.output].mode;
997 for (i = 0; i < 32; i++) {
998 if (tmp & (1 << i)) {
999 if (i >= MATROXFB_MAX_OUTPUTS)
1001 if (!minfo->
outputs[i].output)
1003 switch (minfo->
outputs[i].src) {
1025 if (tmp & (1 << i)) {
1037 matroxfb_set_par(info);
1060 if (minfo->
outputs[i].output) {
1061 switch (minfo->
outputs[i].src) {
1070 if (conn & MATROXFB_OUTPUT_CONN_DFP)
1071 conn &= ~MATROXFB_OUTPUT_CONN_SECONDARY;
1072 if (conn & MATROXFB_OUTPUT_CONN_SECONDARY)
1073 conn &= ~MATROXFB_OUTPUT_CONN_DFP;
1085 if (minfo->
outputs[i].output) {
1101 r.version = KERNEL_VERSION(1,0,0);
1117 if (!minfo->
outputs[1].output) {
1119 }
else if (minfo->
outputs[1].output->getqueryctrl) {
1120 err = minfo->
outputs[1].output->getqueryctrl(minfo->
outputs[1].data, &qctrl);
1139 if (!minfo->
outputs[1].output) {
1141 }
else if (minfo->
outputs[1].output->getctrl) {
1161 if (!minfo->
outputs[1].output) {
1163 }
else if (minfo->
outputs[1].output->setctrl) {
1177 static int matroxfb_blank(
int blank,
struct fb_info *info)
1194 default: seq = 0x00; crtc = 0x00;
break;
1208 static struct fb_ops matroxfb_ops = {
1210 .fb_open = matroxfb_open,
1211 .fb_release = matroxfb_release,
1212 .fb_check_var = matroxfb_check_var,
1213 .fb_set_par = matroxfb_set_par,
1214 .fb_setcolreg = matroxfb_setcolreg,
1215 .fb_pan_display =matroxfb_pan_display,
1216 .fb_blank = matroxfb_blank,
1217 .fb_ioctl = matroxfb_ioctl,
1224 #define RSDepth(X) (((X) >> 8) & 0x0F)
1235 { { 0, 8, 0}, { 0, 8, 0}, { 0, 8, 0}, { 0, 0, 0}, 8 },
1236 { { 10, 5, 0}, { 5, 5, 0}, { 0, 5, 0}, { 15, 1, 0}, 16 },
1237 { { 11, 5, 0}, { 5, 6, 0}, { 0, 5, 0}, { 0, 0, 0}, 16 },
1238 { { 16, 8, 0}, { 8, 8, 0}, { 0, 8, 0}, { 24, 8, 0}, 32 },
1239 { { 0, 8, 0}, { 0, 8, 0}, { 0, 8, 0}, { 0, 0, 0}, 4 },
1240 { { 16, 8, 0}, { 8, 8, 0}, { 0, 8, 0}, { 0, 0, 0}, 24 },
1241 { { 0, 6, 0}, { 0, 6, 0}, { 0, 6, 0}, { 0, 0, 0}, 0 },
1242 { { 0, 6, 0}, { 0, 6, 0}, { 0, 6, 0}, { 0, 0, 0}, 0 },
1246 static unsigned int mem;
1247 static int option_precise_width = 1;
1249 static int cross4MB = -1;
1250 static int disabled;
1253 static int no_pci_retry;
1256 static int noinit = 1;
1260 static int mtrr = 1;
1262 static int grayscale;
1263 static int dev = -1;
1264 static unsigned int vesa = ~0;
1265 static int depth = -1;
1266 static unsigned int xres;
1267 static unsigned int yres;
1268 static unsigned int upper = ~0;
1269 static unsigned int lower = ~0;
1270 static unsigned int vslen;
1271 static unsigned int left = ~0;
1272 static unsigned int right = ~0;
1273 static unsigned int hslen;
1274 static unsigned int pixclock;
1275 static int sync = -1;
1276 static unsigned int fv;
1277 static unsigned int fh;
1278 static unsigned int maxclk;
1280 static int dfp_type = -1;
1282 static char outputs[8];
1285 static char videomode[64];
1289 unsigned int maxSize,
unsigned int *realSize)
1295 unsigned char bytes[32];
1300 vm = minfo->video.vbase;
1301 maxSize &= ~0x1FFFFF;
1304 if (maxSize > 0x2000000) maxSize = 0x2000000;
1308 mga_outb(M_EXTVGA_DATA, orig | 0x80);
1311 for (offs = 0x100000; offs < maxSize; offs += 0x200000)
1312 *tmp++ = mga_readb(vm, offs);
1313 for (offs = 0x100000; offs < maxSize; offs += 0x200000)
1314 mga_writeb(vm, offs, 0x02);
1316 for (offs = 0x100000; offs < maxSize; offs += 0x200000) {
1317 if (mga_readb(vm, offs) != 0x02)
1319 mga_writeb(vm, offs, mga_readb(vm, offs) - 0x02);
1320 if (mga_readb(vm, offs))
1324 for (offs2 = 0x100000; offs2 < maxSize; offs2 += 0x200000)
1325 mga_writeb(vm, offs2, *tmp++);
1330 *realSize = offs - 0x100000;
1331 #ifdef CONFIG_FB_MATROX_MILLENIUM
1343 #ifdef CONFIG_FB_MATROX_MILLENIUM
1348 #ifdef CONFIG_FB_MATROX_MYSTIQUE
1351 #ifdef CONFIG_FB_MATROX_G
1359 #define DEVF_VIDEO64BIT 0x0001
1360 #define DEVF_SWAPS 0x0002
1361 #define DEVF_SRCORG 0x0004
1362 #define DEVF_DUALHEAD 0x0008
1363 #define DEVF_CROSS4MB 0x0010
1364 #define DEVF_TEXT4B 0x0020
1367 #define DEVF_SUPPORT32MB 0x0100
1368 #define DEVF_ANY_VXRES 0x0200
1369 #define DEVF_TEXT16B 0x0400
1370 #define DEVF_CRTC2 0x0800
1371 #define DEVF_MAVEN_CAPABLE 0x1000
1372 #define DEVF_PANELLINK_CAPABLE 0x2000
1373 #define DEVF_G450DAC 0x4000
1375 #define DEVF_GCORE (DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB)
1376 #define DEVF_G2CORE (DEVF_GCORE | DEVF_ANY_VXRES | DEVF_MAVEN_CAPABLE | DEVF_PANELLINK_CAPABLE | DEVF_SRCORG | DEVF_DUALHEAD)
1377 #define DEVF_G100 (DEVF_GCORE)
1378 #define DEVF_G200 (DEVF_G2CORE)
1379 #define DEVF_G400 (DEVF_G2CORE | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2)
1381 #define DEVF_G450 (DEVF_GCORE | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2 | DEVF_G450DAC | DEVF_SRCORG | DEVF_DUALHEAD)
1382 #define DEVF_G550 (DEVF_G450)
1384 static struct board {
1392 #ifdef CONFIG_FB_MATROX_MILLENIUM
1399 "Millennium (PCI)"},
1406 "Millennium II (PCI)"},
1413 "Millennium II (AGP)"},
1415 #ifdef CONFIG_FB_MATROX_MYSTIQUE
1429 "Mystique 220 (PCI)"},
1443 "Mystique 220 (AGP)"},
1445 #ifdef CONFIG_FB_MATROX_G
1480 "Mystique G200 (AGP)"},
1487 "Millennium G200 (AGP)"},
1494 "Marvel G200 (AGP)"},
1515 "Millennium G400 MAX (AGP)"},
1549 NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2,
1554 static int hotplug = 0;
1577 }
else if (c ==
'1') {
1579 }
else if (c ==
'2' && minfo->
devflags.crtc2) {
1592 unsigned long ctrlptr_phys = 0;
1593 unsigned long video_base_phys = 0;
1607 minfo->hw_switch = b->base->lowlevel;
1608 minfo->devflags.accelerator = b->base->accelID;
1609 minfo->max_pixel_clock = b->maxclk;
1634 minfo->
devflags.dfp_type = dfp_type;
1638 setDefaultOutputs(minfo);
1640 minfo->
outputs[2].data = minfo;
1641 minfo->
outputs[2].output = &panellink_output;
1647 if (minfo->
capable.cross4MB < 0)
1659 if (!ctrlptr_phys) {
1660 printk(
KERN_ERR "matroxfb: control registers are not available, matroxfb disabled\n");
1663 if (!video_base_phys) {
1664 printk(
KERN_ERR "matroxfb: video RAM is not available in PCI address space, matroxfb disabled\n");
1667 memsize = b->
base->maxvram;
1676 if (mem < 1024) mem *= 1024;
1677 if (mem < 0x00100000) mem *= 1024;
1679 if (mem && (mem < memsize))
1683 printk(
KERN_ERR "matroxfb: cannot ioremap(%lX, 16384), matroxfb disabled\n", ctrlptr_phys);
1686 minfo->
mmio.base = ctrlptr_phys;
1687 minfo->
mmio.len = 16384;
1688 minfo->
video.base = video_base_phys;
1690 printk(
KERN_ERR "matroxfb: cannot ioremap(%lX, %d), matroxfb disabled\n",
1691 video_base_phys, memsize);
1700 mga_option &= 0x7FFFFFFF;
1705 if (!(mga_option & 0x20000000) && !minfo->
devflags.nopciretry) {
1708 mga_option |= 0x20000000;
1713 minfo->
hw.MXoptionReg = mga_option;
1727 if (!matroxfb_getmemory(minfo, memsize, &minfo->
video.len) || !minfo->
video.len) {
1733 minfo->
video.base = video_base_phys;
1735 if (minfo->
video.len_usable > b->
base->maxdisplayable)
1736 minfo->
video.len_usable = b->
base->maxdisplayable;
1740 minfo->mtrr.vram_valid = 1;
1750 minfo->
fbcon.monspecs.hfmin = 0;
1751 minfo->
fbcon.monspecs.hfmax = fh;
1752 minfo->
fbcon.monspecs.vfmin = 0;
1753 minfo->
fbcon.monspecs.vfmax = fv;
1754 minfo->
fbcon.monspecs.dpms = 0;
1757 vesafb_defined.
red =
colors[depth-1].red;
1762 vesafb_defined.
vmode = 0;
1766 minfo->
fbops = matroxfb_ops;
1768 minfo->
fbcon.pseudo_palette = minfo->
cmap;
1802 vesafb_defined.
xres = xres;
1804 vesafb_defined.
yres = yres;
1807 else if (vesafb_defined.
sync == ~0) {
1808 vesafb_defined.
sync = 0;
1811 else if (yres < 480)
1822 if ((tmp < fh) || (fh == 0)) fh =
tmp;
1827 if ((tmp < maxclk) || (maxclk == 0)) maxclk =
tmp;
1829 tmp = (maxclk + 499) / 500;
1831 tmp = (2000000000 +
tmp) / tmp;
1832 if (tmp > pixclock) pixclock =
tmp;
1836 if (pixclock < 2000)
1838 if (pixclock > 1000000)
1840 vesafb_defined.
pixclock = pixclock;
1844 #if defined(CONFIG_PPC_PMAC)
1846 if (machine_is(powermac)) {
1848 if (default_vmode <= 0 || default_vmode >
VMODE_MAX)
1854 if (default_cmode < CMODE_8 || default_cmode >
CMODE_32)
1860 vesafb_defined = var;
1872 matroxfb_init_fix(minfo);
1873 minfo->
fbcon.screen_base = vaddr_va(minfo->
video.vbase);
1875 matroxfb_check_var(&vesafb_defined, &minfo->
fbcon);
1880 minfo->
fbcon.var = vesafb_defined;
1886 printk(
KERN_INFO "matroxfb: framebuffer at 0x%lX, mapped to 0x%p, size %d\n",
1896 printk(
"fb%d: %s frame buffer device\n",
1913 mga_iounmap(minfo->
video.vbase);
1915 mga_iounmap(minfo->
mmio.vbase);
1927 #define matroxfb_l(x) list_entry(x, struct matrox_fb_info, next_fb)
1928 #define matroxfb_driver_l(x) list_entry(x, struct matroxfb_driver, node)
1932 list_add(&drv->
node, &matroxfb_driver_list);
1940 p = drv->
probe(minfo);
1959 if (minfo->
drivers[i] == drv) {
1970 static void matroxfb_register_device(
struct matrox_fb_info* minfo) {
1973 list_add(&minfo->
next_fb, &matroxfb_list);
1977 if (drv && drv->
probe) {
1978 void *
p = drv->
probe(minfo);
1990 static void matroxfb_unregister_device(
struct matrox_fb_info* minfo) {
2011 svid = pdev->subsystem_vendor;
2012 sid = pdev->subsystem_device;
2016 if ((b->
svid != svid) || (b->
sid != sid))
continue;
2035 memset(minfo, 0,
sizeof(*minfo));
2042 pci_set_drvdata(pdev, minfo);
2061 minfo->
devflags.nopciretry = no_pci_retry;
2062 minfo->
devflags.mga_24bpp_fix = inv24;
2063 minfo->
devflags.precise_width = option_precise_width;
2075 minfo->
crtc1.panpos = -1;
2077 err = initMatrox2(minfo, b);
2079 matroxfb_register_device(minfo);
2086 static void pci_remove_matrox(
struct pci_dev* pdev) {
2089 minfo = pci_get_drvdata(pdev);
2090 matroxfb_remove(minfo, 1);
2094 #ifdef CONFIG_FB_MATROX_MILLENIUM
2102 #ifdef CONFIG_FB_MATROX_MYSTIQUE
2106 #ifdef CONFIG_FB_MATROX_G
2129 .id_table = matroxfb_devices,
2130 .probe = matroxfb_probe,
2131 .remove = pci_remove_matrox,
2136 #define RSResolution(X) ((X) & 0x0F)
2140 #define RS1024x768 4
2141 #define RS1280x1024 5
2142 #define RS1600x1200 6
2145 #define RS1152x864 9
2146 #define RS1408x1056 10
2147 #define RS640x350 11
2148 #define RS1056x344 12
2149 #define RS1056x400 13
2150 #define RS1056x480 14
2154 { 640, 400, 48, 16, 39, 8, 96, 2, 70 },
2155 { 640, 480, 48, 16, 33, 10, 96, 2, 60 },
2156 { 800, 600, 144, 24, 28, 8, 112, 6, 60 },
2157 { 1024, 768, 160, 32, 30, 4, 128, 4, 60 },
2158 { 1280, 1024, 224, 32, 32, 4, 136, 4, 60 },
2159 { 1600, 1200, 272, 48, 32, 5, 152, 5, 60 },
2160 { 768, 576, 144, 16, 28, 6, 112, 4, 60 },
2161 { 960, 720, 144, 24, 28, 8, 112, 4, 60 },
2162 { 1152, 864, 192, 32, 30, 4, 128, 4, 60 },
2163 { 1408, 1056, 256, 40, 32, 5, 144, 5, 60 },
2164 { 640, 350, 48, 16, 39, 8, 96, 2, 70 },
2165 { 1056, 344, 96, 24, 59, 44, 160, 2, 70 },
2166 { 1056, 400, 96, 24, 39, 8, 160, 2, 70 },
2167 { 1056, 480, 96, 24, 36, 12, 160, 3, 60 },
2168 { 0, 0, ~0, ~0, ~0, ~0, 0, 0, 0 }
2171 #define RSCreate(X,Y) ((X) | ((Y) << 8))
2172 static struct {
unsigned int vesa;
unsigned int info; } *RSptr, vesamap[] __initdata = {
2228 static void __init matroxfb_init_params(
void) {
2233 if (maxclk < 1000) maxclk *= 1000;
2234 if (maxclk < 1000000) maxclk *= 1000;
2240 for (RSptr = vesamap; RSptr->vesa; RSptr++) {
2241 if (RSptr->vesa == vesa)
break;
2250 left = timmings[
res].left;
2252 xres = timmings[
res].xres;
2254 right = timmings[
res].right;
2256 hslen = timmings[
res].hslen;
2258 upper = timmings[
res].upper;
2260 yres = timmings[
res].yres;
2262 lower = timmings[
res].lower;
2264 vslen = timmings[
res].vslen;
2265 if (!(fv||fh||maxclk||pixclock))
2266 fv = timmings[
res].vfreq;
2272 static int __init matrox_init(
void) {
2275 matroxfb_init_params();
2276 err = pci_register_driver(&matroxfb_driver);
2283 static void __exit matrox_done(
void) {
2296 if (!options || !*options)
2299 while ((this_opt =
strsep(&options, ",")) !=
NULL) {
2300 if (!*this_opt)
continue;
2302 dprintk(
"matroxfb_setup: option %s\n", this_opt);
2304 if (!
strncmp(this_opt,
"dev:", 4))
2306 else if (!
strncmp(this_opt,
"depth:", 6)) {
2308 case 0: depth =
RSText;
break;
2309 case 4: depth =
RS4bpp;
break;
2310 case 8: depth =
RS8bpp;
break;
2311 case 15:depth =
RS15bpp;
break;
2312 case 16:depth =
RS16bpp;
break;
2313 case 24:depth =
RS24bpp;
break;
2314 case 32:depth =
RS32bpp;
break;
2318 }
else if (!
strncmp(this_opt,
"xres:", 5))
2320 else if (!
strncmp(this_opt,
"yres:", 5))
2322 else if (!
strncmp(this_opt,
"vslen:", 6))
2324 else if (!
strncmp(this_opt,
"hslen:", 6))
2326 else if (!
strncmp(this_opt,
"left:", 5))
2328 else if (!
strncmp(this_opt,
"right:", 6))
2330 else if (!
strncmp(this_opt,
"upper:", 6))
2332 else if (!
strncmp(this_opt,
"lower:", 6))
2334 else if (!
strncmp(this_opt,
"pixclock:", 9))
2336 else if (!
strncmp(this_opt,
"sync:", 5))
2338 else if (!
strncmp(this_opt,
"vesa:", 5))
2340 else if (!
strncmp(this_opt,
"maxclk:", 7))
2342 else if (!
strncmp(this_opt,
"fh:", 3))
2344 else if (!
strncmp(this_opt,
"fv:", 3))
2346 else if (!
strncmp(this_opt,
"mem:", 4))
2348 else if (!
strncmp(this_opt,
"mode:", 5))
2349 strlcpy(videomode, this_opt+5,
sizeof(videomode));
2350 else if (!
strncmp(this_opt,
"outputs:", 8))
2351 strlcpy(outputs, this_opt+8,
sizeof(outputs));
2352 else if (!
strncmp(this_opt,
"dfp:", 4)) {
2356 #ifdef CONFIG_PPC_PMAC
2357 else if (!
strncmp(this_opt,
"vmode:", 6)) {
2359 if (vmode > 0 && vmode <= VMODE_MAX)
2360 default_vmode = vmode;
2361 }
else if (!
strncmp(this_opt,
"cmode:", 6)) {
2379 else if (!
strcmp(this_opt,
"disabled"))
2381 else if (!
strcmp(this_opt,
"enabled"))
2383 else if (!
strcmp(this_opt,
"sgram"))
2385 else if (!
strcmp(this_opt,
"sdram"))
2387 else if (!
strncmp(this_opt,
"memtype:", 8))
2392 if (!
strncmp(this_opt,
"no", 2)) {
2396 if (!
strcmp(this_opt,
"inverse"))
2398 else if (!
strcmp(this_opt,
"accel"))
2400 else if (!
strcmp(this_opt,
"pan"))
2402 else if (!
strcmp(this_opt,
"pciretry"))
2403 no_pci_retry = !
value;
2404 else if (!
strcmp(this_opt,
"vga"))
2406 else if (!
strcmp(this_opt,
"bios"))
2408 else if (!
strcmp(this_opt,
"init"))
2411 else if (!
strcmp(this_opt,
"mtrr"))
2414 else if (!
strcmp(this_opt,
"inv24"))
2416 else if (!
strcmp(this_opt,
"cross4MB"))
2418 else if (!
strcmp(this_opt,
"grayscale"))
2420 else if (!
strcmp(this_opt,
"dfp"))
2423 strlcpy(videomode, this_opt,
sizeof(videomode));
2432 static int __init matroxfb_init(
void)
2441 matroxfb_setup(option);
2447 err = matrox_init();
2461 MODULE_DESCRIPTION(
"Accelerated FBDev driver for Matrox Millennium/Mystique/G100/G200/G400/G450/G550");
2465 MODULE_PARM_DESC(mem,
"Size of available memory in MB, KB or B (2,4,8,12,16MB, default=autodetect)");
2469 MODULE_PARM_DESC(noaccel,
"Do not use accelerating engine (0 or 1=disabled) (default=0)");
2471 MODULE_PARM_DESC(nopan,
"Disable pan on startup (0 or 1=disabled) (default=0)");
2473 MODULE_PARM_DESC(no_pci_retry,
"PCI retries enabled (0 or 1=disabled) (default=0)");
2475 MODULE_PARM_DESC(novga,
"VGA I/O (0x3C0-0x3DF) disabled (0 or 1=disabled) (default=0)");
2477 MODULE_PARM_DESC(nobios,
"Disables ROM BIOS (0 or 1=disabled) (default=do not change BIOS state)");
2479 MODULE_PARM_DESC(noinit,
"Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0)");
2481 MODULE_PARM_DESC(memtype,
"Memory type for G200/G400 (see Documentation/fb/matroxfb.txt for explanation) (default=3 for G200, 0 for G400)");
2484 MODULE_PARM_DESC(mtrr,
"This speeds up video memory accesses (0=disabled or 1) (default=1)");
2487 MODULE_PARM_DESC(sgram,
"Indicates that G100/G200/G400 has SGRAM memory (0=SDRAM, 1=SGRAM) (default=0)");
2489 MODULE_PARM_DESC(inv24,
"Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity)");
2493 MODULE_PARM_DESC(dev,
"Multihead support, attach to device ID (0..N) (default=all working)");
2497 MODULE_PARM_DESC(xres,
"Horizontal resolution (px), overrides xres from vesa (default=vesa)");
2499 MODULE_PARM_DESC(yres,
"Vertical resolution (scans), overrides yres from vesa (default=vesa)");
2501 MODULE_PARM_DESC(upper,
"Upper blank space (scans), overrides upper from vesa (default=vesa)");
2503 MODULE_PARM_DESC(lower,
"Lower blank space (scans), overrides lower from vesa (default=vesa)");
2505 MODULE_PARM_DESC(vslen,
"Vertical sync length (scans), overrides lower from vesa (default=vesa)");
2507 MODULE_PARM_DESC(left,
"Left blank space (px), overrides left from vesa (default=vesa)");
2509 MODULE_PARM_DESC(right,
"Right blank space (px), overrides right from vesa (default=vesa)");
2511 MODULE_PARM_DESC(hslen,
"Horizontal sync length (px), overrides hslen from vesa (default=vesa)");
2513 MODULE_PARM_DESC(pixclock,
"Pixelclock (ns), overrides pixclock from vesa (default=vesa)");
2515 MODULE_PARM_DESC(sync,
"Sync polarity, overrides sync from vesa (default=vesa)");
2517 MODULE_PARM_DESC(depth,
"Color depth (0=text,8,15,16,24,32) (default=vesa)");
2519 MODULE_PARM_DESC(maxclk,
"Startup maximal clock, 0-999MHz, 1000-999999kHz, 1000000-INF Hz");
2521 MODULE_PARM_DESC(fh,
"Startup horizontal frequency, 0-999kHz, 1000-INF Hz");
2524 "You should specify \"fv:max_monitor_vsync,fh:max_monitor_hsync,maxclk:max_monitor_dotclock\"");
2526 MODULE_PARM_DESC(grayscale,
"Sets display into grayscale. Works perfectly with paletized videomode (4, 8bpp), some limitations apply to 16, 24 and 32bpp videomodes (default=nograyscale)");
2528 MODULE_PARM_DESC(cross4MB,
"Specifies that 4MB boundary can be in middle of line. (default=autodetected)");
2530 MODULE_PARM_DESC(dfp,
"Specifies whether to use digital flat panel interface of G200/G400 (0 or 1) (default=0)");
2532 MODULE_PARM_DESC(dfp_type,
"Specifies DFP interface type (0 to 255) (default=read from hardware)");
2534 MODULE_PARM_DESC(outputs,
"Specifies which CRTC is mapped to which output (string of up to three letters, consisting of 0 (disabled), 1 (CRTC1), 2 (CRTC2)) (default=111 for Gx50, 101 for G200/G400 with DFP, and 100 for all other devices)");
2535 #ifdef CONFIG_PPC_PMAC
2537 MODULE_PARM_DESC(vmode,
"Specify the vmode mode number that should be used (640x480 default)");
2539 MODULE_PARM_DESC(cmode,
"Specify the video depth that should be used (8bit default)");
2564 printk(
KERN_ERR "matroxfb: depth %d is not supported, using default\n", depth);