aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cyber2000fb.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-10-19 02:40:28 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:42 -0400
commit532237eff1f271302ed923af6d811a699d582bbc (patch)
tree316731f3250acc43ea030ac14041023b9d702864 /drivers/video/cyber2000fb.c
parent87d0613103aa279f8a39a497af09edbb068ef285 (diff)
cyber2000fb: checkpatch fixes
This patch fixes errors and warnings pointed out by the checkpatch.pl script. Antonino Daplas replaced BIT with ENCODE_BIT. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/cyber2000fb.c')
-rw-r--r--drivers/video/cyber2000fb.c208
1 files changed, 105 insertions, 103 deletions
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 5e3edf475bf4..5fb8675e0d6b 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -62,7 +62,7 @@ struct cfb_info {
62 struct display_switch *dispsw; 62 struct display_switch *dispsw;
63 struct display *display; 63 struct display *display;
64 struct pci_dev *dev; 64 struct pci_dev *dev;
65 unsigned char __iomem *region; 65 unsigned char __iomem *region;
66 unsigned char __iomem *regs; 66 unsigned char __iomem *regs;
67 u_int id; 67 u_int id;
68 int func_use_count; 68 int func_use_count;
@@ -97,11 +97,11 @@ MODULE_PARM_DESC(default_font, "Default font name");
97/* 97/*
98 * Our access methods. 98 * Our access methods.
99 */ 99 */
100#define cyber2000fb_writel(val,reg,cfb) writel(val, (cfb)->regs + (reg)) 100#define cyber2000fb_writel(val, reg, cfb) writel(val, (cfb)->regs + (reg))
101#define cyber2000fb_writew(val,reg,cfb) writew(val, (cfb)->regs + (reg)) 101#define cyber2000fb_writew(val, reg, cfb) writew(val, (cfb)->regs + (reg))
102#define cyber2000fb_writeb(val,reg,cfb) writeb(val, (cfb)->regs + (reg)) 102#define cyber2000fb_writeb(val, reg, cfb) writeb(val, (cfb)->regs + (reg))
103 103
104#define cyber2000fb_readb(reg,cfb) readb((cfb)->regs + (reg)) 104#define cyber2000fb_readb(reg, cfb) readb((cfb)->regs + (reg))
105 105
106static inline void 106static inline void
107cyber2000_crtcw(unsigned int reg, unsigned int val, struct cfb_info *cfb) 107cyber2000_crtcw(unsigned int reg, unsigned int val, struct cfb_info *cfb)
@@ -221,12 +221,8 @@ cyber2000fb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
221static void 221static void
222cyber2000fb_imageblit(struct fb_info *info, const struct fb_image *image) 222cyber2000fb_imageblit(struct fb_info *info, const struct fb_image *image)
223{ 223{
224// struct cfb_info *cfb = (struct cfb_info *)info; 224 cfb_imageblit(info, image);
225 225 return;
226// if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) {
227 cfb_imageblit(info, image);
228 return;
229// }
230} 226}
231 227
232static int cyber2000fb_sync(struct fb_info *info) 228static int cyber2000fb_sync(struct fb_info *info)
@@ -277,12 +273,12 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
277 273
278 /* 274 /*
279 * Pseudocolour: 275 * Pseudocolour:
280 * 8 8 276 * 8 8
281 * pixel --/--+--/--> red lut --> red dac 277 * pixel --/--+--/--> red lut --> red dac
282 * | 8 278 * | 8
283 * +--/--> green lut --> green dac 279 * +--/--> green lut --> green dac
284 * | 8 280 * | 8
285 * +--/--> blue lut --> blue dac 281 * +--/--> blue lut --> blue dac
286 */ 282 */
287 case FB_VISUAL_PSEUDOCOLOR: 283 case FB_VISUAL_PSEUDOCOLOR:
288 if (regno >= NR_PALETTE) 284 if (regno >= NR_PALETTE)
@@ -292,9 +288,9 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
292 green >>= 8; 288 green >>= 8;
293 blue >>= 8; 289 blue >>= 8;
294 290
295 cfb->palette[regno].red = red; 291 cfb->palette[regno].red = red;
296 cfb->palette[regno].green = green; 292 cfb->palette[regno].green = green;
297 cfb->palette[regno].blue = blue; 293 cfb->palette[regno].blue = blue;
298 294
299 cyber2000fb_writeb(regno, 0x3c8, cfb); 295 cyber2000fb_writeb(regno, 0x3c8, cfb);
300 cyber2000fb_writeb(red, 0x3c9, cfb); 296 cyber2000fb_writeb(red, 0x3c9, cfb);
@@ -304,12 +300,12 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
304 300
305 /* 301 /*
306 * Direct colour: 302 * Direct colour:
307 * n rl 303 * n rl
308 * pixel --/--+--/--> red lut --> red dac 304 * pixel --/--+--/--> red lut --> red dac
309 * | gl 305 * | gl
310 * +--/--> green lut --> green dac 306 * +--/--> green lut --> green dac
311 * | bl 307 * | bl
312 * +--/--> blue lut --> blue dac 308 * +--/--> blue lut --> blue dac
313 * n = bpp, rl = red length, gl = green length, bl = blue length 309 * n = bpp, rl = red length, gl = green length, bl = blue length
314 */ 310 */
315 case FB_VISUAL_DIRECTCOLOR: 311 case FB_VISUAL_DIRECTCOLOR:
@@ -325,9 +321,11 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
325 * to the high 6 bits of the LUT. 321 * to the high 6 bits of the LUT.
326 */ 322 */
327 cyber2000fb_writeb(regno << 2, 0x3c8, cfb); 323 cyber2000fb_writeb(regno << 2, 0x3c8, cfb);
328 cyber2000fb_writeb(cfb->palette[regno >> 1].red, 0x3c9, cfb); 324 cyber2000fb_writeb(cfb->palette[regno >> 1].red,
325 0x3c9, cfb);
329 cyber2000fb_writeb(green, 0x3c9, cfb); 326 cyber2000fb_writeb(green, 0x3c9, cfb);
330 cyber2000fb_writeb(cfb->palette[regno >> 1].blue, 0x3c9, cfb); 327 cyber2000fb_writeb(cfb->palette[regno >> 1].blue,
328 0x3c9, cfb);
331 329
332 green = cfb->palette[regno << 3].green; 330 green = cfb->palette[regno << 3].green;
333 331
@@ -335,9 +333,9 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
335 } 333 }
336 334
337 if (var->green.length >= 5 && regno < 32) { 335 if (var->green.length >= 5 && regno < 32) {
338 cfb->palette[regno << 3].red = red; 336 cfb->palette[regno << 3].red = red;
339 cfb->palette[regno << 3].green = green; 337 cfb->palette[regno << 3].green = green;
340 cfb->palette[regno << 3].blue = blue; 338 cfb->palette[regno << 3].blue = blue;
341 339
342 /* 340 /*
343 * The 5 bits of each colour component are 341 * The 5 bits of each colour component are
@@ -351,9 +349,9 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
351 } 349 }
352 350
353 if (var->green.length == 4 && regno < 16) { 351 if (var->green.length == 4 && regno < 16) {
354 cfb->palette[regno << 4].red = red; 352 cfb->palette[regno << 4].red = red;
355 cfb->palette[regno << 4].green = green; 353 cfb->palette[regno << 4].green = green;
356 cfb->palette[regno << 4].blue = blue; 354 cfb->palette[regno << 4].blue = blue;
357 355
358 /* 356 /*
359 * The 5 bits of each colour component are 357 * The 5 bits of each colour component are
@@ -377,12 +375,12 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
377 375
378 /* 376 /*
379 * True colour: 377 * True colour:
380 * n rl 378 * n rl
381 * pixel --/--+--/--> red dac 379 * pixel --/--+--/--> red dac
382 * | gl 380 * | gl
383 * +--/--> green dac 381 * +--/--> green dac
384 * | bl 382 * | bl
385 * +--/--> blue dac 383 * +--/--> blue dac
386 * n = bpp, rl = red length, gl = green length, bl = blue length 384 * n = bpp, rl = red length, gl = green length, bl = blue length
387 */ 385 */
388 case FB_VISUAL_TRUECOLOR: 386 case FB_VISUAL_TRUECOLOR:
@@ -494,9 +492,9 @@ static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw)
494 492
495 /* PLL registers */ 493 /* PLL registers */
496 cyber2000_grphw(EXT_DCLK_MULT, hw->clock_mult, cfb); 494 cyber2000_grphw(EXT_DCLK_MULT, hw->clock_mult, cfb);
497 cyber2000_grphw(EXT_DCLK_DIV, hw->clock_div, cfb); 495 cyber2000_grphw(EXT_DCLK_DIV, hw->clock_div, cfb);
498 cyber2000_grphw(EXT_MCLK_MULT, cfb->mclk_mult, cfb); 496 cyber2000_grphw(EXT_MCLK_MULT, cfb->mclk_mult, cfb);
499 cyber2000_grphw(EXT_MCLK_DIV, cfb->mclk_div, cfb); 497 cyber2000_grphw(EXT_MCLK_DIV, cfb->mclk_div, cfb);
500 cyber2000_grphw(0x90, 0x01, cfb); 498 cyber2000_grphw(0x90, 0x01, cfb);
501 cyber2000_grphw(0xb9, 0x80, cfb); 499 cyber2000_grphw(0xb9, 0x80, cfb);
502 cyber2000_grphw(0xb9, 0x00, cfb); 500 cyber2000_grphw(0xb9, 0x00, cfb);
@@ -515,8 +513,8 @@ static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw)
515 /* 513 /*
516 * Set up accelerator registers 514 * Set up accelerator registers
517 */ 515 */
518 cyber2000fb_writew(hw->width, CO_REG_SRC_WIDTH, cfb); 516 cyber2000fb_writew(hw->width, CO_REG_SRC_WIDTH, cfb);
519 cyber2000fb_writew(hw->width, CO_REG_DEST_WIDTH, cfb); 517 cyber2000fb_writew(hw->width, CO_REG_DEST_WIDTH, cfb);
520 cyber2000fb_writeb(hw->co_pixfmt, CO_REG_PIXFMT, cfb); 518 cyber2000fb_writeb(hw->co_pixfmt, CO_REG_PIXFMT, cfb);
521} 519}
522 520
@@ -549,15 +547,15 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
549{ 547{
550 u_int Htotal, Hblankend, Hsyncend; 548 u_int Htotal, Hblankend, Hsyncend;
551 u_int Vtotal, Vdispend, Vblankstart, Vblankend, Vsyncstart, Vsyncend; 549 u_int Vtotal, Vdispend, Vblankstart, Vblankend, Vsyncstart, Vsyncend;
552#define ENCODE_BIT(v,b1,m,b2) (((v >> b1) & m) << b2) 550#define ENCODE_BIT(v, b1, m, b2) ((((v) >> (b1)) & (m)) << (b2))
553 551
554 hw->crtc[13] = hw->pitch; 552 hw->crtc[13] = hw->pitch;
555 hw->crtc[17] = 0xe3; 553 hw->crtc[17] = 0xe3;
556 hw->crtc[14] = 0; 554 hw->crtc[14] = 0;
557 hw->crtc[8] = 0; 555 hw->crtc[8] = 0;
558 556
559 Htotal = var->xres + var->right_margin + 557 Htotal = var->xres + var->right_margin +
560 var->hsync_len + var->left_margin; 558 var->hsync_len + var->left_margin;
561 559
562 if (Htotal > 2080) 560 if (Htotal > 2080)
563 return -EINVAL; 561 return -EINVAL;
@@ -567,7 +565,7 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
567 hw->crtc[2] = var->xres >> 3; 565 hw->crtc[2] = var->xres >> 3;
568 hw->crtc[4] = (var->xres + var->right_margin) >> 3; 566 hw->crtc[4] = (var->xres + var->right_margin) >> 3;
569 567
570 Hblankend = (Htotal - 4*8) >> 3; 568 Hblankend = (Htotal - 4 * 8) >> 3;
571 569
572 hw->crtc[3] = ENCODE_BIT(Hblankend, 0, 0x1f, 0) | 570 hw->crtc[3] = ENCODE_BIT(Hblankend, 0, 0x1f, 0) |
573 ENCODE_BIT(1, 0, 0x01, 7); 571 ENCODE_BIT(1, 0, 0x01, 7);
@@ -593,13 +591,13 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
593 hw->crtc[7] = ENCODE_BIT(Vtotal, 8, 0x01, 0) | 591 hw->crtc[7] = ENCODE_BIT(Vtotal, 8, 0x01, 0) |
594 ENCODE_BIT(Vdispend, 8, 0x01, 1) | 592 ENCODE_BIT(Vdispend, 8, 0x01, 1) |
595 ENCODE_BIT(Vsyncstart, 8, 0x01, 2) | 593 ENCODE_BIT(Vsyncstart, 8, 0x01, 2) |
596 ENCODE_BIT(Vblankstart,8, 0x01, 3) | 594 ENCODE_BIT(Vblankstart, 8, 0x01, 3) |
597 ENCODE_BIT(1, 0, 0x01, 4) | 595 ENCODE_BIT(1, 0, 0x01, 4) |
598 ENCODE_BIT(Vtotal, 9, 0x01, 5) | 596 ENCODE_BIT(Vtotal, 9, 0x01, 5) |
599 ENCODE_BIT(Vdispend, 9, 0x01, 6) | 597 ENCODE_BIT(Vdispend, 9, 0x01, 6) |
600 ENCODE_BIT(Vsyncstart, 9, 0x01, 7); 598 ENCODE_BIT(Vsyncstart, 9, 0x01, 7);
601 hw->crtc[9] = ENCODE_BIT(0, 0, 0x1f, 0) | 599 hw->crtc[9] = ENCODE_BIT(0, 0, 0x1f, 0) |
602 ENCODE_BIT(Vblankstart,9, 0x01, 5) | 600 ENCODE_BIT(Vblankstart, 9, 0x01, 5) |
603 ENCODE_BIT(1, 0, 0x01, 6); 601 ENCODE_BIT(1, 0, 0x01, 6);
604 hw->crtc[10] = Vsyncstart; 602 hw->crtc[10] = Vsyncstart;
605 hw->crtc[11] = ENCODE_BIT(Vsyncend, 0, 0x0f, 0) | 603 hw->crtc[11] = ENCODE_BIT(Vsyncend, 0, 0x0f, 0) |
@@ -615,10 +613,10 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
615 * 4=LINECOMP:10 5-IVIDEO 6=FIXCNT 613 * 4=LINECOMP:10 5-IVIDEO 6=FIXCNT
616 */ 614 */
617 hw->crtc_ofl = 615 hw->crtc_ofl =
618 ENCODE_BIT(Vtotal, 10, 0x01, 0) | 616 ENCODE_BIT(Vtotal, 10, 0x01, 0) |
619 ENCODE_BIT(Vdispend, 10, 0x01, 1) | 617 ENCODE_BIT(Vdispend, 10, 0x01, 1) |
620 ENCODE_BIT(Vsyncstart, 10, 0x01, 2) | 618 ENCODE_BIT(Vsyncstart, 10, 0x01, 2) |
621 ENCODE_BIT(Vblankstart,10, 0x01, 3) | 619 ENCODE_BIT(Vblankstart, 10, 0x01, 3) |
622 EXT_CRT_VRTOFL_LINECOMP10; 620 EXT_CRT_VRTOFL_LINECOMP10;
623 621
624 /* woody: set the interlaced bit... */ 622 /* woody: set the interlaced bit... */
@@ -750,11 +748,11 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
750 var->red.msb_right = 0; 748 var->red.msb_right = 0;
751 var->green.msb_right = 0; 749 var->green.msb_right = 0;
752 var->blue.msb_right = 0; 750 var->blue.msb_right = 0;
751 var->transp.offset = 0;
752 var->transp.length = 0;
753 753
754 switch (var->bits_per_pixel) { 754 switch (var->bits_per_pixel) {
755 case 8: /* PSEUDOCOLOUR, 256 */ 755 case 8: /* PSEUDOCOLOUR, 256 */
756 var->transp.offset = 0;
757 var->transp.length = 0;
758 var->red.offset = 0; 756 var->red.offset = 0;
759 var->red.length = 8; 757 var->red.length = 8;
760 var->green.offset = 0; 758 var->green.offset = 0;
@@ -766,8 +764,6 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
766 case 16:/* DIRECTCOLOUR, 64k or 32k */ 764 case 16:/* DIRECTCOLOUR, 64k or 32k */
767 switch (var->green.length) { 765 switch (var->green.length) {
768 case 6: /* RGB565, 64k */ 766 case 6: /* RGB565, 64k */
769 var->transp.offset = 0;
770 var->transp.length = 0;
771 var->red.offset = 11; 767 var->red.offset = 11;
772 var->red.length = 5; 768 var->red.length = 5;
773 var->green.offset = 5; 769 var->green.offset = 5;
@@ -778,8 +774,6 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
778 774
779 default: 775 default:
780 case 5: /* RGB555, 32k */ 776 case 5: /* RGB555, 32k */
781 var->transp.offset = 0;
782 var->transp.length = 0;
783 var->red.offset = 10; 777 var->red.offset = 10;
784 var->red.length = 5; 778 var->red.length = 5;
785 var->green.offset = 5; 779 var->green.offset = 5;
@@ -802,8 +796,6 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
802 break; 796 break;
803 797
804 case 24:/* TRUECOLOUR, 16m */ 798 case 24:/* TRUECOLOUR, 16m */
805 var->transp.offset = 0;
806 var->transp.length = 0;
807 var->red.offset = 16; 799 var->red.offset = 16;
808 var->red.length = 8; 800 var->red.length = 8;
809 var->green.offset = 8; 801 var->green.offset = 8;
@@ -830,7 +822,7 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
830 mem = var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8); 822 mem = var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8);
831 if (mem > cfb->fb.fix.smem_len) 823 if (mem > cfb->fb.fix.smem_len)
832 var->yres_virtual = cfb->fb.fix.smem_len * 8 / 824 var->yres_virtual = cfb->fb.fix.smem_len * 8 /
833 (var->bits_per_pixel * var->xres_virtual); 825 (var->bits_per_pixel * var->xres_virtual);
834 826
835 if (var->yres > var->yres_virtual) 827 if (var->yres > var->yres_virtual)
836 var->yres = var->yres_virtual; 828 var->yres = var->yres_virtual;
@@ -921,7 +913,7 @@ static int cyber2000fb_set_par(struct fb_info *info)
921 hw.fetch <<= 1; 913 hw.fetch <<= 1;
922 hw.fetch += 1; 914 hw.fetch += 1;
923 915
924 cfb->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8; 916 cfb->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8;
925 917
926 /* 918 /*
927 * Same here - if the size of the video mode exceeds the 919 * Same here - if the size of the video mode exceeds the
@@ -952,7 +944,6 @@ static int cyber2000fb_set_par(struct fb_info *info)
952 return 0; 944 return 0;
953} 945}
954 946
955
956/* 947/*
957 * Pan or Wrap the Display 948 * Pan or Wrap the Display
958 */ 949 */
@@ -1002,15 +993,15 @@ static int cyber2000fb_blank(int blank, struct fb_info *info)
1002 switch (blank) { 993 switch (blank) {
1003 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */ 994 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */
1004 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_0; 995 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_0;
1005 break; 996 break;
1006 case FB_BLANK_HSYNC_SUSPEND: /* hsync off */ 997 case FB_BLANK_HSYNC_SUSPEND: /* hsync off */
1007 sync = EXT_SYNC_CTL_VS_NORMAL | EXT_SYNC_CTL_HS_0; 998 sync = EXT_SYNC_CTL_VS_NORMAL | EXT_SYNC_CTL_HS_0;
1008 break; 999 break;
1009 case FB_BLANK_VSYNC_SUSPEND: /* vsync off */ 1000 case FB_BLANK_VSYNC_SUSPEND: /* vsync off */
1010 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_NORMAL; 1001 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_NORMAL;
1011 break; 1002 break;
1012 case FB_BLANK_NORMAL: /* soft blank */ 1003 case FB_BLANK_NORMAL: /* soft blank */
1013 default: /* unblank */ 1004 default: /* unblank */
1014 break; 1005 break;
1015 } 1006 }
1016 1007
@@ -1018,7 +1009,8 @@ static int cyber2000fb_blank(int blank, struct fb_info *info)
1018 1009
1019 if (blank <= 1) { 1010 if (blank <= 1) {
1020 /* turn on ramdacs */ 1011 /* turn on ramdacs */
1021 cfb->ramdac_powerdown &= ~(RAMDAC_DACPWRDN | RAMDAC_BYPASS | RAMDAC_RAMPWRDN); 1012 cfb->ramdac_powerdown &= ~(RAMDAC_DACPWRDN | RAMDAC_BYPASS |
1013 RAMDAC_RAMPWRDN);
1022 cyber2000fb_write_ramdac_ctrl(cfb); 1014 cyber2000fb_write_ramdac_ctrl(cfb);
1023 } 1015 }
1024 1016
@@ -1043,7 +1035,8 @@ static int cyber2000fb_blank(int blank, struct fb_info *info)
1043 1035
1044 if (blank >= 2) { 1036 if (blank >= 2) {
1045 /* turn off ramdacs */ 1037 /* turn off ramdacs */
1046 cfb->ramdac_powerdown |= RAMDAC_DACPWRDN | RAMDAC_BYPASS | RAMDAC_RAMPWRDN; 1038 cfb->ramdac_powerdown |= RAMDAC_DACPWRDN | RAMDAC_BYPASS |
1039 RAMDAC_RAMPWRDN;
1047 cyber2000fb_write_ramdac_ctrl(cfb); 1040 cyber2000fb_write_ramdac_ctrl(cfb);
1048 } 1041 }
1049 1042
@@ -1068,7 +1061,7 @@ static struct fb_ops cyber2000fb_ops = {
1068 * of this driver. It is here solely at the moment to support the other 1061 * of this driver. It is here solely at the moment to support the other
1069 * CyberPro modules external to this driver. 1062 * CyberPro modules external to this driver.
1070 */ 1063 */
1071static struct cfb_info *int_cfb_info; 1064static struct cfb_info *int_cfb_info;
1072 1065
1073/* 1066/*
1074 * Enable access to the extended registers 1067 * Enable access to the extended registers
@@ -1085,6 +1078,7 @@ void cyber2000fb_enable_extregs(struct cfb_info *cfb)
1085 cyber2000_grphw(EXT_FUNC_CTL, old, cfb); 1078 cyber2000_grphw(EXT_FUNC_CTL, old, cfb);
1086 } 1079 }
1087} 1080}
1081EXPORT_SYMBOL(cyber2000fb_enable_extregs);
1088 1082
1089/* 1083/*
1090 * Disable access to the extended registers 1084 * Disable access to the extended registers
@@ -1104,11 +1098,13 @@ void cyber2000fb_disable_extregs(struct cfb_info *cfb)
1104 else 1098 else
1105 cfb->func_use_count -= 1; 1099 cfb->func_use_count -= 1;
1106} 1100}
1101EXPORT_SYMBOL(cyber2000fb_disable_extregs);
1107 1102
1108void cyber2000fb_get_fb_var(struct cfb_info *cfb, struct fb_var_screeninfo *var) 1103void cyber2000fb_get_fb_var(struct cfb_info *cfb, struct fb_var_screeninfo *var)
1109{ 1104{
1110 memcpy(var, &cfb->fb.var, sizeof(struct fb_var_screeninfo)); 1105 memcpy(var, &cfb->fb.var, sizeof(struct fb_var_screeninfo));
1111} 1106}
1107EXPORT_SYMBOL(cyber2000fb_get_fb_var);
1112 1108
1113/* 1109/*
1114 * Attach a capture/tv driver to the core CyberX0X0 driver. 1110 * Attach a capture/tv driver to the core CyberX0X0 driver.
@@ -1122,13 +1118,15 @@ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
1122 info->fb_size = int_cfb_info->fb.fix.smem_len; 1118 info->fb_size = int_cfb_info->fb.fix.smem_len;
1123 info->enable_extregs = cyber2000fb_enable_extregs; 1119 info->enable_extregs = cyber2000fb_enable_extregs;
1124 info->disable_extregs = cyber2000fb_disable_extregs; 1120 info->disable_extregs = cyber2000fb_disable_extregs;
1125 info->info = int_cfb_info; 1121 info->info = int_cfb_info;
1126 1122
1127 strlcpy(info->dev_name, int_cfb_info->fb.fix.id, sizeof(info->dev_name)); 1123 strlcpy(info->dev_name, int_cfb_info->fb.fix.id,
1124 sizeof(info->dev_name));
1128 } 1125 }
1129 1126
1130 return int_cfb_info != NULL; 1127 return int_cfb_info != NULL;
1131} 1128}
1129EXPORT_SYMBOL(cyber2000fb_attach);
1132 1130
1133/* 1131/*
1134 * Detach a capture/tv driver from the core CyberX0X0 driver. 1132 * Detach a capture/tv driver from the core CyberX0X0 driver.
@@ -1136,12 +1134,7 @@ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
1136void cyber2000fb_detach(int idx) 1134void cyber2000fb_detach(int idx)
1137{ 1135{
1138} 1136}
1139
1140EXPORT_SYMBOL(cyber2000fb_attach);
1141EXPORT_SYMBOL(cyber2000fb_detach); 1137EXPORT_SYMBOL(cyber2000fb_detach);
1142EXPORT_SYMBOL(cyber2000fb_enable_extregs);
1143EXPORT_SYMBOL(cyber2000fb_disable_extregs);
1144EXPORT_SYMBOL(cyber2000fb_get_fb_var);
1145 1138
1146/* 1139/*
1147 * These parameters give 1140 * These parameters give
@@ -1205,7 +1198,7 @@ static void cyberpro_init_hw(struct cfb_info *cfb)
1205 int i; 1198 int i;
1206 1199
1207 for (i = 0; i < sizeof(igs_regs); i += 2) 1200 for (i = 0; i < sizeof(igs_regs); i += 2)
1208 cyber2000_grphw(igs_regs[i], igs_regs[i+1], cfb); 1201 cyber2000_grphw(igs_regs[i], igs_regs[i + 1], cfb);
1209 1202
1210 if (cfb->id == ID_CYBERPRO_5000) { 1203 if (cfb->id == ID_CYBERPRO_5000) {
1211 unsigned char val; 1204 unsigned char val;
@@ -1215,8 +1208,8 @@ static void cyberpro_init_hw(struct cfb_info *cfb)
1215 } 1208 }
1216} 1209}
1217 1210
1218static struct cfb_info * __devinit 1211static struct cfb_info __devinit *cyberpro_alloc_fb_info(unsigned int id,
1219cyberpro_alloc_fb_info(unsigned int id, char *name) 1212 char *name)
1220{ 1213{
1221 struct cfb_info *cfb; 1214 struct cfb_info *cfb;
1222 1215
@@ -1228,9 +1221,9 @@ cyberpro_alloc_fb_info(unsigned int id, char *name)
1228 cfb->id = id; 1221 cfb->id = id;
1229 1222
1230 if (id == ID_CYBERPRO_5000) 1223 if (id == ID_CYBERPRO_5000)
1231 cfb->ref_ps = 40690; // 24.576 MHz 1224 cfb->ref_ps = 40690; /* 24.576 MHz */
1232 else 1225 else
1233 cfb->ref_ps = 69842; // 14.31818 MHz (69841?) 1226 cfb->ref_ps = 69842; /* 14.31818 MHz (69841?) */
1234 1227
1235 cfb->divisors[0] = 1; 1228 cfb->divisors[0] = 1;
1236 cfb->divisors[1] = 2; 1229 cfb->divisors[1] = 2;
@@ -1282,8 +1275,7 @@ cyberpro_alloc_fb_info(unsigned int id, char *name)
1282 return cfb; 1275 return cfb;
1283} 1276}
1284 1277
1285static void 1278static void cyberpro_free_fb_info(struct cfb_info *cfb)
1286cyberpro_free_fb_info(struct cfb_info *cfb)
1287{ 1279{
1288 if (cfb) { 1280 if (cfb) {
1289 /* 1281 /*
@@ -1300,8 +1292,7 @@ cyberpro_free_fb_info(struct cfb_info *cfb)
1300 * video=cyber2000:font:fontname 1292 * video=cyber2000:font:fontname
1301 */ 1293 */
1302#ifndef MODULE 1294#ifndef MODULE
1303static int 1295static int cyber2000fb_setup(char *options)
1304cyber2000fb_setup(char *options)
1305{ 1296{
1306 char *opt; 1297 char *opt;
1307 1298
@@ -1315,7 +1306,8 @@ cyber2000fb_setup(char *options)
1315 if (strncmp(opt, "font:", 5) == 0) { 1306 if (strncmp(opt, "font:", 5) == 0) {
1316 static char default_font_storage[40]; 1307 static char default_font_storage[40];
1317 1308
1318 strlcpy(default_font_storage, opt + 5, sizeof(default_font_storage)); 1309 strlcpy(default_font_storage, opt + 5,
1310 sizeof(default_font_storage));
1319 default_font = default_font_storage; 1311 default_font = default_font_storage;
1320 continue; 1312 continue;
1321 } 1313 }
@@ -1354,10 +1346,18 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1354 * Determine the size of the memory. 1346 * Determine the size of the memory.
1355 */ 1347 */
1356 switch (cfb->mem_ctl2 & MEM_CTL2_SIZE_MASK) { 1348 switch (cfb->mem_ctl2 & MEM_CTL2_SIZE_MASK) {
1357 case MEM_CTL2_SIZE_4MB: smem_size = 0x00400000; break; 1349 case MEM_CTL2_SIZE_4MB:
1358 case MEM_CTL2_SIZE_2MB: smem_size = 0x00200000; break; 1350 smem_size = 0x00400000;
1359 case MEM_CTL2_SIZE_1MB: smem_size = 0x00100000; break; 1351 break;
1360 default: smem_size = 0x00100000; break; 1352 case MEM_CTL2_SIZE_2MB:
1353 smem_size = 0x00200000;
1354 break;
1355 case MEM_CTL2_SIZE_1MB:
1356 smem_size = 0x00100000;
1357 break;
1358 default:
1359 smem_size = 0x00100000;
1360 break;
1361 } 1361 }
1362 1362
1363 cfb->fb.fix.smem_len = smem_size; 1363 cfb->fb.fix.smem_len = smem_size;
@@ -1366,8 +1366,8 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1366 1366
1367 err = -EINVAL; 1367 err = -EINVAL;
1368 if (!fb_find_mode(&cfb->fb.var, &cfb->fb, NULL, NULL, 0, 1368 if (!fb_find_mode(&cfb->fb.var, &cfb->fb, NULL, NULL, 0,
1369 &cyber2000fb_default_mode, 8)) { 1369 &cyber2000fb_default_mode, 8)) {
1370 printk("%s: no valid mode found\n", cfb->fb.fix.id); 1370 printk(KERN_ERR "%s: no valid mode found\n", cfb->fb.fix.id);
1371 goto failed; 1371 goto failed;
1372 } 1372 }
1373 1373
@@ -1377,7 +1377,7 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1377 if (cfb->fb.var.yres_virtual < cfb->fb.var.yres) 1377 if (cfb->fb.var.yres_virtual < cfb->fb.var.yres)
1378 cfb->fb.var.yres_virtual = cfb->fb.var.yres; 1378 cfb->fb.var.yres_virtual = cfb->fb.var.yres;
1379 1379
1380// fb_set_var(&cfb->fb.var, -1, &cfb->fb); 1380/* fb_set_var(&cfb->fb.var, -1, &cfb->fb); */
1381 1381
1382 /* 1382 /*
1383 * Calculate the hsync and vsync frequencies. Note that 1383 * Calculate the hsync and vsync frequencies. Note that
@@ -1425,20 +1425,20 @@ static void cyberpro_common_resume(struct cfb_info *cfb)
1425 1425
1426#include <asm/arch/hardware.h> 1426#include <asm/arch/hardware.h>
1427 1427
1428static int __devinit 1428static int __devinit cyberpro_vl_probe(void)
1429cyberpro_vl_probe(void)
1430{ 1429{
1431 struct cfb_info *cfb; 1430 struct cfb_info *cfb;
1432 int err = -ENOMEM; 1431 int err = -ENOMEM;
1433 1432
1434 if (!request_mem_region(FB_START,FB_SIZE,"CyberPro2010")) return err; 1433 if (!request_mem_region(FB_START, FB_SIZE, "CyberPro2010"))
1434 return err;
1435 1435
1436 cfb = cyberpro_alloc_fb_info(ID_CYBERPRO_2010, "CyberPro2010"); 1436 cfb = cyberpro_alloc_fb_info(ID_CYBERPRO_2010, "CyberPro2010");
1437 if (!cfb) 1437 if (!cfb)
1438 goto failed_release; 1438 goto failed_release;
1439 1439
1440 cfb->dev = NULL; 1440 cfb->dev = NULL;
1441 cfb->region = ioremap(FB_START,FB_SIZE); 1441 cfb->region = ioremap(FB_START, FB_SIZE);
1442 if (!cfb->region) 1442 if (!cfb->region)
1443 goto failed_ioremap; 1443 goto failed_ioremap;
1444 1444
@@ -1475,7 +1475,7 @@ failed:
1475failed_ioremap: 1475failed_ioremap:
1476 cyberpro_free_fb_info(cfb); 1476 cyberpro_free_fb_info(cfb);
1477failed_release: 1477failed_release:
1478 release_mem_region(FB_START,FB_SIZE); 1478 release_mem_region(FB_START, FB_SIZE);
1479 1479
1480 return err; 1480 return err;
1481} 1481}
@@ -1538,7 +1538,8 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1538 * Allow the CyberPro to accept PCI burst accesses 1538 * Allow the CyberPro to accept PCI burst accesses
1539 */ 1539 */
1540 if (cfb->id == ID_CYBERPRO_2010) { 1540 if (cfb->id == ID_CYBERPRO_2010) {
1541 printk(KERN_INFO "%s: NOT enabling PCI bursts\n", cfb->fb.fix.id); 1541 printk(KERN_INFO "%s: NOT enabling PCI bursts\n",
1542 cfb->fb.fix.id);
1542 } else { 1543 } else {
1543 val = cyber2000_grphr(EXT_BUS_CTL, cfb); 1544 val = cyber2000_grphr(EXT_BUS_CTL, cfb);
1544 if (!(val & EXT_BUS_CTL_PCIBURST_WRITE)) { 1545 if (!(val & EXT_BUS_CTL_PCIBURST_WRITE)) {
@@ -1688,9 +1689,10 @@ static int cyberpro_pci_resume(struct pci_dev *dev)
1688} 1689}
1689 1690
1690static struct pci_device_id cyberpro_pci_table[] = { 1691static struct pci_device_id cyberpro_pci_table[] = {
1691// Not yet 1692/* Not yet
1692// { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682, 1693 * { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
1693// PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 }, 1694 * PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
1695 */
1694 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000, 1696 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000,
1695 PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 }, 1697 PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 },
1696 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010, 1698 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010,
@@ -1700,7 +1702,7 @@ static struct pci_device_id cyberpro_pci_table[] = {
1700 { 0, } 1702 { 0, }
1701}; 1703};
1702 1704
1703MODULE_DEVICE_TABLE(pci,cyberpro_pci_table); 1705MODULE_DEVICE_TABLE(pci, cyberpro_pci_table);
1704 1706
1705static struct pci_driver cyberpro_driver = { 1707static struct pci_driver cyberpro_driver = {
1706 .name = "CyberPro", 1708 .name = "CyberPro",