aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig23
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/aty/atyfb.h6
-rw-r--r--drivers/video/aty/atyfb_base.c11
-rw-r--r--drivers/video/aty/mach64_ct.c2
-rw-r--r--drivers/video/aty/radeon_i2c.c106
-rw-r--r--drivers/video/aty/radeon_pm.c3
-rw-r--r--drivers/video/au1100fb.c30
-rw-r--r--drivers/video/console/fbcon.c54
-rw-r--r--drivers/video/console/fbcon.h2
-rw-r--r--drivers/video/console/fbcon_ccw.c2
-rw-r--r--drivers/video/console/fbcon_cw.c2
-rw-r--r--drivers/video/console/fbcon_ud.c2
-rw-r--r--drivers/video/console/softcursor.c31
-rw-r--r--drivers/video/fb_ddc.c116
-rw-r--r--drivers/video/fbmem.c3
-rw-r--r--drivers/video/fbsysfs.c35
-rw-r--r--drivers/video/i810/i810-i2c.c42
-rw-r--r--drivers/video/i810/i810_main.c6
-rw-r--r--drivers/video/matrox/matroxfb_base.c12
-rw-r--r--drivers/video/mbx/mbxfb.c21
-rw-r--r--drivers/video/nvidia/nv_i2c.c45
-rw-r--r--drivers/video/nvidia/nvidia.c16
-rw-r--r--drivers/video/pxafb.c106
-rw-r--r--drivers/video/pxafb.h4
-rw-r--r--drivers/video/riva/fbdev.c10
-rw-r--r--drivers/video/riva/rivafb-i2c.c44
-rw-r--r--drivers/video/s3c2410fb.h2
-rw-r--r--drivers/video/savage/savagefb-i2c.c49
-rw-r--r--drivers/video/sis/init.h7
-rw-r--r--drivers/video/sis/init301.h7
-rw-r--r--drivers/video/sis/initextlfb.c4
-rw-r--r--drivers/video/sis/osdef.h4
-rw-r--r--drivers/video/sis/sis_accel.c26
-rw-r--r--drivers/video/sis/sis_accel.h14
-rw-r--r--drivers/video/sis/sis_main.c232
-rw-r--r--drivers/video/sis/sis_main.h65
-rw-r--r--drivers/video/sis/vgatypes.h2
-rw-r--r--drivers/video/sstfb.c170
39 files changed, 472 insertions, 845 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e0ef3328942c..daaa486159cf 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -53,6 +53,11 @@ config FB
53 (e.g. an accelerated X server) and that are not frame buffer 53 (e.g. an accelerated X server) and that are not frame buffer
54 device-aware may cause unexpected results. If unsure, say N. 54 device-aware may cause unexpected results. If unsure, say N.
55 55
56config FB_DDC
57 tristate
58 depends on FB && I2C && I2C_ALGOBIT
59 default n
60
56config FB_CFB_FILLRECT 61config FB_CFB_FILLRECT
57 tristate 62 tristate
58 depends on FB 63 depends on FB
@@ -183,7 +188,7 @@ config FB_ARMCLCD_SHARP_LQ035Q7DB02_HRTFT
183 bool "LogicPD LCD 3.5\" QVGA w/HRTFT IC" 188 bool "LogicPD LCD 3.5\" QVGA w/HRTFT IC"
184 help 189 help
185 This is an implementation of the Sharp LQ035Q7DB02, a 3.5" 190 This is an implementation of the Sharp LQ035Q7DB02, a 3.5"
186 color QVGA, HRTFT panel. The LogicPD device includes an 191 color QVGA, HRTFT panel. The LogicPD device includes
187 an integrated HRTFT controller IC. 192 an integrated HRTFT controller IC.
188 The native resolution is 240x320. 193 The native resolution is 240x320.
189 194
@@ -398,7 +403,7 @@ config FB_ARC
398 is based on the KS-108 lcd controller and is typically a matrix 403 is based on the KS-108 lcd controller and is typically a matrix
399 of 2*n chips. This driver was tested with a 128x64 panel. This 404 of 2*n chips. This driver was tested with a 128x64 panel. This
400 driver supports it for use with x86 SBCs through a 16 bit GPIO 405 driver supports it for use with x86 SBCs through a 16 bit GPIO
401 interface (8 bit data, 8 bit control). If you anticpate using 406 interface (8 bit data, 8 bit control). If you anticipate using
402 this driver, say Y or M; otherwise say N. You must specify the 407 this driver, say Y or M; otherwise say N. You must specify the
403 GPIO IO address to be used for setting control and data. 408 GPIO IO address to be used for setting control and data.
404 409
@@ -696,6 +701,7 @@ config FB_NVIDIA
696 depends on FB && PCI 701 depends on FB && PCI
697 select I2C_ALGOBIT if FB_NVIDIA_I2C 702 select I2C_ALGOBIT if FB_NVIDIA_I2C
698 select I2C if FB_NVIDIA_I2C 703 select I2C if FB_NVIDIA_I2C
704 select FB_DDC if FB_NVIDIA_I2C
699 select FB_MODE_HELPERS 705 select FB_MODE_HELPERS
700 select FB_CFB_FILLRECT 706 select FB_CFB_FILLRECT
701 select FB_CFB_COPYAREA 707 select FB_CFB_COPYAREA
@@ -734,6 +740,7 @@ config FB_RIVA
734 depends on FB && PCI 740 depends on FB && PCI
735 select I2C_ALGOBIT if FB_RIVA_I2C 741 select I2C_ALGOBIT if FB_RIVA_I2C
736 select I2C if FB_RIVA_I2C 742 select I2C if FB_RIVA_I2C
743 select FB_DDC if FB_RIVA_I2C
737 select FB_MODE_HELPERS 744 select FB_MODE_HELPERS
738 select FB_CFB_FILLRECT 745 select FB_CFB_FILLRECT
739 select FB_CFB_COPYAREA 746 select FB_CFB_COPYAREA
@@ -764,7 +771,7 @@ config FB_RIVA_DEBUG
764 default n 771 default n
765 help 772 help
766 Say Y here if you want the Riva driver to output all sorts 773 Say Y here if you want the Riva driver to output all sorts
767 of debugging informations to provide to the maintainer when 774 of debugging information to provide to the maintainer when
768 something goes wrong. 775 something goes wrong.
769 776
770config FB_RIVA_BACKLIGHT 777config FB_RIVA_BACKLIGHT
@@ -822,6 +829,7 @@ config FB_I810_I2C
822 depends on FB_I810 && FB_I810_GTF 829 depends on FB_I810 && FB_I810_GTF
823 select I2C 830 select I2C
824 select I2C_ALGOBIT 831 select I2C_ALGOBIT
832 select FB_DDC
825 help 833 help
826 834
827config FB_INTEL 835config FB_INTEL
@@ -857,7 +865,7 @@ config FB_INTEL_DEBUG
857 depends on FB_INTEL 865 depends on FB_INTEL
858 ---help--- 866 ---help---
859 Say Y here if you want the Intel driver to output all sorts 867 Say Y here if you want the Intel driver to output all sorts
860 of debugging informations to provide to the maintainer when 868 of debugging information to provide to the maintainer when
861 something goes wrong. 869 something goes wrong.
862 870
863config FB_INTEL_I2C 871config FB_INTEL_I2C
@@ -1012,6 +1020,7 @@ config FB_RADEON
1012 depends on FB && PCI 1020 depends on FB && PCI
1013 select I2C_ALGOBIT if FB_RADEON_I2C 1021 select I2C_ALGOBIT if FB_RADEON_I2C
1014 select I2C if FB_RADEON_I2C 1022 select I2C if FB_RADEON_I2C
1023 select FB_DDC if FB_RADEON_I2C
1015 select FB_MODE_HELPERS 1024 select FB_MODE_HELPERS
1016 select FB_CFB_FILLRECT 1025 select FB_CFB_FILLRECT
1017 select FB_CFB_COPYAREA 1026 select FB_CFB_COPYAREA
@@ -1053,7 +1062,7 @@ config FB_RADEON_DEBUG
1053 default n 1062 default n
1054 help 1063 help
1055 Say Y here if you want the Radeon driver to output all sorts 1064 Say Y here if you want the Radeon driver to output all sorts
1056 of debugging informations to provide to the maintainer when 1065 of debugging information to provide to the maintainer when
1057 something goes wrong. 1066 something goes wrong.
1058 1067
1059config FB_ATY128 1068config FB_ATY128
@@ -1140,6 +1149,7 @@ config FB_SAVAGE
1140 depends on FB && PCI && EXPERIMENTAL 1149 depends on FB && PCI && EXPERIMENTAL
1141 select I2C_ALGOBIT if FB_SAVAGE_I2C 1150 select I2C_ALGOBIT if FB_SAVAGE_I2C
1142 select I2C if FB_SAVAGE_I2C 1151 select I2C if FB_SAVAGE_I2C
1152 select FB_DDC if FB_SAVAGE_I2C
1143 select FB_MODE_HELPERS 1153 select FB_MODE_HELPERS
1144 select FB_CFB_FILLRECT 1154 select FB_CFB_FILLRECT
1145 select FB_CFB_COPYAREA 1155 select FB_CFB_COPYAREA
@@ -1619,7 +1629,8 @@ config FB_VIRTUAL
1619 kernel option `video=vfb:'. 1629 kernel option `video=vfb:'.
1620 1630
1621 To compile this driver as a module, choose M here: the 1631 To compile this driver as a module, choose M here: the
1622 module will be called vfb. 1632 module will be called vfb. In order to load it, you must use
1633 the vfb_enable=1 option.
1623 1634
1624 If unsure, say N. 1635 If unsure, say N.
1625if VT 1636if VT
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 481c6c9695f8..a6980e9a2481 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
18obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o 18obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
19obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o 19obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
20obj-$(CONFIG_FB_MACMODES) += macmodes.o 20obj-$(CONFIG_FB_MACMODES) += macmodes.o
21obj-$(CONFIG_FB_DDC) += fb_ddc.o
21 22
22# Hardware specific drivers go first 23# Hardware specific drivers go first
23obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o 24obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o
diff --git a/drivers/video/aty/atyfb.h b/drivers/video/aty/atyfb.h
index 55fb8b04489b..b04f49fb976a 100644
--- a/drivers/video/aty/atyfb.h
+++ b/drivers/video/aty/atyfb.h
@@ -355,5 +355,9 @@ static inline void wait_for_idle(struct atyfb_par *par)
355 355
356extern void aty_reset_engine(const struct atyfb_par *par); 356extern void aty_reset_engine(const struct atyfb_par *par);
357extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); 357extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info);
358extern void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par);
359extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); 358extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par);
359
360void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
361void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
362void atyfb_imageblit(struct fb_info *info, const struct fb_image *image);
363
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 19a71f045784..b45c9fd1b330 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -240,9 +240,6 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
240static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); 240static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
241static int atyfb_blank(int blank, struct fb_info *info); 241static int atyfb_blank(int blank, struct fb_info *info);
242static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg); 242static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg);
243extern void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
244extern void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
245extern void atyfb_imageblit(struct fb_info *info, const struct fb_image *image);
246#ifdef __sparc__ 243#ifdef __sparc__
247static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma); 244static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma);
248#endif 245#endif
@@ -3863,6 +3860,7 @@ static int __devinit atyfb_setup(char *options)
3863 3860
3864static int __devinit atyfb_init(void) 3861static int __devinit atyfb_init(void)
3865{ 3862{
3863 int err1 = 1, err2 = 1;
3866#ifndef MODULE 3864#ifndef MODULE
3867 char *option = NULL; 3865 char *option = NULL;
3868 3866
@@ -3872,12 +3870,13 @@ static int __devinit atyfb_init(void)
3872#endif 3870#endif
3873 3871
3874#ifdef CONFIG_PCI 3872#ifdef CONFIG_PCI
3875 pci_register_driver(&atyfb_driver); 3873 err1 = pci_register_driver(&atyfb_driver);
3876#endif 3874#endif
3877#ifdef CONFIG_ATARI 3875#ifdef CONFIG_ATARI
3878 atyfb_atari_probe(); 3876 err2 = atyfb_atari_probe();
3879#endif 3877#endif
3880 return 0; 3878
3879 return (err1 && err2) ? -ENODEV : 0;
3881} 3880}
3882 3881
3883static void __exit atyfb_exit(void) 3882static void __exit atyfb_exit(void)
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c
index e7056934c6a8..5080816be653 100644
--- a/drivers/video/aty/mach64_ct.c
+++ b/drivers/video/aty/mach64_ct.c
@@ -27,7 +27,7 @@ u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par)
27 return res; 27 return res;
28} 28}
29 29
30void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par) 30static void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par)
31{ 31{
32 /* write addr byte */ 32 /* write addr byte */
33 aty_st_8(CLOCK_CNTL_ADDR, ((offset << 2) & PLL_ADDR) | PLL_WR_EN, par); 33 aty_st_8(CLOCK_CNTL_ADDR, ((offset << 2) & PLL_ADDR) | PLL_WR_EN, par);
diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c
index 9aaca58c074a..676754520099 100644
--- a/drivers/video/aty/radeon_i2c.c
+++ b/drivers/video/aty/radeon_i2c.c
@@ -16,8 +16,6 @@
16#include "radeonfb.h" 16#include "radeonfb.h"
17#include "../edid.h" 17#include "../edid.h"
18 18
19#define RADEON_DDC 0x50
20
21static void radeon_gpio_setscl(void* data, int state) 19static void radeon_gpio_setscl(void* data, int state)
22{ 20{
23 struct radeon_i2c_chan *chan = data; 21 struct radeon_i2c_chan *chan = data;
@@ -138,108 +136,10 @@ void radeon_delete_i2c_busses(struct radeonfb_info *rinfo)
138 rinfo->i2c[3].rinfo = NULL; 136 rinfo->i2c[3].rinfo = NULL;
139} 137}
140 138
141 139int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn,
142static u8 *radeon_do_probe_i2c_edid(struct radeon_i2c_chan *chan) 140 u8 **out_edid)
143{
144 u8 start = 0x0;
145 struct i2c_msg msgs[] = {
146 {
147 .addr = RADEON_DDC,
148 .len = 1,
149 .buf = &start,
150 }, {
151 .addr = RADEON_DDC,
152 .flags = I2C_M_RD,
153 .len = EDID_LENGTH,
154 },
155 };
156 u8 *buf;
157
158 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
159 if (!buf) {
160 dev_warn(&chan->rinfo->pdev->dev, "Out of memory!\n");
161 return NULL;
162 }
163 msgs[1].buf = buf;
164
165 if (i2c_transfer(&chan->adapter, msgs, 2) == 2)
166 return buf;
167 dev_dbg(&chan->rinfo->pdev->dev, "Unable to read EDID block.\n");
168 kfree(buf);
169 return NULL;
170}
171
172
173int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_edid)
174{ 141{
175 u32 reg = rinfo->i2c[conn-1].ddc_reg; 142 u8 *edid = fb_ddc_read(&rinfo->i2c[conn-1].adapter);
176 u8 *edid = NULL;
177 int i, j;
178
179 OUTREG(reg, INREG(reg) &
180 ~(VGA_DDC_DATA_OUTPUT | VGA_DDC_CLK_OUTPUT));
181
182 OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
183 (void)INREG(reg);
184
185 for (i = 0; i < 3; i++) {
186 /* For some old monitors we need the
187 * following process to initialize/stop DDC
188 */
189 OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
190 (void)INREG(reg);
191 msleep(13);
192
193 OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
194 (void)INREG(reg);
195 for (j = 0; j < 5; j++) {
196 msleep(10);
197 if (INREG(reg) & VGA_DDC_CLK_INPUT)
198 break;
199 }
200 if (j == 5)
201 continue;
202
203 OUTREG(reg, INREG(reg) | VGA_DDC_DATA_OUT_EN);
204 (void)INREG(reg);
205 msleep(15);
206 OUTREG(reg, INREG(reg) | VGA_DDC_CLK_OUT_EN);
207 (void)INREG(reg);
208 msleep(15);
209 OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
210 (void)INREG(reg);
211 msleep(15);
212
213 /* Do the real work */
214 edid = radeon_do_probe_i2c_edid(&rinfo->i2c[conn-1]);
215
216 OUTREG(reg, INREG(reg) |
217 (VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
218 (void)INREG(reg);
219 msleep(15);
220
221 OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
222 (void)INREG(reg);
223 for (j = 0; j < 10; j++) {
224 msleep(10);
225 if (INREG(reg) & VGA_DDC_CLK_INPUT)
226 break;
227 }
228
229 OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
230 (void)INREG(reg);
231 msleep(15);
232 OUTREG(reg, INREG(reg) |
233 (VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
234 (void)INREG(reg);
235 if (edid)
236 break;
237 }
238 /* Release the DDC lines when done or the Apple Cinema HD display
239 * will switch off
240 */
241 OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN | VGA_DDC_DATA_OUT_EN));
242 (void)INREG(reg);
243 143
244 if (out_edid) 144 if (out_edid)
245 *out_edid = edid; 145 *out_edid = edid;
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 365de5dcc888..9a2b0d69b0ae 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -86,6 +86,9 @@ static struct radeon_device_id radeon_workaround_list[] = {
86 BUGFIX("Samsung P35", 86 BUGFIX("Samsung P35",
87 PCI_VENDOR_ID_SAMSUNG, 0xc00c, 87 PCI_VENDOR_ID_SAMSUNG, 0xc00c,
88 radeon_pm_off, radeon_reinitialize_M10), 88 radeon_pm_off, radeon_reinitialize_M10),
89 BUGFIX("Acer Aspire 2010",
90 PCI_VENDOR_ID_AI, 0x0061,
91 radeon_pm_off, radeon_reinitialize_M10),
89 { .ident = NULL } 92 { .ident = NULL }
90}; 93};
91 94
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index f25d5d648333..ef5c16f7f5a6 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -8,6 +8,7 @@
8 * <c.pellegrin@exadron.com> 8 * <c.pellegrin@exadron.com>
9 * 9 *
10 * PM support added by Rodolfo Giometti <giometti@linux.it> 10 * PM support added by Rodolfo Giometti <giometti@linux.it>
11 * Cursor enable/disable by Rodolfo Giometti <giometti@linux.it>
11 * 12 *
12 * Copyright 2002 MontaVista Software 13 * Copyright 2002 MontaVista Software
13 * Author: MontaVista Software, Inc. 14 * Author: MontaVista Software, Inc.
@@ -110,6 +111,10 @@ static struct fb_var_screeninfo au1100fb_var __initdata = {
110 111
111static struct au1100fb_drv_info drv_info; 112static struct au1100fb_drv_info drv_info;
112 113
114static int nocursor = 0;
115module_param(nocursor, int, 0644);
116MODULE_PARM_DESC(nocursor, "cursor enable/disable");
117
113/* 118/*
114 * Set hardware with var settings. This will enable the controller with a specific 119 * Set hardware with var settings. This will enable the controller with a specific
115 * mode, normally validated with the fb_check_var method 120 * mode, normally validated with the fb_check_var method
@@ -422,6 +427,17 @@ int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
422 return 0; 427 return 0;
423} 428}
424 429
430/* fb_cursor
431 * Used to disable cursor drawing...
432 */
433int au1100fb_fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
434{
435 if (nocursor)
436 return 0;
437 else
438 return -EINVAL; /* just to force soft_cursor() call */
439}
440
425static struct fb_ops au1100fb_ops = 441static struct fb_ops au1100fb_ops =
426{ 442{
427 .owner = THIS_MODULE, 443 .owner = THIS_MODULE,
@@ -433,6 +449,7 @@ static struct fb_ops au1100fb_ops =
433 .fb_imageblit = cfb_imageblit, 449 .fb_imageblit = cfb_imageblit,
434 .fb_rotate = au1100fb_fb_rotate, 450 .fb_rotate = au1100fb_fb_rotate,
435 .fb_mmap = au1100fb_fb_mmap, 451 .fb_mmap = au1100fb_fb_mmap,
452 .fb_cursor = au1100fb_fb_cursor,
436}; 453};
437 454
438 455
@@ -677,7 +694,7 @@ int au1100fb_setup(char *options)
677 if (options) { 694 if (options) {
678 while ((this_opt = strsep(&options,",")) != NULL) { 695 while ((this_opt = strsep(&options,",")) != NULL) {
679 /* Panel option */ 696 /* Panel option */
680 if (!strncmp(this_opt, "panel:", 6)) { 697 if (!strncmp(this_opt, "panel:", 6)) {
681 int i; 698 int i;
682 this_opt += 6; 699 this_opt += 6;
683 for (i = 0; i < num_panels; i++) { 700 for (i = 0; i < num_panels; i++) {
@@ -685,13 +702,18 @@ int au1100fb_setup(char *options)
685 known_lcd_panels[i].name, 702 known_lcd_panels[i].name,
686 strlen(this_opt))) { 703 strlen(this_opt))) {
687 panel_idx = i; 704 panel_idx = i;
688 break; 705 break;
706 }
689 } 707 }
690 }
691 if (i >= num_panels) { 708 if (i >= num_panels) {
692 print_warn("Panel %s not supported!", this_opt); 709 print_warn("Panel %s not supported!", this_opt);
693 } 710 }
694 } 711 }
712 if (!strncmp(this_opt, "nocursor", 8)) {
713 this_opt += 8;
714 nocursor = 1;
715 print_info("Cursor disabled");
716 }
695 /* Mode option (only option that start with digit) */ 717 /* Mode option (only option that start with digit) */
696 else if (isdigit(this_opt[0])) { 718 else if (isdigit(this_opt[0])) {
697 mode = kmalloc(strlen(this_opt) + 1, GFP_KERNEL); 719 mode = kmalloc(strlen(this_opt) + 1, GFP_KERNEL);
@@ -700,7 +722,7 @@ int au1100fb_setup(char *options)
700 /* Unsupported option */ 722 /* Unsupported option */
701 else { 723 else {
702 print_warn("Unsupported option \"%s\"", this_opt); 724 print_warn("Unsupported option \"%s\"", this_opt);
703 } 725 }
704 } 726 }
705 } 727 }
706 728
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 1b4f75d1f8a9..8c041daa3a15 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -133,6 +133,7 @@ static int info_idx = -1;
133 133
134/* console rotation */ 134/* console rotation */
135static int rotate; 135static int rotate;
136static int fbcon_has_sysfs;
136 137
137static const struct consw fb_con; 138static const struct consw fb_con;
138 139
@@ -396,9 +397,8 @@ static void fb_flashcursor(void *private)
396 vc = vc_cons[ops->currcon].d; 397 vc = vc_cons[ops->currcon].d;
397 398
398 if (!vc || !CON_IS_VISIBLE(vc) || 399 if (!vc || !CON_IS_VISIBLE(vc) ||
399 fbcon_is_inactive(vc, info) ||
400 registered_fb[con2fb_map[vc->vc_num]] != info || 400 registered_fb[con2fb_map[vc->vc_num]] != info ||
401 vc_cons[ops->currcon].d->vc_deccm != 1) { 401 vc->vc_deccm != 1) {
402 release_console_sem(); 402 release_console_sem();
403 return; 403 return;
404 } 404 }
@@ -2166,7 +2166,12 @@ static int fbcon_switch(struct vc_data *vc)
2166 fbcon_del_cursor_timer(old_info); 2166 fbcon_del_cursor_timer(old_info);
2167 } 2167 }
2168 2168
2169 fbcon_add_cursor_timer(info); 2169 if (fbcon_is_inactive(vc, info) ||
2170 ops->blank_state != FB_BLANK_UNBLANK)
2171 fbcon_del_cursor_timer(info);
2172 else
2173 fbcon_add_cursor_timer(info);
2174
2170 set_blitting_type(vc, info); 2175 set_blitting_type(vc, info);
2171 ops->cursor_reset = 1; 2176 ops->cursor_reset = 1;
2172 2177
@@ -2276,10 +2281,11 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
2276 update_screen(vc); 2281 update_screen(vc);
2277 } 2282 }
2278 2283
2279 if (!blank) 2284 if (fbcon_is_inactive(vc, info) ||
2280 fbcon_add_cursor_timer(info); 2285 ops->blank_state != FB_BLANK_UNBLANK)
2281 else
2282 fbcon_del_cursor_timer(info); 2286 fbcon_del_cursor_timer(info);
2287 else
2288 fbcon_add_cursor_timer(info);
2283 2289
2284 return 0; 2290 return 0;
2285} 2291}
@@ -3161,11 +3167,26 @@ static struct class_device_attribute class_device_attrs[] = {
3161 3167
3162static int fbcon_init_class_device(void) 3168static int fbcon_init_class_device(void)
3163{ 3169{
3164 int i; 3170 int i, error = 0;
3171
3172 fbcon_has_sysfs = 1;
3173
3174 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
3175 error = class_device_create_file(fbcon_class_device,
3176 &class_device_attrs[i]);
3177
3178 if (error)
3179 break;
3180 }
3181
3182 if (error) {
3183 while (--i >= 0)
3184 class_device_remove_file(fbcon_class_device,
3185 &class_device_attrs[i]);
3186
3187 fbcon_has_sysfs = 0;
3188 }
3165 3189
3166 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3167 class_device_create_file(fbcon_class_device,
3168 &class_device_attrs[i]);
3169 return 0; 3190 return 0;
3170} 3191}
3171 3192
@@ -3225,7 +3246,10 @@ static void fbcon_exit(void)
3225 module_put(info->fbops->owner); 3246 module_put(info->fbops->owner);
3226 3247
3227 if (info->fbcon_par) { 3248 if (info->fbcon_par) {
3249 struct fbcon_ops *ops = info->fbcon_par;
3250
3228 fbcon_del_cursor_timer(info); 3251 fbcon_del_cursor_timer(info);
3252 kfree(ops->cursor_src);
3229 kfree(info->fbcon_par); 3253 kfree(info->fbcon_par);
3230 info->fbcon_par = NULL; 3254 info->fbcon_par = NULL;
3231 } 3255 }
@@ -3271,9 +3295,13 @@ static void __exit fbcon_deinit_class_device(void)
3271{ 3295{
3272 int i; 3296 int i;
3273 3297
3274 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 3298 if (fbcon_has_sysfs) {
3275 class_device_remove_file(fbcon_class_device, 3299 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3276 &class_device_attrs[i]); 3300 class_device_remove_file(fbcon_class_device,
3301 &class_device_attrs[i]);
3302
3303 fbcon_has_sysfs = 0;
3304 }
3277} 3305}
3278 3306
3279static void __exit fb_console_exit(void) 3307static void __exit fb_console_exit(void)
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index f244ad066d68..b9386d168c04 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -80,6 +80,8 @@ struct fbcon_ops {
80 char *cursor_data; 80 char *cursor_data;
81 u8 *fontbuffer; 81 u8 *fontbuffer;
82 u8 *fontdata; 82 u8 *fontdata;
83 u8 *cursor_src;
84 u32 cursor_size;
83 u32 fd_size; 85 u32 fd_size;
84}; 86};
85 /* 87 /*
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c
index 4481c80b8b2a..825e6d6972a7 100644
--- a/drivers/video/console/fbcon_ccw.c
+++ b/drivers/video/console/fbcon_ccw.c
@@ -391,7 +391,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
391 ops->cursor_reset = 0; 391 ops->cursor_reset = 0;
392} 392}
393 393
394int ccw_update_start(struct fb_info *info) 394static int ccw_update_start(struct fb_info *info)
395{ 395{
396 struct fbcon_ops *ops = info->fbcon_par; 396 struct fbcon_ops *ops = info->fbcon_par;
397 u32 yoffset; 397 u32 yoffset;
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c
index 7f92c06afea7..c637e6318803 100644
--- a/drivers/video/console/fbcon_cw.c
+++ b/drivers/video/console/fbcon_cw.c
@@ -375,7 +375,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
375 ops->cursor_reset = 0; 375 ops->cursor_reset = 0;
376} 376}
377 377
378int cw_update_start(struct fb_info *info) 378static int cw_update_start(struct fb_info *info)
379{ 379{
380 struct fbcon_ops *ops = info->fbcon_par; 380 struct fbcon_ops *ops = info->fbcon_par;
381 u32 vxres = GETVXRES(ops->p->scrollmode, info); 381 u32 vxres = GETVXRES(ops->p->scrollmode, info);
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c
index ab91005e64dc..1473506df5d0 100644
--- a/drivers/video/console/fbcon_ud.c
+++ b/drivers/video/console/fbcon_ud.c
@@ -415,7 +415,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
415 ops->cursor_reset = 0; 415 ops->cursor_reset = 0;
416} 416}
417 417
418int ud_update_start(struct fb_info *info) 418static int ud_update_start(struct fb_info *info)
419{ 419{
420 struct fbcon_ops *ops = info->fbcon_par; 420 struct fbcon_ops *ops = info->fbcon_par;
421 int xoffset, yoffset; 421 int xoffset, yoffset;
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c
index 557c563e4aed..7d07d8383569 100644
--- a/drivers/video/console/softcursor.c
+++ b/drivers/video/console/softcursor.c
@@ -20,11 +20,12 @@
20 20
21int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) 21int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
22{ 22{
23 struct fbcon_ops *ops = info->fbcon_par;
23 unsigned int scan_align = info->pixmap.scan_align - 1; 24 unsigned int scan_align = info->pixmap.scan_align - 1;
24 unsigned int buf_align = info->pixmap.buf_align - 1; 25 unsigned int buf_align = info->pixmap.buf_align - 1;
25 unsigned int i, size, dsize, s_pitch, d_pitch; 26 unsigned int i, size, dsize, s_pitch, d_pitch;
26 struct fb_image *image; 27 struct fb_image *image;
27 u8 *dst, *src; 28 u8 *dst;
28 29
29 if (info->state != FBINFO_STATE_RUNNING) 30 if (info->state != FBINFO_STATE_RUNNING)
30 return 0; 31 return 0;
@@ -32,11 +33,19 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
32 s_pitch = (cursor->image.width + 7) >> 3; 33 s_pitch = (cursor->image.width + 7) >> 3;
33 dsize = s_pitch * cursor->image.height; 34 dsize = s_pitch * cursor->image.height;
34 35
35 src = kmalloc(dsize + sizeof(struct fb_image), GFP_ATOMIC); 36 if (dsize + sizeof(struct fb_image) != ops->cursor_size) {
36 if (!src) 37 if (ops->cursor_src != NULL)
37 return -ENOMEM; 38 kfree(ops->cursor_src);
39 ops->cursor_size = dsize + sizeof(struct fb_image);
38 40
39 image = (struct fb_image *) (src + dsize); 41 ops->cursor_src = kmalloc(ops->cursor_size, GFP_ATOMIC);
42 if (!ops->cursor_src) {
43 ops->cursor_size = 0;
44 return -ENOMEM;
45 }
46 }
47
48 image = (struct fb_image *) (ops->cursor_src + dsize);
40 *image = cursor->image; 49 *image = cursor->image;
41 d_pitch = (s_pitch + scan_align) & ~scan_align; 50 d_pitch = (s_pitch + scan_align) & ~scan_align;
42 51
@@ -48,21 +57,23 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
48 switch (cursor->rop) { 57 switch (cursor->rop) {
49 case ROP_XOR: 58 case ROP_XOR:
50 for (i = 0; i < dsize; i++) 59 for (i = 0; i < dsize; i++)
51 src[i] = image->data[i] ^ cursor->mask[i]; 60 ops->cursor_src[i] = image->data[i] ^
61 cursor->mask[i];
52 break; 62 break;
53 case ROP_COPY: 63 case ROP_COPY:
54 default: 64 default:
55 for (i = 0; i < dsize; i++) 65 for (i = 0; i < dsize; i++)
56 src[i] = image->data[i] & cursor->mask[i]; 66 ops->cursor_src[i] = image->data[i] &
67 cursor->mask[i];
57 break; 68 break;
58 } 69 }
59 } else 70 } else
60 memcpy(src, image->data, dsize); 71 memcpy(ops->cursor_src, image->data, dsize);
61 72
62 fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height); 73 fb_pad_aligned_buffer(dst, d_pitch, ops->cursor_src, s_pitch,
74 image->height);
63 image->data = dst; 75 image->data = dst;
64 info->fbops->fb_imageblit(info, image); 76 info->fbops->fb_imageblit(info, image);
65 kfree(src);
66 return 0; 77 return 0;
67} 78}
68 79
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c
new file mode 100644
index 000000000000..3aa6ebf68f17
--- /dev/null
+++ b/drivers/video/fb_ddc.c
@@ -0,0 +1,116 @@
1/*
2 * driver/vide/fb_ddc.c - DDC/EDID read support.
3 *
4 * Copyright (C) 2006 Dennis Munsie <dmunsie@cecropia.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/delay.h>
12#include <linux/device.h>
13#include <linux/fb.h>
14#include <linux/i2c-algo-bit.h>
15
16#include "edid.h"
17
18#define DDC_ADDR 0x50
19
20static unsigned char *fb_do_probe_ddc_edid(struct i2c_adapter *adapter)
21{
22 unsigned char start = 0x0;
23 struct i2c_msg msgs[] = {
24 {
25 .addr = DDC_ADDR,
26 .len = 1,
27 .buf = &start,
28 }, {
29 .addr = DDC_ADDR,
30 .flags = I2C_M_RD,
31 .len = EDID_LENGTH,
32 }
33 };
34 unsigned char *buf;
35
36 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
37 if (!buf) {
38 dev_warn(&adapter->dev, "unable to allocate memory for EDID "
39 "block.\n");
40 return NULL;
41 }
42 msgs[1].buf = buf;
43
44 if (i2c_transfer(adapter, msgs, 2) == 2)
45 return buf;
46
47 dev_warn(&adapter->dev, "unable to read EDID block.\n");
48 kfree(buf);
49 return NULL;
50}
51
52unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
53{
54 struct i2c_algo_bit_data *algo_data = adapter->algo_data;
55 unsigned char *edid = NULL;
56 int i, j;
57
58 algo_data->setscl(algo_data->data, 1);
59 algo_data->setscl(algo_data->data, 0);
60
61 for (i = 0; i < 3; i++) {
62 /* For some old monitors we need the
63 * following process to initialize/stop DDC
64 */
65 algo_data->setsda(algo_data->data, 0);
66 msleep(13);
67
68 algo_data->setscl(algo_data->data, 1);
69 for (j = 0; j < 5; j++) {
70 msleep(10);
71 if (algo_data->getscl(algo_data->data))
72 break;
73 }
74 if (j == 5)
75 continue;
76
77 algo_data->setsda(algo_data->data, 0);
78 msleep(15);
79 algo_data->setscl(algo_data->data, 0);
80 msleep(15);
81 algo_data->setsda(algo_data->data, 1);
82 msleep(15);
83
84 /* Do the real work */
85 edid = fb_do_probe_ddc_edid(adapter);
86 algo_data->setsda(algo_data->data, 0);
87 algo_data->setscl(algo_data->data, 0);
88 msleep(15);
89
90 algo_data->setscl(algo_data->data, 1);
91 for (j = 0; j < 10; j++) {
92 msleep(10);
93 if (algo_data->getscl(algo_data->data))
94 break;
95 }
96
97 algo_data->setsda(algo_data->data, 1);
98 msleep(15);
99 algo_data->setscl(algo_data->data, 0);
100 if (edid)
101 break;
102 }
103 /* Release the DDC lines when done or the Apple Cinema HD display
104 * will switch off
105 */
106 algo_data->setsda(algo_data->data, 0);
107 algo_data->setscl(algo_data->data, 0);
108
109 return edid;
110}
111
112EXPORT_SYMBOL_GPL(fb_ddc_read);
113
114MODULE_AUTHOR("Dennis Munsie <dmunsie@cecropia.com>");
115MODULE_DESCRIPTION("DDC/EDID reading support");
116MODULE_LICENSE("GPL");
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 17961e3ecaa0..93ffcdd95f50 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -554,7 +554,8 @@ static int fbmem_read_proc(char *buf, char **start, off_t offset,
554 int clen; 554 int clen;
555 555
556 clen = 0; 556 clen = 0;
557 for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++) 557 for (fi = registered_fb; fi < &registered_fb[FB_MAX] && clen < 4000;
558 fi++)
558 if (*fi) 559 if (*fi)
559 clen += sprintf(buf + clen, "%d %s\n", 560 clen += sprintf(buf + clen, "%d %s\n",
560 (*fi)->node, 561 (*fi)->node,
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index c151dcf68786..d3a50417ed9a 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -20,6 +20,8 @@
20#include <linux/console.h> 20#include <linux/console.h>
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23#define FB_SYSFS_FLAG_ATTR 1
24
23/** 25/**
24 * framebuffer_alloc - creates a new frame buffer info structure 26 * framebuffer_alloc - creates a new frame buffer info structure
25 * 27 *
@@ -483,12 +485,27 @@ static struct class_device_attribute class_device_attrs[] = {
483 485
484int fb_init_class_device(struct fb_info *fb_info) 486int fb_init_class_device(struct fb_info *fb_info)
485{ 487{
486 unsigned int i; 488 int i, error = 0;
489
487 class_set_devdata(fb_info->class_device, fb_info); 490 class_set_devdata(fb_info->class_device, fb_info);
488 491
489 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 492 fb_info->class_flag |= FB_SYSFS_FLAG_ATTR;
490 class_device_create_file(fb_info->class_device, 493
491 &class_device_attrs[i]); 494 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
495 error = class_device_create_file(fb_info->class_device,
496 &class_device_attrs[i]);
497
498 if (error)
499 break;
500 }
501
502 if (error) {
503 while (--i >= 0)
504 class_device_remove_file(fb_info->class_device,
505 &class_device_attrs[i]);
506 fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR;
507 }
508
492 return 0; 509 return 0;
493} 510}
494 511
@@ -496,9 +513,13 @@ void fb_cleanup_class_device(struct fb_info *fb_info)
496{ 513{
497 unsigned int i; 514 unsigned int i;
498 515
499 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 516 if (fb_info->class_flag & FB_SYSFS_FLAG_ATTR) {
500 class_device_remove_file(fb_info->class_device, 517 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
501 &class_device_attrs[i]); 518 class_device_remove_file(fb_info->class_device,
519 &class_device_attrs[i]);
520
521 fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR;
522 }
502} 523}
503 524
504#ifdef CONFIG_FB_BACKLIGHT 525#ifdef CONFIG_FB_BACKLIGHT
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c
index 7d06b38e80a0..b38d805db313 100644
--- a/drivers/video/i810/i810-i2c.c
+++ b/drivers/video/i810/i810-i2c.c
@@ -19,7 +19,6 @@
19#include "i810_main.h" 19#include "i810_main.h"
20#include "../edid.h" 20#include "../edid.h"
21 21
22#define I810_DDC 0x50
23/* bit locations in the registers */ 22/* bit locations in the registers */
24#define SCL_DIR_MASK 0x0001 23#define SCL_DIR_MASK 0x0001
25#define SCL_DIR 0x0002 24#define SCL_DIR 0x0002
@@ -150,53 +149,14 @@ void i810_delete_i2c_busses(struct i810fb_par *par)
150 par->chan[2].par = NULL; 149 par->chan[2].par = NULL;
151} 150}
152 151
153static u8 *i810_do_probe_i2c_edid(struct i810fb_i2c_chan *chan)
154{
155 u8 start = 0x0;
156 struct i2c_msg msgs[] = {
157 {
158 .addr = I810_DDC,
159 .len = 1,
160 .buf = &start,
161 }, {
162 .addr = I810_DDC,
163 .flags = I2C_M_RD,
164 .len = EDID_LENGTH,
165 },
166 };
167 u8 *buf;
168
169 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
170 if (!buf) {
171 DPRINTK("i810-i2c: Failed to allocate memory\n");
172 return NULL;
173 }
174 msgs[1].buf = buf;
175
176 if (i2c_transfer(&chan->adapter, msgs, 2) == 2) {
177 DPRINTK("i810-i2c: I2C Transfer successful\n");
178 return buf;
179 }
180
181 DPRINTK("i810-i2c: Unable to read EDID block.\n");
182 kfree(buf);
183 return NULL;
184}
185
186int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn) 152int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn)
187{ 153{
188 struct i810fb_par *par = info->par; 154 struct i810fb_par *par = info->par;
189 u8 *edid = NULL; 155 u8 *edid = NULL;
190 int i;
191 156
192 DPRINTK("i810-i2c: Probe DDC%i Bus\n", conn+1); 157 DPRINTK("i810-i2c: Probe DDC%i Bus\n", conn+1);
193 if (conn < par->ddc_num) { 158 if (conn < par->ddc_num) {
194 for (i = 0; i < 3; i++) { 159 edid = fb_ddc_read(&par->chan[conn].adapter);
195 /* Do the real work */
196 edid = i810_do_probe_i2c_edid(&par->chan[conn]);
197 if (edid)
198 break;
199 }
200 } else { 160 } else {
201 const u8 *e = fb_firmware_edid(info->device); 161 const u8 *e = fb_firmware_edid(info->device);
202 162
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index d42edaccb84c..b55a12d95eb2 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1602,7 +1602,10 @@ static int i810fb_resume(struct pci_dev *dev)
1602 acquire_console_sem(); 1602 acquire_console_sem();
1603 pci_set_power_state(dev, PCI_D0); 1603 pci_set_power_state(dev, PCI_D0);
1604 pci_restore_state(dev); 1604 pci_restore_state(dev);
1605 pci_enable_device(dev); 1605
1606 if (pci_enable_device(dev))
1607 goto fail;
1608
1606 pci_set_master(dev); 1609 pci_set_master(dev);
1607 agp_bind_memory(par->i810_gtt.i810_fb_memory, 1610 agp_bind_memory(par->i810_gtt.i810_fb_memory,
1608 par->fb.offset); 1611 par->fb.offset);
@@ -1611,6 +1614,7 @@ static int i810fb_resume(struct pci_dev *dev)
1611 i810fb_set_par(info); 1614 i810fb_set_par(info);
1612 fb_set_suspend (info, 0); 1615 fb_set_suspend (info, 0);
1613 info->fbops->fb_blank(VESA_NO_BLANKING, info); 1616 info->fbops->fb_blank(VESA_NO_BLANKING, info);
1617fail:
1614 release_console_sem(); 1618 release_console_sem();
1615 return 0; 1619 return 0;
1616} 1620}
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index 4a57dabb77d4..7acf01c181ee 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -2277,10 +2277,13 @@ static void __init matroxfb_init_params(void) {
2277 } 2277 }
2278} 2278}
2279 2279
2280static void __init matrox_init(void) { 2280static int __init matrox_init(void) {
2281 int err;
2282
2281 matroxfb_init_params(); 2283 matroxfb_init_params();
2282 pci_register_driver(&matroxfb_driver); 2284 err = pci_register_driver(&matroxfb_driver);
2283 dev = -1; /* accept all new devices... */ 2285 dev = -1; /* accept all new devices... */
2286 return err;
2284} 2287}
2285 2288
2286/* **************************** exit-time only **************************** */ 2289/* **************************** exit-time only **************************** */
@@ -2437,6 +2440,7 @@ static int __initdata initialized = 0;
2437static int __init matroxfb_init(void) 2440static int __init matroxfb_init(void)
2438{ 2441{
2439 char *option = NULL; 2442 char *option = NULL;
2443 int err = 0;
2440 2444
2441 DBG(__FUNCTION__) 2445 DBG(__FUNCTION__)
2442 2446
@@ -2448,11 +2452,11 @@ static int __init matroxfb_init(void)
2448 return -ENXIO; 2452 return -ENXIO;
2449 if (!initialized) { 2453 if (!initialized) {
2450 initialized = 1; 2454 initialized = 1;
2451 matrox_init(); 2455 err = matrox_init();
2452 } 2456 }
2453 hotplug = 1; 2457 hotplug = 1;
2454 /* never return failure, user can hotplug matrox later... */ 2458 /* never return failure, user can hotplug matrox later... */
2455 return 0; 2459 return err;
2456} 2460}
2457 2461
2458module_init(matroxfb_init); 2462module_init(matroxfb_init);
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c
index 6849ab75d403..a32d1af79e07 100644
--- a/drivers/video/mbx/mbxfb.c
+++ b/drivers/video/mbx/mbxfb.c
@@ -118,8 +118,19 @@ static unsigned int mbxfb_get_pixclock(unsigned int pixclock_ps,
118 /* convert pixclock to KHz */ 118 /* convert pixclock to KHz */
119 pixclock = PICOS2KHZ(pixclock_ps); 119 pixclock = PICOS2KHZ(pixclock_ps);
120 120
121 /* PLL output freq = (ref_clk * M) / (N * 2^P)
122 *
123 * M: 1 to 63
124 * N: 1 to 7
125 * P: 0 to 7
126 */
127
128 /* RAPH: When N==1, the resulting pixel clock appears to
129 * get divided by 2. Preventing N=1 by starting the following
130 * loop at 2 prevents this. Is this a bug with my chip
131 * revision or something I dont understand? */
121 for (m = 1; m < 64; m++) { 132 for (m = 1; m < 64; m++) {
122 for (n = 1; n < 8; n++) { 133 for (n = 2; n < 8; n++) {
123 for (p = 0; p < 8; p++) { 134 for (p = 0; p < 8; p++) {
124 clk = (ref_clk * m) / (n * (1 << p)); 135 clk = (ref_clk * m) / (n * (1 << p));
125 err = (clk > pixclock) ? (clk - pixclock) : 136 err = (clk > pixclock) ? (clk - pixclock) :
@@ -244,8 +255,8 @@ static int mbxfb_set_par(struct fb_info *info)
244 255
245 /* setup resolution */ 256 /* setup resolution */
246 gsctrl &= ~(FMsk(GSCTRL_GSWIDTH) | FMsk(GSCTRL_GSHEIGHT)); 257 gsctrl &= ~(FMsk(GSCTRL_GSWIDTH) | FMsk(GSCTRL_GSHEIGHT));
247 gsctrl |= Gsctrl_Width(info->var.xres - 1) | 258 gsctrl |= Gsctrl_Width(info->var.xres) |
248 Gsctrl_Height(info->var.yres - 1); 259 Gsctrl_Height(info->var.yres);
249 writel(gsctrl, GSCTRL); 260 writel(gsctrl, GSCTRL);
250 udelay(1000); 261 udelay(1000);
251 262
@@ -402,8 +413,8 @@ static void __devinit setup_graphics(struct fb_info *fbi)
402{ 413{
403 unsigned long gsctrl; 414 unsigned long gsctrl;
404 415
405 gsctrl = GSCTRL_GAMMA_EN | Gsctrl_Width(fbi->var.xres - 1) | 416 gsctrl = GSCTRL_GAMMA_EN | Gsctrl_Width(fbi->var.xres) |
406 Gsctrl_Height(fbi->var.yres - 1); 417 Gsctrl_Height(fbi->var.yres);
407 switch (fbi->var.bits_per_pixel) { 418 switch (fbi->var.bits_per_pixel) {
408 case 16: 419 case 16:
409 if (fbi->var.green.length == 5) 420 if (fbi->var.green.length == 5)
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index 19eef3a09023..e48de3c9fd13 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -160,51 +160,12 @@ void nvidia_delete_i2c_busses(struct nvidia_par *par)
160 160
161} 161}
162 162
163static u8 *nvidia_do_probe_i2c_edid(struct nvidia_i2c_chan *chan)
164{
165 u8 start = 0x0;
166 struct i2c_msg msgs[] = {
167 {
168 .addr = 0x50,
169 .len = 1,
170 .buf = &start,
171 }, {
172 .addr = 0x50,
173 .flags = I2C_M_RD,
174 .len = EDID_LENGTH,
175 },
176 };
177 u8 *buf;
178
179 if (!chan->par)
180 return NULL;
181
182 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
183 if (!buf) {
184 dev_warn(&chan->par->pci_dev->dev, "Out of memory!\n");
185 return NULL;
186 }
187 msgs[1].buf = buf;
188
189 if (i2c_transfer(&chan->adapter, msgs, 2) == 2)
190 return buf;
191 dev_dbg(&chan->par->pci_dev->dev, "Unable to read EDID block.\n");
192 kfree(buf);
193 return NULL;
194}
195
196int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid) 163int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
197{ 164{
198 struct nvidia_par *par = info->par; 165 struct nvidia_par *par = info->par;
199 u8 *edid = NULL; 166 u8 *edid;
200 int i; 167
201 168 edid = fb_ddc_read(&par->chan[conn - 1].adapter);
202 for (i = 0; i < 3; i++) {
203 /* Do the real work */
204 edid = nvidia_do_probe_i2c_edid(&par->chan[conn - 1]);
205 if (edid)
206 break;
207 }
208 169
209 if (!edid && conn == 1) { 170 if (!edid && conn == 1) {
210 /* try to get from firmware */ 171 /* try to get from firmware */
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index f8cd4c519aeb..eb24107bcc81 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -28,6 +28,9 @@
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#endif 30#endif
31#ifdef CONFIG_BOOTX_TEXT
32#include <asm/btext.h>
33#endif
31 34
32#include "nv_local.h" 35#include "nv_local.h"
33#include "nv_type.h" 36#include "nv_type.h"
@@ -681,6 +684,13 @@ static int nvidiafb_set_par(struct fb_info *info)
681 684
682 nvidia_vga_protect(par, 0); 685 nvidia_vga_protect(par, 0);
683 686
687#ifdef CONFIG_BOOTX_TEXT
688 /* Update debug text engine */
689 btext_update_display(info->fix.smem_start,
690 info->var.xres, info->var.yres,
691 info->var.bits_per_pixel, info->fix.line_length);
692#endif
693
684 NVTRACE_LEAVE(); 694 NVTRACE_LEAVE();
685 return 0; 695 return 0;
686} 696}
@@ -984,7 +994,10 @@ static int nvidiafb_resume(struct pci_dev *dev)
984 994
985 if (par->pm_state != PM_EVENT_FREEZE) { 995 if (par->pm_state != PM_EVENT_FREEZE) {
986 pci_restore_state(dev); 996 pci_restore_state(dev);
987 pci_enable_device(dev); 997
998 if (pci_enable_device(dev))
999 goto fail;
1000
988 pci_set_master(dev); 1001 pci_set_master(dev);
989 } 1002 }
990 1003
@@ -993,6 +1006,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
993 fb_set_suspend (info, 0); 1006 fb_set_suspend (info, 0);
994 nvidiafb_blank(FB_BLANK_UNBLANK, info); 1007 nvidiafb_blank(FB_BLANK_UNBLANK, info);
995 1008
1009fail:
996 release_console_sem(); 1010 release_console_sem();
997 return 0; 1011 return 0;
998} 1012}
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index bbb07106cd54..3bc5da4a57ca 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -59,7 +59,7 @@
59#define LCCR3_INVALID_CONFIG_MASK (LCCR3_HSP|LCCR3_VSP|LCCR3_PCD|LCCR3_BPP) 59#define LCCR3_INVALID_CONFIG_MASK (LCCR3_HSP|LCCR3_VSP|LCCR3_PCD|LCCR3_BPP)
60 60
61static void (*pxafb_backlight_power)(int); 61static void (*pxafb_backlight_power)(int);
62static void (*pxafb_lcd_power)(int); 62static void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
63 63
64static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *); 64static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *);
65static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); 65static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
@@ -214,6 +214,48 @@ extern unsigned int get_clk_frequency_khz(int info);
214#endif 214#endif
215 215
216/* 216/*
217 * Select the smallest mode that allows the desired resolution to be
218 * displayed. If desired parameters can be rounded up.
219 */
220static struct pxafb_mode_info *pxafb_getmode(struct pxafb_mach_info *mach, struct fb_var_screeninfo *var)
221{
222 struct pxafb_mode_info *mode = NULL;
223 struct pxafb_mode_info *modelist = mach->modes;
224 unsigned int best_x = 0xffffffff, best_y = 0xffffffff;
225 unsigned int i;
226
227 for (i = 0 ; i < mach->num_modes ; i++) {
228 if (modelist[i].xres >= var->xres && modelist[i].yres >= var->yres &&
229 modelist[i].xres < best_x && modelist[i].yres < best_y &&
230 modelist[i].bpp >= var->bits_per_pixel ) {
231 best_x = modelist[i].xres;
232 best_y = modelist[i].yres;
233 mode = &modelist[i];
234 }
235 }
236
237 return mode;
238}
239
240static void pxafb_setmode(struct fb_var_screeninfo *var, struct pxafb_mode_info *mode)
241{
242 var->xres = mode->xres;
243 var->yres = mode->yres;
244 var->bits_per_pixel = mode->bpp;
245 var->pixclock = mode->pixclock;
246 var->hsync_len = mode->hsync_len;
247 var->left_margin = mode->left_margin;
248 var->right_margin = mode->right_margin;
249 var->vsync_len = mode->vsync_len;
250 var->upper_margin = mode->upper_margin;
251 var->lower_margin = mode->lower_margin;
252 var->sync = mode->sync;
253 var->grayscale = mode->cmap_greyscale;
254 var->xres_virtual = var->xres;
255 var->yres_virtual = var->yres;
256}
257
258/*
217 * pxafb_check_var(): 259 * pxafb_check_var():
218 * Get the video params out of 'var'. If a value doesn't fit, round it up, 260 * Get the video params out of 'var'. If a value doesn't fit, round it up,
219 * if it's too big, return -EINVAL. 261 * if it's too big, return -EINVAL.
@@ -225,15 +267,29 @@ extern unsigned int get_clk_frequency_khz(int info);
225static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 267static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
226{ 268{
227 struct pxafb_info *fbi = (struct pxafb_info *)info; 269 struct pxafb_info *fbi = (struct pxafb_info *)info;
270 struct pxafb_mach_info *inf = fbi->dev->platform_data;
228 271
229 if (var->xres < MIN_XRES) 272 if (var->xres < MIN_XRES)
230 var->xres = MIN_XRES; 273 var->xres = MIN_XRES;
231 if (var->yres < MIN_YRES) 274 if (var->yres < MIN_YRES)
232 var->yres = MIN_YRES; 275 var->yres = MIN_YRES;
233 if (var->xres > fbi->max_xres) 276
234 return -EINVAL; 277 if (inf->fixed_modes) {
235 if (var->yres > fbi->max_yres) 278 struct pxafb_mode_info *mode;
236 return -EINVAL; 279
280 mode = pxafb_getmode(inf, var);
281 if (!mode)
282 return -EINVAL;
283 pxafb_setmode(var, mode);
284 } else {
285 if (var->xres > inf->modes->xres)
286 return -EINVAL;
287 if (var->yres > inf->modes->yres)
288 return -EINVAL;
289 if (var->bits_per_pixel > inf->modes->bpp)
290 return -EINVAL;
291 }
292
237 var->xres_virtual = 293 var->xres_virtual =
238 max(var->xres_virtual, var->xres); 294 max(var->xres_virtual, var->xres);
239 var->yres_virtual = 295 var->yres_virtual =
@@ -693,7 +749,7 @@ static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on)
693 pr_debug("pxafb: LCD power o%s\n", on ? "n" : "ff"); 749 pr_debug("pxafb: LCD power o%s\n", on ? "n" : "ff");
694 750
695 if (pxafb_lcd_power) 751 if (pxafb_lcd_power)
696 pxafb_lcd_power(on); 752 pxafb_lcd_power(on, &fbi->fb.var);
697} 753}
698 754
699static void pxafb_setup_gpio(struct pxafb_info *fbi) 755static void pxafb_setup_gpio(struct pxafb_info *fbi)
@@ -869,9 +925,11 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
869 * registers. 925 * registers.
870 */ 926 */
871 if (old_state == C_ENABLE) { 927 if (old_state == C_ENABLE) {
928 __pxafb_lcd_power(fbi, 0);
872 pxafb_disable_controller(fbi); 929 pxafb_disable_controller(fbi);
873 pxafb_setup_gpio(fbi); 930 pxafb_setup_gpio(fbi);
874 pxafb_enable_controller(fbi); 931 pxafb_enable_controller(fbi);
932 __pxafb_lcd_power(fbi, 1);
875 } 933 }
876 break; 934 break;
877 935
@@ -1049,6 +1107,8 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
1049 struct pxafb_info *fbi; 1107 struct pxafb_info *fbi;
1050 void *addr; 1108 void *addr;
1051 struct pxafb_mach_info *inf = dev->platform_data; 1109 struct pxafb_mach_info *inf = dev->platform_data;
1110 struct pxafb_mode_info *mode = inf->modes;
1111 int i, smemlen;
1052 1112
1053 /* Alloc the pxafb_info and pseudo_palette in one step */ 1113 /* Alloc the pxafb_info and pseudo_palette in one step */
1054 fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); 1114 fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL);
@@ -1082,31 +1142,21 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
1082 addr = addr + sizeof(struct pxafb_info); 1142 addr = addr + sizeof(struct pxafb_info);
1083 fbi->fb.pseudo_palette = addr; 1143 fbi->fb.pseudo_palette = addr;
1084 1144
1085 fbi->max_xres = inf->xres; 1145 pxafb_setmode(&fbi->fb.var, mode);
1086 fbi->fb.var.xres = inf->xres; 1146
1087 fbi->fb.var.xres_virtual = inf->xres;
1088 fbi->max_yres = inf->yres;
1089 fbi->fb.var.yres = inf->yres;
1090 fbi->fb.var.yres_virtual = inf->yres;
1091 fbi->max_bpp = inf->bpp;
1092 fbi->fb.var.bits_per_pixel = inf->bpp;
1093 fbi->fb.var.pixclock = inf->pixclock;
1094 fbi->fb.var.hsync_len = inf->hsync_len;
1095 fbi->fb.var.left_margin = inf->left_margin;
1096 fbi->fb.var.right_margin = inf->right_margin;
1097 fbi->fb.var.vsync_len = inf->vsync_len;
1098 fbi->fb.var.upper_margin = inf->upper_margin;
1099 fbi->fb.var.lower_margin = inf->lower_margin;
1100 fbi->fb.var.sync = inf->sync;
1101 fbi->fb.var.grayscale = inf->cmap_greyscale;
1102 fbi->cmap_inverse = inf->cmap_inverse; 1147 fbi->cmap_inverse = inf->cmap_inverse;
1103 fbi->cmap_static = inf->cmap_static; 1148 fbi->cmap_static = inf->cmap_static;
1149
1104 fbi->lccr0 = inf->lccr0; 1150 fbi->lccr0 = inf->lccr0;
1105 fbi->lccr3 = inf->lccr3; 1151 fbi->lccr3 = inf->lccr3;
1106 fbi->state = C_STARTUP; 1152 fbi->state = C_STARTUP;
1107 fbi->task_state = (u_char)-1; 1153 fbi->task_state = (u_char)-1;
1108 fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres * 1154
1109 fbi->max_bpp / 8; 1155 for (i = 0; i < inf->num_modes; i++) {
1156 smemlen = mode[i].xres * mode[i].yres * mode[i].bpp / 8;
1157 if (smemlen > fbi->fb.fix.smem_len)
1158 fbi->fb.fix.smem_len = smemlen;
1159 }
1110 1160
1111 init_waitqueue_head(&fbi->ctrlr_wait); 1161 init_waitqueue_head(&fbi->ctrlr_wait);
1112 INIT_WORK(&fbi->task, pxafb_task, fbi); 1162 INIT_WORK(&fbi->task, pxafb_task, fbi);
@@ -1307,12 +1357,12 @@ int __init pxafb_probe(struct platform_device *dev)
1307 (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) 1357 (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual)
1308 dev_warn(&dev->dev, "Dual panel only valid in passive mode\n"); 1358 dev_warn(&dev->dev, "Dual panel only valid in passive mode\n");
1309 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && 1359 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas &&
1310 (inf->upper_margin || inf->lower_margin)) 1360 (inf->modes->upper_margin || inf->modes->lower_margin))
1311 dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n"); 1361 dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n");
1312#endif 1362#endif
1313 1363
1314 dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); 1364 dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->modes->xres, inf->modes->yres, inf->modes->bpp);
1315 if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { 1365 if (inf->modes->xres == 0 || inf->modes->yres == 0 || inf->modes->bpp == 0) {
1316 dev_err(&dev->dev, "Invalid resolution or bit depth\n"); 1366 dev_err(&dev->dev, "Invalid resolution or bit depth\n");
1317 ret = -EINVAL; 1367 ret = -EINVAL;
1318 goto failed; 1368 goto failed;
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
index 47f41f70db7a..7499a1c4bf79 100644
--- a/drivers/video/pxafb.h
+++ b/drivers/video/pxafb.h
@@ -41,10 +41,6 @@ struct pxafb_info {
41 struct fb_info fb; 41 struct fb_info fb;
42 struct device *dev; 42 struct device *dev;
43 43
44 u_int max_bpp;
45 u_int max_xres;
46 u_int max_yres;
47
48 /* 44 /*
49 * These are the addresses we mapped 45 * These are the addresses we mapped
50 * the framebuffer memory region to. 46 * the framebuffer memory region to.
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 4acde4f7dbf8..a433cc78ef90 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -393,8 +393,8 @@ static void riva_bl_init(struct riva_par *par)
393 mutex_lock(&info->bl_mutex); 393 mutex_lock(&info->bl_mutex);
394 info->bl_dev = bd; 394 info->bl_dev = bd;
395 fb_bl_default_curve(info, 0, 395 fb_bl_default_curve(info, 0,
396 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, 396 MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL,
397 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 397 FB_BACKLIGHT_MAX);
398 mutex_unlock(&info->bl_mutex); 398 mutex_unlock(&info->bl_mutex);
399 399
400 down(&bd->sem); 400 down(&bd->sem);
@@ -784,7 +784,7 @@ static void riva_load_video_mode(struct fb_info *info)
784 784
785 NVTRACE_ENTER(); 785 NVTRACE_ENTER();
786 /* time to calculate */ 786 /* time to calculate */
787 rivafb_blank(1, info); 787 rivafb_blank(FB_BLANK_NORMAL, info);
788 788
789 bpp = info->var.bits_per_pixel; 789 bpp = info->var.bits_per_pixel;
790 if (bpp == 16 && info->var.green.length == 5) 790 if (bpp == 16 && info->var.green.length == 5)
@@ -917,7 +917,7 @@ static void riva_load_video_mode(struct fb_info *info)
917 par->current_state = newmode; 917 par->current_state = newmode;
918 riva_load_state(par, &par->current_state); 918 riva_load_state(par, &par->current_state);
919 par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */ 919 par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */
920 rivafb_blank(0, info); 920 rivafb_blank(FB_BLANK_UNBLANK, info);
921 NVTRACE_LEAVE(); 921 NVTRACE_LEAVE();
922} 922}
923 923
@@ -1843,7 +1843,7 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1843 for (i = 0; propnames[i] != NULL; ++i) { 1843 for (i = 0; propnames[i] != NULL; ++i) {
1844 pedid = get_property(dp, propnames[i], NULL); 1844 pedid = get_property(dp, propnames[i], NULL);
1845 if (pedid != NULL) { 1845 if (pedid != NULL) {
1846 par->EDID = pedid; 1846 par->EDID = (unsigned char *)pedid;
1847 NVTRACE("LCD found.\n"); 1847 NVTRACE("LCD found.\n");
1848 return 1; 1848 return 1;
1849 } 1849 }
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c
index 9751c37c0bfd..c15b259af644 100644
--- a/drivers/video/riva/rivafb-i2c.c
+++ b/drivers/video/riva/rivafb-i2c.c
@@ -25,8 +25,6 @@
25#include "rivafb.h" 25#include "rivafb.h"
26#include "../edid.h" 26#include "../edid.h"
27 27
28#define RIVA_DDC 0x50
29
30static void riva_gpio_setscl(void* data, int state) 28static void riva_gpio_setscl(void* data, int state)
31{ 29{
32 struct riva_i2c_chan *chan = data; 30 struct riva_i2c_chan *chan = data;
@@ -158,50 +156,12 @@ void riva_delete_i2c_busses(struct riva_par *par)
158 par->chan[2].par = NULL; 156 par->chan[2].par = NULL;
159} 157}
160 158
161static u8 *riva_do_probe_i2c_edid(struct riva_i2c_chan *chan)
162{
163 u8 start = 0x0;
164 struct i2c_msg msgs[] = {
165 {
166 .addr = RIVA_DDC,
167 .len = 1,
168 .buf = &start,
169 }, {
170 .addr = RIVA_DDC,
171 .flags = I2C_M_RD,
172 .len = EDID_LENGTH,
173 },
174 };
175 u8 *buf;
176
177 if (!chan->par)
178 return NULL;
179
180 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
181 if (!buf) {
182 dev_warn(&chan->par->pdev->dev, "Out of memory!\n");
183 return NULL;
184 }
185 msgs[1].buf = buf;
186
187 if (i2c_transfer(&chan->adapter, msgs, 2) == 2)
188 return buf;
189 dev_dbg(&chan->par->pdev->dev, "Unable to read EDID block.\n");
190 kfree(buf);
191 return NULL;
192}
193
194int riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid) 159int riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid)
195{ 160{
196 u8 *edid = NULL; 161 u8 *edid = NULL;
197 int i;
198 162
199 for (i = 0; i < 3; i++) { 163 edid = fb_ddc_read(&par->chan[conn-1].adapter);
200 /* Do the real work */ 164
201 edid = riva_do_probe_i2c_edid(&par->chan[conn-1]);
202 if (edid)
203 break;
204 }
205 if (out_edid) 165 if (out_edid)
206 *out_edid = edid; 166 *out_edid = edid;
207 if (!edid) 167 if (!edid)
diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h
index be40968f899e..f3f8a8e15012 100644
--- a/drivers/video/s3c2410fb.h
+++ b/drivers/video/s3c2410fb.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/s3c2410fb.h 2 * linux/drivers/video/s3c2410fb.h
3 * Copyright (c) Arnaud Patard 3 * Copyright (c) Arnaud Patard
4 * 4 *
5 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c
index d7d810dbf0bd..3f94223b7f0c 100644
--- a/drivers/video/savage/savagefb-i2c.c
+++ b/drivers/video/savage/savagefb-i2c.c
@@ -213,52 +213,15 @@ void savagefb_delete_i2c_busses(struct fb_info *info)
213 par->chan.par = NULL; 213 par->chan.par = NULL;
214} 214}
215 215
216static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan)
217{
218 u8 start = 0x0;
219 struct i2c_msg msgs[] = {
220 {
221 .addr = SAVAGE_DDC,
222 .len = 1,
223 .buf = &start,
224 }, {
225 .addr = SAVAGE_DDC,
226 .flags = I2C_M_RD,
227 .len = EDID_LENGTH,
228 },
229 };
230 u8 *buf = NULL;
231
232 if (chan->par) {
233 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
234
235 if (buf) {
236 msgs[1].buf = buf;
237
238 if (i2c_transfer(&chan->adapter, msgs, 2) != 2) {
239 dev_dbg(&chan->par->pcidev->dev,
240 "Unable to read EDID block.\n");
241 kfree(buf);
242 buf = NULL;
243 }
244 }
245 }
246
247 return buf;
248}
249
250int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid) 216int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid)
251{ 217{
252 struct savagefb_par *par = info->par; 218 struct savagefb_par *par = info->par;
253 u8 *edid = NULL; 219 u8 *edid;
254 int i; 220
255 221 if (par->chan.par)
256 for (i = 0; i < 3; i++) { 222 edid = fb_ddc_read(&par->chan.adapter);
257 /* Do the real work */ 223 else
258 edid = savage_do_probe_i2c_edid(&par->chan); 224 edid = NULL;
259 if (edid)
260 break;
261 }
262 225
263 if (!edid) { 226 if (!edid) {
264 /* try to get from firmware */ 227 /* try to get from firmware */
diff --git a/drivers/video/sis/init.h b/drivers/video/sis/init.h
index 7ecab87cef02..59d12844b4dd 100644
--- a/drivers/video/sis/init.h
+++ b/drivers/video/sis/init.h
@@ -77,16 +77,9 @@
77#include <linux/types.h> 77#include <linux/types.h>
78#include <asm/io.h> 78#include <asm/io.h>
79#include <linux/fb.h> 79#include <linux/fb.h>
80#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
81#include <video/fbcon.h>
82#endif
83#include "sis.h" 80#include "sis.h"
84#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
85#include <linux/sisfb.h>
86#else
87#include <video/sisfb.h> 81#include <video/sisfb.h>
88#endif 82#endif
89#endif
90 83
91/* Mode numbers */ 84/* Mode numbers */
92static const unsigned short ModeIndex_320x200[] = {0x59, 0x41, 0x00, 0x4f}; 85static const unsigned short ModeIndex_320x200[] = {0x59, 0x41, 0x00, 0x4f};
diff --git a/drivers/video/sis/init301.h b/drivers/video/sis/init301.h
index bc321dc57e92..4f3a28699d37 100644
--- a/drivers/video/sis/init301.h
+++ b/drivers/video/sis/init301.h
@@ -71,16 +71,9 @@
71#include <linux/types.h> 71#include <linux/types.h>
72#include <asm/io.h> 72#include <asm/io.h>
73#include <linux/fb.h> 73#include <linux/fb.h>
74#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
75#include <video/fbcon.h>
76#endif
77#include "sis.h" 74#include "sis.h"
78#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
79#include <linux/sisfb.h>
80#else
81#include <video/sisfb.h> 75#include <video/sisfb.h>
82#endif 76#endif
83#endif
84 77
85static const unsigned char SiS_YPbPrTable[3][64] = { 78static const unsigned char SiS_YPbPrTable[3][64] = {
86 { 79 {
diff --git a/drivers/video/sis/initextlfb.c b/drivers/video/sis/initextlfb.c
index 09f5d758b6c0..c3884a29f4c5 100644
--- a/drivers/video/sis/initextlfb.c
+++ b/drivers/video/sis/initextlfb.c
@@ -34,12 +34,10 @@
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/fb.h> 35#include <linux/fb.h>
36 36
37#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
38int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, 37int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr,
39 unsigned char modeno, unsigned char rateindex); 38 unsigned char modeno, unsigned char rateindex);
40int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno, 39int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
41 unsigned char rateindex, struct fb_var_screeninfo *var); 40 unsigned char rateindex, struct fb_var_screeninfo *var);
42#endif
43BOOLEAN sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, 41BOOLEAN sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno,
44 int *htotal, int *vtotal, unsigned char rateindex); 42 int *htotal, int *vtotal, unsigned char rateindex);
45 43
@@ -49,7 +47,6 @@ extern BOOLEAN SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *Mode
49extern void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, 47extern void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
50 int xres, int yres, struct fb_var_screeninfo *var, BOOLEAN writeres); 48 int xres, int yres, struct fb_var_screeninfo *var, BOOLEAN writeres);
51 49
52#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
53int 50int
54sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, unsigned char modeno, 51sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, unsigned char modeno,
55 unsigned char rateindex) 52 unsigned char rateindex)
@@ -177,7 +174,6 @@ sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
177 174
178 return 1; 175 return 1;
179} 176}
180#endif /* Linux >= 2.5 */
181 177
182BOOLEAN 178BOOLEAN
183sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, int *htotal, 179sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, int *htotal,
diff --git a/drivers/video/sis/osdef.h b/drivers/video/sis/osdef.h
index f59568020eb2..d048bd39961b 100644
--- a/drivers/video/sis/osdef.h
+++ b/drivers/video/sis/osdef.h
@@ -100,11 +100,7 @@
100#define SIS315H 100#define SIS315H
101#endif 101#endif
102 102
103#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
104#define SIS_LINUX_KERNEL_26 103#define SIS_LINUX_KERNEL_26
105#else
106#define SIS_LINUX_KERNEL_24
107#endif
108 104
109#if !defined(SIS300) && !defined(SIS315H) 105#if !defined(SIS300) && !defined(SIS315H)
110#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set 106#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
diff --git a/drivers/video/sis/sis_accel.c b/drivers/video/sis/sis_accel.c
index 3b7ce032e2ed..7addf91d2fea 100644
--- a/drivers/video/sis/sis_accel.c
+++ b/drivers/video/sis/sis_accel.c
@@ -32,22 +32,10 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/fb.h> 34#include <linux/fb.h>
35#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
36#include <linux/console.h>
37#endif
38#include <linux/ioport.h> 35#include <linux/ioport.h>
39#include <linux/types.h> 36#include <linux/types.h>
40
41#include <asm/io.h> 37#include <asm/io.h>
42 38
43#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
44#include <video/fbcon.h>
45#include <video/fbcon-cfb8.h>
46#include <video/fbcon-cfb16.h>
47#include <video/fbcon-cfb24.h>
48#include <video/fbcon-cfb32.h>
49#endif
50
51#include "sis.h" 39#include "sis.h"
52#include "sis_accel.h" 40#include "sis_accel.h"
53 41
@@ -91,11 +79,9 @@ static const u8 sisPatALUConv[] =
91 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ 79 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
92}; 80};
93 81
94#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
95static const int myrops[] = { 82static const int myrops[] = {
96 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 83 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
97}; 84};
98#endif
99 85
100/* 300 series ----------------------------------------------------- */ 86/* 300 series ----------------------------------------------------- */
101#ifdef CONFIG_FB_SIS_300 87#ifdef CONFIG_FB_SIS_300
@@ -315,8 +301,6 @@ void sisfb_syncaccel(struct sis_video_info *ivideo)
315 } 301 }
316} 302}
317 303
318#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* --------------- 2.5 --------------- */
319
320int fbcon_sis_sync(struct fb_info *info) 304int fbcon_sis_sync(struct fb_info *info)
321{ 305{
322 struct sis_video_info *ivideo = (struct sis_video_info *)info->par; 306 struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
@@ -438,13 +422,3 @@ void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area)
438 422
439 sisfb_syncaccel(ivideo); 423 sisfb_syncaccel(ivideo);
440} 424}
441
442#endif
443
444#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* -------------- 2.4 --------------- */
445
446#include "sisfb_accel_2_4.h"
447
448#endif /* KERNEL VERSION */
449
450
diff --git a/drivers/video/sis/sis_accel.h b/drivers/video/sis/sis_accel.h
index 046e2c4a8e09..30e03cdf6b85 100644
--- a/drivers/video/sis/sis_accel.h
+++ b/drivers/video/sis/sis_accel.h
@@ -390,25 +390,11 @@
390 MMIO_OUT32(ivideo->mmio_vbase, FIRE_TRIGGER, 0); \ 390 MMIO_OUT32(ivideo->mmio_vbase, FIRE_TRIGGER, 0); \
391 CmdQueLen -= 2; 391 CmdQueLen -= 2;
392 392
393
394int sisfb_initaccel(struct sis_video_info *ivideo); 393int sisfb_initaccel(struct sis_video_info *ivideo);
395void sisfb_syncaccel(struct sis_video_info *ivideo); 394void sisfb_syncaccel(struct sis_video_info *ivideo);
396 395
397#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33)
398void fbcon_sis_bmove(struct display *p, int srcy, int srcx, int dsty,
399 int dstx, int height, int width);
400void fbcon_sis_revc(struct display *p, int srcy, int srcx);
401void fbcon_sis_clear8(struct vc_data *conp, struct display *p, int srcy,
402 int srcx, int height, int width);
403void fbcon_sis_clear16(struct vc_data *conp, struct display *p, int srcy,
404 int srcx, int height, int width);
405void fbcon_sis_clear32(struct vc_data *conp, struct display *p, int srcy,
406 int srcx, int height, int width);
407#endif
408#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
409int fbcon_sis_sync(struct fb_info *info); 396int fbcon_sis_sync(struct fb_info *info);
410void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect); 397void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
411void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area); 398void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area);
412#endif
413 399
414#endif 400#endif
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 895ebda7d9e3..baaf495a0a6d 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -35,9 +35,7 @@
35 35
36#include <linux/version.h> 36#include <linux/version.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
39#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
40#endif
41#include <linux/kernel.h> 39#include <linux/kernel.h>
42#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
43#include <linux/spinlock.h> 41#include <linux/spinlock.h>
@@ -58,9 +56,6 @@
58#include <linux/init.h> 56#include <linux/init.h>
59#include <linux/pci.h> 57#include <linux/pci.h>
60#include <linux/vmalloc.h> 58#include <linux/vmalloc.h>
61#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
62#include <linux/vt_kern.h>
63#endif
64#include <linux/capability.h> 59#include <linux/capability.h>
65#include <linux/fs.h> 60#include <linux/fs.h>
66#include <linux/types.h> 61#include <linux/types.h>
@@ -70,35 +65,9 @@
70#include <asm/mtrr.h> 65#include <asm/mtrr.h>
71#endif 66#endif
72 67
73#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
74#include <video/fbcon.h>
75#include <video/fbcon-cfb8.h>
76#include <video/fbcon-cfb16.h>
77#include <video/fbcon-cfb24.h>
78#include <video/fbcon-cfb32.h>
79#endif
80
81#include "sis.h" 68#include "sis.h"
82#include "sis_main.h" 69#include "sis_main.h"
83 70
84#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
85#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
86#error "This version of sisfb requires at least 2.6.3"
87#endif
88#endif
89
90#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
91#ifdef FBCON_HAS_CFB8
92extern struct display_switch fbcon_sis8;
93#endif
94#ifdef FBCON_HAS_CFB16
95extern struct display_switch fbcon_sis16;
96#endif
97#ifdef FBCON_HAS_CFB32
98extern struct display_switch fbcon_sis32;
99#endif
100#endif
101
102static void sisfb_handle_command(struct sis_video_info *ivideo, 71static void sisfb_handle_command(struct sis_video_info *ivideo,
103 struct sisfb_cmd *sisfb_command); 72 struct sisfb_cmd *sisfb_command);
104 73
@@ -114,17 +83,7 @@ sisfb_setdefaultparms(void)
114 sisfb_max = -1; 83 sisfb_max = -1;
115 sisfb_userom = -1; 84 sisfb_userom = -1;
116 sisfb_useoem = -1; 85 sisfb_useoem = -1;
117#ifdef MODULE
118 /* Module: "None" for 2.4, default mode for 2.5+ */
119#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
120 sisfb_mode_idx = -1;
121#else
122 sisfb_mode_idx = MODE_INDEX_NONE;
123#endif
124#else
125 /* Static: Default mode */
126 sisfb_mode_idx = -1; 86 sisfb_mode_idx = -1;
127#endif
128 sisfb_parm_rate = -1; 87 sisfb_parm_rate = -1;
129 sisfb_crt1off = 0; 88 sisfb_crt1off = 0;
130 sisfb_forcecrt1 = -1; 89 sisfb_forcecrt1 = -1;
@@ -142,10 +101,6 @@ sisfb_setdefaultparms(void)
142 sisfb_tvxposoffset = 0; 101 sisfb_tvxposoffset = 0;
143 sisfb_tvyposoffset = 0; 102 sisfb_tvyposoffset = 0;
144 sisfb_nocrt2rate = 0; 103 sisfb_nocrt2rate = 0;
145#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
146 sisfb_inverse = 0;
147 sisfb_fontname[0] = 0;
148#endif
149#if !defined(__i386__) && !defined(__x86_64__) 104#if !defined(__i386__) && !defined(__x86_64__)
150 sisfb_resetcard = 0; 105 sisfb_resetcard = 0;
151 sisfb_videoram = 0; 106 sisfb_videoram = 0;
@@ -162,14 +117,11 @@ sisfb_search_vesamode(unsigned int vesamode, BOOLEAN quiet)
162 /* We don't know the hardware specs yet and there is no ivideo */ 117 /* We don't know the hardware specs yet and there is no ivideo */
163 118
164 if(vesamode == 0) { 119 if(vesamode == 0) {
165#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
166 sisfb_mode_idx = MODE_INDEX_NONE;
167#else
168 if(!quiet) 120 if(!quiet)
169 printk(KERN_ERR "sisfb: Invalid mode. Using default.\n"); 121 printk(KERN_ERR "sisfb: Invalid mode. Using default.\n");
170 122
171 sisfb_mode_idx = DEFAULT_MODE; 123 sisfb_mode_idx = DEFAULT_MODE;
172#endif 124
173 return; 125 return;
174 } 126 }
175 127
@@ -215,7 +167,6 @@ sisfb_search_mode(char *name, BOOLEAN quiet)
215 return; 167 return;
216 } 168 }
217 169
218#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
219 if(!strnicmp(name, sisbios_mode[MODE_INDEX_NONE].name, strlen(name))) { 170 if(!strnicmp(name, sisbios_mode[MODE_INDEX_NONE].name, strlen(name))) {
220 if(!quiet) 171 if(!quiet)
221 printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n"); 172 printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n");
@@ -223,7 +174,7 @@ sisfb_search_mode(char *name, BOOLEAN quiet)
223 sisfb_mode_idx = DEFAULT_MODE; 174 sisfb_mode_idx = DEFAULT_MODE;
224 return; 175 return;
225 } 176 }
226#endif 177
227 if(strlen(name) <= 19) { 178 if(strlen(name) <= 19) {
228 strcpy(strbuf1, name); 179 strcpy(strbuf1, name);
229 for(i = 0; i < strlen(strbuf1); i++) { 180 for(i = 0; i < strlen(strbuf1); i++) {
@@ -1315,20 +1266,7 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in
1315 ivideo->refresh_rate = 60; 1266 ivideo->refresh_rate = 60;
1316 } 1267 }
1317 1268
1318#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1319 if(ivideo->sisfb_thismonitor.datavalid) {
1320 if(!sisfb_verify_rate(ivideo, &ivideo->sisfb_thismonitor, ivideo->sisfb_mode_idx,
1321 ivideo->rate_idx, ivideo->refresh_rate)) {
1322 printk(KERN_INFO "sisfb: WARNING: Refresh rate exceeds monitor specs!\n");
1323 }
1324 }
1325#endif
1326
1327#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1328 if(((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) && isactive) {
1329#else
1330 if(isactive) { 1269 if(isactive) {
1331#endif
1332 /* If acceleration to be used? Need to know 1270 /* If acceleration to be used? Need to know
1333 * before pre/post_set_mode() 1271 * before pre/post_set_mode()
1334 */ 1272 */
@@ -1367,9 +1305,7 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in
1367 ivideo->current_linelength = ivideo->video_linelength; 1305 ivideo->current_linelength = ivideo->video_linelength;
1368 ivideo->current_pixclock = var->pixclock; 1306 ivideo->current_pixclock = var->pixclock;
1369 ivideo->current_refresh_rate = ivideo->refresh_rate; 1307 ivideo->current_refresh_rate = ivideo->refresh_rate;
1370#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
1371 ivideo->sisfb_lastrates[ivideo->mode_no] = ivideo->refresh_rate; 1308 ivideo->sisfb_lastrates[ivideo->mode_no] = ivideo->refresh_rate;
1372#endif
1373 } 1309 }
1374 1310
1375 return 0; 1311 return 0;
@@ -1435,18 +1371,6 @@ sisfb_pan_var(struct sis_video_info *ivideo, struct fb_var_screeninfo *var)
1435 return 0; 1371 return 0;
1436} 1372}
1437 1373
1438/* ------------ FBDev related routines for 2.4 series ----------- */
1439
1440#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1441
1442#include "sisfb_fbdev_2_4.h"
1443
1444#endif
1445
1446/* ------------ FBDev related routines for 2.6 series ----------- */
1447
1448#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
1449
1450static int 1374static int
1451sisfb_open(struct fb_info *info, int user) 1375sisfb_open(struct fb_info *info, int user)
1452{ 1376{
@@ -1744,8 +1668,6 @@ sisfb_blank(int blank, struct fb_info *info)
1744 return sisfb_myblank(ivideo, blank); 1668 return sisfb_myblank(ivideo, blank);
1745} 1669}
1746 1670
1747#endif
1748
1749/* ----------- FBDev related routines for all series ---------- */ 1671/* ----------- FBDev related routines for all series ---------- */
1750 1672
1751#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) 1673#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
@@ -1969,20 +1891,6 @@ sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
1969 1891
1970/* ---------------- fb_ops structures ----------------- */ 1892/* ---------------- fb_ops structures ----------------- */
1971 1893
1972#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1973static struct fb_ops sisfb_ops = {
1974 .owner = THIS_MODULE,
1975 .fb_get_fix = sisfb_get_fix,
1976 .fb_get_var = sisfb_get_var,
1977 .fb_set_var = sisfb_set_var,
1978 .fb_get_cmap = sisfb_get_cmap,
1979 .fb_set_cmap = sisfb_set_cmap,
1980 .fb_pan_display = sisfb_pan_display,
1981 .fb_ioctl = sisfb_ioctl
1982};
1983#endif
1984
1985#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
1986static struct fb_ops sisfb_ops = { 1894static struct fb_ops sisfb_ops = {
1987 .owner = THIS_MODULE, 1895 .owner = THIS_MODULE,
1988 .fb_open = sisfb_open, 1896 .fb_open = sisfb_open,
@@ -2004,7 +1912,6 @@ static struct fb_ops sisfb_ops = {
2004#endif 1912#endif
2005 .fb_ioctl = sisfb_ioctl 1913 .fb_ioctl = sisfb_ioctl
2006}; 1914};
2007#endif
2008 1915
2009/* ---------------- Chip generation dependent routines ---------------- */ 1916/* ---------------- Chip generation dependent routines ---------------- */
2010 1917
@@ -4100,16 +4007,6 @@ sisfb_setup(char *options)
4100 sisfb_search_mode(this_opt + 5, FALSE); 4007 sisfb_search_mode(this_opt + 5, FALSE);
4101 } else if(!strnicmp(this_opt, "vesa:", 5)) { 4008 } else if(!strnicmp(this_opt, "vesa:", 5)) {
4102 sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0), FALSE); 4009 sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0), FALSE);
4103#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
4104 } else if(!strnicmp(this_opt, "inverse", 7)) {
4105 sisfb_inverse = 1;
4106 /* fb_invert_cmaps(); */
4107 } else if(!strnicmp(this_opt, "font:", 5)) {
4108 if(strlen(this_opt + 5) < 40) {
4109 strncpy(sisfb_fontname, this_opt + 5, sizeof(sisfb_fontname) - 1);
4110 sisfb_fontname[sizeof(sisfb_fontname) - 1] = '\0';
4111 }
4112#endif
4113 } else if(!strnicmp(this_opt, "rate:", 5)) { 4010 } else if(!strnicmp(this_opt, "rate:", 5)) {
4114 sisfb_parm_rate = simple_strtoul(this_opt + 5, NULL, 0); 4011 sisfb_parm_rate = simple_strtoul(this_opt + 5, NULL, 0);
4115 } else if(!strnicmp(this_opt, "forcecrt1:", 10)) { 4012 } else if(!strnicmp(this_opt, "forcecrt1:", 10)) {
@@ -5870,17 +5767,9 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5870 if(sisfb_off) 5767 if(sisfb_off)
5871 return -ENXIO; 5768 return -ENXIO;
5872 5769
5873#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,3))
5874 sis_fb_info = framebuffer_alloc(sizeof(*ivideo), &pdev->dev); 5770 sis_fb_info = framebuffer_alloc(sizeof(*ivideo), &pdev->dev);
5875 if(!sis_fb_info) 5771 if(!sis_fb_info)
5876 return -ENOMEM; 5772 return -ENOMEM;
5877#else
5878 sis_fb_info = kmalloc(sizeof(*sis_fb_info) + sizeof(*ivideo), GFP_KERNEL);
5879 if(!sis_fb_info)
5880 return -ENOMEM;
5881 memset(sis_fb_info, 0, sizeof(*sis_fb_info) + sizeof(*ivideo));
5882 sis_fb_info->par = ((char *)sis_fb_info + sizeof(*sis_fb_info));
5883#endif
5884 5773
5885 ivideo = (struct sis_video_info *)sis_fb_info->par; 5774 ivideo = (struct sis_video_info *)sis_fb_info->par;
5886 ivideo->memyselfandi = sis_fb_info; 5775 ivideo->memyselfandi = sis_fb_info;
@@ -5970,10 +5859,6 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5970 ivideo->tvxpos = sisfb_tvxposoffset; 5859 ivideo->tvxpos = sisfb_tvxposoffset;
5971 ivideo->tvypos = sisfb_tvyposoffset; 5860 ivideo->tvypos = sisfb_tvyposoffset;
5972 ivideo->sisfb_nocrt2rate = sisfb_nocrt2rate; 5861 ivideo->sisfb_nocrt2rate = sisfb_nocrt2rate;
5973#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
5974 ivideo->sisfb_inverse = sisfb_inverse;
5975#endif
5976
5977 ivideo->refresh_rate = 0; 5862 ivideo->refresh_rate = 0;
5978 if(ivideo->sisfb_parm_rate != -1) { 5863 if(ivideo->sisfb_parm_rate != -1) {
5979 ivideo->refresh_rate = ivideo->sisfb_parm_rate; 5864 ivideo->refresh_rate = ivideo->sisfb_parm_rate;
@@ -6049,10 +5934,6 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6049 } 5934 }
6050 } 5935 }
6051 5936
6052#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6053 strcpy(sis_fb_info->modename, ivideo->myid);
6054#endif
6055
6056 ivideo->SiS_Pr.ChipType = ivideo->chip; 5937 ivideo->SiS_Pr.ChipType = ivideo->chip;
6057 5938
6058 ivideo->SiS_Pr.ivideo = (void *)ivideo; 5939 ivideo->SiS_Pr.ivideo = (void *)ivideo;
@@ -6134,20 +6015,6 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6134#endif 6015#endif
6135 } 6016 }
6136 6017
6137#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6138#ifdef MODULE
6139 if((reg & 0x80) && (reg != 0xff)) {
6140 if((sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni])
6141 != 0xFF) {
6142 printk(KERN_INFO "sisfb: Cannot initialize display mode, "
6143 "X server is active\n");
6144 ret = -EBUSY;
6145 goto error_4;
6146 }
6147 }
6148#endif
6149#endif
6150
6151 /* Search and copy ROM image */ 6018 /* Search and copy ROM image */
6152 ivideo->bios_abase = NULL; 6019 ivideo->bios_abase = NULL;
6153 ivideo->SiS_Pr.VirtualRomBase = NULL; 6020 ivideo->SiS_Pr.VirtualRomBase = NULL;
@@ -6281,9 +6148,6 @@ error_0: iounmap(ivideo->video_vbase);
6281error_1: release_mem_region(ivideo->video_base, ivideo->video_size); 6148error_1: release_mem_region(ivideo->video_base, ivideo->video_size);
6282error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size); 6149error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size);
6283error_3: vfree(ivideo->bios_abase); 6150error_3: vfree(ivideo->bios_abase);
6284#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6285error_4:
6286#endif
6287 if(ivideo->lpcdev) 6151 if(ivideo->lpcdev)
6288 SIS_PCI_PUT_DEVICE(ivideo->lpcdev); 6152 SIS_PCI_PUT_DEVICE(ivideo->lpcdev);
6289 if(ivideo->nbridge) 6153 if(ivideo->nbridge)
@@ -6586,7 +6450,6 @@ error_4:
6586 sis_fb_info->fix = ivideo->sisfb_fix; 6450 sis_fb_info->fix = ivideo->sisfb_fix;
6587 sis_fb_info->screen_base = ivideo->video_vbase + ivideo->video_offset; 6451 sis_fb_info->screen_base = ivideo->video_vbase + ivideo->video_offset;
6588 sis_fb_info->fbops = &sisfb_ops; 6452 sis_fb_info->fbops = &sisfb_ops;
6589
6590 sisfb_get_fix(&sis_fb_info->fix, -1, sis_fb_info); 6453 sisfb_get_fix(&sis_fb_info->fix, -1, sis_fb_info);
6591 sis_fb_info->pseudo_palette = ivideo->pseudo_palette; 6454 sis_fb_info->pseudo_palette = ivideo->pseudo_palette;
6592 6455
@@ -6603,10 +6466,6 @@ error_4:
6603 } 6466 }
6604#endif 6467#endif
6605 6468
6606#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6607 vc_resize_con(1, 1, 0);
6608#endif
6609
6610 if(register_framebuffer(sis_fb_info) < 0) { 6469 if(register_framebuffer(sis_fb_info) < 0) {
6611 printk(KERN_ERR "sisfb: Fatal error: Failed to register framebuffer\n"); 6470 printk(KERN_ERR "sisfb: Fatal error: Failed to register framebuffer\n");
6612 ret = -EINVAL; 6471 ret = -EINVAL;
@@ -6653,12 +6512,7 @@ error_4:
6653 6512
6654 6513
6655 printk(KERN_INFO "fb%d: %s frame buffer device version %d.%d.%d\n", 6514 printk(KERN_INFO "fb%d: %s frame buffer device version %d.%d.%d\n",
6656#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 6515 sis_fb_info->node, ivideo->myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
6657 GET_FB_IDX(sis_fb_info->node),
6658#else
6659 sis_fb_info->node,
6660#endif
6661 ivideo->myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
6662 6516
6663 printk(KERN_INFO "sisfb: Copyright (C) 2001-2005 Thomas Winischhofer\n"); 6517 printk(KERN_INFO "sisfb: Copyright (C) 2001-2005 Thomas Winischhofer\n");
6664 6518
@@ -6732,11 +6586,7 @@ static void __devexit sisfb_remove(struct pci_dev *pdev)
6732 /* Unregister the framebuffer */ 6586 /* Unregister the framebuffer */
6733 if(ivideo->registered) { 6587 if(ivideo->registered) {
6734 unregister_framebuffer(sis_fb_info); 6588 unregister_framebuffer(sis_fb_info);
6735#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,3))
6736 framebuffer_release(sis_fb_info); 6589 framebuffer_release(sis_fb_info);
6737#else
6738 kfree(sis_fb_info);
6739#endif
6740 } 6590 }
6741 6591
6742 /* OK, our ivideo is gone for good from here. */ 6592 /* OK, our ivideo is gone for good from here. */
@@ -6762,7 +6612,6 @@ static struct pci_driver sisfb_driver = {
6762 6612
6763SISINITSTATIC int __init sisfb_init(void) 6613SISINITSTATIC int __init sisfb_init(void)
6764{ 6614{
6765#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
6766#ifndef MODULE 6615#ifndef MODULE
6767 char *options = NULL; 6616 char *options = NULL;
6768 6617
@@ -6771,15 +6620,12 @@ SISINITSTATIC int __init sisfb_init(void)
6771 6620
6772 sisfb_setup(options); 6621 sisfb_setup(options);
6773#endif 6622#endif
6774#endif
6775 return pci_register_driver(&sisfb_driver); 6623 return pci_register_driver(&sisfb_driver);
6776} 6624}
6777 6625
6778#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
6779#ifndef MODULE 6626#ifndef MODULE
6780module_init(sisfb_init); 6627module_init(sisfb_init);
6781#endif 6628#endif
6782#endif
6783 6629
6784/*****************************************************/ 6630/*****************************************************/
6785/* MODULE */ 6631/* MODULE */
@@ -6799,9 +6645,6 @@ static int pdc1 = -1;
6799static int noaccel = -1; 6645static int noaccel = -1;
6800static int noypan = -1; 6646static int noypan = -1;
6801static int nomax = -1; 6647static int nomax = -1;
6802#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6803static int inverse = 0;
6804#endif
6805static int userom = -1; 6648static int userom = -1;
6806static int useoem = -1; 6649static int useoem = -1;
6807static char *tvstandard = NULL; 6650static char *tvstandard = NULL;
@@ -6861,10 +6704,6 @@ static int __init sisfb_init_module(void)
6861 else if(nomax == 0) 6704 else if(nomax == 0)
6862 sisfb_max = 1; 6705 sisfb_max = 1;
6863 6706
6864#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6865 if(inverse) sisfb_inverse = 1;
6866#endif
6867
6868 if(mem) 6707 if(mem)
6869 sisfb_parm_mem = mem; 6708 sisfb_parm_mem = mem;
6870 6709
@@ -6913,35 +6752,6 @@ MODULE_DESCRIPTION("SiS 300/540/630/730/315/55x/65x/661/74x/330/76x/34x, XGI V3X
6913MODULE_LICENSE("GPL"); 6752MODULE_LICENSE("GPL");
6914MODULE_AUTHOR("Thomas Winischhofer <thomas@winischhofer.net>, Others"); 6753MODULE_AUTHOR("Thomas Winischhofer <thomas@winischhofer.net>, Others");
6915 6754
6916#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6917MODULE_PARM(mem, "i");
6918MODULE_PARM(noaccel, "i");
6919MODULE_PARM(noypan, "i");
6920MODULE_PARM(nomax, "i");
6921MODULE_PARM(userom, "i");
6922MODULE_PARM(useoem, "i");
6923MODULE_PARM(mode, "s");
6924MODULE_PARM(vesa, "i");
6925MODULE_PARM(rate, "i");
6926MODULE_PARM(forcecrt1, "i");
6927MODULE_PARM(forcecrt2type, "s");
6928MODULE_PARM(scalelcd, "i");
6929MODULE_PARM(pdc, "i");
6930MODULE_PARM(pdc1, "i");
6931MODULE_PARM(specialtiming, "s");
6932MODULE_PARM(lvdshl, "i");
6933MODULE_PARM(tvstandard, "s");
6934MODULE_PARM(tvxposoffset, "i");
6935MODULE_PARM(tvyposoffset, "i");
6936MODULE_PARM(nocrt2rate, "i");
6937MODULE_PARM(inverse, "i");
6938#if !defined(__i386__) && !defined(__x86_64__)
6939MODULE_PARM(resetcard, "i");
6940MODULE_PARM(videoram, "i");
6941#endif
6942#endif
6943
6944#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
6945module_param(mem, int, 0); 6755module_param(mem, int, 0);
6946module_param(noaccel, int, 0); 6756module_param(noaccel, int, 0);
6947module_param(noypan, int, 0); 6757module_param(noypan, int, 0);
@@ -6966,18 +6776,7 @@ module_param(nocrt2rate, int, 0);
6966module_param(resetcard, int, 0); 6776module_param(resetcard, int, 0);
6967module_param(videoram, int, 0); 6777module_param(videoram, int, 0);
6968#endif 6778#endif
6969#endif
6970 6779
6971#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6972MODULE_PARM_DESC(mem,
6973 "\nDetermines the beginning of the video memory heap in KB. This heap is used\n"
6974 "for video RAM management for eg. DRM/DRI. On 300 series, the default depends\n"
6975 "on the amount of video RAM available. If 8MB of video RAM or less is available,\n"
6976 "the heap starts at 4096KB, if between 8 and 16MB are available at 8192KB,\n"
6977 "otherwise at 12288KB. On 315/330/340 series, the heap size is 32KB by default.\n"
6978 "The value is to be specified without 'KB' and must match the MaxXFBMem setting\n"
6979 "for XFree86 4.x/X.org 6.7 and later.\n");
6980#else
6981MODULE_PARM_DESC(mem, 6780MODULE_PARM_DESC(mem,
6982 "\nDetermines the beginning of the video memory heap in KB. This heap is used\n" 6781 "\nDetermines the beginning of the video memory heap in KB. This heap is used\n"
6983 "for video RAM management for eg. DRM/DRI. On 300 series, the default depends\n" 6782 "for video RAM management for eg. DRM/DRI. On 300 series, the default depends\n"
@@ -6985,7 +6784,6 @@ MODULE_PARM_DESC(mem,
6985 "the heap starts at 4096KB, if between 8 and 16MB are available at 8192KB,\n" 6784 "the heap starts at 4096KB, if between 8 and 16MB are available at 8192KB,\n"
6986 "otherwise at 12288KB. On 315/330/340 series, the heap size is 32KB by default.\n" 6785 "otherwise at 12288KB. On 315/330/340 series, the heap size is 32KB by default.\n"
6987 "The value is to be specified without 'KB'.\n"); 6786 "The value is to be specified without 'KB'.\n");
6988#endif
6989 6787
6990MODULE_PARM_DESC(noaccel, 6788MODULE_PARM_DESC(noaccel,
6991 "\nIf set to anything other than 0, 2D acceleration will be disabled.\n" 6789 "\nIf set to anything other than 0, 2D acceleration will be disabled.\n"
@@ -7002,23 +6800,6 @@ MODULE_PARM_DESC(nomax,
7002 "enable the user to positively specify a virtual Y size of the screen using\n" 6800 "enable the user to positively specify a virtual Y size of the screen using\n"
7003 "fbset. (default: 0)\n"); 6801 "fbset. (default: 0)\n");
7004 6802
7005#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
7006MODULE_PARM_DESC(mode,
7007 "\nSelects the desired display mode in the format [X]x[Y]x[Depth], eg.\n"
7008 "1024x768x16. Other formats supported include XxY-Depth and\n"
7009 "XxY-Depth@Rate. If the parameter is only one (decimal or hexadecimal)\n"
7010 "number, it will be interpreted as a VESA mode number. (default: none if\n"
7011 "sisfb is a module; this leaves the console untouched and the driver will\n"
7012 "only do the video memory management for eg. DRM/DRI; 800x600x8 if sisfb\n"
7013 "is in the kernel)\n");
7014MODULE_PARM_DESC(vesa,
7015 "\nSelects the desired display mode by VESA defined mode number, eg. 0x117\n"
7016 "(default: 0x0000 if sisfb is a module; this leaves the console untouched\n"
7017 "and the driver will only do the video memory management for eg. DRM/DRI;\n"
7018 "0x0103 if sisfb is in the kernel)\n");
7019#endif
7020
7021#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
7022MODULE_PARM_DESC(mode, 6803MODULE_PARM_DESC(mode,
7023 "\nSelects the desired default display mode in the format XxYxDepth,\n" 6804 "\nSelects the desired default display mode in the format XxYxDepth,\n"
7024 "eg. 1024x768x16. Other formats supported include XxY-Depth and\n" 6805 "eg. 1024x768x16. Other formats supported include XxY-Depth and\n"
@@ -7028,7 +6809,6 @@ MODULE_PARM_DESC(mode,
7028MODULE_PARM_DESC(vesa, 6809MODULE_PARM_DESC(vesa,
7029 "\nSelects the desired default display mode by VESA defined mode number, eg.\n" 6810 "\nSelects the desired default display mode by VESA defined mode number, eg.\n"
7030 "0x117 (default: 0x0103)\n"); 6811 "0x117 (default: 0x0103)\n");
7031#endif
7032 6812
7033MODULE_PARM_DESC(rate, 6813MODULE_PARM_DESC(rate,
7034 "\nSelects the desired vertical refresh rate for CRT1 (external VGA) in Hz.\n" 6814 "\nSelects the desired vertical refresh rate for CRT1 (external VGA) in Hz.\n"
@@ -7094,12 +6874,6 @@ MODULE_PARM_DESC(nocrt2rate,
7094 "\nSetting this to 1 will force the driver to use the default refresh rate for\n" 6874 "\nSetting this to 1 will force the driver to use the default refresh rate for\n"
7095 "CRT2 if CRT2 type is VGA. (default: 0, use same rate as CRT1)\n"); 6875 "CRT2 if CRT2 type is VGA. (default: 0, use same rate as CRT1)\n");
7096 6876
7097#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
7098MODULE_PARM_DESC(inverse,
7099 "\nSetting this to anything but 0 should invert the display colors, but this\n"
7100 "does not seem to work. (default: 0)\n");
7101#endif
7102
7103#if !defined(__i386__) && !defined(__x86_64__) 6877#if !defined(__i386__) && !defined(__x86_64__)
7104#ifdef CONFIG_FB_SIS_300 6878#ifdef CONFIG_FB_SIS_300
7105MODULE_PARM_DESC(resetcard, 6879MODULE_PARM_DESC(resetcard,
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h
index 70b6df371b8e..88e4f1e41470 100644
--- a/drivers/video/sis/sis_main.h
+++ b/drivers/video/sis/sis_main.h
@@ -67,15 +67,7 @@ static int sisfb_ypan = -1;
67static int sisfb_max = -1; 67static int sisfb_max = -1;
68static int sisfb_userom = 1; 68static int sisfb_userom = 1;
69static int sisfb_useoem = -1; 69static int sisfb_useoem = -1;
70#ifdef MODULE
71#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
72static int sisfb_mode_idx = -1;
73#else
74static int sisfb_mode_idx = MODE_INDEX_NONE; /* Don't use a mode by default if we are a module */
75#endif
76#else
77static int sisfb_mode_idx = -1; /* Use a default mode if we are inside the kernel */ 70static int sisfb_mode_idx = -1; /* Use a default mode if we are inside the kernel */
78#endif
79static int sisfb_parm_rate = -1; 71static int sisfb_parm_rate = -1;
80static int sisfb_crt1off = 0; 72static int sisfb_crt1off = 0;
81static int sisfb_forcecrt1 = -1; 73static int sisfb_forcecrt1 = -1;
@@ -93,10 +85,6 @@ static int sisfb_tvstd = -1;
93static int sisfb_tvxposoffset = 0; 85static int sisfb_tvxposoffset = 0;
94static int sisfb_tvyposoffset = 0; 86static int sisfb_tvyposoffset = 0;
95static int sisfb_nocrt2rate = 0; 87static int sisfb_nocrt2rate = 0;
96#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
97static int sisfb_inverse = 0;
98static char sisfb_fontname[40];
99#endif
100#if !defined(__i386__) && !defined(__x86_64__) 88#if !defined(__i386__) && !defined(__x86_64__)
101static int sisfb_resetcard = 0; 89static int sisfb_resetcard = 0;
102static int sisfb_videoram = 0; 90static int sisfb_videoram = 0;
@@ -687,54 +675,8 @@ SISINITSTATIC int sisfb_init(void);
687static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, 675static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
688 struct fb_info *info); 676 struct fb_info *info);
689 677
690#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
691static int sisfb_get_fix(struct fb_fix_screeninfo *fix,
692 int con,
693 struct fb_info *info);
694static int sisfb_get_var(struct fb_var_screeninfo *var,
695 int con,
696 struct fb_info *info);
697static int sisfb_set_var(struct fb_var_screeninfo *var,
698 int con,
699 struct fb_info *info);
700static void sisfb_crtc_to_var(struct sis_video_info *ivideo,
701 struct fb_var_screeninfo *var);
702static int sisfb_get_cmap(struct fb_cmap *cmap,
703 int kspc,
704 int con,
705 struct fb_info *info);
706static int sisfb_set_cmap(struct fb_cmap *cmap,
707 int kspc,
708 int con,
709 struct fb_info *info);
710static int sisfb_update_var(int con,
711 struct fb_info *info);
712static int sisfb_switch(int con,
713 struct fb_info *info);
714static void sisfb_blank(int blank,
715 struct fb_info *info);
716static void sisfb_set_disp(int con,
717 struct fb_var_screeninfo *var,
718 struct fb_info *info);
719static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green,
720 unsigned *blue, unsigned *transp,
721 struct fb_info *fb_info);
722static void sisfb_do_install_cmap(int con,
723 struct fb_info *info);
724static int sisfb_ioctl(struct inode *inode, struct file *file,
725 unsigned int cmd, unsigned long arg, int con,
726 struct fb_info *info);
727#endif
728
729#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
730#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
731static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, 678static int sisfb_ioctl(struct fb_info *info, unsigned int cmd,
732 unsigned long arg); 679 unsigned long arg);
733#else
734static int sisfb_ioctl(struct inode *inode, struct file *file,
735 unsigned int cmd, unsigned long arg,
736 struct fb_info *info);
737#endif
738static int sisfb_set_par(struct fb_info *info); 680static int sisfb_set_par(struct fb_info *info);
739static int sisfb_blank(int blank, 681static int sisfb_blank(int blank,
740 struct fb_info *info); 682 struct fb_info *info);
@@ -743,7 +685,6 @@ extern void fbcon_sis_fillrect(struct fb_info *info,
743extern void fbcon_sis_copyarea(struct fb_info *info, 685extern void fbcon_sis_copyarea(struct fb_info *info,
744 const struct fb_copyarea *area); 686 const struct fb_copyarea *area);
745extern int fbcon_sis_sync(struct fb_info *info); 687extern int fbcon_sis_sync(struct fb_info *info);
746#endif
747 688
748/* Internal 2D accelerator functions */ 689/* Internal 2D accelerator functions */
749extern int sisfb_initaccel(struct sis_video_info *ivideo); 690extern int sisfb_initaccel(struct sis_video_info *ivideo);
@@ -811,16 +752,10 @@ extern BOOLEAN SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
811 752
812extern BOOLEAN sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, 753extern BOOLEAN sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno,
813 int *htotal, int *vtotal, unsigned char rateindex); 754 int *htotal, int *vtotal, unsigned char rateindex);
814#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
815extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, 755extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr,
816 unsigned char modeno, unsigned char rateindex); 756 unsigned char modeno, unsigned char rateindex);
817extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno, 757extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
818 unsigned char rateindex, struct fb_var_screeninfo *var); 758 unsigned char rateindex, struct fb_var_screeninfo *var);
819#endif
820#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
821extern void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres,
822 int yres, struct fb_var_screeninfo *var, BOOLEAN writeres);
823#endif
824 759
825/* Chrontel TV, DDC and DPMS functions */ 760/* Chrontel TV, DDC and DPMS functions */
826extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg); 761extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg);
diff --git a/drivers/video/sis/vgatypes.h b/drivers/video/sis/vgatypes.h
index 831b9f42264b..05d08b7889a1 100644
--- a/drivers/video/sis/vgatypes.h
+++ b/drivers/video/sis/vgatypes.h
@@ -73,12 +73,10 @@ typedef unsigned int BOOLEAN;
73 73
74#ifdef SIS_LINUX_KERNEL 74#ifdef SIS_LINUX_KERNEL
75typedef unsigned long SISIOADDRESS; 75typedef unsigned long SISIOADDRESS;
76#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
77#include <linux/types.h> /* Need __iomem */ 76#include <linux/types.h> /* Need __iomem */
78#undef SISIOMEMTYPE 77#undef SISIOMEMTYPE
79#define SISIOMEMTYPE __iomem 78#define SISIOMEMTYPE __iomem
80#endif 79#endif
81#endif
82 80
83#ifdef SIS_XORG_XF86 81#ifdef SIS_XORG_XF86
84#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0) 82#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0)
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index dad54e73147b..711cb11d6eb3 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -17,7 +17,10 @@
17 * (port driver to new frambuffer infrastructure) 17 * (port driver to new frambuffer infrastructure)
18 * 01/2003 Helge Deller <deller@gmx.de> 18 * 01/2003 Helge Deller <deller@gmx.de>
19 * (initial work on fb hardware acceleration for voodoo2) 19 * (initial work on fb hardware acceleration for voodoo2)
20 * 20 * 08/2006 Alan Cox <alan@redhat.com>
21 * Remove never finished and bogus 24/32bit support
22 * Clean up macro abuse
23 * Minor tidying for format.
21 */ 24 */
22 25
23/* 26/*
@@ -40,6 +43,7 @@
40 through the fifo. warning: issuing a nop command seems to need pci_fifo 43 through the fifo. warning: issuing a nop command seems to need pci_fifo
41-FIXME: in case of failure in the init sequence, be sure we return to a safe 44-FIXME: in case of failure in the init sequence, be sure we return to a safe
42 state. 45 state.
46- FIXME: Use accelerator for 2D scroll
43-FIXME: 4MB boards have banked memory (FbiInit2 bits 1 & 20) 47-FIXME: 4MB boards have banked memory (FbiInit2 bits 1 & 20)
44 */ 48 */
45 49
@@ -67,9 +71,6 @@
67 71
68#undef SST_DEBUG 72#undef SST_DEBUG
69 73
70/* enable 24/32 bpp functions ? (completely untested!) */
71#undef EN_24_32_BPP
72
73/* 74/*
74 Default video mode . 75 Default video mode .
75 0 800x600@60 took from glide 76 0 800x600@60 took from glide
@@ -377,7 +378,11 @@ static void sstfb_clear_screen(struct fb_info *info)
377 * sstfb_check_var - Optional function. Validates a var passed in. 378 * sstfb_check_var - Optional function. Validates a var passed in.
378 * @var: frame buffer variable screen structure 379 * @var: frame buffer variable screen structure
379 * @info: frame buffer structure that represents a single frame buffer 380 * @info: frame buffer structure that represents a single frame buffer
381 *
382 * Limit to the abilities of a single chip as SLI is not supported
383 * by this driver.
380 */ 384 */
385
381static int sstfb_check_var(struct fb_var_screeninfo *var, 386static int sstfb_check_var(struct fb_var_screeninfo *var,
382 struct fb_info *info) 387 struct fb_info *info)
383{ 388{
@@ -390,7 +395,7 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
390 unsigned int freq; 395 unsigned int freq;
391 396
392 if (sst_calc_pll(PICOS2KHZ(var->pixclock), &freq, &par->pll)) { 397 if (sst_calc_pll(PICOS2KHZ(var->pixclock), &freq, &par->pll)) {
393 eprintk("Pixclock at %ld KHZ out of range\n", 398 printk(KERN_ERR "sstfb: Pixclock at %ld KHZ out of range\n",
394 PICOS2KHZ(var->pixclock)); 399 PICOS2KHZ(var->pixclock));
395 return -EINVAL; 400 return -EINVAL;
396 } 401 }
@@ -409,27 +414,15 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
409 case 0 ... 16 : 414 case 0 ... 16 :
410 var->bits_per_pixel = 16; 415 var->bits_per_pixel = 16;
411 break; 416 break;
412#ifdef EN_24_32_BPP
413 case 17 ... 24 :
414 var->bits_per_pixel = 24;
415 break;
416 case 25 ... 32 :
417 var->bits_per_pixel = 32;
418 break;
419#endif
420 default : 417 default :
421 eprintk("Unsupported bpp %d\n", var->bits_per_pixel); 418 printk(KERN_ERR "sstfb: Unsupported bpp %d\n", var->bits_per_pixel);
422 return -EINVAL; 419 return -EINVAL;
423 } 420 }
424 421
425 /* validity tests */ 422 /* validity tests */
426 if ((var->xres <= 1) || (yDim <= 0 ) 423 if (var->xres <= 1 || yDim <= 0 || var->hsync_len <= 1 ||
427 || (var->hsync_len <= 1) 424 hSyncOff <= 1 || var->left_margin <= 2 || vSyncOn <= 0 ||
428 || (hSyncOff <= 1) 425 vSyncOff <= 0 || vBackPorch <= 0) {
429 || (var->left_margin <= 2)
430 || (vSyncOn <= 0)
431 || (vSyncOff <= 0)
432 || (vBackPorch <= 0)) {
433 return -EINVAL; 426 return -EINVAL;
434 } 427 }
435 428
@@ -437,21 +430,17 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
437 /* Voodoo 2 limits */ 430 /* Voodoo 2 limits */
438 tiles_in_X = (var->xres + 63 ) / 64 * 2; 431 tiles_in_X = (var->xres + 63 ) / 64 * 2;
439 432
440 if (((var->xres - 1) >= POW2(11)) || (yDim >= POW2(11))) { 433 if (var->xres > POW2(11) || yDim >= POW2(11)) {
441 eprintk("Unsupported resolution %dx%d\n", 434 printk(KERN_ERR "sstfb: Unsupported resolution %dx%d\n",
442 var->xres, var->yres); 435 var->xres, var->yres);
443 return -EINVAL; 436 return -EINVAL;
444 } 437 }
445 438
446 if (((var->hsync_len-1) >= POW2(9)) 439 if (var->hsync_len > POW2(9) || hSyncOff > POW2(11) ||
447 || ((hSyncOff-1) >= POW2(11)) 440 var->left_margin - 2 >= POW2(9) || vSyncOn >= POW2(13) ||
448 || ((var->left_margin - 2) >= POW2(9)) 441 vSyncOff >= POW2(13) || vBackPorch >= POW2(9) ||
449 || (vSyncOn >= POW2(13)) 442 tiles_in_X >= POW2(6) || tiles_in_X <= 0) {
450 || (vSyncOff >= POW2(13)) 443 printk(KERN_ERR "sstfb: Unsupported timings\n");
451 || (vBackPorch >= POW2(9))
452 || (tiles_in_X >= POW2(6))
453 || (tiles_in_X <= 0)) {
454 eprintk("Unsupported Timings\n");
455 return -EINVAL; 444 return -EINVAL;
456 } 445 }
457 } else { 446 } else {
@@ -459,24 +448,20 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
459 tiles_in_X = (var->xres + 63 ) / 64; 448 tiles_in_X = (var->xres + 63 ) / 64;
460 449
461 if (var->vmode) { 450 if (var->vmode) {
462 eprintk("Interlace/Doublescan not supported %#x\n", 451 printk(KERN_ERR "sstfb: Interlace/doublescan not supported %#x\n",
463 var->vmode); 452 var->vmode);
464 return -EINVAL; 453 return -EINVAL;
465 } 454 }
466 if (((var->xres - 1) >= POW2(10)) || (var->yres >= POW2(10))) { 455 if (var->xres > POW2(10) || var->yres >= POW2(10)) {
467 eprintk("Unsupported resolution %dx%d\n", 456 printk(KERN_ERR "sstfb: Unsupported resolution %dx%d\n",
468 var->xres, var->yres); 457 var->xres, var->yres);
469 return -EINVAL; 458 return -EINVAL;
470 } 459 }
471 if (((var->hsync_len - 1) >= POW2(8)) 460 if (var->hsync_len > POW2(8) || hSyncOff - 1 > POW2(10) ||
472 || ((hSyncOff-1) >= POW2(10)) 461 var->left_margin - 2 >= POW2(8) || vSyncOn >= POW2(12) ||
473 || ((var->left_margin - 2) >= POW2(8)) 462 vSyncOff >= POW2(12) || vBackPorch >= POW2(8) ||
474 || (vSyncOn >= POW2(12)) 463 tiles_in_X >= POW2(4) || tiles_in_X <= 0) {
475 || (vSyncOff >= POW2(12)) 464 printk(KERN_ERR "sstfb: Unsupported timings\n");
476 || (vBackPorch >= POW2(8))
477 || (tiles_in_X >= POW2(4))
478 || (tiles_in_X <= 0)) {
479 eprintk("Unsupported Timings\n");
480 return -EINVAL; 465 return -EINVAL;
481 } 466 }
482 } 467 }
@@ -486,8 +471,8 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
486 real_length = tiles_in_X * (IS_VOODOO2(par) ? 32 : 64 ) 471 real_length = tiles_in_X * (IS_VOODOO2(par) ? 32 : 64 )
487 * ((var->bits_per_pixel == 16) ? 2 : 4); 472 * ((var->bits_per_pixel == 16) ? 2 : 4);
488 473
489 if ((real_length * yDim) > info->fix.smem_len) { 474 if (real_length * yDim > info->fix.smem_len) {
490 eprintk("Not enough video memory\n"); 475 printk(KERN_ERR "sstfb: Not enough video memory\n");
491 return -ENOMEM; 476 return -ENOMEM;
492 } 477 }
493 478
@@ -515,20 +500,6 @@ static int sstfb_check_var(struct fb_var_screeninfo *var,
515 var->blue.offset = 0; 500 var->blue.offset = 0;
516 var->transp.offset = 0; 501 var->transp.offset = 0;
517 break; 502 break;
518#ifdef EN_24_32_BPP
519 case 24: /* RGB 888 LfbMode 4 */
520 case 32: /* ARGB 8888 LfbMode 5 */
521 var->red.length = 8;
522 var->green.length = 8;
523 var->blue.length = 8;
524 var->transp.length = 0;
525
526 var->red.offset = 16;
527 var->green.offset = 8;
528 var->blue.offset = 0;
529 var->transp.offset = 0; /* in 24bpp we fake a 32 bpp mode */
530 break;
531#endif
532 default: 503 default:
533 return -EINVAL; 504 return -EINVAL;
534 } 505 }
@@ -653,13 +624,6 @@ static int sstfb_set_par(struct fb_info *info)
653 case 16: 624 case 16:
654 fbiinit1 |= SEL_SOURCE_VCLK_2X_SEL; 625 fbiinit1 |= SEL_SOURCE_VCLK_2X_SEL;
655 break; 626 break;
656#ifdef EN_24_32_BPP
657 case 24:
658 case 32:
659 /* sst_set_bits(FBIINIT1, SEL_SOURCE_VCLK_2X_DIV2 | EN_24BPP);*/
660 fbiinit1 |= SEL_SOURCE_VCLK_2X_SEL | EN_24BPP;
661 break;
662#endif
663 default: 627 default:
664 return -EINVAL; 628 return -EINVAL;
665 } 629 }
@@ -690,14 +654,6 @@ static int sstfb_set_par(struct fb_info *info)
690 case 16: 654 case 16:
691 lfbmode = LFB_565; 655 lfbmode = LFB_565;
692 break; 656 break;
693#ifdef EN_24_32_BPP
694 case 24:
695 lfbmode = LFB_888;
696 break;
697 case 32:
698 lfbmode = LFB_8888;
699 break;
700#endif
701 default: 657 default:
702 return -EINVAL; 658 return -EINVAL;
703 } 659 }
@@ -789,8 +745,7 @@ static int sstfb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
789 return -EFAULT; 745 return -EFAULT;
790 if (val > info->fix.smem_len) 746 if (val > info->fix.smem_len)
791 val = info->fix.smem_len; 747 val = info->fix.smem_len;
792 printk("filling %#x \n", val); 748 for (p = 0 ; p < val; p += 2)
793 for (p=0 ; p<val; p+=2)
794 writew(p >> 6, info->screen_base + p); 749 writew(p >> 6, info->screen_base + p);
795 return 0; 750 return 0;
796 751
@@ -802,13 +757,10 @@ static int sstfb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
802 pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, 757 pci_write_config_dword(sst_dev, PCI_INIT_ENABLE,
803 tmp | PCI_EN_INIT_WR ); 758 tmp | PCI_EN_INIT_WR );
804 fbiinit0 = sst_read (FBIINIT0); 759 fbiinit0 = sst_read (FBIINIT0);
805 if (val) { 760 if (val)
806 sst_write(FBIINIT0, fbiinit0 & ~EN_VGA_PASSTHROUGH); 761 sst_write(FBIINIT0, fbiinit0 & ~EN_VGA_PASSTHROUGH);
807 iprintk("Disabling VGA pass-through\n"); 762 else
808 } else {
809 sst_write(FBIINIT0, fbiinit0 | EN_VGA_PASSTHROUGH); 763 sst_write(FBIINIT0, fbiinit0 | EN_VGA_PASSTHROUGH);
810 iprintk("Enabling VGA pass-through\n");
811 }
812 pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, tmp); 764 pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, tmp);
813 return 0; 765 return 0;
814 766
@@ -884,9 +836,9 @@ static int __devinit sst_get_memsize(struct fb_info *info, __u32 *memsize)
884 u8 __iomem *fbbase_virt = info->screen_base; 836 u8 __iomem *fbbase_virt = info->screen_base;
885 837
886 /* force memsize */ 838 /* force memsize */
887 if ((mem >= 1 ) && (mem <= 4)) { 839 if (mem >= 1 && mem <= 4) {
888 *memsize = (mem * 0x100000); 840 *memsize = (mem * 0x100000);
889 iprintk("supplied memsize: %#x\n", *memsize); 841 printk(KERN_INFO "supplied memsize: %#x\n", *memsize);
890 return 1; 842 return 1;
891 } 843 }
892 844
@@ -927,7 +879,7 @@ static int __devinit sst_detect_att(struct fb_info *info)
927 struct sstfb_par *par = info->par; 879 struct sstfb_par *par = info->par;
928 int i, mir, dir; 880 int i, mir, dir;
929 881
930 for (i=0; i<3; i++) { 882 for (i = 0; i < 3; i++) {
931 sst_dac_write(DACREG_WMA, 0); /* backdoor */ 883 sst_dac_write(DACREG_WMA, 0); /* backdoor */
932 sst_dac_read(DACREG_RMR); /* read 4 times RMR */ 884 sst_dac_read(DACREG_RMR); /* read 4 times RMR */
933 sst_dac_read(DACREG_RMR); 885 sst_dac_read(DACREG_RMR);
@@ -940,7 +892,7 @@ static int __devinit sst_detect_att(struct fb_info *info)
940 /*the 7th, device ID register */ 892 /*the 7th, device ID register */
941 dir = sst_dac_read(DACREG_RMR); 893 dir = sst_dac_read(DACREG_RMR);
942 f_ddprintk("mir: %#x, dir: %#x\n", mir, dir); 894 f_ddprintk("mir: %#x, dir: %#x\n", mir, dir);
943 if ((mir == DACREG_MIR_ATT ) && (dir == DACREG_DIR_ATT)) { 895 if (mir == DACREG_MIR_ATT && dir == DACREG_DIR_ATT) {
944 return 1; 896 return 1;
945 } 897 }
946 } 898 }
@@ -1134,12 +1086,6 @@ static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp)
1134 case 16: 1086 case 16:
1135 sst_dac_write(DACREG_RMR, (cr0 & 0x0f) | DACREG_CR0_16BPP); 1087 sst_dac_write(DACREG_RMR, (cr0 & 0x0f) | DACREG_CR0_16BPP);
1136 break; 1088 break;
1137#ifdef EN_24_32_BPP
1138 case 24:
1139 case 32:
1140 sst_dac_write(DACREG_RMR, (cr0 & 0x0f) | DACREG_CR0_24BPP);
1141 break;
1142#endif
1143 default: 1089 default:
1144 dprintk("%s: bad depth '%u'\n", __FUNCTION__, bpp); 1090 dprintk("%s: bad depth '%u'\n", __FUNCTION__, bpp);
1145 break; 1091 break;
@@ -1154,12 +1100,6 @@ static void sst_set_vidmod_ics(struct fb_info *info, const int bpp)
1154 case 16: 1100 case 16:
1155 sst_dac_write(DACREG_ICS_CMD, DACREG_ICS_CMD_16BPP); 1101 sst_dac_write(DACREG_ICS_CMD, DACREG_ICS_CMD_16BPP);
1156 break; 1102 break;
1157#ifdef EN_24_32_BPP
1158 case 24:
1159 case 32:
1160 sst_dac_write(DACREG_ICS_CMD, DACREG_ICS_CMD_24BPP);
1161 break;
1162#endif
1163 default: 1103 default:
1164 dprintk("%s: bad depth '%u'\n", __FUNCTION__, bpp); 1104 dprintk("%s: bad depth '%u'\n", __FUNCTION__, bpp);
1165 break; 1105 break;
@@ -1250,7 +1190,7 @@ static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par)
1250 PCI_EN_INIT_WR | PCI_REMAP_DAC ); 1190 PCI_EN_INIT_WR | PCI_REMAP_DAC );
1251 /* detect dac type */ 1191 /* detect dac type */
1252 if (!sst_detect_dactype(info, par)) { 1192 if (!sst_detect_dactype(info, par)) {
1253 eprintk("Unknown dac type\n"); 1193 printk(KERN_ERR "sstfb: unknown dac type.\n");
1254 //FIXME watch it: we are not in a safe state, bad bad bad. 1194 //FIXME watch it: we are not in a safe state, bad bad bad.
1255 return 0; 1195 return 0;
1256 } 1196 }
@@ -1258,10 +1198,10 @@ static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par)
1258 /* set graphic clock */ 1198 /* set graphic clock */
1259 par->gfx_clock = spec->default_gfx_clock; 1199 par->gfx_clock = spec->default_gfx_clock;
1260 if ((gfxclk >10 ) && (gfxclk < spec->max_gfxclk)) { 1200 if ((gfxclk >10 ) && (gfxclk < spec->max_gfxclk)) {
1261 iprintk("Using supplied graphic freq : %dMHz\n", gfxclk); 1201 printk(KERN_INFO "sstfb: Using supplied graphic freq : %dMHz\n", gfxclk);
1262 par->gfx_clock = gfxclk *1000; 1202 par->gfx_clock = gfxclk *1000;
1263 } else if (gfxclk) { 1203 } else if (gfxclk) {
1264 wprintk ("%dMhz is way out of spec! Using default\n", gfxclk); 1204 printk(KERN_WARNING "sstfb: %dMhz is way out of spec! Using default\n", gfxclk);
1265 } 1205 }
1266 1206
1267 sst_calc_pll(par->gfx_clock, &Fout, &gfx_timings); 1207 sst_calc_pll(par->gfx_clock, &Fout, &gfx_timings);
@@ -1396,7 +1336,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1396 1336
1397 /* Enable device in PCI config. */ 1337 /* Enable device in PCI config. */
1398 if ((err=pci_enable_device(pdev))) { 1338 if ((err=pci_enable_device(pdev))) {
1399 eprintk("cannot enable device\n"); 1339 printk(KERN_ERR "cannot enable device\n");
1400 return err; 1340 return err;
1401 } 1341 }
1402 1342
@@ -1422,39 +1362,39 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1422 fix->smem_start = fix->mmio_start + 0x400000; 1362 fix->smem_start = fix->mmio_start + 0x400000;
1423 1363
1424 if (!request_mem_region(fix->mmio_start, fix->mmio_len, "sstfb MMIO")) { 1364 if (!request_mem_region(fix->mmio_start, fix->mmio_len, "sstfb MMIO")) {
1425 eprintk("cannot reserve mmio memory\n"); 1365 printk(KERN_ERR "sstfb: cannot reserve mmio memory\n");
1426 goto fail_mmio_mem; 1366 goto fail_mmio_mem;
1427 } 1367 }
1428 1368
1429 if (!request_mem_region(fix->smem_start, 0x400000,"sstfb FB")) { 1369 if (!request_mem_region(fix->smem_start, 0x400000,"sstfb FB")) {
1430 eprintk("cannot reserve fb memory\n"); 1370 printk(KERN_ERR "sstfb: cannot reserve fb memory\n");
1431 goto fail_fb_mem; 1371 goto fail_fb_mem;
1432 } 1372 }
1433 1373
1434 par->mmio_vbase = ioremap_nocache(fix->mmio_start, 1374 par->mmio_vbase = ioremap_nocache(fix->mmio_start,
1435 fix->mmio_len); 1375 fix->mmio_len);
1436 if (!par->mmio_vbase) { 1376 if (!par->mmio_vbase) {
1437 eprintk("cannot remap register area %#lx\n", 1377 printk(KERN_ERR "sstfb: cannot remap register area %#lx\n",
1438 fix->mmio_start); 1378 fix->mmio_start);
1439 goto fail_mmio_remap; 1379 goto fail_mmio_remap;
1440 } 1380 }
1441 info->screen_base = ioremap_nocache(fix->smem_start, 0x400000); 1381 info->screen_base = ioremap_nocache(fix->smem_start, 0x400000);
1442 if (!info->screen_base) { 1382 if (!info->screen_base) {
1443 eprintk("cannot remap framebuffer %#lx\n", 1383 printk(KERN_ERR "sstfb: cannot remap framebuffer %#lx\n",
1444 fix->smem_start); 1384 fix->smem_start);
1445 goto fail_fb_remap; 1385 goto fail_fb_remap;
1446 } 1386 }
1447 1387
1448 if (!sst_init(info, par)) { 1388 if (!sst_init(info, par)) {
1449 eprintk("Init failed\n"); 1389 printk(KERN_ERR "sstfb: Init failed\n");
1450 goto fail; 1390 goto fail;
1451 } 1391 }
1452 sst_get_memsize(info, &fix->smem_len); 1392 sst_get_memsize(info, &fix->smem_len);
1453 strlcpy(fix->id, spec->name, sizeof(fix->id)); 1393 strlcpy(fix->id, spec->name, sizeof(fix->id));
1454 1394
1455 iprintk("%s (revision %d) with %s dac\n", 1395 printk(KERN_INFO "%s (revision %d) with %s dac\n",
1456 fix->id, par->revision, par->dac_sw.name); 1396 fix->id, par->revision, par->dac_sw.name);
1457 iprintk("framebuffer at %#lx, mapped to 0x%p, size %dMB\n", 1397 printk(KERN_INFO "framebuffer at %#lx, mapped to 0x%p, size %dMB\n",
1458 fix->smem_start, info->screen_base, 1398 fix->smem_start, info->screen_base,
1459 fix->smem_len >> 20); 1399 fix->smem_len >> 20);
1460 1400
@@ -1471,24 +1411,25 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1471 fix->accel = FB_ACCEL_NONE; /* FIXME */ 1411 fix->accel = FB_ACCEL_NONE; /* FIXME */
1472 /* 1412 /*
1473 * According to the specs, the linelength must be of 1024 *pixels* 1413 * According to the specs, the linelength must be of 1024 *pixels*
1474 * and the 24bpp mode is in fact a 32 bpp mode. 1414 * and the 24bpp mode is in fact a 32 bpp mode (and both are in
1415 * fact dithered to 16bit).
1475 */ 1416 */
1476 fix->line_length = 2048; /* default value, for 24 or 32bit: 4096 */ 1417 fix->line_length = 2048; /* default value, for 24 or 32bit: 4096 */
1477 1418
1478 if ( mode_option && 1419 if ( mode_option &&
1479 fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 16)) { 1420 fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 16)) {
1480 eprintk("can't set supplied video mode. Using default\n"); 1421 printk(KERN_ERR "sstfb: can't set supplied video mode. Using default\n");
1481 info->var = sstfb_default; 1422 info->var = sstfb_default;
1482 } else 1423 } else
1483 info->var = sstfb_default; 1424 info->var = sstfb_default;
1484 1425
1485 if (sstfb_check_var(&info->var, info)) { 1426 if (sstfb_check_var(&info->var, info)) {
1486 eprintk("invalid default video mode.\n"); 1427 printk(KERN_ERR "sstfb: invalid default video mode.\n");
1487 goto fail; 1428 goto fail;
1488 } 1429 }
1489 1430
1490 if (sstfb_set_par(info)) { 1431 if (sstfb_set_par(info)) {
1491 eprintk("can't set default video mode.\n"); 1432 printk(KERN_ERR "sstfb: can't set default video mode.\n");
1492 goto fail; 1433 goto fail;
1493 } 1434 }
1494 1435
@@ -1497,7 +1438,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1497 /* register fb */ 1438 /* register fb */
1498 info->device = &pdev->dev; 1439 info->device = &pdev->dev;
1499 if (register_framebuffer(info) < 0) { 1440 if (register_framebuffer(info) < 0) {
1500 eprintk("can't register framebuffer.\n"); 1441 printk(KERN_ERR "sstfb: can't register framebuffer.\n");
1501 goto fail; 1442 goto fail;
1502 } 1443 }
1503 1444
@@ -1711,4 +1652,3 @@ module_param(gfxclk, int, 0);
1711MODULE_PARM_DESC(gfxclk, "Force graphic chip frequency in MHz. DANGEROUS. (default=auto)"); 1652MODULE_PARM_DESC(gfxclk, "Force graphic chip frequency in MHz. DANGEROUS. (default=auto)");
1712module_param(slowpci, bool, 0); 1653module_param(slowpci, bool, 0);
1713MODULE_PARM_DESC(slowpci, "Uses slow PCI settings (0 or 1) (default=0)"); 1654MODULE_PARM_DESC(slowpci, "Uses slow PCI settings (0 or 1) (default=0)");
1714