aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig39
-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/intelfb/Makefile4
-rw-r--r--drivers/video/intelfb/intelfb.h79
-rw-r--r--drivers/video/intelfb/intelfb_i2c.c200
-rw-r--r--drivers/video/intelfb/intelfbdrv.c64
-rw-r--r--drivers/video/intelfb/intelfbhw.c136
-rw-r--r--drivers/video/intelfb/intelfbhw.h25
-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/riva/fbdev.c8
-rw-r--r--drivers/video/riva/rivafb-i2c.c44
-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
42 files changed, 914 insertions, 813 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 702eb933cf88..a1c8923b0bf5 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
@@ -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
@@ -822,33 +829,52 @@ 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
828 tristate "Intel 830M/845G/852GM/855GM/865G support (EXPERIMENTAL)" 836 tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G support (EXPERIMENTAL)"
829 depends on FB && EXPERIMENTAL && PCI && X86 837 depends on FB && EXPERIMENTAL && PCI && X86
830 select AGP 838 select AGP
831 select AGP_INTEL 839 select AGP_INTEL
840 select I2C_ALGOBIT if FB_INTEL_I2C
841 select I2C if FB_INTEL_I2C
832 select FB_MODE_HELPERS 842 select FB_MODE_HELPERS
833 select FB_CFB_FILLRECT 843 select FB_CFB_FILLRECT
834 select FB_CFB_COPYAREA 844 select FB_CFB_COPYAREA
835 select FB_CFB_IMAGEBLIT 845 select FB_CFB_IMAGEBLIT
836 help 846 help
837 This driver supports the on-board graphics built in to the Intel 847 This driver supports the on-board graphics built in to the Intel
838 830M/845G/852GM/855GM/865G chipsets. 848 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM chipsets.
839 Say Y if you have and plan to use such a board. 849 Say Y if you have and plan to use such a board.
840 850
841 To compile this driver as a module, choose M here: the 851 If you say Y here and want DDC/I2C support you must first say Y to
852 "I2C support" and "I2C bit-banging support" in the character devices
853 section.
854
855 If you say M here then "I2C support" and "I2C bit-banging support"
856 can be build either as modules or built-in.
857
858 To compile this driver as a module, choose M here: the
842 module will be called intelfb. 859 module will be called intelfb.
843 860
861 For more information, please read <file:Documentation/fb/intelfb.txt>
862
844config FB_INTEL_DEBUG 863config FB_INTEL_DEBUG
845 bool "Intel driver Debug Messages" 864 bool "Intel driver Debug Messages"
846 depends on FB_INTEL 865 depends on FB_INTEL
847 ---help--- 866 ---help---
848 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
849 of debugging informations to provide to the maintainer when 868 of debugging informations to provide to the maintainer when
850 something goes wrong. 869 something goes wrong.
851 870
871config FB_INTEL_I2C
872 bool "DDC/I2C for Intel framebuffer support"
873 depends on FB_INTEL
874 default y
875 help
876 Say Y here if you want DDC/I2C support for your on-board Intel graphics.
877
852config FB_MATROX 878config FB_MATROX
853 tristate "Matrox acceleration" 879 tristate "Matrox acceleration"
854 depends on FB && PCI 880 depends on FB && PCI
@@ -994,6 +1020,7 @@ config FB_RADEON
994 depends on FB && PCI 1020 depends on FB && PCI
995 select I2C_ALGOBIT if FB_RADEON_I2C 1021 select I2C_ALGOBIT if FB_RADEON_I2C
996 select I2C if FB_RADEON_I2C 1022 select I2C if FB_RADEON_I2C
1023 select FB_DDC if FB_RADEON_I2C
997 select FB_MODE_HELPERS 1024 select FB_MODE_HELPERS
998 select FB_CFB_FILLRECT 1025 select FB_CFB_FILLRECT
999 select FB_CFB_COPYAREA 1026 select FB_CFB_COPYAREA
@@ -1122,6 +1149,7 @@ config FB_SAVAGE
1122 depends on FB && PCI && EXPERIMENTAL 1149 depends on FB && PCI && EXPERIMENTAL
1123 select I2C_ALGOBIT if FB_SAVAGE_I2C 1150 select I2C_ALGOBIT if FB_SAVAGE_I2C
1124 select I2C if FB_SAVAGE_I2C 1151 select I2C if FB_SAVAGE_I2C
1152 select FB_DDC if FB_SAVAGE_I2C
1125 select FB_MODE_HELPERS 1153 select FB_MODE_HELPERS
1126 select FB_CFB_FILLRECT 1154 select FB_CFB_FILLRECT
1127 select FB_CFB_COPYAREA 1155 select FB_CFB_COPYAREA
@@ -1601,7 +1629,8 @@ config FB_VIRTUAL
1601 kernel option `video=vfb:'. 1629 kernel option `video=vfb:'.
1602 1630
1603 To compile this driver as a module, choose M here: the 1631 To compile this driver as a module, choose M here: the
1604 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.
1605 1634
1606 If unsure, say N. 1635 If unsure, say N.
1607if 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/intelfb/Makefile b/drivers/video/intelfb/Makefile
index 722d21d6e5cd..6c782d3ae1be 100644
--- a/drivers/video/intelfb/Makefile
+++ b/drivers/video/intelfb/Makefile
@@ -1,6 +1,8 @@
1obj-$(CONFIG_FB_INTEL) += intelfb.o 1obj-$(CONFIG_FB_INTEL) += intelfb.o
2 2
3intelfb-objs := intelfbdrv.o intelfbhw.o 3intelfb-y := intelfbdrv.o intelfbhw.o
4intelfb-$(CONFIG_FB_INTEL_I2C) += intelfb_i2c.o
5intelfb-objs := $(intelfb-y)
4 6
5ifdef CONFIG_FB_INTEL_DEBUG 7ifdef CONFIG_FB_INTEL_DEBUG
6#EXTRA_CFLAGS += -DDEBUG -DVERBOSE -DREGDUMP 8#EXTRA_CFLAGS += -DDEBUG -DVERBOSE -DREGDUMP
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h
index e290d7460e1b..80b94c19a9fa 100644
--- a/drivers/video/intelfb/intelfb.h
+++ b/drivers/video/intelfb/intelfb.h
@@ -6,6 +6,10 @@
6#include <linux/agp_backend.h> 6#include <linux/agp_backend.h>
7#include <linux/fb.h> 7#include <linux/fb.h>
8 8
9#ifdef CONFIG_FB_INTEL_I2C
10#include <linux/i2c.h>
11#include <linux/i2c-algo-bit.h>
12#endif
9 13
10/*** Version/name ***/ 14/*** Version/name ***/
11#define INTELFB_VERSION "0.9.4" 15#define INTELFB_VERSION "0.9.4"
@@ -115,6 +119,29 @@
115/* Intel agpgart driver */ 119/* Intel agpgart driver */
116#define AGP_PHYSICAL_MEMORY 2 120#define AGP_PHYSICAL_MEMORY 2
117 121
122/* store information about an Ixxx DVO */
123/* The i830->i865 use multiple DVOs with multiple i2cs */
124/* the i915, i945 have a single sDVO i2c bus - which is different */
125#define MAX_OUTPUTS 6
126
127/* these are outputs from the chip - integrated only
128 external chips are via DVO or SDVO output */
129#define INTELFB_OUTPUT_UNUSED 0
130#define INTELFB_OUTPUT_ANALOG 1
131#define INTELFB_OUTPUT_DVO 2
132#define INTELFB_OUTPUT_SDVO 3
133#define INTELFB_OUTPUT_LVDS 4
134#define INTELFB_OUTPUT_TVOUT 5
135
136#define INTELFB_DVO_CHIP_NONE 0
137#define INTELFB_DVO_CHIP_LVDS 1
138#define INTELFB_DVO_CHIP_TMDS 2
139#define INTELFB_DVO_CHIP_TVOUT 4
140
141#define INTELFB_OUTPUT_PIPE_NC 0
142#define INTELFB_OUTPUT_PIPE_A 1
143#define INTELFB_OUTPUT_PIPE_B 2
144
118/*** Data Types ***/ 145/*** Data Types ***/
119 146
120/* supported chipsets */ 147/* supported chipsets */
@@ -195,6 +222,10 @@ struct intelfb_hwstate {
195 u32 mem_mode; 222 u32 mem_mode;
196 u32 fw_blc_0; 223 u32 fw_blc_0;
197 u32 fw_blc_1; 224 u32 fw_blc_1;
225 u16 hwstam;
226 u16 ier;
227 u16 iir;
228 u16 imr;
198}; 229};
199 230
200struct intelfb_heap_data { 231struct intelfb_heap_data {
@@ -204,6 +235,33 @@ struct intelfb_heap_data {
204 u32 size; // in bytes 235 u32 size; // in bytes
205}; 236};
206 237
238#ifdef CONFIG_FB_INTEL_I2C
239struct intelfb_i2c_chan {
240 struct intelfb_info *dinfo;
241 u32 reg;
242 struct i2c_adapter adapter;
243 struct i2c_algo_bit_data algo;
244};
245#endif
246
247struct intelfb_output_rec {
248 int type;
249 int pipe;
250 int flags;
251
252#ifdef CONFIG_FB_INTEL_I2C
253 struct intelfb_i2c_chan i2c_bus;
254 struct intelfb_i2c_chan ddc_bus;
255#endif
256};
257
258struct intelfb_vsync {
259 wait_queue_head_t wait;
260 unsigned int count;
261 int pan_display;
262 u32 pan_offset;
263};
264
207struct intelfb_info { 265struct intelfb_info {
208 struct fb_info *info; 266 struct fb_info *info;
209 struct fb_ops *fbops; 267 struct fb_ops *fbops;
@@ -220,7 +278,7 @@ struct intelfb_info {
220 u8 fbmem_gart; 278 u8 fbmem_gart;
221 279
222 /* mtrr support */ 280 /* mtrr support */
223 u32 mtrr_reg; 281 int mtrr_reg;
224 u32 has_mtrr; 282 u32 has_mtrr;
225 283
226 /* heap data */ 284 /* heap data */
@@ -267,6 +325,12 @@ struct intelfb_info {
267 int fixed_mode; 325 int fixed_mode;
268 int ring_active; 326 int ring_active;
269 int flag; 327 int flag;
328 unsigned long irq_flags;
329 int open;
330
331 /* vsync */
332 struct intelfb_vsync vsync;
333 spinlock_t int_lock;
270 334
271 /* hw cursor */ 335 /* hw cursor */
272 int cursor_on; 336 int cursor_on;
@@ -285,12 +349,25 @@ struct intelfb_info {
285 349
286 /* index into plls */ 350 /* index into plls */
287 int pll_index; 351 int pll_index;
352
353 /* outputs */
354 int num_outputs;
355 struct intelfb_output_rec output[MAX_OUTPUTS];
288}; 356};
289 357
290#define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM)) 358#define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM))
291 359
360#ifndef FBIO_WAITFORVSYNC
361#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
362#endif
363
292/*** function prototypes ***/ 364/*** function prototypes ***/
293 365
294extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var); 366extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var);
295 367
368#ifdef CONFIG_FB_INTEL_I2C
369extern void intelfb_create_i2c_busses(struct intelfb_info *dinfo);
370extern void intelfb_delete_i2c_busses(struct intelfb_info *dinfo);
371#endif
372
296#endif /* _INTELFB_H */ 373#endif /* _INTELFB_H */
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c
new file mode 100644
index 000000000000..c1113d6e941d
--- /dev/null
+++ b/drivers/video/intelfb/intelfb_i2c.c
@@ -0,0 +1,200 @@
1/**************************************************************************
2
3 Copyright 2006 Dave Airlie <airlied@linux.ie>
4
5All Rights Reserved.
6
7Permission is hereby granted, free of charge, to any person obtaining a
8copy of this software and associated documentation files (the "Software"),
9to deal in the Software without restriction, including without limitation
10on the rights to use, copy, modify, merge, publish, distribute, sub
11license, and/or sell copies of the Software, and to permit persons to whom
12the Software is furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice (including the next
15paragraph) shall be included in all copies or substantial portions of the
16Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26**************************************************************************/
27
28#include <linux/config.h>
29#include <linux/module.h>
30#include <linux/kernel.h>
31#include <linux/sched.h>
32#include <linux/delay.h>
33#include <linux/pci.h>
34#include <linux/fb.h>
35
36#include <linux/i2c.h>
37#include <linux/i2c-id.h>
38#include <linux/i2c-algo-bit.h>
39
40#include <asm/io.h>
41
42#include "intelfb.h"
43#include "intelfbhw.h"
44
45/* bit locations in the registers */
46#define SCL_DIR_MASK 0x0001
47#define SCL_DIR 0x0002
48#define SCL_VAL_MASK 0x0004
49#define SCL_VAL_OUT 0x0008
50#define SCL_VAL_IN 0x0010
51#define SDA_DIR_MASK 0x0100
52#define SDA_DIR 0x0200
53#define SDA_VAL_MASK 0x0400
54#define SDA_VAL_OUT 0x0800
55#define SDA_VAL_IN 0x1000
56
57static void intelfb_gpio_setscl(void *data, int state)
58{
59 struct intelfb_i2c_chan *chan = data;
60 struct intelfb_info *dinfo = chan->dinfo;
61 u32 val;
62
63 OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK);
64 val = INREG(chan->reg);
65}
66
67static void intelfb_gpio_setsda(void *data, int state)
68{
69 struct intelfb_i2c_chan *chan = data;
70 struct intelfb_info *dinfo = chan->dinfo;
71 u32 val;
72
73 OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK);
74 val = INREG(chan->reg);
75}
76
77static int intelfb_gpio_getscl(void *data)
78{
79 struct intelfb_i2c_chan *chan = data;
80 struct intelfb_info *dinfo = chan->dinfo;
81 u32 val;
82
83 OUTREG(chan->reg, SCL_DIR_MASK);
84 OUTREG(chan->reg, 0);
85 val = INREG(chan->reg);
86 return ((val & SCL_VAL_IN) != 0);
87}
88
89static int intelfb_gpio_getsda(void *data)
90{
91 struct intelfb_i2c_chan *chan = data;
92 struct intelfb_info *dinfo = chan->dinfo;
93 u32 val;
94
95 OUTREG(chan->reg, SDA_DIR_MASK);
96 OUTREG(chan->reg, 0);
97 val = INREG(chan->reg);
98 return ((val & SDA_VAL_IN) != 0);
99}
100
101static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
102 struct intelfb_i2c_chan *chan,
103 const u32 reg, const char *name)
104{
105 int rc;
106
107 chan->dinfo = dinfo;
108 chan->reg = reg;
109 snprintf(chan->adapter.name, I2C_NAME_SIZE, "intelfb %s", name);
110 chan->adapter.owner = THIS_MODULE;
111 chan->adapter.id = I2C_HW_B_INTELFB;
112 chan->adapter.algo_data = &chan->algo;
113 chan->adapter.dev.parent = &chan->dinfo->pdev->dev;
114 chan->algo.setsda = intelfb_gpio_setsda;
115 chan->algo.setscl = intelfb_gpio_setscl;
116 chan->algo.getsda = intelfb_gpio_getsda;
117 chan->algo.getscl = intelfb_gpio_getscl;
118 chan->algo.udelay = 40;
119 chan->algo.timeout = 20;
120 chan->algo.data = chan;
121
122 i2c_set_adapdata(&chan->adapter, chan);
123
124 /* Raise SCL and SDA */
125 intelfb_gpio_setsda(chan, 1);
126 intelfb_gpio_setscl(chan, 1);
127 udelay(20);
128
129 rc = i2c_bit_add_bus(&chan->adapter);
130 if (rc == 0)
131 DBG_MSG("I2C bus %s registered.\n", name);
132 else
133 WRN_MSG("Failed to register I2C bus %s.\n", name);
134 return rc;
135}
136
137void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
138{
139 int i = 0;
140
141 /* everyone has at least a single analog output */
142 dinfo->num_outputs = 1;
143 dinfo->output[i].type = INTELFB_OUTPUT_ANALOG;
144
145 /* setup the DDC bus for analog output */
146 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, "CRTDDC_A");
147 i++;
148
149 /* need to add the output busses for each device
150 - this function is very incomplete
151 - i915GM has LVDS and TVOUT for example
152 */
153 switch(dinfo->chipset) {
154 case INTEL_830M:
155 case INTEL_845G:
156 case INTEL_855GM:
157 case INTEL_865G:
158 dinfo->output[i].type = INTELFB_OUTPUT_DVO;
159 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOD, "DVODDC_D");
160 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "DVOI2C_E");
161 i++;
162 break;
163 case INTEL_915G:
164 case INTEL_915GM:
165 /* has some LVDS + tv-out */
166 case INTEL_945G:
167 case INTEL_945GM:
168 /* SDVO ports have a single control bus - 2 devices */
169 dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
170 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "SDVOCTRL_E");
171 /* TODO: initialize the SDVO */
172// I830SDVOInit(pScrn, i, DVOB);
173 i++;
174
175 /* set up SDVOC */
176 dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
177 dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus;
178 /* TODO: initialize the SDVO */
179// I830SDVOInit(pScrn, i, DVOC);
180 i++;
181 break;
182 }
183 dinfo->num_outputs = i;
184}
185
186void intelfb_delete_i2c_busses(struct intelfb_info *dinfo)
187{
188 int i;
189
190 for (i = 0; i < MAX_OUTPUTS; i++) {
191 if (dinfo->output[i].i2c_bus.dinfo) {
192 i2c_bit_del_bus(&dinfo->output[i].i2c_bus.adapter);
193 dinfo->output[i].i2c_bus.dinfo = NULL;
194 }
195 if (dinfo->output[i].ddc_bus.dinfo) {
196 i2c_bit_del_bus(&dinfo->output[i].ddc_bus.adapter);
197 dinfo->output[i].ddc_bus.dinfo = NULL;
198 }
199 }
200}
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 06af89d44a0d..6f9de04193d2 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -136,6 +136,8 @@
136static void __devinit get_initial_mode(struct intelfb_info *dinfo); 136static void __devinit get_initial_mode(struct intelfb_info *dinfo);
137static void update_dinfo(struct intelfb_info *dinfo, 137static void update_dinfo(struct intelfb_info *dinfo,
138 struct fb_var_screeninfo *var); 138 struct fb_var_screeninfo *var);
139static int intelfb_open(struct fb_info *info, int user);
140static int intelfb_release(struct fb_info *info, int user);
139static int intelfb_check_var(struct fb_var_screeninfo *var, 141static int intelfb_check_var(struct fb_var_screeninfo *var,
140 struct fb_info *info); 142 struct fb_info *info);
141static int intelfb_set_par(struct fb_info *info); 143static int intelfb_set_par(struct fb_info *info);
@@ -194,6 +196,8 @@ static int num_registered = 0;
194/* fb ops */ 196/* fb ops */
195static struct fb_ops intel_fb_ops = { 197static struct fb_ops intel_fb_ops = {
196 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
199 .fb_open = intelfb_open,
200 .fb_release = intelfb_release,
197 .fb_check_var = intelfb_check_var, 201 .fb_check_var = intelfb_check_var,
198 .fb_set_par = intelfb_set_par, 202 .fb_set_par = intelfb_set_par,
199 .fb_setcolreg = intelfb_setcolreg, 203 .fb_setcolreg = intelfb_setcolreg,
@@ -446,6 +450,8 @@ cleanup(struct intelfb_info *dinfo)
446 if (!dinfo) 450 if (!dinfo)
447 return; 451 return;
448 452
453 intelfbhw_disable_irq(dinfo);
454
449 fb_dealloc_cmap(&dinfo->info->cmap); 455 fb_dealloc_cmap(&dinfo->info->cmap);
450 kfree(dinfo->info->pixmap.addr); 456 kfree(dinfo->info->pixmap.addr);
451 457
@@ -467,6 +473,11 @@ cleanup(struct intelfb_info *dinfo)
467 agp_free_memory(dinfo->gtt_ring_mem); 473 agp_free_memory(dinfo->gtt_ring_mem);
468 } 474 }
469 475
476#ifdef CONFIG_FB_INTEL_I2C
477 /* un-register I2C bus */
478 intelfb_delete_i2c_busses(dinfo);
479#endif
480
470 if (dinfo->mmio_base) 481 if (dinfo->mmio_base)
471 iounmap((void __iomem *)dinfo->mmio_base); 482 iounmap((void __iomem *)dinfo->mmio_base);
472 if (dinfo->aperture.virtual) 483 if (dinfo->aperture.virtual)
@@ -844,6 +855,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
844 if (bailearly == 5) 855 if (bailearly == 5)
845 bailout(dinfo); 856 bailout(dinfo);
846 857
858#ifdef CONFIG_FB_INTEL_I2C
859 /* register I2C bus */
860 intelfb_create_i2c_busses(dinfo);
861#endif
862
847 if (bailearly == 6) 863 if (bailearly == 6)
848 bailout(dinfo); 864 bailout(dinfo);
849 865
@@ -888,6 +904,13 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
888 } 904 }
889 905
890 dinfo->registered = 1; 906 dinfo->registered = 1;
907 dinfo->open = 0;
908
909 init_waitqueue_head(&dinfo->vsync.wait);
910 spin_lock_init(&dinfo->int_lock);
911 dinfo->irq_flags = 0;
912 dinfo->vsync.pan_display = 0;
913 dinfo->vsync.pan_offset = 0;
891 914
892 return 0; 915 return 0;
893 916
@@ -1188,6 +1211,34 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
1188 ***************************************************************/ 1211 ***************************************************************/
1189 1212
1190static int 1213static int
1214intelfb_open(struct fb_info *info, int user)
1215{
1216 struct intelfb_info *dinfo = GET_DINFO(info);
1217
1218 if (user) {
1219 dinfo->open++;
1220 }
1221
1222 return 0;
1223}
1224
1225static int
1226intelfb_release(struct fb_info *info, int user)
1227{
1228 struct intelfb_info *dinfo = GET_DINFO(info);
1229
1230 if (user) {
1231 dinfo->open--;
1232 msleep(1);
1233 if (!dinfo->open) {
1234 intelfbhw_disable_irq(dinfo);
1235 }
1236 }
1237
1238 return 0;
1239}
1240
1241static int
1191intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 1242intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1192{ 1243{
1193 int change_var = 0; 1244 int change_var = 0;
@@ -1433,6 +1484,19 @@ static int
1433intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) 1484intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
1434{ 1485{
1435 int retval = 0; 1486 int retval = 0;
1487 struct intelfb_info *dinfo = GET_DINFO(info);
1488 u32 pipe = 0;
1489
1490 switch (cmd) {
1491 case FBIO_WAITFORVSYNC:
1492 if (get_user(pipe, (__u32 __user *)arg))
1493 return -EFAULT;
1494
1495 retval = intelfbhw_wait_for_vsync(dinfo, pipe);
1496 break;
1497 default:
1498 break;
1499 }
1436 1500
1437 return retval; 1501 return retval;
1438} 1502}
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 2a9322f9cfdc..f887f1efd3fe 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -32,6 +32,7 @@
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
34#include <linux/pagemap.h> 34#include <linux/pagemap.h>
35#include <linux/interrupt.h>
35 36
36#include <asm/io.h> 37#include <asm/io.h>
37 38
@@ -368,7 +369,13 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
368 369
369 offset += dinfo->fb.offset << 12; 370 offset += dinfo->fb.offset << 12;
370 371
371 OUTREG(DSPABASE, offset); 372 dinfo->vsync.pan_offset = offset;
373 if ((var->activate & FB_ACTIVATE_VBL) && !intelfbhw_enable_irq(dinfo, 0)) {
374 dinfo->vsync.pan_display = 1;
375 } else {
376 dinfo->vsync.pan_display = 0;
377 OUTREG(DSPABASE, offset);
378 }
372 379
373 return 0; 380 return 0;
374} 381}
@@ -585,6 +592,11 @@ intelfbhw_read_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
585 hw->fw_blc_0 = INREG(FW_BLC_0); 592 hw->fw_blc_0 = INREG(FW_BLC_0);
586 hw->fw_blc_1 = INREG(FW_BLC_1); 593 hw->fw_blc_1 = INREG(FW_BLC_1);
587 594
595 hw->hwstam = INREG16(HWSTAM);
596 hw->ier = INREG16(IER);
597 hw->iir = INREG16(IIR);
598 hw->imr = INREG16(IMR);
599
588 return 0; 600 return 0;
589} 601}
590 602
@@ -613,6 +625,7 @@ static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, int lvd
613 return vco / p; 625 return vco / p;
614} 626}
615 627
628#if REGDUMP
616static void 629static void
617intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2) 630intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2)
618{ 631{
@@ -638,6 +651,7 @@ intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2)
638 *o_p1 = p1; 651 *o_p1 = p1;
639 *o_p2 = p2; 652 *o_p2 = p2;
640} 653}
654#endif
641 655
642 656
643void 657void
@@ -794,6 +808,10 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
794 printk(" FW_BLC_0 0x%08x\n", hw->fw_blc_0); 808 printk(" FW_BLC_0 0x%08x\n", hw->fw_blc_0);
795 printk(" FW_BLC_1 0x%08x\n", hw->fw_blc_1); 809 printk(" FW_BLC_1 0x%08x\n", hw->fw_blc_1);
796 810
811 printk(" HWSTAM 0x%04x\n", hw->hwstam);
812 printk(" IER 0x%04x\n", hw->ier);
813 printk(" IIR 0x%04x\n", hw->iir);
814 printk(" IMR 0x%04x\n", hw->imr);
797 printk("hw state dump end\n"); 815 printk("hw state dump end\n");
798#endif 816#endif
799} 817}
@@ -1932,3 +1950,119 @@ intelfbhw_cursor_reset(struct intelfb_info *dinfo) {
1932 addr += 16; 1950 addr += 16;
1933 } 1951 }
1934} 1952}
1953
1954static irqreturn_t
1955intelfbhw_irq(int irq, void *dev_id, struct pt_regs *fp) {
1956 int handled = 0;
1957 u16 tmp;
1958 struct intelfb_info *dinfo = (struct intelfb_info *)dev_id;
1959
1960 spin_lock(&dinfo->int_lock);
1961
1962 tmp = INREG16(IIR);
1963 tmp &= VSYNC_PIPE_A_INTERRUPT;
1964
1965 if (tmp == 0) {
1966 spin_unlock(&dinfo->int_lock);
1967 return IRQ_RETVAL(handled);
1968 }
1969
1970 OUTREG16(IIR, tmp);
1971
1972 if (tmp & VSYNC_PIPE_A_INTERRUPT) {
1973 dinfo->vsync.count++;
1974 if (dinfo->vsync.pan_display) {
1975 dinfo->vsync.pan_display = 0;
1976 OUTREG(DSPABASE, dinfo->vsync.pan_offset);
1977 }
1978 wake_up_interruptible(&dinfo->vsync.wait);
1979 handled = 1;
1980 }
1981
1982 spin_unlock(&dinfo->int_lock);
1983
1984 return IRQ_RETVAL(handled);
1985}
1986
1987int
1988intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable) {
1989
1990 if (!test_and_set_bit(0, &dinfo->irq_flags)) {
1991 if (request_irq(dinfo->pdev->irq, intelfbhw_irq, SA_SHIRQ, "intelfb", dinfo)) {
1992 clear_bit(0, &dinfo->irq_flags);
1993 return -EINVAL;
1994 }
1995
1996 spin_lock_irq(&dinfo->int_lock);
1997 OUTREG16(HWSTAM, 0xfffe);
1998 OUTREG16(IMR, 0x0);
1999 OUTREG16(IER, VSYNC_PIPE_A_INTERRUPT);
2000 spin_unlock_irq(&dinfo->int_lock);
2001 } else if (reenable) {
2002 u16 ier;
2003
2004 spin_lock_irq(&dinfo->int_lock);
2005 ier = INREG16(IER);
2006 if ((ier & VSYNC_PIPE_A_INTERRUPT)) {
2007 DBG_MSG("someone disabled the IRQ [%08X]\n", ier);
2008 OUTREG(IER, VSYNC_PIPE_A_INTERRUPT);
2009 }
2010 spin_unlock_irq(&dinfo->int_lock);
2011 }
2012 return 0;
2013}
2014
2015void
2016intelfbhw_disable_irq(struct intelfb_info *dinfo) {
2017 u16 tmp;
2018
2019 if (test_and_clear_bit(0, &dinfo->irq_flags)) {
2020 if (dinfo->vsync.pan_display) {
2021 dinfo->vsync.pan_display = 0;
2022 OUTREG(DSPABASE, dinfo->vsync.pan_offset);
2023 }
2024 spin_lock_irq(&dinfo->int_lock);
2025 OUTREG16(HWSTAM, 0xffff);
2026 OUTREG16(IMR, 0xffff);
2027 OUTREG16(IER, 0x0);
2028
2029 tmp = INREG16(IIR);
2030 OUTREG16(IIR, tmp);
2031 spin_unlock_irq(&dinfo->int_lock);
2032
2033 free_irq(dinfo->pdev->irq, dinfo);
2034 }
2035}
2036
2037int
2038intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) {
2039 struct intelfb_vsync *vsync;
2040 unsigned int count;
2041 int ret;
2042
2043 switch (pipe) {
2044 case 0:
2045 vsync = &dinfo->vsync;
2046 break;
2047 default:
2048 return -ENODEV;
2049 }
2050
2051 ret = intelfbhw_enable_irq(dinfo, 0);
2052 if (ret) {
2053 return ret;
2054 }
2055
2056 count = vsync->count;
2057 ret = wait_event_interruptible_timeout(vsync->wait, count != vsync->count, HZ/10);
2058 if (ret < 0) {
2059 return ret;
2060 }
2061 if (ret == 0) {
2062 intelfbhw_enable_irq(dinfo, 1);
2063 DBG_MSG("wait_for_vsync timed out!\n");
2064 return -ETIMEDOUT;
2065 }
2066
2067 return 0;
2068}
diff --git a/drivers/video/intelfb/intelfbhw.h b/drivers/video/intelfb/intelfbhw.h
index 10acda098b71..8c54ba8fbdda 100644
--- a/drivers/video/intelfb/intelfbhw.h
+++ b/drivers/video/intelfb/intelfbhw.h
@@ -88,6 +88,19 @@
88#define INSTDONE 0x2090 88#define INSTDONE 0x2090
89#define PRI_RING_EMPTY 1 89#define PRI_RING_EMPTY 1
90 90
91#define HWSTAM 0x2098
92#define IER 0x20A0
93#define IIR 0x20A4
94#define IMR 0x20A8
95#define VSYNC_PIPE_A_INTERRUPT (1 << 7)
96#define PIPE_A_EVENT_INTERRUPT (1 << 4)
97#define VSYNC_PIPE_B_INTERRUPT (1 << 5)
98#define PIPE_B_EVENT_INTERRUPT (1 << 4)
99#define HOST_PORT_EVENT_INTERRUPT (1 << 3)
100#define CAPTURE_EVENT_INTERRUPT (1 << 2)
101#define USER_DEFINED_INTERRUPT (1 << 1)
102#define BREAKPOINT_INTERRUPT 1
103
91#define INSTPM 0x20c0 104#define INSTPM 0x20c0
92#define SYNC_FLUSH_ENABLE (1 << 5) 105#define SYNC_FLUSH_ENABLE (1 << 5)
93 106
@@ -113,6 +126,12 @@
113#define FW_DISPC_BL_SHIFT 8 126#define FW_DISPC_BL_SHIFT 8
114#define FW_DISPC_BL_MASK 0x7 127#define FW_DISPC_BL_MASK 0x7
115 128
129#define GPIOA 0x5010
130#define GPIOB 0x5014
131#define GPIOC 0x5018 // this may be external DDC on i830
132#define GPIOD 0x501C // this is DVO DDC
133#define GPIOE 0x5020 // this is DVO i2C
134#define GPIOF 0x5024
116 135
117/* PLL registers */ 136/* PLL registers */
118#define VGA0_DIVISOR 0x06000 137#define VGA0_DIVISOR 0x06000
@@ -468,9 +487,12 @@
468 487
469/* I/O macros */ 488/* I/O macros */
470#define INREG8(addr) readb((u8 __iomem *)(dinfo->mmio_base + (addr))) 489#define INREG8(addr) readb((u8 __iomem *)(dinfo->mmio_base + (addr)))
490#define INREG16(addr) readw((u16 __iomem *)(dinfo->mmio_base + (addr)))
471#define INREG(addr) readl((u32 __iomem *)(dinfo->mmio_base + (addr))) 491#define INREG(addr) readl((u32 __iomem *)(dinfo->mmio_base + (addr)))
472#define OUTREG8(addr, val) writeb((val),(u8 __iomem *)(dinfo->mmio_base + \ 492#define OUTREG8(addr, val) writeb((val),(u8 __iomem *)(dinfo->mmio_base + \
473 (addr))) 493 (addr)))
494#define OUTREG16(addr, val) writew((val),(u16 __iomem *)(dinfo->mmio_base + \
495 (addr)))
474#define OUTREG(addr, val) writel((val),(u32 __iomem *)(dinfo->mmio_base + \ 496#define OUTREG(addr, val) writel((val),(u32 __iomem *)(dinfo->mmio_base + \
475 (addr))) 497 (addr)))
476 498
@@ -545,5 +567,8 @@ extern void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg,
545extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, 567extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
546 int height, u8 *data); 568 int height, u8 *data);
547extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo); 569extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
570extern int intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable);
571extern void intelfbhw_disable_irq(struct intelfb_info *dinfo);
572extern int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe);
548 573
549#endif /* _INTELFBHW_H */ 574#endif /* _INTELFBHW_H */
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/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 4acde4f7dbf8..b120896c8ab4 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
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/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