diff options
Diffstat (limited to 'drivers/video/matrox/matroxfb_base.c')
-rw-r--r-- | drivers/video/matrox/matroxfb_base.c | 124 |
1 files changed, 73 insertions, 51 deletions
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 867a4d915e77..73ad59822ea1 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -154,7 +154,8 @@ static struct fb_var_screeninfo vesafb_defined = { | |||
154 | 154 | ||
155 | 155 | ||
156 | /* --------------------------------------------------------------------- */ | 156 | /* --------------------------------------------------------------------- */ |
157 | static void update_crtc2(WPMINFO unsigned int pos) { | 157 | static void update_crtc2(struct matrox_fb_info *minfo, unsigned int pos) |
158 | { | ||
158 | struct matroxfb_dh_fb_info *info = minfo->crtc2.info; | 159 | struct matroxfb_dh_fb_info *info = minfo->crtc2.info; |
159 | 160 | ||
160 | /* Make sure that displays are compatible */ | 161 | /* Make sure that displays are compatible */ |
@@ -177,7 +178,8 @@ static void update_crtc2(WPMINFO unsigned int pos) { | |||
177 | } | 178 | } |
178 | } | 179 | } |
179 | 180 | ||
180 | static void matroxfb_crtc1_panpos(WPMINFO2) { | 181 | static void matroxfb_crtc1_panpos(struct matrox_fb_info *minfo) |
182 | { | ||
181 | if (minfo->crtc1.panpos >= 0) { | 183 | if (minfo->crtc1.panpos >= 0) { |
182 | unsigned long flags; | 184 | unsigned long flags; |
183 | int panpos; | 185 | int panpos; |
@@ -210,7 +212,7 @@ static irqreturn_t matrox_irq(int irq, void *dev_id) | |||
210 | if (status & 0x20) { | 212 | if (status & 0x20) { |
211 | mga_outl(M_ICLEAR, 0x20); | 213 | mga_outl(M_ICLEAR, 0x20); |
212 | minfo->crtc1.vsync.cnt++; | 214 | minfo->crtc1.vsync.cnt++; |
213 | matroxfb_crtc1_panpos(PMINFO2); | 215 | matroxfb_crtc1_panpos(minfo); |
214 | wake_up_interruptible(&minfo->crtc1.vsync.wait); | 216 | wake_up_interruptible(&minfo->crtc1.vsync.wait); |
215 | handled = 1; | 217 | handled = 1; |
216 | } | 218 | } |
@@ -223,7 +225,8 @@ static irqreturn_t matrox_irq(int irq, void *dev_id) | |||
223 | return IRQ_RETVAL(handled); | 225 | return IRQ_RETVAL(handled); |
224 | } | 226 | } |
225 | 227 | ||
226 | int matroxfb_enable_irq(WPMINFO int reenable) { | 228 | int matroxfb_enable_irq(struct matrox_fb_info *minfo, int reenable) |
229 | { | ||
227 | u_int32_t bm; | 230 | u_int32_t bm; |
228 | 231 | ||
229 | if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) | 232 | if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) |
@@ -252,10 +255,11 @@ int matroxfb_enable_irq(WPMINFO int reenable) { | |||
252 | return 0; | 255 | return 0; |
253 | } | 256 | } |
254 | 257 | ||
255 | static void matroxfb_disable_irq(WPMINFO2) { | 258 | static void matroxfb_disable_irq(struct matrox_fb_info *minfo) |
259 | { | ||
256 | if (test_and_clear_bit(0, &minfo->irq_flags)) { | 260 | if (test_and_clear_bit(0, &minfo->irq_flags)) { |
257 | /* Flush pending pan-at-vbl request... */ | 261 | /* Flush pending pan-at-vbl request... */ |
258 | matroxfb_crtc1_panpos(PMINFO2); | 262 | matroxfb_crtc1_panpos(minfo); |
259 | if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) | 263 | if (minfo->devflags.accelerator == FB_ACCEL_MATROX_MGAG400) |
260 | mga_outl(M_IEN, mga_inl(M_IEN) & ~0x220); | 264 | mga_outl(M_IEN, mga_inl(M_IEN) & ~0x220); |
261 | else | 265 | else |
@@ -264,7 +268,8 @@ static void matroxfb_disable_irq(WPMINFO2) { | |||
264 | } | 268 | } |
265 | } | 269 | } |
266 | 270 | ||
267 | int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) { | 271 | int matroxfb_wait_for_sync(struct matrox_fb_info *minfo, u_int32_t crtc) |
272 | { | ||
268 | struct matrox_vsync *vs; | 273 | struct matrox_vsync *vs; |
269 | unsigned int cnt; | 274 | unsigned int cnt; |
270 | int ret; | 275 | int ret; |
@@ -282,7 +287,7 @@ int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) { | |||
282 | default: | 287 | default: |
283 | return -ENODEV; | 288 | return -ENODEV; |
284 | } | 289 | } |
285 | ret = matroxfb_enable_irq(PMINFO 0); | 290 | ret = matroxfb_enable_irq(minfo, 0); |
286 | if (ret) { | 291 | if (ret) { |
287 | return ret; | 292 | return ret; |
288 | } | 293 | } |
@@ -293,7 +298,7 @@ int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) { | |||
293 | return ret; | 298 | return ret; |
294 | } | 299 | } |
295 | if (ret == 0) { | 300 | if (ret == 0) { |
296 | matroxfb_enable_irq(PMINFO 1); | 301 | matroxfb_enable_irq(minfo, 1); |
297 | return -ETIMEDOUT; | 302 | return -ETIMEDOUT; |
298 | } | 303 | } |
299 | return 0; | 304 | return 0; |
@@ -301,7 +306,9 @@ int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) { | |||
301 | 306 | ||
302 | /* --------------------------------------------------------------------- */ | 307 | /* --------------------------------------------------------------------- */ |
303 | 308 | ||
304 | static void matrox_pan_var(WPMINFO struct fb_var_screeninfo *var) { | 309 | static void matrox_pan_var(struct matrox_fb_info *minfo, |
310 | struct fb_var_screeninfo *var) | ||
311 | { | ||
305 | unsigned int pos; | 312 | unsigned int pos; |
306 | unsigned short p0, p1, p2; | 313 | unsigned short p0, p1, p2; |
307 | #ifdef CONFIG_FB_MATROX_32MB | 314 | #ifdef CONFIG_FB_MATROX_32MB |
@@ -329,7 +336,7 @@ static void matrox_pan_var(WPMINFO struct fb_var_screeninfo *var) { | |||
329 | #endif | 336 | #endif |
330 | 337 | ||
331 | /* FB_ACTIVATE_VBL and we can acquire interrupts? Honor FB_ACTIVATE_VBL then... */ | 338 | /* FB_ACTIVATE_VBL and we can acquire interrupts? Honor FB_ACTIVATE_VBL then... */ |
332 | vbl = (var->activate & FB_ACTIVATE_VBL) && (matroxfb_enable_irq(PMINFO 0) == 0); | 339 | vbl = (var->activate & FB_ACTIVATE_VBL) && (matroxfb_enable_irq(minfo, 0) == 0); |
333 | 340 | ||
334 | CRITBEGIN | 341 | CRITBEGIN |
335 | 342 | ||
@@ -349,12 +356,13 @@ static void matrox_pan_var(WPMINFO struct fb_var_screeninfo *var) { | |||
349 | } | 356 | } |
350 | matroxfb_DAC_unlock_irqrestore(flags); | 357 | matroxfb_DAC_unlock_irqrestore(flags); |
351 | 358 | ||
352 | update_crtc2(PMINFO pos); | 359 | update_crtc2(minfo, pos); |
353 | 360 | ||
354 | CRITEND | 361 | CRITEND |
355 | } | 362 | } |
356 | 363 | ||
357 | static void matroxfb_remove(WPMINFO int dummy) { | 364 | static void matroxfb_remove(struct matrox_fb_info *minfo, int dummy) |
365 | { | ||
358 | /* Currently we are holding big kernel lock on all dead & usecount updates. | 366 | /* Currently we are holding big kernel lock on all dead & usecount updates. |
359 | * Destroy everything after all users release it. Especially do not unregister | 367 | * Destroy everything after all users release it. Especially do not unregister |
360 | * framebuffer and iounmap memory, neither fbmem nor fbcon-cfb* does not check | 368 | * framebuffer and iounmap memory, neither fbmem nor fbcon-cfb* does not check |
@@ -370,7 +378,7 @@ static void matroxfb_remove(WPMINFO int dummy) { | |||
370 | } | 378 | } |
371 | matroxfb_unregister_device(minfo); | 379 | matroxfb_unregister_device(minfo); |
372 | unregister_framebuffer(&minfo->fbcon); | 380 | unregister_framebuffer(&minfo->fbcon); |
373 | matroxfb_g450_shutdown(PMINFO2); | 381 | matroxfb_g450_shutdown(minfo); |
374 | #ifdef CONFIG_MTRR | 382 | #ifdef CONFIG_MTRR |
375 | if (minfo->mtrr.vram_valid) | 383 | if (minfo->mtrr.vram_valid) |
376 | mtrr_del(minfo->mtrr.vram, minfo->video.base, minfo->video.len); | 384 | mtrr_del(minfo->mtrr.vram, minfo->video.base, minfo->video.len); |
@@ -410,11 +418,11 @@ static int matroxfb_release(struct fb_info *info, int user) | |||
410 | 418 | ||
411 | if (user) { | 419 | if (user) { |
412 | if (0 == --minfo->userusecount) { | 420 | if (0 == --minfo->userusecount) { |
413 | matroxfb_disable_irq(PMINFO2); | 421 | matroxfb_disable_irq(minfo); |
414 | } | 422 | } |
415 | } | 423 | } |
416 | if (!(--minfo->usecount) && minfo->dead) { | 424 | if (!(--minfo->usecount) && minfo->dead) { |
417 | matroxfb_remove(PMINFO 0); | 425 | matroxfb_remove(minfo, 0); |
418 | } | 426 | } |
419 | return(0); | 427 | return(0); |
420 | } | 428 | } |
@@ -425,11 +433,13 @@ static int matroxfb_pan_display(struct fb_var_screeninfo *var, | |||
425 | 433 | ||
426 | DBG(__func__) | 434 | DBG(__func__) |
427 | 435 | ||
428 | matrox_pan_var(PMINFO var); | 436 | matrox_pan_var(minfo, var); |
429 | return 0; | 437 | return 0; |
430 | } | 438 | } |
431 | 439 | ||
432 | static int matroxfb_get_final_bppShift(CPMINFO int bpp) { | 440 | static int matroxfb_get_final_bppShift(const struct matrox_fb_info *minfo, |
441 | int bpp) | ||
442 | { | ||
433 | int bppshft2; | 443 | int bppshft2; |
434 | 444 | ||
435 | DBG(__func__) | 445 | DBG(__func__) |
@@ -445,7 +455,9 @@ static int matroxfb_get_final_bppShift(CPMINFO int bpp) { | |||
445 | return bppshft2; | 455 | return bppshft2; |
446 | } | 456 | } |
447 | 457 | ||
448 | static int matroxfb_test_and_set_rounding(CPMINFO int xres, int bpp) { | 458 | static int matroxfb_test_and_set_rounding(const struct matrox_fb_info *minfo, |
459 | int xres, int bpp) | ||
460 | { | ||
449 | int over; | 461 | int over; |
450 | int rounding; | 462 | int rounding; |
451 | 463 | ||
@@ -476,7 +488,9 @@ static int matroxfb_test_and_set_rounding(CPMINFO int xres, int bpp) { | |||
476 | return xres; | 488 | return xres; |
477 | } | 489 | } |
478 | 490 | ||
479 | static int matroxfb_pitch_adjust(CPMINFO int xres, int bpp) { | 491 | static int matroxfb_pitch_adjust(const struct matrox_fb_info *minfo, int xres, |
492 | int bpp) | ||
493 | { | ||
480 | const int* width; | 494 | const int* width; |
481 | int xres_new; | 495 | int xres_new; |
482 | 496 | ||
@@ -488,14 +502,14 @@ static int matroxfb_pitch_adjust(CPMINFO int xres, int bpp) { | |||
488 | 502 | ||
489 | if (minfo->devflags.precise_width) { | 503 | if (minfo->devflags.precise_width) { |
490 | while (*width) { | 504 | while (*width) { |
491 | if ((*width >= xres) && (matroxfb_test_and_set_rounding(PMINFO *width, bpp) == *width)) { | 505 | if ((*width >= xres) && (matroxfb_test_and_set_rounding(minfo, *width, bpp) == *width)) { |
492 | break; | 506 | break; |
493 | } | 507 | } |
494 | width++; | 508 | width++; |
495 | } | 509 | } |
496 | xres_new = *width; | 510 | xres_new = *width; |
497 | } else { | 511 | } else { |
498 | xres_new = matroxfb_test_and_set_rounding(PMINFO xres, bpp); | 512 | xres_new = matroxfb_test_and_set_rounding(minfo, xres, bpp); |
499 | } | 513 | } |
500 | return xres_new; | 514 | return xres_new; |
501 | } | 515 | } |
@@ -522,7 +536,10 @@ static int matroxfb_get_cmap_len(struct fb_var_screeninfo *var) { | |||
522 | return 16; /* return something reasonable... or panic()? */ | 536 | return 16; /* return something reasonable... or panic()? */ |
523 | } | 537 | } |
524 | 538 | ||
525 | static int matroxfb_decode_var(CPMINFO struct fb_var_screeninfo *var, int *visual, int *video_cmap_len, unsigned int* ydstorg) { | 539 | static int matroxfb_decode_var(const struct matrox_fb_info *minfo, |
540 | struct fb_var_screeninfo *var, int *visual, | ||
541 | int *video_cmap_len, unsigned int* ydstorg) | ||
542 | { | ||
526 | struct RGBT { | 543 | struct RGBT { |
527 | unsigned char bpp; | 544 | unsigned char bpp; |
528 | struct { | 545 | struct { |
@@ -564,7 +581,7 @@ static int matroxfb_decode_var(CPMINFO struct fb_var_screeninfo *var, int *visua | |||
564 | if (var->xres_virtual < var->xres) | 581 | if (var->xres_virtual < var->xres) |
565 | var->xres_virtual = var->xres; | 582 | var->xres_virtual = var->xres; |
566 | 583 | ||
567 | var->xres_virtual = matroxfb_pitch_adjust(PMINFO var->xres_virtual, bpp); | 584 | var->xres_virtual = matroxfb_pitch_adjust(minfo, var->xres_virtual, bpp); |
568 | memlen = var->xres_virtual * bpp * var->yres_virtual / 8; | 585 | memlen = var->xres_virtual * bpp * var->yres_virtual / 8; |
569 | if (memlen > vramlen) { | 586 | if (memlen > vramlen) { |
570 | var->yres_virtual = vramlen * 8 / (var->xres_virtual * bpp); | 587 | var->yres_virtual = vramlen * 8 / (var->xres_virtual * bpp); |
@@ -700,7 +717,7 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
700 | return 0; | 717 | return 0; |
701 | } | 718 | } |
702 | 719 | ||
703 | static void matroxfb_init_fix(WPMINFO2) | 720 | static void matroxfb_init_fix(struct matrox_fb_info *minfo) |
704 | { | 721 | { |
705 | struct fb_fix_screeninfo *fix = &minfo->fbcon.fix; | 722 | struct fb_fix_screeninfo *fix = &minfo->fbcon.fix; |
706 | DBG(__func__) | 723 | DBG(__func__) |
@@ -715,7 +732,7 @@ static void matroxfb_init_fix(WPMINFO2) | |||
715 | fix->accel = minfo->devflags.accelerator; | 732 | fix->accel = minfo->devflags.accelerator; |
716 | } | 733 | } |
717 | 734 | ||
718 | static void matroxfb_update_fix(WPMINFO2) | 735 | static void matroxfb_update_fix(struct matrox_fb_info *minfo) |
719 | { | 736 | { |
720 | struct fb_fix_screeninfo *fix = &minfo->fbcon.fix; | 737 | struct fb_fix_screeninfo *fix = &minfo->fbcon.fix; |
721 | DBG(__func__) | 738 | DBG(__func__) |
@@ -737,7 +754,7 @@ static int matroxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *inf | |||
737 | if (minfo->dead) { | 754 | if (minfo->dead) { |
738 | return -ENXIO; | 755 | return -ENXIO; |
739 | } | 756 | } |
740 | if ((err = matroxfb_decode_var(PMINFO var, &visual, &cmap_len, &ydstorg)) != 0) | 757 | if ((err = matroxfb_decode_var(minfo, var, &visual, &cmap_len, &ydstorg)) != 0) |
741 | return err; | 758 | return err; |
742 | return 0; | 759 | return 0; |
743 | } | 760 | } |
@@ -758,10 +775,10 @@ static int matroxfb_set_par(struct fb_info *info) | |||
758 | } | 775 | } |
759 | 776 | ||
760 | var = &info->var; | 777 | var = &info->var; |
761 | if ((err = matroxfb_decode_var(PMINFO var, &visual, &cmap_len, &ydstorg)) != 0) | 778 | if ((err = matroxfb_decode_var(minfo, var, &visual, &cmap_len, &ydstorg)) != 0) |
762 | return err; | 779 | return err; |
763 | minfo->fbcon.screen_base = vaddr_va(minfo->video.vbase) + ydstorg; | 780 | minfo->fbcon.screen_base = vaddr_va(minfo->video.vbase) + ydstorg; |
764 | matroxfb_update_fix(PMINFO2); | 781 | matroxfb_update_fix(minfo); |
765 | minfo->fbcon.fix.visual = visual; | 782 | minfo->fbcon.fix.visual = visual; |
766 | minfo->fbcon.fix.type = FB_TYPE_PACKED_PIXELS; | 783 | minfo->fbcon.fix.type = FB_TYPE_PACKED_PIXELS; |
767 | minfo->fbcon.fix.type_aux = 0; | 784 | minfo->fbcon.fix.type_aux = 0; |
@@ -777,7 +794,7 @@ static int matroxfb_set_par(struct fb_info *info) | |||
777 | minfo->curr.ydstorg.pixels = ydstorg; | 794 | minfo->curr.ydstorg.pixels = ydstorg; |
778 | else | 795 | else |
779 | minfo->curr.ydstorg.pixels = (ydstorg * 8) / var->bits_per_pixel; | 796 | minfo->curr.ydstorg.pixels = (ydstorg * 8) / var->bits_per_pixel; |
780 | minfo->curr.final_bppShift = matroxfb_get_final_bppShift(PMINFO var->bits_per_pixel); | 797 | minfo->curr.final_bppShift = matroxfb_get_final_bppShift(minfo, var->bits_per_pixel); |
781 | { struct my_timming mt; | 798 | { struct my_timming mt; |
782 | struct matrox_hw_state* hw; | 799 | struct matrox_hw_state* hw; |
783 | int out; | 800 | int out; |
@@ -805,7 +822,7 @@ static int matroxfb_set_par(struct fb_info *info) | |||
805 | up_read(&minfo->altout.lock); | 822 | up_read(&minfo->altout.lock); |
806 | minfo->crtc1.pixclock = mt.pixclock; | 823 | minfo->crtc1.pixclock = mt.pixclock; |
807 | minfo->crtc1.mnp = mt.mnp; | 824 | minfo->crtc1.mnp = mt.mnp; |
808 | minfo->hw_switch->init(PMINFO &mt); | 825 | minfo->hw_switch->init(minfo, &mt); |
809 | pos = (var->yoffset * var->xres_virtual + var->xoffset) * minfo->curr.final_bppShift / 32; | 826 | pos = (var->yoffset * var->xres_virtual + var->xoffset) * minfo->curr.final_bppShift / 32; |
810 | pos += minfo->curr.ydstorg.chunks; | 827 | pos += minfo->curr.ydstorg.chunks; |
811 | 828 | ||
@@ -813,8 +830,8 @@ static int matroxfb_set_par(struct fb_info *info) | |||
813 | hw->CRTC[0x0C] = (pos & 0xFF00) >> 8; | 830 | hw->CRTC[0x0C] = (pos & 0xFF00) >> 8; |
814 | hw->CRTCEXT[0] = (hw->CRTCEXT[0] & 0xF0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40); | 831 | hw->CRTCEXT[0] = (hw->CRTCEXT[0] & 0xF0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40); |
815 | hw->CRTCEXT[8] = pos >> 21; | 832 | hw->CRTCEXT[8] = pos >> 21; |
816 | minfo->hw_switch->restore(PMINFO2); | 833 | minfo->hw_switch->restore(minfo); |
817 | update_crtc2(PMINFO pos); | 834 | update_crtc2(minfo, pos); |
818 | down_read(&minfo->altout.lock); | 835 | down_read(&minfo->altout.lock); |
819 | for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { | 836 | for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { |
820 | if (minfo->outputs[out].src == MATROXFB_SRC_CRTC1 && | 837 | if (minfo->outputs[out].src == MATROXFB_SRC_CRTC1 && |
@@ -829,18 +846,19 @@ static int matroxfb_set_par(struct fb_info *info) | |||
829 | } | 846 | } |
830 | } | 847 | } |
831 | up_read(&minfo->altout.lock); | 848 | up_read(&minfo->altout.lock); |
832 | matrox_cfbX_init(PMINFO2); | 849 | matrox_cfbX_init(minfo); |
833 | } | 850 | } |
834 | } | 851 | } |
835 | minfo->initialized = 1; | 852 | minfo->initialized = 1; |
836 | return 0; | 853 | return 0; |
837 | } | 854 | } |
838 | 855 | ||
839 | static int matroxfb_get_vblank(WPMINFO struct fb_vblank *vblank) | 856 | static int matroxfb_get_vblank(struct matrox_fb_info *minfo, |
857 | struct fb_vblank *vblank) | ||
840 | { | 858 | { |
841 | unsigned int sts1; | 859 | unsigned int sts1; |
842 | 860 | ||
843 | matroxfb_enable_irq(PMINFO 0); | 861 | matroxfb_enable_irq(minfo, 0); |
844 | memset(vblank, 0, sizeof(*vblank)); | 862 | memset(vblank, 0, sizeof(*vblank)); |
845 | vblank->flags = FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VSYNC | | 863 | vblank->flags = FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VSYNC | |
846 | FB_VBLANK_HAVE_VBLANK | FB_VBLANK_HAVE_HBLANK; | 864 | FB_VBLANK_HAVE_VBLANK | FB_VBLANK_HAVE_HBLANK; |
@@ -886,7 +904,7 @@ static int matroxfb_ioctl(struct fb_info *info, | |||
886 | struct fb_vblank vblank; | 904 | struct fb_vblank vblank; |
887 | int err; | 905 | int err; |
888 | 906 | ||
889 | err = matroxfb_get_vblank(PMINFO &vblank); | 907 | err = matroxfb_get_vblank(minfo, &vblank); |
890 | if (err) | 908 | if (err) |
891 | return err; | 909 | return err; |
892 | if (copy_to_user(argp, &vblank, sizeof(vblank))) | 910 | if (copy_to_user(argp, &vblank, sizeof(vblank))) |
@@ -900,7 +918,7 @@ static int matroxfb_ioctl(struct fb_info *info, | |||
900 | if (get_user(crt, (u_int32_t __user *)arg)) | 918 | if (get_user(crt, (u_int32_t __user *)arg)) |
901 | return -EFAULT; | 919 | return -EFAULT; |
902 | 920 | ||
903 | return matroxfb_wait_for_sync(PMINFO crt); | 921 | return matroxfb_wait_for_sync(minfo, crt); |
904 | } | 922 | } |
905 | case MATROXFB_SET_OUTPUT_MODE: | 923 | case MATROXFB_SET_OUTPUT_MODE: |
906 | { | 924 | { |
@@ -1277,7 +1295,9 @@ static char outputs[8]; /* "matrox:outputs:xxx" */ | |||
1277 | static char videomode[64]; /* "matrox:mode:xxxxx" or "matrox:xxxxx" */ | 1295 | static char videomode[64]; /* "matrox:mode:xxxxx" or "matrox:xxxxx" */ |
1278 | #endif | 1296 | #endif |
1279 | 1297 | ||
1280 | static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int *realSize){ | 1298 | static int matroxfb_getmemory(struct matrox_fb_info *minfo, |
1299 | unsigned int maxSize, unsigned int *realSize) | ||
1300 | { | ||
1281 | vaddr_t vm; | 1301 | vaddr_t vm; |
1282 | unsigned int offs; | 1302 | unsigned int offs; |
1283 | unsigned int offs2; | 1303 | unsigned int offs2; |
@@ -1554,7 +1574,8 @@ static struct fb_videomode defaultmode = { | |||
1554 | 1574 | ||
1555 | static int hotplug = 0; | 1575 | static int hotplug = 0; |
1556 | 1576 | ||
1557 | static void setDefaultOutputs(WPMINFO2) { | 1577 | static void setDefaultOutputs(struct matrox_fb_info *minfo) |
1578 | { | ||
1558 | unsigned int i; | 1579 | unsigned int i; |
1559 | const char* ptr; | 1580 | const char* ptr; |
1560 | 1581 | ||
@@ -1587,7 +1608,8 @@ static void setDefaultOutputs(WPMINFO2) { | |||
1587 | outputs[0] = 0; | 1608 | outputs[0] = 0; |
1588 | } | 1609 | } |
1589 | 1610 | ||
1590 | static int initMatrox2(WPMINFO struct board* b){ | 1611 | static int initMatrox2(struct matrox_fb_info *minfo, struct board *b) |
1612 | { | ||
1591 | unsigned long ctrlptr_phys = 0; | 1613 | unsigned long ctrlptr_phys = 0; |
1592 | unsigned long video_base_phys = 0; | 1614 | unsigned long video_base_phys = 0; |
1593 | unsigned int memsize; | 1615 | unsigned int memsize; |
@@ -1636,7 +1658,7 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1636 | minfo->devflags.g450dac = (b->flags & DEVF_G450DAC) != 0; | 1658 | minfo->devflags.g450dac = (b->flags & DEVF_G450DAC) != 0; |
1637 | minfo->devflags.textstep = minfo->devflags.vgastep * minfo->devflags.textmode; | 1659 | minfo->devflags.textstep = minfo->devflags.vgastep * minfo->devflags.textmode; |
1638 | minfo->devflags.textvram = 65536 / minfo->devflags.textmode; | 1660 | minfo->devflags.textvram = 65536 / minfo->devflags.textmode; |
1639 | setDefaultOutputs(PMINFO2); | 1661 | setDefaultOutputs(minfo); |
1640 | if (b->flags & DEVF_PANELLINK_CAPABLE) { | 1662 | if (b->flags & DEVF_PANELLINK_CAPABLE) { |
1641 | minfo->outputs[2].data = minfo; | 1663 | minfo->outputs[2].data = minfo; |
1642 | minfo->outputs[2].output = &panellink_output; | 1664 | minfo->outputs[2].output = &panellink_output; |
@@ -1719,13 +1741,13 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1719 | } | 1741 | } |
1720 | 1742 | ||
1721 | err = -ENXIO; | 1743 | err = -ENXIO; |
1722 | matroxfb_read_pins(PMINFO2); | 1744 | matroxfb_read_pins(minfo); |
1723 | if (minfo->hw_switch->preinit(PMINFO2)) { | 1745 | if (minfo->hw_switch->preinit(minfo)) { |
1724 | goto failVideoIO; | 1746 | goto failVideoIO; |
1725 | } | 1747 | } |
1726 | 1748 | ||
1727 | err = -ENOMEM; | 1749 | err = -ENOMEM; |
1728 | if (!matroxfb_getmemory(PMINFO memsize, &minfo->video.len) || !minfo->video.len) { | 1750 | if (!matroxfb_getmemory(minfo, memsize, &minfo->video.len) || !minfo->video.len) { |
1729 | printk(KERN_ERR "matroxfb: cannot determine memory size\n"); | 1751 | printk(KERN_ERR "matroxfb: cannot determine memory size\n"); |
1730 | goto failVideoIO; | 1752 | goto failVideoIO; |
1731 | } | 1753 | } |
@@ -1745,8 +1767,8 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1745 | 1767 | ||
1746 | if (!minfo->devflags.novga) | 1768 | if (!minfo->devflags.novga) |
1747 | request_region(0x3C0, 32, "matrox"); | 1769 | request_region(0x3C0, 32, "matrox"); |
1748 | matroxfb_g450_connect(PMINFO2); | 1770 | matroxfb_g450_connect(minfo); |
1749 | minfo->hw_switch->reset(PMINFO2); | 1771 | minfo->hw_switch->reset(minfo); |
1750 | 1772 | ||
1751 | minfo->fbcon.monspecs.hfmin = 0; | 1773 | minfo->fbcon.monspecs.hfmin = 0; |
1752 | minfo->fbcon.monspecs.hfmax = fh; | 1774 | minfo->fbcon.monspecs.hfmax = fh; |
@@ -1870,7 +1892,7 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1870 | vesafb_defined.yres_virtual = 65536; /* large enough to be INF, but small enough | 1892 | vesafb_defined.yres_virtual = 65536; /* large enough to be INF, but small enough |
1871 | to yres_virtual * xres_virtual < 2^32 */ | 1893 | to yres_virtual * xres_virtual < 2^32 */ |
1872 | } | 1894 | } |
1873 | matroxfb_init_fix(PMINFO2); | 1895 | matroxfb_init_fix(minfo); |
1874 | minfo->fbcon.screen_base = vaddr_va(minfo->video.vbase); | 1896 | minfo->fbcon.screen_base = vaddr_va(minfo->video.vbase); |
1875 | /* Normalize values (namely yres_virtual) */ | 1897 | /* Normalize values (namely yres_virtual) */ |
1876 | matroxfb_check_var(&vesafb_defined, &minfo->fbcon); | 1898 | matroxfb_check_var(&vesafb_defined, &minfo->fbcon); |
@@ -1910,7 +1932,7 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1910 | 1932 | ||
1911 | return 0; | 1933 | return 0; |
1912 | failVideoIO:; | 1934 | failVideoIO:; |
1913 | matroxfb_g450_shutdown(PMINFO2); | 1935 | matroxfb_g450_shutdown(minfo); |
1914 | mga_iounmap(minfo->video.vbase); | 1936 | mga_iounmap(minfo->video.vbase); |
1915 | failCtrlIO:; | 1937 | failCtrlIO:; |
1916 | mga_iounmap(minfo->mmio.vbase); | 1938 | mga_iounmap(minfo->mmio.vbase); |
@@ -2075,7 +2097,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm | |||
2075 | init_waitqueue_head(&minfo->crtc2.vsync.wait); | 2097 | init_waitqueue_head(&minfo->crtc2.vsync.wait); |
2076 | minfo->crtc1.panpos = -1; | 2098 | minfo->crtc1.panpos = -1; |
2077 | 2099 | ||
2078 | err = initMatrox2(PMINFO b); | 2100 | err = initMatrox2(minfo, b); |
2079 | if (!err) { | 2101 | if (!err) { |
2080 | matroxfb_register_device(minfo); | 2102 | matroxfb_register_device(minfo); |
2081 | return 0; | 2103 | return 0; |
@@ -2088,7 +2110,7 @@ static void pci_remove_matrox(struct pci_dev* pdev) { | |||
2088 | struct matrox_fb_info* minfo; | 2110 | struct matrox_fb_info* minfo; |
2089 | 2111 | ||
2090 | minfo = pci_get_drvdata(pdev); | 2112 | minfo = pci_get_drvdata(pdev); |
2091 | matroxfb_remove(PMINFO 1); | 2113 | matroxfb_remove(minfo, 1); |
2092 | } | 2114 | } |
2093 | 2115 | ||
2094 | static struct pci_device_id matroxfb_devices[] = { | 2116 | static struct pci_device_id matroxfb_devices[] = { |