diff options
Diffstat (limited to 'drivers/video/tridentfb.c')
-rw-r--r-- | drivers/video/tridentfb.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index dfe52b424c97..604b10a590da 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -30,6 +30,7 @@ struct tridentfb_par { | |||
30 | void __iomem *io_virt; /* iospace virtual memory address */ | 30 | void __iomem *io_virt; /* iospace virtual memory address */ |
31 | u32 pseudo_pal[16]; | 31 | u32 pseudo_pal[16]; |
32 | int chip_id; | 32 | int chip_id; |
33 | int flatpanel; | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | static unsigned char eng_oper; /* engine operation... */ | 36 | static unsigned char eng_oper; /* engine operation... */ |
@@ -43,24 +44,22 @@ static struct fb_fix_screeninfo tridentfb_fix = { | |||
43 | .accel = FB_ACCEL_NONE, | 44 | .accel = FB_ACCEL_NONE, |
44 | }; | 45 | }; |
45 | 46 | ||
46 | static int displaytype; | ||
47 | |||
48 | /* defaults which are normally overriden by user values */ | 47 | /* defaults which are normally overriden by user values */ |
49 | 48 | ||
50 | /* video mode */ | 49 | /* video mode */ |
51 | static char *mode_option __devinitdata = "640x480"; | 50 | static char *mode_option __devinitdata = "640x480"; |
52 | static int bpp = 8; | 51 | static int bpp __devinitdata = 8; |
53 | 52 | ||
54 | static int noaccel; | 53 | static int noaccel __devinitdata; |
55 | 54 | ||
56 | static int center; | 55 | static int center; |
57 | static int stretch; | 56 | static int stretch; |
58 | 57 | ||
59 | static int fp; | 58 | static int fp __devinitdata; |
60 | static int crt; | 59 | static int crt __devinitdata; |
61 | 60 | ||
62 | static int memsize; | 61 | static int memsize __devinitdata; |
63 | static int memdiff; | 62 | static int memdiff __devinitdata; |
64 | static int nativex; | 63 | static int nativex; |
65 | 64 | ||
66 | module_param(mode_option, charp, 0); | 65 | module_param(mode_option, charp, 0); |
@@ -75,7 +74,9 @@ module_param(memsize, int, 0); | |||
75 | module_param(memdiff, int, 0); | 74 | module_param(memdiff, int, 0); |
76 | module_param(nativex, int, 0); | 75 | module_param(nativex, int, 0); |
77 | module_param(fp, int, 0); | 76 | module_param(fp, int, 0); |
77 | MODULE_PARM_DESC(fp, "Define if flatpanel is connected"); | ||
78 | module_param(crt, int, 0); | 78 | module_param(crt, int, 0); |
79 | MODULE_PARM_DESC(crt, "Define if CRT is connected"); | ||
79 | 80 | ||
80 | static int is3Dchip(int id) | 81 | static int is3Dchip(int id) |
81 | { | 82 | { |
@@ -728,15 +729,15 @@ static void set_number_of_lines(struct tridentfb_par *par, int lines) | |||
728 | 729 | ||
729 | /* | 730 | /* |
730 | * If we see that FP is active we assume we have one. | 731 | * If we see that FP is active we assume we have one. |
731 | * Otherwise we have a CRT display.User can override. | 732 | * Otherwise we have a CRT display. User can override. |
732 | */ | 733 | */ |
733 | static unsigned int __devinit get_displaytype(struct tridentfb_par *par) | 734 | static int __devinit is_flatpanel(struct tridentfb_par *par) |
734 | { | 735 | { |
735 | if (fp) | 736 | if (fp) |
736 | return DISPLAY_FP; | 737 | return 1; |
737 | if (crt || !iscyber(par->chip_id)) | 738 | if (crt || !iscyber(par->chip_id)) |
738 | return DISPLAY_CRT; | 739 | return 0; |
739 | return (read3CE(par, FPConfig) & 0x10) ? DISPLAY_FP : DISPLAY_CRT; | 740 | return (read3CE(par, FPConfig) & 0x10) ? 1 : 0; |
740 | } | 741 | } |
741 | 742 | ||
742 | /* Try detecting the video memory size */ | 743 | /* Try detecting the video memory size */ |
@@ -824,6 +825,7 @@ static unsigned int __devinit get_memsize(struct tridentfb_par *par) | |||
824 | static int tridentfb_check_var(struct fb_var_screeninfo *var, | 825 | static int tridentfb_check_var(struct fb_var_screeninfo *var, |
825 | struct fb_info *info) | 826 | struct fb_info *info) |
826 | { | 827 | { |
828 | struct tridentfb_par *par = info->par; | ||
827 | int bpp = var->bits_per_pixel; | 829 | int bpp = var->bits_per_pixel; |
828 | debug("enter\n"); | 830 | debug("enter\n"); |
829 | 831 | ||
@@ -831,7 +833,7 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, | |||
831 | if (bpp == 24) | 833 | if (bpp == 24) |
832 | bpp = var->bits_per_pixel = 32; | 834 | bpp = var->bits_per_pixel = 32; |
833 | /* check whether resolution fits on panel and in memory */ | 835 | /* check whether resolution fits on panel and in memory */ |
834 | if (flatpanel && nativex && var->xres > nativex) | 836 | if (par->flatpanel && nativex && var->xres > nativex) |
835 | return -EINVAL; | 837 | return -EINVAL; |
836 | if (var->xres * var->yres_virtual * bpp / 8 > info->fix.smem_len) | 838 | if (var->xres * var->yres_virtual * bpp / 8 > info->fix.smem_len) |
837 | return -EINVAL; | 839 | return -EINVAL; |
@@ -928,7 +930,7 @@ static int tridentfb_set_par(struct fb_info *info) | |||
928 | crtc_unlock(par); | 930 | crtc_unlock(par); |
929 | write3CE(par, CyberControl, 8); | 931 | write3CE(par, CyberControl, 8); |
930 | 932 | ||
931 | if (flatpanel && var->xres < nativex) { | 933 | if (par->flatpanel && var->xres < nativex) { |
932 | /* | 934 | /* |
933 | * on flat panels with native size larger | 935 | * on flat panels with native size larger |
934 | * than requested resolution decide whether | 936 | * than requested resolution decide whether |
@@ -1097,7 +1099,7 @@ static int tridentfb_set_par(struct fb_info *info) | |||
1097 | t_outb(par, tmp, 0x3C6); | 1099 | t_outb(par, tmp, 0x3C6); |
1098 | t_inb(par, 0x3C8); | 1100 | t_inb(par, 0x3C8); |
1099 | 1101 | ||
1100 | if (flatpanel) | 1102 | if (par->flatpanel) |
1101 | set_number_of_lines(par, info->var.yres); | 1103 | set_number_of_lines(par, info->var.yres); |
1102 | set_lwidth(par, info->var.xres * bpp / (4 * 16)); | 1104 | set_lwidth(par, info->var.xres * bpp / (4 * 16)); |
1103 | info->fix.visual = (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | 1105 | info->fix.visual = (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; |
@@ -1153,7 +1155,7 @@ static int tridentfb_blank(int blank_mode, struct fb_info *info) | |||
1153 | struct tridentfb_par *par = info->par; | 1155 | struct tridentfb_par *par = info->par; |
1154 | 1156 | ||
1155 | debug("enter\n"); | 1157 | debug("enter\n"); |
1156 | if (flatpanel) | 1158 | if (par->flatpanel) |
1157 | return 0; | 1159 | return 0; |
1158 | t_outb(par, 0x04, 0x83C8); /* Read DPMS Control */ | 1160 | t_outb(par, 0x04, 0x83C8); /* Read DPMS Control */ |
1159 | PMCont = t_inb(par, 0x83C6) & 0xFC; | 1161 | PMCont = t_inb(par, 0x83C6) & 0xFC; |
@@ -1322,9 +1324,9 @@ static int __devinit trident_pci_probe(struct pci_dev *dev, | |||
1322 | } | 1324 | } |
1323 | 1325 | ||
1324 | output("%s board found\n", pci_name(dev)); | 1326 | output("%s board found\n", pci_name(dev)); |
1325 | displaytype = get_displaytype(default_par); | 1327 | default_par->flatpanel = is_flatpanel(default_par); |
1326 | 1328 | ||
1327 | if (flatpanel) | 1329 | if (default_par->flatpanel) |
1328 | nativex = get_nativex(default_par); | 1330 | nativex = get_nativex(default_par); |
1329 | 1331 | ||
1330 | info->fix = tridentfb_fix; | 1332 | info->fix = tridentfb_fix; |
@@ -1441,9 +1443,9 @@ static int __init tridentfb_setup(char *options) | |||
1441 | if (!strncmp(opt, "noaccel", 7)) | 1443 | if (!strncmp(opt, "noaccel", 7)) |
1442 | noaccel = 1; | 1444 | noaccel = 1; |
1443 | else if (!strncmp(opt, "fp", 2)) | 1445 | else if (!strncmp(opt, "fp", 2)) |
1444 | displaytype = DISPLAY_FP; | 1446 | fp = 1; |
1445 | else if (!strncmp(opt, "crt", 3)) | 1447 | else if (!strncmp(opt, "crt", 3)) |
1446 | displaytype = DISPLAY_CRT; | 1448 | fp = 0; |
1447 | else if (!strncmp(opt, "bpp=", 4)) | 1449 | else if (!strncmp(opt, "bpp=", 4)) |
1448 | bpp = simple_strtoul(opt + 4, NULL, 0); | 1450 | bpp = simple_strtoul(opt + 4, NULL, 0); |
1449 | else if (!strncmp(opt, "center", 6)) | 1451 | else if (!strncmp(opt, "center", 6)) |