aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tridentfb.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-24 00:30:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:35 -0400
commit6eed8e1ec8532a6cd10c8b27236bde023c52c56a (patch)
treed992c96807c7e2e25666d09a154316241ba6de8f /drivers/video/tridentfb.c
parent122e8ad3cbf172043ea93f2db8e107fa9f9b0192 (diff)
tridentfb: move global flat panel variable into structure
This patch moves flat panel indicator into tridentfb_par structure and removes related global variables and macros. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/tridentfb.c')
-rw-r--r--drivers/video/tridentfb.c44
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
35static unsigned char eng_oper; /* engine operation... */ 36static 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
46static 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 */
51static char *mode_option __devinitdata = "640x480"; 50static char *mode_option __devinitdata = "640x480";
52static int bpp = 8; 51static int bpp __devinitdata = 8;
53 52
54static int noaccel; 53static int noaccel __devinitdata;
55 54
56static int center; 55static int center;
57static int stretch; 56static int stretch;
58 57
59static int fp; 58static int fp __devinitdata;
60static int crt; 59static int crt __devinitdata;
61 60
62static int memsize; 61static int memsize __devinitdata;
63static int memdiff; 62static int memdiff __devinitdata;
64static int nativex; 63static int nativex;
65 64
66module_param(mode_option, charp, 0); 65module_param(mode_option, charp, 0);
@@ -75,7 +74,9 @@ module_param(memsize, int, 0);
75module_param(memdiff, int, 0); 74module_param(memdiff, int, 0);
76module_param(nativex, int, 0); 75module_param(nativex, int, 0);
77module_param(fp, int, 0); 76module_param(fp, int, 0);
77MODULE_PARM_DESC(fp, "Define if flatpanel is connected");
78module_param(crt, int, 0); 78module_param(crt, int, 0);
79MODULE_PARM_DESC(crt, "Define if CRT is connected");
79 80
80static int is3Dchip(int id) 81static 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 */
733static unsigned int __devinit get_displaytype(struct tridentfb_par *par) 734static 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)
824static int tridentfb_check_var(struct fb_var_screeninfo *var, 825static 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))