aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig49
-rw-r--r--drivers/video/Makefile9
-rw-r--r--drivers/video/aty/aty128fb.c36
-rw-r--r--drivers/video/aty/atyfb_base.c43
-rw-r--r--drivers/video/aty/mach64_accel.c10
-rw-r--r--drivers/video/aty/mach64_cursor.c33
-rw-r--r--drivers/video/aty/radeon_base.c2
-rw-r--r--drivers/video/au1100fb.c44
-rw-r--r--drivers/video/backlight/Kconfig12
-rw-r--r--drivers/video/backlight/Makefile2
-rw-r--r--drivers/video/backlight/hp680_bl.c2
-rw-r--r--drivers/video/backlight/locomolcd.c123
-rw-r--r--drivers/video/cfbimgblt.c1
-rw-r--r--drivers/video/cirrusfb.c2
-rw-r--r--drivers/video/console/fbcon.c361
-rw-r--r--drivers/video/console/fbcon.h1
-rw-r--r--drivers/video/console/mdacon.c2
-rw-r--r--drivers/video/console/newport_con.c38
-rw-r--r--drivers/video/console/promcon.c4
-rw-r--r--drivers/video/console/sticon.c2
-rw-r--r--drivers/video/console/vgacon.c28
-rw-r--r--drivers/video/epson1355fb.c29
-rw-r--r--drivers/video/fbcvt.c1
-rw-r--r--drivers/video/fbmem.c58
-rw-r--r--drivers/video/fbmon.c33
-rw-r--r--drivers/video/fbsysfs.c52
-rw-r--r--drivers/video/geode/gx1fb_core.c3
-rw-r--r--drivers/video/geode/gxfb_core.c3
-rw-r--r--drivers/video/i810/i810_main.c3
-rw-r--r--drivers/video/imacfb.c345
-rw-r--r--drivers/video/macmodes.c6
-rw-r--r--drivers/video/macmodes.h7
-rw-r--r--drivers/video/modedb.c11
-rw-r--r--drivers/video/neofb.c32
-rw-r--r--drivers/video/nvidia/nv_hw.c10
-rw-r--r--drivers/video/nvidia/nvidia.c370
-rw-r--r--drivers/video/riva/fbdev.c2
-rw-r--r--drivers/video/s3c2410fb.c17
-rw-r--r--drivers/video/savage/savagefb.h45
-rw-r--r--drivers/video/savage/savagefb_driver.c1475
-rw-r--r--drivers/video/sis/sis_main.c2
-rw-r--r--drivers/video/skeletonfb.c5
-rw-r--r--drivers/video/tgafb.c1
-rw-r--r--drivers/video/vesafb.c59
-rw-r--r--drivers/video/vfb.c29
-rw-r--r--drivers/video/vga16fb.c40
46 files changed, 2015 insertions, 1427 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 168ede7902bd..17de4c84db69 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -4,6 +4,21 @@
4 4
5menu "Graphics support" 5menu "Graphics support"
6 6
7config FIRMWARE_EDID
8 bool "Enable firmware EDID"
9 default y
10 ---help---
11 This enables access to the EDID transferred from the firmware.
12 On the i386, this is from the Video BIOS. Enable this if DDC/I2C
13 transfers do not work for your driver and if you are using
14 nvidiafb, i810fb or savagefb.
15
16 In general, choosing Y for this option is safe. If you
17 experience extremely long delays while booting before you get
18 something on your display, try setting this to N. Matrox cards in
19 combination with certain motherboards and monitors are known to
20 suffer from this problem.
21
7config FB 22config FB
8 tristate "Support for frame buffer devices" 23 tristate "Support for frame buffer devices"
9 ---help--- 24 ---help---
@@ -70,22 +85,6 @@ config FB_MACMODES
70 depends on FB 85 depends on FB
71 default n 86 default n
72 87
73config FB_FIRMWARE_EDID
74 bool "Enable firmware EDID"
75 depends on FB
76 default y
77 ---help---
78 This enables access to the EDID transferred from the firmware.
79 On the i386, this is from the Video BIOS. Enable this if DDC/I2C
80 transfers do not work for your driver and if you are using
81 nvidiafb, i810fb or savagefb.
82
83 In general, choosing Y for this option is safe. If you
84 experience extremely long delays while booting before you get
85 something on your display, try setting this to N. Matrox cards in
86 combination with certain motherboards and monitors are known to
87 suffer from this problem.
88
89config FB_BACKLIGHT 88config FB_BACKLIGHT
90 bool 89 bool
91 depends on FB 90 depends on FB
@@ -551,10 +550,14 @@ config FB_VESA
551 You will get a boot time penguin logo at no additional cost. Please 550 You will get a boot time penguin logo at no additional cost. Please
552 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. 551 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y.
553 552
554config VIDEO_SELECT 553config FB_IMAC
555 bool 554 bool "Intel-based Macintosh Framebuffer Support"
556 depends on FB_VESA 555 depends on (FB = y) && X86
557 default y 556 select FB_CFB_FILLRECT
557 select FB_CFB_COPYAREA
558 select FB_CFB_IMAGEBLIT
559 help
560 This is the frame buffer device driver for the Intel-based Macintosh
558 561
559config FB_HGA 562config FB_HGA
560 tristate "Hercules mono graphics support" 563 tristate "Hercules mono graphics support"
@@ -578,12 +581,6 @@ config FB_HGA_ACCEL
578 This will compile the Hercules mono graphics with 581 This will compile the Hercules mono graphics with
579 acceleration functions. 582 acceleration functions.
580 583
581
582config VIDEO_SELECT
583 bool
584 depends on (FB = y) && X86
585 default y
586
587config FB_SGIVW 584config FB_SGIVW
588 tristate "SGI Visual Workstation framebuffer support" 585 tristate "SGI Visual Workstation framebuffer support"
589 depends on FB && X86_VISWS 586 depends on FB && X86_VISWS
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 23de3b2c7856..c335e9bc3b20 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -4,15 +4,15 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_VT) += console/
8obj-$(CONFIG_LOGO) += logo/
9obj-$(CONFIG_SYSFS) += backlight/
10
11obj-$(CONFIG_FB) += fb.o 7obj-$(CONFIG_FB) += fb.o
12fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ 8fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
13 modedb.o fbcvt.o 9 modedb.o fbcvt.o
14fb-objs := $(fb-y) 10fb-objs := $(fb-y)
15 11
12obj-$(CONFIG_VT) += console/
13obj-$(CONFIG_LOGO) += logo/
14obj-$(CONFIG_SYSFS) += backlight/
15
16obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o 16obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
17obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o 17obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
18obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o 18obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
@@ -97,6 +97,7 @@ obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o
97 97
98# Platform or fallback drivers go here 98# Platform or fallback drivers go here
99obj-$(CONFIG_FB_VESA) += vesafb.o 99obj-$(CONFIG_FB_VESA) += vesafb.o
100obj-$(CONFIG_FB_IMAC) += imacfb.o
100obj-$(CONFIG_FB_VGA16) += vga16fb.o vgastate.o 101obj-$(CONFIG_FB_VGA16) += vga16fb.o vgastate.o
101obj-$(CONFIG_FB_OF) += offb.o 102obj-$(CONFIG_FB_OF) += offb.o
102 103
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index db878fd55fb2..11cf7fcb1d55 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -100,7 +100,7 @@
100 100
101#ifndef CONFIG_PPC_PMAC 101#ifndef CONFIG_PPC_PMAC
102/* default mode */ 102/* default mode */
103static struct fb_var_screeninfo default_var __initdata = { 103static struct fb_var_screeninfo default_var __devinitdata = {
104 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */ 104 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
105 640, 480, 640, 480, 0, 0, 8, 0, 105 640, 480, 640, 480, 0, 0, 8, 0,
106 {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, 106 {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
@@ -123,7 +123,7 @@ static struct fb_var_screeninfo default_var = {
123 123
124/* default modedb mode */ 124/* default modedb mode */
125/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */ 125/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
126static struct fb_videomode defaultmode __initdata = { 126static struct fb_videomode defaultmode __devinitdata = {
127 .refresh = 60, 127 .refresh = 60,
128 .xres = 640, 128 .xres = 640,
129 .yres = 480, 129 .yres = 480,
@@ -335,7 +335,7 @@ static const struct aty128_meminfo sdr_sgram =
335static const struct aty128_meminfo ddr_sgram = 335static const struct aty128_meminfo ddr_sgram =
336 { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; 336 { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
337 337
338static struct fb_fix_screeninfo aty128fb_fix __initdata = { 338static struct fb_fix_screeninfo aty128fb_fix __devinitdata = {
339 .id = "ATY Rage128", 339 .id = "ATY Rage128",
340 .type = FB_TYPE_PACKED_PIXELS, 340 .type = FB_TYPE_PACKED_PIXELS,
341 .visual = FB_VISUAL_PSEUDOCOLOR, 341 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -345,15 +345,15 @@ static struct fb_fix_screeninfo aty128fb_fix __initdata = {
345 .accel = FB_ACCEL_ATI_RAGE128, 345 .accel = FB_ACCEL_ATI_RAGE128,
346}; 346};
347 347
348static char *mode_option __initdata = NULL; 348static char *mode_option __devinitdata = NULL;
349 349
350#ifdef CONFIG_PPC_PMAC 350#ifdef CONFIG_PPC_PMAC
351static int default_vmode __initdata = VMODE_1024_768_60; 351static int default_vmode __devinitdata = VMODE_1024_768_60;
352static int default_cmode __initdata = CMODE_8; 352static int default_cmode __devinitdata = CMODE_8;
353#endif 353#endif
354 354
355static int default_crt_on __initdata = 0; 355static int default_crt_on __devinitdata = 0;
356static int default_lcd_on __initdata = 1; 356static int default_lcd_on __devinitdata = 1;
357 357
358#ifdef CONFIG_MTRR 358#ifdef CONFIG_MTRR
359static int mtrr = 1; 359static int mtrr = 1;
@@ -445,9 +445,9 @@ static int aty128_encode_var(struct fb_var_screeninfo *var,
445static int aty128_decode_var(struct fb_var_screeninfo *var, 445static int aty128_decode_var(struct fb_var_screeninfo *var,
446 struct aty128fb_par *par); 446 struct aty128fb_par *par);
447#if 0 447#if 0
448static void __init aty128_get_pllinfo(struct aty128fb_par *par, 448static void __devinit aty128_get_pllinfo(struct aty128fb_par *par,
449 void __iomem *bios); 449 void __iomem *bios);
450static void __init __iomem *aty128_map_ROM(struct pci_dev *pdev, const struct aty128fb_par *par); 450static void __devinit __iomem *aty128_map_ROM(struct pci_dev *pdev, const struct aty128fb_par *par);
451#endif 451#endif
452static void aty128_timings(struct aty128fb_par *par); 452static void aty128_timings(struct aty128fb_par *par);
453static void aty128_init_engine(struct aty128fb_par *par); 453static void aty128_init_engine(struct aty128fb_par *par);
@@ -573,7 +573,7 @@ static void aty_pll_writeupdate(const struct aty128fb_par *par)
573 573
574 574
575/* write to the scratch register to test r/w functionality */ 575/* write to the scratch register to test r/w functionality */
576static int __init register_test(const struct aty128fb_par *par) 576static int __devinit register_test(const struct aty128fb_par *par)
577{ 577{
578 u32 val; 578 u32 val;
579 int flag = 0; 579 int flag = 0;
@@ -772,7 +772,7 @@ static u32 depth_to_dst(u32 depth)
772 772
773 773
774#ifndef __sparc__ 774#ifndef __sparc__
775static void __iomem * __init aty128_map_ROM(const struct aty128fb_par *par, struct pci_dev *dev) 775static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par, struct pci_dev *dev)
776{ 776{
777 u16 dptr; 777 u16 dptr;
778 u8 rom_type; 778 u8 rom_type;
@@ -856,7 +856,7 @@ static void __iomem * __init aty128_map_ROM(const struct aty128fb_par *par, stru
856 return NULL; 856 return NULL;
857} 857}
858 858
859static void __init aty128_get_pllinfo(struct aty128fb_par *par, unsigned char __iomem *bios) 859static void __devinit aty128_get_pllinfo(struct aty128fb_par *par, unsigned char __iomem *bios)
860{ 860{
861 unsigned int bios_hdr; 861 unsigned int bios_hdr;
862 unsigned int bios_pll; 862 unsigned int bios_pll;
@@ -903,7 +903,7 @@ static void __iomem * __devinit aty128_find_mem_vbios(struct aty128fb_par *par)
903#endif /* ndef(__sparc__) */ 903#endif /* ndef(__sparc__) */
904 904
905/* fill in known card constants if pll_block is not available */ 905/* fill in known card constants if pll_block is not available */
906static void __init aty128_timings(struct aty128fb_par *par) 906static void __devinit aty128_timings(struct aty128fb_par *par)
907{ 907{
908#ifdef CONFIG_PPC_OF 908#ifdef CONFIG_PPC_OF
909 /* instead of a table lookup, assume OF has properly 909 /* instead of a table lookup, assume OF has properly
@@ -1645,7 +1645,7 @@ static int aty128fb_sync(struct fb_info *info)
1645} 1645}
1646 1646
1647#ifndef MODULE 1647#ifndef MODULE
1648static int __init aty128fb_setup(char *options) 1648static int __devinit aty128fb_setup(char *options)
1649{ 1649{
1650 char *this_opt; 1650 char *this_opt;
1651 1651
@@ -1893,7 +1893,7 @@ static void aty128_early_resume(void *data)
1893} 1893}
1894#endif /* CONFIG_PPC_PMAC */ 1894#endif /* CONFIG_PPC_PMAC */
1895 1895
1896static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) 1896static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent)
1897{ 1897{
1898 struct fb_info *info = pci_get_drvdata(pdev); 1898 struct fb_info *info = pci_get_drvdata(pdev);
1899 struct aty128fb_par *par = info->par; 1899 struct aty128fb_par *par = info->par;
@@ -2037,7 +2037,7 @@ static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *
2037 2037
2038#ifdef CONFIG_PCI 2038#ifdef CONFIG_PCI
2039/* register a card ++ajoshi */ 2039/* register a card ++ajoshi */
2040static int __init aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 2040static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2041{ 2041{
2042 unsigned long fb_addr, reg_addr; 2042 unsigned long fb_addr, reg_addr;
2043 struct aty128fb_par *par; 2043 struct aty128fb_par *par;
@@ -2556,7 +2556,7 @@ static int aty128_pci_resume(struct pci_dev *pdev)
2556} 2556}
2557 2557
2558 2558
2559static int __init aty128fb_init(void) 2559static int __devinit aty128fb_init(void)
2560{ 2560{
2561#ifndef MODULE 2561#ifndef MODULE
2562 char *option = NULL; 2562 char *option = NULL;
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index c5185f7cf4ba..22e720611bf6 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -316,12 +316,12 @@ static int vram;
316static int pll; 316static int pll;
317static int mclk; 317static int mclk;
318static int xclk; 318static int xclk;
319static int comp_sync __initdata = -1; 319static int comp_sync __devinitdata = -1;
320static char *mode; 320static char *mode;
321 321
322#ifdef CONFIG_PPC 322#ifdef CONFIG_PPC
323static int default_vmode __initdata = VMODE_CHOOSE; 323static int default_vmode __devinitdata = VMODE_CHOOSE;
324static int default_cmode __initdata = CMODE_CHOOSE; 324static int default_cmode __devinitdata = CMODE_CHOOSE;
325 325
326module_param_named(vmode, default_vmode, int, 0); 326module_param_named(vmode, default_vmode, int, 0);
327MODULE_PARM_DESC(vmode, "int: video mode for mac"); 327MODULE_PARM_DESC(vmode, "int: video mode for mac");
@@ -330,10 +330,10 @@ MODULE_PARM_DESC(cmode, "int: color mode for mac");
330#endif 330#endif
331 331
332#ifdef CONFIG_ATARI 332#ifdef CONFIG_ATARI
333static unsigned int mach64_count __initdata = 0; 333static unsigned int mach64_count __devinitdata = 0;
334static unsigned long phys_vmembase[FB_MAX] __initdata = { 0, }; 334static unsigned long phys_vmembase[FB_MAX] __devinitdata = { 0, };
335static unsigned long phys_size[FB_MAX] __initdata = { 0, }; 335static unsigned long phys_size[FB_MAX] __devinitdata = { 0, };
336static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, }; 336static unsigned long phys_guiregbase[FB_MAX] __devinitdata = { 0, };
337#endif 337#endif
338 338
339/* top -> down is an evolution of mach64 chipset, any corrections? */ 339/* top -> down is an evolution of mach64 chipset, any corrections? */
@@ -583,7 +583,7 @@ static u32 atyfb_get_pixclock(struct fb_var_screeninfo *var, struct atyfb_par *p
583 * Apple monitor sense 583 * Apple monitor sense
584 */ 584 */
585 585
586static int __init read_aty_sense(const struct atyfb_par *par) 586static int __devinit read_aty_sense(const struct atyfb_par *par)
587{ 587{
588 int sense, i; 588 int sense, i;
589 589
@@ -1281,6 +1281,14 @@ static int atyfb_set_par(struct fb_info *info)
1281 1281
1282 par->accel_flags = var->accel_flags; /* hack */ 1282 par->accel_flags = var->accel_flags; /* hack */
1283 1283
1284 if (var->accel_flags) {
1285 info->fbops->fb_sync = atyfb_sync;
1286 info->flags &= ~FBINFO_HWACCEL_DISABLED;
1287 } else {
1288 info->fbops->fb_sync = NULL;
1289 info->flags |= FBINFO_HWACCEL_DISABLED;
1290 }
1291
1284 if (par->blitter_may_be_busy) 1292 if (par->blitter_may_be_busy)
1285 wait_for_idle(par); 1293 wait_for_idle(par);
1286 1294
@@ -2253,7 +2261,7 @@ static void aty_bl_exit(struct atyfb_par *par)
2253 2261
2254#endif /* CONFIG_FB_ATY_BACKLIGHT */ 2262#endif /* CONFIG_FB_ATY_BACKLIGHT */
2255 2263
2256static void __init aty_calc_mem_refresh(struct atyfb_par *par, int xclk) 2264static void __devinit aty_calc_mem_refresh(struct atyfb_par *par, int xclk)
2257{ 2265{
2258 const int ragepro_tbl[] = { 2266 const int ragepro_tbl[] = {
2259 44, 50, 55, 66, 75, 80, 100 2267 44, 50, 55, 66, 75, 80, 100
@@ -2313,7 +2321,7 @@ static int __devinit atyfb_get_timings_from_lcd(struct atyfb_par *par,
2313} 2321}
2314#endif /* defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) */ 2322#endif /* defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) */
2315 2323
2316static int __init aty_init(struct fb_info *info, const char *name) 2324static int __devinit aty_init(struct fb_info *info, const char *name)
2317{ 2325{
2318 struct atyfb_par *par = (struct atyfb_par *) info->par; 2326 struct atyfb_par *par = (struct atyfb_par *) info->par;
2319 const char *ramname = NULL, *xtal; 2327 const char *ramname = NULL, *xtal;
@@ -2394,12 +2402,15 @@ static int __init aty_init(struct fb_info *info, const char *name)
2394 break; 2402 break;
2395 } 2403 }
2396 switch (clk_type) { 2404 switch (clk_type) {
2405#ifdef CONFIG_ATARI
2397 case CLK_ATI18818_1: 2406 case CLK_ATI18818_1:
2398 par->pll_ops = &aty_pll_ati18818_1; 2407 par->pll_ops = &aty_pll_ati18818_1;
2399 break; 2408 break;
2409#else
2400 case CLK_IBMRGB514: 2410 case CLK_IBMRGB514:
2401 par->pll_ops = &aty_pll_ibm514; 2411 par->pll_ops = &aty_pll_ibm514;
2402 break; 2412 break;
2413#endif
2403#if 0 /* dead code */ 2414#if 0 /* dead code */
2404 case CLK_STG1703: 2415 case CLK_STG1703:
2405 par->pll_ops = &aty_pll_stg1703; 2416 par->pll_ops = &aty_pll_stg1703;
@@ -2604,7 +2615,11 @@ static int __init aty_init(struct fb_info *info, const char *name)
2604 2615
2605 info->fbops = &atyfb_ops; 2616 info->fbops = &atyfb_ops;
2606 info->pseudo_palette = pseudo_palette; 2617 info->pseudo_palette = pseudo_palette;
2607 info->flags = FBINFO_FLAG_DEFAULT; 2618 info->flags = FBINFO_DEFAULT |
2619 FBINFO_HWACCEL_IMAGEBLIT |
2620 FBINFO_HWACCEL_FILLRECT |
2621 FBINFO_HWACCEL_COPYAREA |
2622 FBINFO_HWACCEL_YPAN;
2608 2623
2609#ifdef CONFIG_PMAC_BACKLIGHT 2624#ifdef CONFIG_PMAC_BACKLIGHT
2610 if (M64_HAS(G3_PB_1_1) && machine_is_compatible("PowerBook1,1")) { 2625 if (M64_HAS(G3_PB_1_1) && machine_is_compatible("PowerBook1,1")) {
@@ -2733,7 +2748,7 @@ aty_init_exit:
2733} 2748}
2734 2749
2735#ifdef CONFIG_ATARI 2750#ifdef CONFIG_ATARI
2736static int __init store_video_par(char *video_str, unsigned char m64_num) 2751static int __devinit store_video_par(char *video_str, unsigned char m64_num)
2737{ 2752{
2738 char *p; 2753 char *p;
2739 unsigned long vmembase, size, guiregbase; 2754 unsigned long vmembase, size, guiregbase;
@@ -3764,7 +3779,7 @@ static struct pci_driver atyfb_driver = {
3764#endif /* CONFIG_PCI */ 3779#endif /* CONFIG_PCI */
3765 3780
3766#ifndef MODULE 3781#ifndef MODULE
3767static int __init atyfb_setup(char *options) 3782static int __devinit atyfb_setup(char *options)
3768{ 3783{
3769 char *this_opt; 3784 char *this_opt;
3770 3785
@@ -3836,7 +3851,7 @@ static int __init atyfb_setup(char *options)
3836} 3851}
3837#endif /* MODULE */ 3852#endif /* MODULE */
3838 3853
3839static int __init atyfb_init(void) 3854static int __devinit atyfb_init(void)
3840{ 3855{
3841#ifndef MODULE 3856#ifndef MODULE
3842 char *option = NULL; 3857 char *option = NULL;
diff --git a/drivers/video/aty/mach64_accel.c b/drivers/video/aty/mach64_accel.c
index c98f4a442134..1490e5e1c232 100644
--- a/drivers/video/aty/mach64_accel.c
+++ b/drivers/video/aty/mach64_accel.c
@@ -200,8 +200,6 @@ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
200 if (!area->width || !area->height) 200 if (!area->width || !area->height)
201 return; 201 return;
202 if (!par->accel_flags) { 202 if (!par->accel_flags) {
203 if (par->blitter_may_be_busy)
204 wait_for_idle(par);
205 cfb_copyarea(info, area); 203 cfb_copyarea(info, area);
206 return; 204 return;
207 } 205 }
@@ -248,8 +246,6 @@ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
248 if (!rect->width || !rect->height) 246 if (!rect->width || !rect->height)
249 return; 247 return;
250 if (!par->accel_flags) { 248 if (!par->accel_flags) {
251 if (par->blitter_may_be_busy)
252 wait_for_idle(par);
253 cfb_fillrect(info, rect); 249 cfb_fillrect(info, rect);
254 return; 250 return;
255 } 251 }
@@ -288,14 +284,10 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
288 return; 284 return;
289 if (!par->accel_flags || 285 if (!par->accel_flags ||
290 (image->depth != 1 && info->var.bits_per_pixel != image->depth)) { 286 (image->depth != 1 && info->var.bits_per_pixel != image->depth)) {
291 if (par->blitter_may_be_busy)
292 wait_for_idle(par);
293
294 cfb_imageblit(info, image); 287 cfb_imageblit(info, image);
295 return; 288 return;
296 } 289 }
297 290
298 wait_for_idle(par);
299 pix_width = pix_width_save = aty_ld_le32(DP_PIX_WIDTH, par); 291 pix_width = pix_width_save = aty_ld_le32(DP_PIX_WIDTH, par);
300 host_cntl = aty_ld_le32(HOST_CNTL, par) | HOST_BYTE_ALIGN; 292 host_cntl = aty_ld_le32(HOST_CNTL, par) | HOST_BYTE_ALIGN;
301 293
@@ -425,8 +417,6 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
425 } 417 }
426 } 418 }
427 419
428 wait_for_idle(par);
429
430 /* restore pix_width */ 420 /* restore pix_width */
431 wait_for_fifo(1, par); 421 wait_for_fifo(1, par);
432 aty_st_le32(DP_PIX_WIDTH, pix_width_save, par); 422 aty_st_le32(DP_PIX_WIDTH, pix_width_save, par);
diff --git a/drivers/video/aty/mach64_cursor.c b/drivers/video/aty/mach64_cursor.c
index ad8b7496f853..2a7f381c330f 100644
--- a/drivers/video/aty/mach64_cursor.c
+++ b/drivers/video/aty/mach64_cursor.c
@@ -66,11 +66,6 @@ static const u8 cursor_bits_lookup[16] = {
66 0x01, 0x41, 0x11, 0x51, 0x05, 0x45, 0x15, 0x55 66 0x01, 0x41, 0x11, 0x51, 0x05, 0x45, 0x15, 0x55
67}; 67};
68 68
69static const u8 cursor_mask_lookup[16] = {
70 0xaa, 0x2a, 0x8a, 0x0a, 0xa2, 0x22, 0x82, 0x02,
71 0xa8, 0x28, 0x88, 0x08, 0xa0, 0x20, 0x80, 0x00
72};
73
74static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor) 69static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
75{ 70{
76 struct atyfb_par *par = (struct atyfb_par *) info->par; 71 struct atyfb_par *par = (struct atyfb_par *) info->par;
@@ -130,13 +125,13 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
130 fg_idx = cursor->image.fg_color; 125 fg_idx = cursor->image.fg_color;
131 bg_idx = cursor->image.bg_color; 126 bg_idx = cursor->image.bg_color;
132 127
133 fg = (info->cmap.red[fg_idx] << 24) | 128 fg = ((info->cmap.red[fg_idx] & 0xff) << 24) |
134 (info->cmap.green[fg_idx] << 16) | 129 ((info->cmap.green[fg_idx] & 0xff) << 16) |
135 (info->cmap.blue[fg_idx] << 8) | 15; 130 ((info->cmap.blue[fg_idx] & 0xff) << 8) | 0xff;
136 131
137 bg = (info->cmap.red[bg_idx] << 24) | 132 bg = ((info->cmap.red[bg_idx] & 0xff) << 24) |
138 (info->cmap.green[bg_idx] << 16) | 133 ((info->cmap.green[bg_idx] & 0xff) << 16) |
139 (info->cmap.blue[bg_idx] << 8); 134 ((info->cmap.blue[bg_idx] & 0xff) << 8);
140 135
141 wait_for_fifo(2, par); 136 wait_for_fifo(2, par);
142 aty_st_le32(CUR_CLR0, bg, par); 137 aty_st_le32(CUR_CLR0, bg, par);
@@ -166,19 +161,17 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
166 switch (cursor->rop) { 161 switch (cursor->rop) {
167 case ROP_XOR: 162 case ROP_XOR:
168 // Upper 4 bits of mask data 163 // Upper 4 bits of mask data
169 fb_writeb(cursor_mask_lookup[m >> 4 ] | 164 fb_writeb(cursor_bits_lookup[(b ^ m) >> 4], dst++);
170 cursor_bits_lookup[(b ^ m) >> 4], dst++);
171 // Lower 4 bits of mask 165 // Lower 4 bits of mask
172 fb_writeb(cursor_mask_lookup[m & 0x0f ] | 166 fb_writeb(cursor_bits_lookup[(b ^ m) & 0x0f],
173 cursor_bits_lookup[(b ^ m) & 0x0f], dst++); 167 dst++);
174 break; 168 break;
175 case ROP_COPY: 169 case ROP_COPY:
176 // Upper 4 bits of mask data 170 // Upper 4 bits of mask data
177 fb_writeb(cursor_mask_lookup[m >> 4 ] | 171 fb_writeb(cursor_bits_lookup[(b & m) >> 4], dst++);
178 cursor_bits_lookup[(b & m) >> 4], dst++);
179 // Lower 4 bits of mask 172 // Lower 4 bits of mask
180 fb_writeb(cursor_mask_lookup[m & 0x0f ] | 173 fb_writeb(cursor_bits_lookup[(b & m) & 0x0f],
181 cursor_bits_lookup[(b & m) & 0x0f], dst++); 174 dst++);
182 break; 175 break;
183 } 176 }
184 } 177 }
@@ -194,7 +187,7 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
194 return 0; 187 return 0;
195} 188}
196 189
197int __init aty_init_cursor(struct fb_info *info) 190int __devinit aty_init_cursor(struct fb_info *info)
198{ 191{
199 unsigned long addr; 192 unsigned long addr;
200 193
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index c5ecbb02e01d..68b15645b893 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2379,7 +2379,6 @@ err_release_pci0:
2379err_release_fb: 2379err_release_fb:
2380 framebuffer_release(info); 2380 framebuffer_release(info);
2381err_disable: 2381err_disable:
2382 pci_disable_device(pdev);
2383err_out: 2382err_out:
2384 return ret; 2383 return ret;
2385} 2384}
@@ -2436,7 +2435,6 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev)
2436#endif 2435#endif
2437 fb_dealloc_cmap(&info->cmap); 2436 fb_dealloc_cmap(&info->cmap);
2438 framebuffer_release(info); 2437 framebuffer_release(info);
2439 pci_disable_device(pdev);
2440} 2438}
2441 2439
2442 2440
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 789450bb0bc9..9ef68cd83bb4 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -7,6 +7,8 @@
7 * Karl Lessard <klessard@sunrisetelecom.com> 7 * Karl Lessard <klessard@sunrisetelecom.com>
8 * <c.pellegrin@exadron.com> 8 * <c.pellegrin@exadron.com>
9 * 9 *
10 * PM support added by Rodolfo Giometti <giometti@linux.it>
11 *
10 * Copyright 2002 MontaVista Software 12 * Copyright 2002 MontaVista Software
11 * Author: MontaVista Software, Inc. 13 * Author: MontaVista Software, Inc.
12 * ppopov@mvista.com or source@mvista.com 14 * ppopov@mvista.com or source@mvista.com
@@ -602,17 +604,52 @@ int au1100fb_drv_remove(struct device *dev)
602 return 0; 604 return 0;
603} 605}
604 606
607#ifdef CONFIG_PM
608static u32 sys_clksrc;
609static struct au1100fb_regs fbregs;
610
605int au1100fb_drv_suspend(struct device *dev, pm_message_t state) 611int au1100fb_drv_suspend(struct device *dev, pm_message_t state)
606{ 612{
607 /* TODO */ 613 struct au1100fb_device *fbdev = dev_get_drvdata(dev);
614
615 if (!fbdev)
616 return 0;
617
618 /* Save the clock source state */
619 sys_clksrc = au_readl(SYS_CLKSRC);
620
621 /* Blank the LCD */
622 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
623
624 /* Stop LCD clocking */
625 au_writel(sys_clksrc & ~SYS_CS_ML_MASK, SYS_CLKSRC);
626
627 memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
628
608 return 0; 629 return 0;
609} 630}
610 631
611int au1100fb_drv_resume(struct device *dev) 632int au1100fb_drv_resume(struct device *dev)
612{ 633{
613 /* TODO */ 634 struct au1100fb_device *fbdev = dev_get_drvdata(dev);
635
636 if (!fbdev)
637 return 0;
638
639 memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
640
641 /* Restart LCD clocking */
642 au_writel(sys_clksrc, SYS_CLKSRC);
643
644 /* Unblank the LCD */
645 au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
646
614 return 0; 647 return 0;
615} 648}
649#else
650#define au1100fb_drv_suspend NULL
651#define au1100fb_drv_resume NULL
652#endif
616 653
617static struct device_driver au1100fb_driver = { 654static struct device_driver au1100fb_driver = {
618 .name = "au1100-lcd", 655 .name = "au1100-lcd",
@@ -706,8 +743,7 @@ void __exit au1100fb_cleanup(void)
706{ 743{
707 driver_unregister(&au1100fb_driver); 744 driver_unregister(&au1100fb_driver);
708 745
709 if (drv_info.opt_mode) 746 kfree(drv_info.opt_mode);
710 kfree(drv_info.opt_mode);
711} 747}
712 748
713module_init(au1100fb_init); 749module_init(au1100fb_init);
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index b895eaaa73fd..022f9d3473f5 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -10,7 +10,7 @@ menuconfig BACKLIGHT_LCD_SUPPORT
10 10
11config BACKLIGHT_CLASS_DEVICE 11config BACKLIGHT_CLASS_DEVICE
12 tristate "Lowlevel Backlight controls" 12 tristate "Lowlevel Backlight controls"
13 depends on BACKLIGHT_LCD_SUPPORT 13 depends on BACKLIGHT_LCD_SUPPORT && FB
14 default m 14 default m
15 help 15 help
16 This framework adds support for low-level control of the LCD 16 This framework adds support for low-level control of the LCD
@@ -26,7 +26,7 @@ config BACKLIGHT_DEVICE
26 26
27config LCD_CLASS_DEVICE 27config LCD_CLASS_DEVICE
28 tristate "Lowlevel LCD controls" 28 tristate "Lowlevel LCD controls"
29 depends on BACKLIGHT_LCD_SUPPORT 29 depends on BACKLIGHT_LCD_SUPPORT && FB
30 default m 30 default m
31 help 31 help
32 This framework adds support for low-level control of LCD. 32 This framework adds support for low-level control of LCD.
@@ -50,6 +50,14 @@ config BACKLIGHT_CORGI
50 If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the 50 If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the
51 backlight driver. 51 backlight driver.
52 52
53config BACKLIGHT_LOCOMO
54 tristate "Sharp LOCOMO LCD/Backlight Driver"
55 depends on BACKLIGHT_DEVICE && SHARP_LOCOMO
56 default y
57 help
58 If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to
59 enable the LCD/backlight driver.
60
53config BACKLIGHT_HP680 61config BACKLIGHT_HP680
54 tristate "HP Jornada 680 Backlight Driver" 62 tristate "HP Jornada 680 Backlight Driver"
55 depends on BACKLIGHT_DEVICE && SH_HP6XX 63 depends on BACKLIGHT_DEVICE && SH_HP6XX
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 744210c38e74..65e5553fc849 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -4,4 +4,4 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o
4obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o 4obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
5obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o 5obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o
6obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o 6obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
7obj-$(CONFIG_SHARP_LOCOMO) += locomolcd.o 7obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index a71e984c93d4..ffc72ae3ada8 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -27,7 +27,7 @@
27 27
28static int hp680bl_suspended; 28static int hp680bl_suspended;
29static int current_intensity = 0; 29static int current_intensity = 0;
30static spinlock_t bl_lock = SPIN_LOCK_UNLOCKED; 30static DEFINE_SPINLOCK(bl_lock);
31static struct backlight_device *hp680_backlight_device; 31static struct backlight_device *hp680_backlight_device;
32 32
33static void hp680bl_send_intensity(struct backlight_device *bd) 33static void hp680bl_send_intensity(struct backlight_device *bd)
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index 60831bb23685..bd879b7ec119 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -17,6 +17,8 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/fb.h>
21#include <linux/backlight.h>
20 22
21#include <asm/hardware/locomo.h> 23#include <asm/hardware/locomo.h>
22#include <asm/irq.h> 24#include <asm/irq.h>
@@ -25,7 +27,10 @@
25 27
26#include "../../../arch/arm/mach-sa1100/generic.h" 28#include "../../../arch/arm/mach-sa1100/generic.h"
27 29
30static struct backlight_device *locomolcd_bl_device;
28static struct locomo_dev *locomolcd_dev; 31static struct locomo_dev *locomolcd_dev;
32static unsigned long locomolcd_flags;
33#define LOCOMOLCD_SUSPENDED 0x01
29 34
30static void locomolcd_on(int comadj) 35static void locomolcd_on(int comadj)
31{ 36{
@@ -89,12 +94,10 @@ void locomolcd_power(int on)
89 } 94 }
90 95
91 /* read comadj */ 96 /* read comadj */
92 if (comadj == -1) { 97 if (comadj == -1 && machine_is_collie())
93 if (machine_is_poodle()) 98 comadj = 128;
94 comadj = 118; 99 if (comadj == -1 && machine_is_poodle())
95 if (machine_is_collie()) 100 comadj = 118;
96 comadj = 128;
97 }
98 101
99 if (on) 102 if (on)
100 locomolcd_on(comadj); 103 locomolcd_on(comadj);
@@ -105,26 +108,100 @@ void locomolcd_power(int on)
105} 108}
106EXPORT_SYMBOL(locomolcd_power); 109EXPORT_SYMBOL(locomolcd_power);
107 110
108static int poodle_lcd_probe(struct locomo_dev *dev) 111
112static int current_intensity;
113
114static int locomolcd_set_intensity(struct backlight_device *bd)
115{
116 int intensity = bd->props->brightness;
117
118 if (bd->props->power != FB_BLANK_UNBLANK)
119 intensity = 0;
120 if (bd->props->fb_blank != FB_BLANK_UNBLANK)
121 intensity = 0;
122 if (locomolcd_flags & LOCOMOLCD_SUSPENDED)
123 intensity = 0;
124
125 switch (intensity) {
126 /* AC and non-AC are handled differently, but produce same results in sharp code? */
127 case 0: locomo_frontlight_set(locomolcd_dev, 0, 0, 161); break;
128 case 1: locomo_frontlight_set(locomolcd_dev, 117, 0, 161); break;
129 case 2: locomo_frontlight_set(locomolcd_dev, 163, 0, 148); break;
130 case 3: locomo_frontlight_set(locomolcd_dev, 194, 0, 161); break;
131 case 4: locomo_frontlight_set(locomolcd_dev, 194, 1, 161); break;
132
133 default:
134 return -ENODEV;
135 }
136 current_intensity = intensity;
137 return 0;
138}
139
140static int locomolcd_get_intensity(struct backlight_device *bd)
141{
142 return current_intensity;
143}
144
145static struct backlight_properties locomobl_data = {
146 .owner = THIS_MODULE,
147 .get_brightness = locomolcd_get_intensity,
148 .update_status = locomolcd_set_intensity,
149 .max_brightness = 4,
150};
151
152#ifdef CONFIG_PM
153static int locomolcd_suspend(struct locomo_dev *dev, pm_message_t state)
154{
155 locomolcd_flags |= LOCOMOLCD_SUSPENDED;
156 locomolcd_set_intensity(locomolcd_bl_device);
157 return 0;
158}
159
160static int locomolcd_resume(struct locomo_dev *dev)
161{
162 locomolcd_flags &= ~LOCOMOLCD_SUSPENDED;
163 locomolcd_set_intensity(locomolcd_bl_device);
164 return 0;
165}
166#else
167#define locomolcd_suspend NULL
168#define locomolcd_resume NULL
169#endif
170
171static int locomolcd_probe(struct locomo_dev *dev)
109{ 172{
110 unsigned long flags; 173 unsigned long flags;
111 174
112 local_irq_save(flags); 175 local_irq_save(flags);
113 locomolcd_dev = dev; 176 locomolcd_dev = dev;
114 177
178 locomo_gpio_set_dir(dev, LOCOMO_GPIO_FL_VR, 0);
179
115 /* the poodle_lcd_power function is called for the first time 180 /* the poodle_lcd_power function is called for the first time
116 * from fs_initcall, which is before locomo is activated. 181 * from fs_initcall, which is before locomo is activated.
117 * We need to recall poodle_lcd_power here*/ 182 * We need to recall poodle_lcd_power here*/
118#ifdef CONFIG_MACH_POODLE 183 if (machine_is_poodle())
119 locomolcd_power(1); 184 locomolcd_power(1);
120#endif 185
121 local_irq_restore(flags); 186 local_irq_restore(flags);
187
188 locomolcd_bl_device = backlight_device_register("locomo-bl", NULL, &locomobl_data);
189
190 if (IS_ERR (locomolcd_bl_device))
191 return PTR_ERR (locomolcd_bl_device);
192
193 /* Set up frontlight so that screen is readable */
194 locomobl_data.brightness = 2;
195 locomolcd_set_intensity(locomolcd_bl_device);
196
122 return 0; 197 return 0;
123} 198}
124 199
125static int poodle_lcd_remove(struct locomo_dev *dev) 200static int locomolcd_remove(struct locomo_dev *dev)
126{ 201{
127 unsigned long flags; 202 unsigned long flags;
203
204 backlight_device_unregister(locomolcd_bl_device);
128 local_irq_save(flags); 205 local_irq_save(flags);
129 locomolcd_dev = NULL; 206 locomolcd_dev = NULL;
130 local_irq_restore(flags); 207 local_irq_restore(flags);
@@ -136,19 +213,33 @@ static struct locomo_driver poodle_lcd_driver = {
136 .name = "locomo-backlight", 213 .name = "locomo-backlight",
137 }, 214 },
138 .devid = LOCOMO_DEVID_BACKLIGHT, 215 .devid = LOCOMO_DEVID_BACKLIGHT,
139 .probe = poodle_lcd_probe, 216 .probe = locomolcd_probe,
140 .remove = poodle_lcd_remove, 217 .remove = locomolcd_remove,
218 .suspend = locomolcd_suspend,
219 .resume = locomolcd_resume,
141}; 220};
142 221
143static int __init poodle_lcd_init(void) 222
223static int __init locomolcd_init(void)
144{ 224{
145 int ret = locomo_driver_register(&poodle_lcd_driver); 225 int ret = locomo_driver_register(&poodle_lcd_driver);
146 if (ret) return ret; 226 if (ret)
227 return ret;
147 228
148#ifdef CONFIG_SA1100_COLLIE 229#ifdef CONFIG_SA1100_COLLIE
149 sa1100fb_lcd_power = locomolcd_power; 230 sa1100fb_lcd_power = locomolcd_power;
150#endif 231#endif
151 return 0; 232 return 0;
152} 233}
153device_initcall(poodle_lcd_init);
154 234
235static void __exit locomolcd_exit(void)
236{
237 locomo_driver_unregister(&poodle_lcd_driver);
238}
239
240module_init(locomolcd_init);
241module_exit(locomolcd_exit);
242
243MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>, Pavel Machek <pavel@suse.cz>");
244MODULE_DESCRIPTION("Collie LCD driver");
245MODULE_LICENSE("GPL");
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index 8ba6152db2fd..ad8a89bf8eae 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -230,6 +230,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
230 tab = cfb_tab16; 230 tab = cfb_tab16;
231 break; 231 break;
232 case 32: 232 case 32:
233 default:
233 tab = cfb_tab32; 234 tab = cfb_tab32;
234 break; 235 break;
235 } 236 }
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 1103010af54a..dda240eb7360 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -2227,7 +2227,6 @@ static void cirrusfb_pci_unmap (struct cirrusfb_info *cinfo)
2227 release_region(0x3C0, 32); 2227 release_region(0x3C0, 32);
2228 pci_release_regions(pdev); 2228 pci_release_regions(pdev);
2229 framebuffer_release(cinfo->info); 2229 framebuffer_release(cinfo->info);
2230 pci_disable_device(pdev);
2231} 2230}
2232#endif /* CONFIG_PCI */ 2231#endif /* CONFIG_PCI */
2233 2232
@@ -2458,7 +2457,6 @@ err_release_regions:
2458err_release_fb: 2457err_release_fb:
2459 framebuffer_release(info); 2458 framebuffer_release(info);
2460err_disable: 2459err_disable:
2461 pci_disable_device(pdev);
2462err_out: 2460err_out:
2463 return ret; 2461 return ret;
2464} 2462}
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 47ba1a79adcd..5dc4083552d8 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -125,6 +125,8 @@ static int softback_lines;
125static int first_fb_vc; 125static int first_fb_vc;
126static int last_fb_vc = MAX_NR_CONSOLES - 1; 126static int last_fb_vc = MAX_NR_CONSOLES - 1;
127static int fbcon_is_default = 1; 127static int fbcon_is_default = 1;
128static int fbcon_has_exited;
129
128/* font data */ 130/* font data */
129static char fontname[40]; 131static char fontname[40];
130 132
@@ -140,7 +142,6 @@ static const struct consw fb_con;
140 142
141#define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row) 143#define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
142 144
143static void fbcon_free_font(struct display *);
144static int fbcon_set_origin(struct vc_data *); 145static int fbcon_set_origin(struct vc_data *);
145 146
146#define CURSOR_DRAW_DELAY (1) 147#define CURSOR_DRAW_DELAY (1)
@@ -194,6 +195,9 @@ static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
194 int line, int count, int dy); 195 int line, int count, int dy);
195static void fbcon_modechanged(struct fb_info *info); 196static void fbcon_modechanged(struct fb_info *info);
196static void fbcon_set_all_vcs(struct fb_info *info); 197static void fbcon_set_all_vcs(struct fb_info *info);
198static void fbcon_start(void);
199static void fbcon_exit(void);
200static struct class_device *fbcon_class_device;
197 201
198#ifdef CONFIG_MAC 202#ifdef CONFIG_MAC
199/* 203/*
@@ -252,7 +256,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
252 if (!ops || ops->currcon < 0 || rotate > 3) 256 if (!ops || ops->currcon < 0 || rotate > 3)
253 return; 257 return;
254 258
255 for (i = 0; i < MAX_NR_CONSOLES; i++) { 259 for (i = first_fb_vc; i <= last_fb_vc; i++) {
256 vc = vc_cons[i].d; 260 vc = vc_cons[i].d;
257 if (!vc || vc->vc_mode != KD_TEXT || 261 if (!vc || vc->vc_mode != KD_TEXT ||
258 registered_fb[con2fb_map[i]] != info) 262 registered_fb[con2fb_map[i]] != info)
@@ -389,15 +393,18 @@ static void fb_flashcursor(void *private)
389 int c; 393 int c;
390 int mode; 394 int mode;
391 395
392 if (ops->currcon != -1) 396 acquire_console_sem();
397 if (ops && ops->currcon != -1)
393 vc = vc_cons[ops->currcon].d; 398 vc = vc_cons[ops->currcon].d;
394 399
395 if (!vc || !CON_IS_VISIBLE(vc) || 400 if (!vc || !CON_IS_VISIBLE(vc) ||
396 fbcon_is_inactive(vc, info) || 401 fbcon_is_inactive(vc, info) ||
397 registered_fb[con2fb_map[vc->vc_num]] != info || 402 registered_fb[con2fb_map[vc->vc_num]] != info ||
398 vc_cons[ops->currcon].d->vc_deccm != 1) 403 vc_cons[ops->currcon].d->vc_deccm != 1) {
404 release_console_sem();
399 return; 405 return;
400 acquire_console_sem(); 406 }
407
401 p = &fb_display[vc->vc_num]; 408 p = &fb_display[vc->vc_num];
402 c = scr_readw((u16 *) vc->vc_pos); 409 c = scr_readw((u16 *) vc->vc_pos);
403 mode = (!ops->cursor_flash || ops->cursor_state.enable) ? 410 mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
@@ -528,7 +535,7 @@ static int search_fb_in_map(int idx)
528{ 535{
529 int i, retval = 0; 536 int i, retval = 0;
530 537
531 for (i = 0; i < MAX_NR_CONSOLES; i++) { 538 for (i = first_fb_vc; i <= last_fb_vc; i++) {
532 if (con2fb_map[i] == idx) 539 if (con2fb_map[i] == idx)
533 retval = 1; 540 retval = 1;
534 } 541 }
@@ -539,7 +546,7 @@ static int search_for_mapped_con(void)
539{ 546{
540 int i, retval = 0; 547 int i, retval = 0;
541 548
542 for (i = 0; i < MAX_NR_CONSOLES; i++) { 549 for (i = first_fb_vc; i <= last_fb_vc; i++) {
543 if (con2fb_map[i] != -1) 550 if (con2fb_map[i] != -1)
544 retval = 1; 551 retval = 1;
545 } 552 }
@@ -561,6 +568,7 @@ static int fbcon_takeover(int show_logo)
561 568
562 err = take_over_console(&fb_con, first_fb_vc, last_fb_vc, 569 err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
563 fbcon_is_default); 570 fbcon_is_default);
571
564 if (err) { 572 if (err) {
565 for (i = first_fb_vc; i <= last_fb_vc; i++) { 573 for (i = first_fb_vc; i <= last_fb_vc; i++) {
566 con2fb_map[i] = -1; 574 con2fb_map[i] = -1;
@@ -795,8 +803,8 @@ static int set_con2fb_map(int unit, int newidx, int user)
795 if (oldidx == newidx) 803 if (oldidx == newidx)
796 return 0; 804 return 0;
797 805
798 if (!info) 806 if (!info || fbcon_has_exited)
799 err = -EINVAL; 807 return -EINVAL;
800 808
801 if (!err && !search_for_mapped_con()) { 809 if (!err && !search_for_mapped_con()) {
802 info_idx = newidx; 810 info_idx = newidx;
@@ -832,6 +840,9 @@ static int set_con2fb_map(int unit, int newidx, int user)
832 con2fb_init_display(vc, info, unit, show_logo); 840 con2fb_init_display(vc, info, unit, show_logo);
833 } 841 }
834 842
843 if (!search_fb_in_map(info_idx))
844 info_idx = newidx;
845
835 release_console_sem(); 846 release_console_sem();
836 return err; 847 return err;
837} 848}
@@ -1034,6 +1045,7 @@ static const char *fbcon_startup(void)
1034#endif /* CONFIG_MAC */ 1045#endif /* CONFIG_MAC */
1035 1046
1036 fbcon_add_cursor_timer(info); 1047 fbcon_add_cursor_timer(info);
1048 fbcon_has_exited = 0;
1037 return display_desc; 1049 return display_desc;
1038} 1050}
1039 1051
@@ -1061,17 +1073,36 @@ static void fbcon_init(struct vc_data *vc, int init)
1061 1073
1062 /* If we are not the first console on this 1074 /* If we are not the first console on this
1063 fb, copy the font from that console */ 1075 fb, copy the font from that console */
1064 t = &fb_display[svc->vc_num]; 1076 t = &fb_display[fg_console];
1065 if (!vc->vc_font.data) { 1077 if (!p->fontdata) {
1066 vc->vc_font.data = (void *)(p->fontdata = t->fontdata); 1078 if (t->fontdata) {
1067 vc->vc_font.width = (*default_mode)->vc_font.width; 1079 struct vc_data *fvc = vc_cons[fg_console].d;
1068 vc->vc_font.height = (*default_mode)->vc_font.height; 1080
1069 p->userfont = t->userfont; 1081 vc->vc_font.data = (void *)(p->fontdata =
1070 if (p->userfont) 1082 fvc->vc_font.data);
1071 REFCOUNT(p->fontdata)++; 1083 vc->vc_font.width = fvc->vc_font.width;
1084 vc->vc_font.height = fvc->vc_font.height;
1085 p->userfont = t->userfont;
1086
1087 if (p->userfont)
1088 REFCOUNT(p->fontdata)++;
1089 } else {
1090 const struct font_desc *font = NULL;
1091
1092 if (!fontname[0] || !(font = find_font(fontname)))
1093 font = get_default_font(info->var.xres,
1094 info->var.yres);
1095 vc->vc_font.width = font->width;
1096 vc->vc_font.height = font->height;
1097 vc->vc_font.data = (void *)(p->fontdata = font->data);
1098 vc->vc_font.charcount = 256; /* FIXME Need to
1099 support more fonts */
1100 }
1072 } 1101 }
1102
1073 if (p->userfont) 1103 if (p->userfont)
1074 charcnt = FNTCHARCNT(p->fontdata); 1104 charcnt = FNTCHARCNT(p->fontdata);
1105
1075 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); 1106 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
1076 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; 1107 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
1077 if (charcnt == 256) { 1108 if (charcnt == 256) {
@@ -1145,13 +1176,47 @@ static void fbcon_init(struct vc_data *vc, int init)
1145 ops->p = &fb_display[fg_console]; 1176 ops->p = &fb_display[fg_console];
1146} 1177}
1147 1178
1179static void fbcon_free_font(struct display *p)
1180{
1181 if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
1182 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int));
1183 p->fontdata = NULL;
1184 p->userfont = 0;
1185}
1186
1148static void fbcon_deinit(struct vc_data *vc) 1187static void fbcon_deinit(struct vc_data *vc)
1149{ 1188{
1150 struct display *p = &fb_display[vc->vc_num]; 1189 struct display *p = &fb_display[vc->vc_num];
1190 struct fb_info *info;
1191 struct fbcon_ops *ops;
1192 int idx;
1151 1193
1152 if (info_idx != -1)
1153 return;
1154 fbcon_free_font(p); 1194 fbcon_free_font(p);
1195 idx = con2fb_map[vc->vc_num];
1196
1197 if (idx == -1)
1198 goto finished;
1199
1200 info = registered_fb[idx];
1201
1202 if (!info)
1203 goto finished;
1204
1205 ops = info->fbcon_par;
1206
1207 if (!ops)
1208 goto finished;
1209
1210 if (CON_IS_VISIBLE(vc))
1211 fbcon_del_cursor_timer(info);
1212
1213 ops->flags &= ~FBCON_FLAGS_INIT;
1214finished:
1215
1216 if (!con_is_bound(&fb_con))
1217 fbcon_exit();
1218
1219 return;
1155} 1220}
1156 1221
1157/* ====================================================================== */ 1222/* ====================================================================== */
@@ -2099,12 +2164,11 @@ static int fbcon_switch(struct vc_data *vc)
2099 if (info->fbops->fb_set_par) 2164 if (info->fbops->fb_set_par)
2100 info->fbops->fb_set_par(info); 2165 info->fbops->fb_set_par(info);
2101 2166
2102 if (old_info != info) { 2167 if (old_info != info)
2103 fbcon_del_cursor_timer(old_info); 2168 fbcon_del_cursor_timer(old_info);
2104 fbcon_add_cursor_timer(info);
2105 }
2106 } 2169 }
2107 2170
2171 fbcon_add_cursor_timer(info);
2108 set_blitting_type(vc, info); 2172 set_blitting_type(vc, info);
2109 ops->cursor_reset = 1; 2173 ops->cursor_reset = 1;
2110 2174
@@ -2222,14 +2286,6 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
2222 return 0; 2286 return 0;
2223} 2287}
2224 2288
2225static void fbcon_free_font(struct display *p)
2226{
2227 if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
2228 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int));
2229 p->fontdata = NULL;
2230 p->userfont = 0;
2231}
2232
2233static int fbcon_get_font(struct vc_data *vc, struct console_font *font) 2289static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
2234{ 2290{
2235 u8 *fontdata = vc->vc_font.data; 2291 u8 *fontdata = vc->vc_font.data;
@@ -2443,7 +2499,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
2443 2499
2444 FNTSUM(new_data) = csum; 2500 FNTSUM(new_data) = csum;
2445 /* Check if the same font is on some other console already */ 2501 /* Check if the same font is on some other console already */
2446 for (i = 0; i < MAX_NR_CONSOLES; i++) { 2502 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2447 struct vc_data *tmp = vc_cons[i].d; 2503 struct vc_data *tmp = vc_cons[i].d;
2448 2504
2449 if (fb_display[i].userfont && 2505 if (fb_display[i].userfont &&
@@ -2768,7 +2824,7 @@ static void fbcon_set_all_vcs(struct fb_info *info)
2768 if (!ops || ops->currcon < 0) 2824 if (!ops || ops->currcon < 0)
2769 return; 2825 return;
2770 2826
2771 for (i = 0; i < MAX_NR_CONSOLES; i++) { 2827 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2772 vc = vc_cons[i].d; 2828 vc = vc_cons[i].d;
2773 if (!vc || vc->vc_mode != KD_TEXT || 2829 if (!vc || vc->vc_mode != KD_TEXT ||
2774 registered_fb[con2fb_map[i]] != info) 2830 registered_fb[con2fb_map[i]] != info)
@@ -2830,22 +2886,57 @@ static int fbcon_mode_deleted(struct fb_info *info,
2830 return found; 2886 return found;
2831} 2887}
2832 2888
2889static int fbcon_fb_unregistered(int idx)
2890{
2891 int i;
2892
2893 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2894 if (con2fb_map[i] == idx)
2895 con2fb_map[i] = -1;
2896 }
2897
2898 if (idx == info_idx) {
2899 info_idx = -1;
2900
2901 for (i = 0; i < FB_MAX; i++) {
2902 if (registered_fb[i] != NULL) {
2903 info_idx = i;
2904 break;
2905 }
2906 }
2907 }
2908
2909 if (info_idx != -1) {
2910 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2911 if (con2fb_map[i] == -1)
2912 con2fb_map[i] = info_idx;
2913 }
2914 }
2915
2916 if (!num_registered_fb)
2917 unregister_con_driver(&fb_con);
2918
2919 return 0;
2920}
2921
2833static int fbcon_fb_registered(int idx) 2922static int fbcon_fb_registered(int idx)
2834{ 2923{
2835 int ret = 0, i; 2924 int ret = 0, i;
2836 2925
2837 if (info_idx == -1) { 2926 if (info_idx == -1) {
2838 for (i = 0; i < MAX_NR_CONSOLES; i++) { 2927 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2839 if (con2fb_map_boot[i] == idx) { 2928 if (con2fb_map_boot[i] == idx) {
2840 info_idx = idx; 2929 info_idx = idx;
2841 break; 2930 break;
2842 } 2931 }
2843 } 2932 }
2933
2844 if (info_idx != -1) 2934 if (info_idx != -1)
2845 ret = fbcon_takeover(1); 2935 ret = fbcon_takeover(1);
2846 } else { 2936 } else {
2847 for (i = 0; i < MAX_NR_CONSOLES; i++) { 2937 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2848 if (con2fb_map_boot[i] == idx) 2938 if (con2fb_map_boot[i] == idx &&
2939 con2fb_map[i] == -1)
2849 set_con2fb_map(i, idx, 0); 2940 set_con2fb_map(i, idx, 0);
2850 } 2941 }
2851 } 2942 }
@@ -2882,7 +2973,7 @@ static void fbcon_new_modelist(struct fb_info *info)
2882 struct fb_var_screeninfo var; 2973 struct fb_var_screeninfo var;
2883 struct fb_videomode *mode; 2974 struct fb_videomode *mode;
2884 2975
2885 for (i = 0; i < MAX_NR_CONSOLES; i++) { 2976 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2886 if (registered_fb[con2fb_map[i]] != info) 2977 if (registered_fb[con2fb_map[i]] != info)
2887 continue; 2978 continue;
2888 if (!fb_display[i].mode) 2979 if (!fb_display[i].mode)
@@ -2910,6 +3001,14 @@ static int fbcon_event_notify(struct notifier_block *self,
2910 struct fb_con2fbmap *con2fb; 3001 struct fb_con2fbmap *con2fb;
2911 int ret = 0; 3002 int ret = 0;
2912 3003
3004 /*
3005 * ignore all events except driver registration and deregistration
3006 * if fbcon is not active
3007 */
3008 if (fbcon_has_exited && !(action == FB_EVENT_FB_REGISTERED ||
3009 action == FB_EVENT_FB_UNREGISTERED))
3010 goto done;
3011
2913 switch(action) { 3012 switch(action) {
2914 case FB_EVENT_SUSPEND: 3013 case FB_EVENT_SUSPEND:
2915 fbcon_suspended(info); 3014 fbcon_suspended(info);
@@ -2930,6 +3029,9 @@ static int fbcon_event_notify(struct notifier_block *self,
2930 case FB_EVENT_FB_REGISTERED: 3029 case FB_EVENT_FB_REGISTERED:
2931 ret = fbcon_fb_registered(info->node); 3030 ret = fbcon_fb_registered(info->node);
2932 break; 3031 break;
3032 case FB_EVENT_FB_UNREGISTERED:
3033 ret = fbcon_fb_unregistered(info->node);
3034 break;
2933 case FB_EVENT_SET_CONSOLE_MAP: 3035 case FB_EVENT_SET_CONSOLE_MAP:
2934 con2fb = event->data; 3036 con2fb = event->data;
2935 ret = set_con2fb_map(con2fb->console - 1, 3037 ret = set_con2fb_map(con2fb->console - 1,
@@ -2945,16 +3047,9 @@ static int fbcon_event_notify(struct notifier_block *self,
2945 case FB_EVENT_NEW_MODELIST: 3047 case FB_EVENT_NEW_MODELIST:
2946 fbcon_new_modelist(info); 3048 fbcon_new_modelist(info);
2947 break; 3049 break;
2948 case FB_EVENT_SET_CON_ROTATE:
2949 fbcon_rotate(info, *(int *)event->data);
2950 break;
2951 case FB_EVENT_GET_CON_ROTATE:
2952 ret = fbcon_get_rotate(info);
2953 break;
2954 case FB_EVENT_SET_CON_ROTATE_ALL:
2955 fbcon_rotate_all(info, *(int *)event->data);
2956 } 3050 }
2957 3051
3052done:
2958 return ret; 3053 return ret;
2959} 3054}
2960 3055
@@ -2992,27 +3087,181 @@ static struct notifier_block fbcon_event_notifier = {
2992 .notifier_call = fbcon_event_notify, 3087 .notifier_call = fbcon_event_notify,
2993}; 3088};
2994 3089
2995static int __init fb_console_init(void) 3090static ssize_t store_rotate(struct class_device *class_device,
3091 const char *buf, size_t count)
2996{ 3092{
2997 int i; 3093 struct fb_info *info;
3094 int rotate, idx;
3095 char **last = NULL;
3096
3097 if (fbcon_has_exited)
3098 return count;
2998 3099
2999 acquire_console_sem(); 3100 acquire_console_sem();
3000 fb_register_client(&fbcon_event_notifier); 3101 idx = con2fb_map[fg_console];
3102
3103 if (idx == -1 || registered_fb[idx] == NULL)
3104 goto err;
3105
3106 info = registered_fb[idx];
3107 rotate = simple_strtoul(buf, last, 0);
3108 fbcon_rotate(info, rotate);
3109err:
3001 release_console_sem(); 3110 release_console_sem();
3111 return count;
3112}
3002 3113
3003 for (i = 0; i < MAX_NR_CONSOLES; i++) 3114static ssize_t store_rotate_all(struct class_device *class_device,
3004 con2fb_map[i] = -1; 3115 const char *buf, size_t count)
3116{
3117 struct fb_info *info;
3118 int rotate, idx;
3119 char **last = NULL;
3120
3121 if (fbcon_has_exited)
3122 return count;
3123
3124 acquire_console_sem();
3125 idx = con2fb_map[fg_console];
3126
3127 if (idx == -1 || registered_fb[idx] == NULL)
3128 goto err;
3005 3129
3130 info = registered_fb[idx];
3131 rotate = simple_strtoul(buf, last, 0);
3132 fbcon_rotate_all(info, rotate);
3133err:
3134 release_console_sem();
3135 return count;
3136}
3137
3138static ssize_t show_rotate(struct class_device *class_device, char *buf)
3139{
3140 struct fb_info *info;
3141 int rotate = 0, idx;
3142
3143 if (fbcon_has_exited)
3144 return 0;
3145
3146 acquire_console_sem();
3147 idx = con2fb_map[fg_console];
3148
3149 if (idx == -1 || registered_fb[idx] == NULL)
3150 goto err;
3151
3152 info = registered_fb[idx];
3153 rotate = fbcon_get_rotate(info);
3154err:
3155 release_console_sem();
3156 return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
3157}
3158
3159static struct class_device_attribute class_device_attrs[] = {
3160 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
3161 __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
3162};
3163
3164static int fbcon_init_class_device(void)
3165{
3166 int i;
3167
3168 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3169 class_device_create_file(fbcon_class_device,
3170 &class_device_attrs[i]);
3171 return 0;
3172}
3173
3174static void fbcon_start(void)
3175{
3006 if (num_registered_fb) { 3176 if (num_registered_fb) {
3177 int i;
3178
3179 acquire_console_sem();
3180
3007 for (i = 0; i < FB_MAX; i++) { 3181 for (i = 0; i < FB_MAX; i++) {
3008 if (registered_fb[i] != NULL) { 3182 if (registered_fb[i] != NULL) {
3009 info_idx = i; 3183 info_idx = i;
3010 break; 3184 break;
3011 } 3185 }
3012 } 3186 }
3187
3188 release_console_sem();
3013 fbcon_takeover(0); 3189 fbcon_takeover(0);
3014 } 3190 }
3191}
3192
3193static void fbcon_exit(void)
3194{
3195 struct fb_info *info;
3196 int i, j, mapped;
3197
3198 if (fbcon_has_exited)
3199 return;
3200
3201#ifdef CONFIG_ATARI
3202 free_irq(IRQ_AUTO_4, fbcon_vbl_handler);
3203#endif
3204#ifdef CONFIG_MAC
3205 if (MACH_IS_MAC && vbl_detected)
3206 free_irq(IRQ_MAC_VBL, fbcon_vbl_handler);
3207#endif
3208
3209 kfree((void *)softback_buf);
3210 softback_buf = 0UL;
3211
3212 for (i = 0; i < FB_MAX; i++) {
3213 mapped = 0;
3214 info = registered_fb[i];
3215
3216 if (info == NULL)
3217 continue;
3218
3219 for (j = first_fb_vc; j <= last_fb_vc; j++) {
3220 if (con2fb_map[j] == i)
3221 mapped = 1;
3222 }
3223
3224 if (mapped) {
3225 if (info->fbops->fb_release)
3226 info->fbops->fb_release(info, 0);
3227 module_put(info->fbops->owner);
3228
3229 if (info->fbcon_par) {
3230 fbcon_del_cursor_timer(info);
3231 kfree(info->fbcon_par);
3232 info->fbcon_par = NULL;
3233 }
3015 3234
3235 if (info->queue.func == fb_flashcursor)
3236 info->queue.func = NULL;
3237 }
3238 }
3239
3240 fbcon_has_exited = 1;
3241}
3242
3243static int __init fb_console_init(void)
3244{
3245 int i;
3246
3247 acquire_console_sem();
3248 fb_register_client(&fbcon_event_notifier);
3249 fbcon_class_device =
3250 class_device_create(fb_class, NULL, MKDEV(0, 0), NULL, "fbcon");
3251
3252 if (IS_ERR(fbcon_class_device)) {
3253 printk(KERN_WARNING "Unable to create class_device "
3254 "for fbcon; errno = %ld\n",
3255 PTR_ERR(fbcon_class_device));
3256 fbcon_class_device = NULL;
3257 } else
3258 fbcon_init_class_device();
3259
3260 for (i = 0; i < MAX_NR_CONSOLES; i++)
3261 con2fb_map[i] = -1;
3262
3263 release_console_sem();
3264 fbcon_start();
3016 return 0; 3265 return 0;
3017} 3266}
3018 3267
@@ -3020,12 +3269,24 @@ module_init(fb_console_init);
3020 3269
3021#ifdef MODULE 3270#ifdef MODULE
3022 3271
3272static void __exit fbcon_deinit_class_device(void)
3273{
3274 int i;
3275
3276 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3277 class_device_remove_file(fbcon_class_device,
3278 &class_device_attrs[i]);
3279}
3280
3023static void __exit fb_console_exit(void) 3281static void __exit fb_console_exit(void)
3024{ 3282{
3025 acquire_console_sem(); 3283 acquire_console_sem();
3026 fb_unregister_client(&fbcon_event_notifier); 3284 fb_unregister_client(&fbcon_event_notifier);
3285 fbcon_deinit_class_device();
3286 class_device_destroy(fb_class, MKDEV(0, 0));
3287 fbcon_exit();
3027 release_console_sem(); 3288 release_console_sem();
3028 give_up_console(&fb_con); 3289 unregister_con_driver(&fb_con);
3029} 3290}
3030 3291
3031module_exit(fb_console_exit); 3292module_exit(fb_console_exit);
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index c38c3d8e7a74..3487a636370a 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -175,6 +175,7 @@ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
175#endif 175#endif
176extern void fbcon_set_bitops(struct fbcon_ops *ops); 176extern void fbcon_set_bitops(struct fbcon_ops *ops);
177extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); 177extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
178extern struct class *fb_class;
178 179
179#define FBCON_ATTRIBUTE_UNDERLINE 1 180#define FBCON_ATTRIBUTE_UNDERLINE 1
180#define FBCON_ATTRIBUTE_REVERSE 2 181#define FBCON_ATTRIBUTE_REVERSE 2
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 7f939d066a5a..c89f90edf8ac 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -308,7 +308,7 @@ static void __init mda_initialize(void)
308 outb_p(0x00, mda_gfx_port); 308 outb_p(0x00, mda_gfx_port);
309} 309}
310 310
311static const char __init *mdacon_startup(void) 311static const char *mdacon_startup(void)
312{ 312{
313 mda_num_columns = 80; 313 mda_num_columns = 80;
314 mda_num_lines = 25; 314 mda_num_lines = 25;
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index e99fe30e568c..03041311711b 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -51,6 +51,7 @@ static int topscan;
51static int xcurs_correction = 29; 51static int xcurs_correction = 29;
52static int newport_xsize; 52static int newport_xsize;
53static int newport_ysize; 53static int newport_ysize;
54static int newport_has_init;
54 55
55static int newport_set_def_font(int unit, struct console_font *op); 56static int newport_set_def_font(int unit, struct console_font *op);
56 57
@@ -283,6 +284,15 @@ static void newport_get_revisions(void)
283 xcurs_correction = 21; 284 xcurs_correction = 21;
284} 285}
285 286
287static void newport_exit(void)
288{
289 int i;
290
291 /* free memory used by user font */
292 for (i = 0; i < MAX_NR_CONSOLES; i++)
293 newport_set_def_font(i, NULL);
294}
295
286/* Can't be __init, take_over_console may call it later */ 296/* Can't be __init, take_over_console may call it later */
287static const char *newport_startup(void) 297static const char *newport_startup(void)
288{ 298{
@@ -290,8 +300,10 @@ static const char *newport_startup(void)
290 300
291 if (!sgi_gfxaddr) 301 if (!sgi_gfxaddr)
292 return NULL; 302 return NULL;
293 npregs = (struct newport_regs *) /* ioremap cannot fail */ 303
294 ioremap(sgi_gfxaddr, sizeof(struct newport_regs)); 304 if (!npregs)
305 npregs = (struct newport_regs *)/* ioremap cannot fail */
306 ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
295 npregs->cset.config = NPORT_CFG_GD0; 307 npregs->cset.config = NPORT_CFG_GD0;
296 308
297 if (newport_wait(npregs)) 309 if (newport_wait(npregs))
@@ -307,11 +319,11 @@ static const char *newport_startup(void)
307 newport_reset(); 319 newport_reset();
308 newport_get_revisions(); 320 newport_get_revisions();
309 newport_get_screensize(); 321 newport_get_screensize();
322 newport_has_init = 1;
310 323
311 return "SGI Newport"; 324 return "SGI Newport";
312 325
313out_unmap: 326out_unmap:
314 iounmap((void *)npregs);
315 return NULL; 327 return NULL;
316} 328}
317 329
@@ -324,11 +336,10 @@ static void newport_init(struct vc_data *vc, int init)
324 336
325static void newport_deinit(struct vc_data *c) 337static void newport_deinit(struct vc_data *c)
326{ 338{
327 int i; 339 if (!con_is_bound(&newport_con) && newport_has_init) {
328 340 newport_exit();
329 /* free memory used by user font */ 341 newport_has_init = 0;
330 for (i = 0; i < MAX_NR_CONSOLES; i++) 342 }
331 newport_set_def_font(i, NULL);
332} 343}
333 344
334static void newport_clear(struct vc_data *vc, int sy, int sx, int height, 345static void newport_clear(struct vc_data *vc, int sy, int sx, int height,
@@ -728,16 +739,23 @@ const struct consw newport_con = {
728#ifdef MODULE 739#ifdef MODULE
729static int __init newport_console_init(void) 740static int __init newport_console_init(void)
730{ 741{
742
743 if (!sgi_gfxaddr)
744 return NULL;
745
746 if (!npregs)
747 npregs = (struct newport_regs *)/* ioremap cannot fail */
748 ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
749
731 return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); 750 return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
732} 751}
752module_init(newport_console_init);
733 753
734static void __exit newport_console_exit(void) 754static void __exit newport_console_exit(void)
735{ 755{
736 give_up_console(&newport_con); 756 give_up_console(&newport_con);
737 iounmap((void *)npregs); 757 iounmap((void *)npregs);
738} 758}
739
740module_init(newport_console_init);
741module_exit(newport_console_exit); 759module_exit(newport_console_exit);
742#endif 760#endif
743 761
diff --git a/drivers/video/console/promcon.c b/drivers/video/console/promcon.c
index 04f42fcaac59..d6e6ad537f9f 100644
--- a/drivers/video/console/promcon.c
+++ b/drivers/video/console/promcon.c
@@ -109,7 +109,7 @@ promcon_end(struct vc_data *conp, char *b)
109 return b - p; 109 return b - p;
110} 110}
111 111
112const char __init *promcon_startup(void) 112const char *promcon_startup(void)
113{ 113{
114 const char *display_desc = "PROM"; 114 const char *display_desc = "PROM";
115 int node; 115 int node;
@@ -133,7 +133,7 @@ const char __init *promcon_startup(void)
133 return display_desc; 133 return display_desc;
134} 134}
135 135
136static void __init 136static void
137promcon_init_unimap(struct vc_data *conp) 137promcon_init_unimap(struct vc_data *conp)
138{ 138{
139 mm_segment_t old_fs = get_fs(); 139 mm_segment_t old_fs = get_fs();
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index fd5940f41271..45c4f227e56e 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -75,7 +75,7 @@ static inline void cursor_undrawn(void)
75 cursor_drawn = 0; 75 cursor_drawn = 0;
76} 76}
77 77
78static const char *__init sticon_startup(void) 78static const char *sticon_startup(void)
79{ 79{
80 return "STI console"; 80 return "STI console";
81} 81}
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index e64d42e2449e..f32b590730f2 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -114,6 +114,7 @@ static int vga_512_chars;
114static int vga_video_font_height; 114static int vga_video_font_height;
115static int vga_scan_lines; 115static int vga_scan_lines;
116static unsigned int vga_rolled_over = 0; 116static unsigned int vga_rolled_over = 0;
117static int vga_init_done;
117 118
118static int __init no_scroll(char *str) 119static int __init no_scroll(char *str)
119{ 120{
@@ -190,7 +191,7 @@ static void vgacon_scrollback_init(int pitch)
190 } 191 }
191} 192}
192 193
193static void __init vgacon_scrollback_startup(void) 194static void vgacon_scrollback_startup(void)
194{ 195{
195 vgacon_scrollback = alloc_bootmem(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE 196 vgacon_scrollback = alloc_bootmem(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE
196 * 1024); 197 * 1024);
@@ -355,7 +356,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
355} 356}
356#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */ 357#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */
357 358
358static const char __init *vgacon_startup(void) 359static const char *vgacon_startup(void)
359{ 360{
360 const char *display_desc = NULL; 361 const char *display_desc = NULL;
361 u16 saved1, saved2; 362 u16 saved1, saved2;
@@ -523,7 +524,12 @@ static const char __init *vgacon_startup(void)
523 524
524 vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH; 525 vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH;
525 vgacon_yres = vga_scan_lines; 526 vgacon_yres = vga_scan_lines;
526 vgacon_scrollback_startup(); 527
528 if (!vga_init_done) {
529 vgacon_scrollback_startup();
530 vga_init_done = 1;
531 }
532
527 return display_desc; 533 return display_desc;
528} 534}
529 535
@@ -531,10 +537,20 @@ static void vgacon_init(struct vc_data *c, int init)
531{ 537{
532 unsigned long p; 538 unsigned long p;
533 539
534 /* We cannot be loaded as a module, therefore init is always 1 */ 540 /*
541 * We cannot be loaded as a module, therefore init is always 1,
542 * but vgacon_init can be called more than once, and init will
543 * not be 1.
544 */
535 c->vc_can_do_color = vga_can_do_color; 545 c->vc_can_do_color = vga_can_do_color;
536 c->vc_cols = vga_video_num_columns; 546
537 c->vc_rows = vga_video_num_lines; 547 /* set dimensions manually if init != 0 since vc_resize() will fail */
548 if (init) {
549 c->vc_cols = vga_video_num_columns;
550 c->vc_rows = vga_video_num_lines;
551 } else
552 vc_resize(c, vga_video_num_columns, vga_video_num_lines);
553
538 c->vc_scan_lines = vga_scan_lines; 554 c->vc_scan_lines = vga_scan_lines;
539 c->vc_font.height = vga_video_font_height; 555 c->vc_font.height = vga_video_font_height;
540 c->vc_complement_mask = 0x7700; 556 c->vc_complement_mask = 0x7700;
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c
index 082759447bf6..f0a621ecc288 100644
--- a/drivers/video/epson1355fb.c
+++ b/drivers/video/epson1355fb.c
@@ -605,11 +605,6 @@ static void clearfb16(struct fb_info *info)
605 fb_writeb(0, dst); 605 fb_writeb(0, dst);
606} 606}
607 607
608static void epson1355fb_platform_release(struct device *device)
609{
610 dev_err(device, "This driver is broken, please bug the authors so they will fix it.\n");
611}
612
613static int epson1355fb_remove(struct platform_device *dev) 608static int epson1355fb_remove(struct platform_device *dev)
614{ 609{
615 struct fb_info *info = platform_get_drvdata(dev); 610 struct fb_info *info = platform_get_drvdata(dev);
@@ -733,13 +728,7 @@ static struct platform_driver epson1355fb_driver = {
733 }, 728 },
734}; 729};
735 730
736static struct platform_device epson1355fb_device = { 731static struct platform_device *epson1355fb_device;
737 .name = "epson1355fb",
738 .id = 0,
739 .dev = {
740 .release = epson1355fb_platform_release,
741 }
742};
743 732
744int __init epson1355fb_init(void) 733int __init epson1355fb_init(void)
745{ 734{
@@ -749,11 +738,21 @@ int __init epson1355fb_init(void)
749 return -ENODEV; 738 return -ENODEV;
750 739
751 ret = platform_driver_register(&epson1355fb_driver); 740 ret = platform_driver_register(&epson1355fb_driver);
741
752 if (!ret) { 742 if (!ret) {
753 ret = platform_device_register(&epson1355fb_device); 743 epson1355fb_device = platform_device_alloc("epson1355fb", 0);
754 if (ret) 744
745 if (epson1355fb_device)
746 ret = platform_device_add(epson1355fb_device);
747 else
748 ret = -ENOMEM;
749
750 if (ret) {
751 platform_device_put(epson1355fb_device);
755 platform_driver_unregister(&epson1355fb_driver); 752 platform_driver_unregister(&epson1355fb_driver);
753 }
756 } 754 }
755
757 return ret; 756 return ret;
758} 757}
759 758
@@ -762,7 +761,7 @@ module_init(epson1355fb_init);
762#ifdef MODULE 761#ifdef MODULE
763static void __exit epson1355fb_exit(void) 762static void __exit epson1355fb_exit(void)
764{ 763{
765 platform_device_unregister(&epson1355fb_device); 764 platform_device_unregister(epson1355fb_device);
766 platform_driver_unregister(&epson1355fb_driver); 765 platform_driver_unregister(&epson1355fb_driver);
767} 766}
768 767
diff --git a/drivers/video/fbcvt.c b/drivers/video/fbcvt.c
index ac90883dc3aa..b5498999c4ec 100644
--- a/drivers/video/fbcvt.c
+++ b/drivers/video/fbcvt.c
@@ -376,4 +376,3 @@ int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb)
376 376
377 return 0; 377 return 0;
378} 378}
379EXPORT_SYMBOL(fb_find_mode_cvt);
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 372aa1776827..31143afe7c95 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -34,7 +34,6 @@
34#endif 34#endif
35#include <linux/devfs_fs_kernel.h> 35#include <linux/devfs_fs_kernel.h>
36#include <linux/err.h> 36#include <linux/err.h>
37#include <linux/kernel.h>
38#include <linux/device.h> 37#include <linux/device.h>
39#include <linux/efi.h> 38#include <linux/efi.h>
40 39
@@ -162,7 +161,6 @@ char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size
162} 161}
163 162
164#ifdef CONFIG_LOGO 163#ifdef CONFIG_LOGO
165#include <linux/linux_logo.h>
166 164
167static inline unsigned safe_shift(unsigned d, int n) 165static inline unsigned safe_shift(unsigned d, int n)
168{ 166{
@@ -336,11 +334,11 @@ static void fb_rotate_logo_ud(const u8 *in, u8 *out, u32 width, u32 height)
336 334
337static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height) 335static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height)
338{ 336{
339 int i, j, w = width - 1; 337 int i, j, h = height - 1;
340 338
341 for (i = 0; i < height; i++) 339 for (i = 0; i < height; i++)
342 for (j = 0; j < width; j++) 340 for (j = 0; j < width; j++)
343 out[height * j + w - i] = *in++; 341 out[height * j + h - i] = *in++;
344} 342}
345 343
346static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height) 344static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height)
@@ -358,24 +356,24 @@ static void fb_rotate_logo(struct fb_info *info, u8 *dst,
358 u32 tmp; 356 u32 tmp;
359 357
360 if (rotate == FB_ROTATE_UD) { 358 if (rotate == FB_ROTATE_UD) {
361 image->dx = info->var.xres - image->width;
362 image->dy = info->var.yres - image->height;
363 fb_rotate_logo_ud(image->data, dst, image->width, 359 fb_rotate_logo_ud(image->data, dst, image->width,
364 image->height); 360 image->height);
361 image->dx = info->var.xres - image->width;
362 image->dy = info->var.yres - image->height;
365 } else if (rotate == FB_ROTATE_CW) { 363 } else if (rotate == FB_ROTATE_CW) {
366 tmp = image->width;
367 image->width = image->height;
368 image->height = tmp;
369 image->dx = info->var.xres - image->height;
370 fb_rotate_logo_cw(image->data, dst, image->width, 364 fb_rotate_logo_cw(image->data, dst, image->width,
371 image->height); 365 image->height);
372 } else if (rotate == FB_ROTATE_CCW) {
373 tmp = image->width; 366 tmp = image->width;
374 image->width = image->height; 367 image->width = image->height;
375 image->height = tmp; 368 image->height = tmp;
376 image->dy = info->var.yres - image->width; 369 image->dx = info->var.xres - image->width;
370 } else if (rotate == FB_ROTATE_CCW) {
377 fb_rotate_logo_ccw(image->data, dst, image->width, 371 fb_rotate_logo_ccw(image->data, dst, image->width,
378 image->height); 372 image->height);
373 tmp = image->width;
374 image->width = image->height;
375 image->height = tmp;
376 image->dy = info->var.yres - image->height;
379 } 377 }
380 378
381 image->data = dst; 379 image->data = dst;
@@ -435,7 +433,7 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
435 depth = info->var.green.length; 433 depth = info->var.green.length;
436 } 434 }
437 435
438 if (info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR) { 436 if (info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR && depth > 4) {
439 /* assume console colormap */ 437 /* assume console colormap */
440 depth = 4; 438 depth = 4;
441 } 439 }
@@ -1278,8 +1276,8 @@ static struct file_operations fb_fops = {
1278#endif 1276#endif
1279}; 1277};
1280 1278
1281static struct class *fb_class; 1279struct class *fb_class;
1282 1280EXPORT_SYMBOL(fb_class);
1283/** 1281/**
1284 * register_framebuffer - registers a frame buffer device 1282 * register_framebuffer - registers a frame buffer device
1285 * @fb_info: frame buffer info structure 1283 * @fb_info: frame buffer info structure
@@ -1355,6 +1353,7 @@ register_framebuffer(struct fb_info *fb_info)
1355int 1353int
1356unregister_framebuffer(struct fb_info *fb_info) 1354unregister_framebuffer(struct fb_info *fb_info)
1357{ 1355{
1356 struct fb_event event;
1358 int i; 1357 int i;
1359 1358
1360 i = fb_info->node; 1359 i = fb_info->node;
@@ -1362,13 +1361,17 @@ unregister_framebuffer(struct fb_info *fb_info)
1362 return -EINVAL; 1361 return -EINVAL;
1363 devfs_remove("fb/%d", i); 1362 devfs_remove("fb/%d", i);
1364 1363
1365 if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) 1364 if (fb_info->pixmap.addr &&
1365 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
1366 kfree(fb_info->pixmap.addr); 1366 kfree(fb_info->pixmap.addr);
1367 fb_destroy_modelist(&fb_info->modelist); 1367 fb_destroy_modelist(&fb_info->modelist);
1368 registered_fb[i]=NULL; 1368 registered_fb[i]=NULL;
1369 num_registered_fb--; 1369 num_registered_fb--;
1370 fb_cleanup_class_device(fb_info); 1370 fb_cleanup_class_device(fb_info);
1371 class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1371 class_device_destroy(fb_class, MKDEV(FB_MAJOR, i));
1372 event.info = fb_info;
1373 blocking_notifier_call_chain(&fb_notifier_list,
1374 FB_EVENT_FB_UNREGISTERED, &event);
1372 return 0; 1375 return 0;
1373} 1376}
1374 1377
@@ -1491,28 +1494,6 @@ int fb_new_modelist(struct fb_info *info)
1491 return err; 1494 return err;
1492} 1495}
1493 1496
1494/**
1495 * fb_con_duit - user<->fbcon passthrough
1496 * @info: struct fb_info
1497 * @event: notification event to be passed to fbcon
1498 * @data: private data
1499 *
1500 * DESCRIPTION
1501 * This function is an fbcon-user event passing channel
1502 * which bypasses fbdev. This is hopefully temporary
1503 * until a user interface for fbcon is created
1504 */
1505int fb_con_duit(struct fb_info *info, int event, void *data)
1506{
1507 struct fb_event evnt;
1508
1509 evnt.info = info;
1510 evnt.data = data;
1511
1512 return blocking_notifier_call_chain(&fb_notifier_list, event, &evnt);
1513}
1514EXPORT_SYMBOL(fb_con_duit);
1515
1516static char *video_options[FB_MAX]; 1497static char *video_options[FB_MAX];
1517static int ofonly; 1498static int ofonly;
1518 1499
@@ -1622,6 +1603,5 @@ EXPORT_SYMBOL(fb_set_suspend);
1622EXPORT_SYMBOL(fb_register_client); 1603EXPORT_SYMBOL(fb_register_client);
1623EXPORT_SYMBOL(fb_unregister_client); 1604EXPORT_SYMBOL(fb_unregister_client);
1624EXPORT_SYMBOL(fb_get_options); 1605EXPORT_SYMBOL(fb_get_options);
1625EXPORT_SYMBOL(fb_new_modelist);
1626 1606
1627MODULE_LICENSE("GPL"); 1607MODULE_LICENSE("GPL");
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 53beeb4a9998..3ccfff715a51 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -29,9 +29,9 @@
29#include <linux/tty.h> 29#include <linux/tty.h>
30#include <linux/fb.h> 30#include <linux/fb.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/pci.h>
32#include <video/edid.h> 33#include <video/edid.h>
33#ifdef CONFIG_PPC_OF 34#ifdef CONFIG_PPC_OF
34#include <linux/pci.h>
35#include <asm/prom.h> 35#include <asm/prom.h>
36#include <asm/pci-bridge.h> 36#include <asm/pci-bridge.h>
37#endif 37#endif
@@ -605,6 +605,7 @@ static int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs)
605 block = edid + DETAILED_TIMING_DESCRIPTIONS_START; 605 block = edid + DETAILED_TIMING_DESCRIPTIONS_START;
606 606
607 DPRINTK(" Monitor Operating Limits: "); 607 DPRINTK(" Monitor Operating Limits: ");
608
608 for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) { 609 for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) {
609 if (edid_is_limits_block(block)) { 610 if (edid_is_limits_block(block)) {
610 specs->hfmin = H_MIN_RATE * 1000; 611 specs->hfmin = H_MIN_RATE * 1000;
@@ -618,11 +619,12 @@ static int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs)
618 break; 619 break;
619 } 620 }
620 } 621 }
621 622
622 /* estimate monitor limits based on modes supported */ 623 /* estimate monitor limits based on modes supported */
623 if (retval) { 624 if (retval) {
624 struct fb_videomode *modes; 625 struct fb_videomode *modes, *mode;
625 int num_modes, i, hz, hscan, pixclock; 626 int num_modes, i, hz, hscan, pixclock;
627 int vtotal, htotal;
626 628
627 modes = fb_create_modedb(edid, &num_modes); 629 modes = fb_create_modedb(edid, &num_modes);
628 if (!modes) { 630 if (!modes) {
@@ -632,20 +634,38 @@ static int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs)
632 634
633 retval = 0; 635 retval = 0;
634 for (i = 0; i < num_modes; i++) { 636 for (i = 0; i < num_modes; i++) {
635 hz = modes[i].refresh; 637 mode = &modes[i];
636 pixclock = PICOS2KHZ(modes[i].pixclock) * 1000; 638 pixclock = PICOS2KHZ(modes[i].pixclock) * 1000;
637 hscan = (modes[i].yres * 105 * hz + 5000)/100; 639 htotal = mode->xres + mode->right_margin + mode->hsync_len
640 + mode->left_margin;
641 vtotal = mode->yres + mode->lower_margin + mode->vsync_len
642 + mode->upper_margin;
643
644 if (mode->vmode & FB_VMODE_INTERLACED)
645 vtotal /= 2;
646
647 if (mode->vmode & FB_VMODE_DOUBLE)
648 vtotal *= 2;
649
650 hscan = (pixclock + htotal / 2) / htotal;
651 hscan = (hscan + 500) / 1000 * 1000;
652 hz = (hscan + vtotal / 2) / vtotal;
638 653
639 if (specs->dclkmax == 0 || specs->dclkmax < pixclock) 654 if (specs->dclkmax == 0 || specs->dclkmax < pixclock)
640 specs->dclkmax = pixclock; 655 specs->dclkmax = pixclock;
656
641 if (specs->dclkmin == 0 || specs->dclkmin > pixclock) 657 if (specs->dclkmin == 0 || specs->dclkmin > pixclock)
642 specs->dclkmin = pixclock; 658 specs->dclkmin = pixclock;
659
643 if (specs->hfmax == 0 || specs->hfmax < hscan) 660 if (specs->hfmax == 0 || specs->hfmax < hscan)
644 specs->hfmax = hscan; 661 specs->hfmax = hscan;
662
645 if (specs->hfmin == 0 || specs->hfmin > hscan) 663 if (specs->hfmin == 0 || specs->hfmin > hscan)
646 specs->hfmin = hscan; 664 specs->hfmin = hscan;
665
647 if (specs->vfmax == 0 || specs->vfmax < hz) 666 if (specs->vfmax == 0 || specs->vfmax < hz)
648 specs->vfmax = hz; 667 specs->vfmax = hz;
668
649 if (specs->vfmin == 0 || specs->vfmin > hz) 669 if (specs->vfmin == 0 || specs->vfmin > hz)
650 specs->vfmin = hz; 670 specs->vfmin = hz;
651 } 671 }
@@ -1281,8 +1301,7 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
1281 -EINVAL : 0; 1301 -EINVAL : 0;
1282} 1302}
1283 1303
1284#if defined(CONFIG_FB_FIRMWARE_EDID) && defined(__i386__) 1304#if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86)
1285#include <linux/pci.h>
1286 1305
1287/* 1306/*
1288 * We need to ensure that the EDID block is only returned for 1307 * We need to ensure that the EDID block is only returned for
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 3ceb8c1b392e..4f78f234473d 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -100,13 +100,22 @@ static int mode_string(char *buf, unsigned int offset,
100 const struct fb_videomode *mode) 100 const struct fb_videomode *mode)
101{ 101{
102 char m = 'U'; 102 char m = 'U';
103 char v = 'p';
104
103 if (mode->flag & FB_MODE_IS_DETAILED) 105 if (mode->flag & FB_MODE_IS_DETAILED)
104 m = 'D'; 106 m = 'D';
105 if (mode->flag & FB_MODE_IS_VESA) 107 if (mode->flag & FB_MODE_IS_VESA)
106 m = 'V'; 108 m = 'V';
107 if (mode->flag & FB_MODE_IS_STANDARD) 109 if (mode->flag & FB_MODE_IS_STANDARD)
108 m = 'S'; 110 m = 'S';
109 return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d-%d\n", m, mode->xres, mode->yres, mode->refresh); 111
112 if (mode->vmode & FB_VMODE_INTERLACED)
113 v = 'i';
114 if (mode->vmode & FB_VMODE_DOUBLE)
115 v = 'd';
116
117 return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d%c-%d\n",
118 m, mode->xres, mode->yres, v, mode->refresh);
110} 119}
111 120
112static ssize_t store_mode(struct class_device *class_device, const char * buf, 121static ssize_t store_mode(struct class_device *class_device, const char * buf,
@@ -238,45 +247,6 @@ static ssize_t show_rotate(struct class_device *class_device, char *buf)
238 return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate); 247 return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate);
239} 248}
240 249
241static ssize_t store_con_rotate(struct class_device *class_device,
242 const char *buf, size_t count)
243{
244 struct fb_info *fb_info = class_get_devdata(class_device);
245 int rotate;
246 char **last = NULL;
247
248 acquire_console_sem();
249 rotate = simple_strtoul(buf, last, 0);
250 fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE, &rotate);
251 release_console_sem();
252 return count;
253}
254
255static ssize_t store_con_rotate_all(struct class_device *class_device,
256 const char *buf, size_t count)
257{
258 struct fb_info *fb_info = class_get_devdata(class_device);
259 int rotate;
260 char **last = NULL;
261
262 acquire_console_sem();
263 rotate = simple_strtoul(buf, last, 0);
264 fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE_ALL, &rotate);
265 release_console_sem();
266 return count;
267}
268
269static ssize_t show_con_rotate(struct class_device *class_device, char *buf)
270{
271 struct fb_info *fb_info = class_get_devdata(class_device);
272 int rotate;
273
274 acquire_console_sem();
275 rotate = fb_con_duit(fb_info, FB_EVENT_GET_CON_ROTATE, NULL);
276 release_console_sem();
277 return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
278}
279
280static ssize_t store_virtual(struct class_device *class_device, 250static ssize_t store_virtual(struct class_device *class_device,
281 const char * buf, size_t count) 251 const char * buf, size_t count)
282{ 252{
@@ -493,8 +463,6 @@ static struct class_device_attribute class_device_attrs[] = {
493 __ATTR(name, S_IRUGO, show_name, NULL), 463 __ATTR(name, S_IRUGO, show_name, NULL),
494 __ATTR(stride, S_IRUGO, show_stride, NULL), 464 __ATTR(stride, S_IRUGO, show_stride, NULL),
495 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), 465 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
496 __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate),
497 __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all),
498 __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate), 466 __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate),
499#ifdef CONFIG_FB_BACKLIGHT 467#ifdef CONFIG_FB_BACKLIGHT
500 __ATTR(bl_curve, S_IRUGO|S_IWUSR, show_bl_curve, store_bl_curve), 468 __ATTR(bl_curve, S_IRUGO|S_IWUSR, show_bl_curve, store_bl_curve),
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/geode/gx1fb_core.c
index 20e69156d728..4d3a8871d3d1 100644
--- a/drivers/video/geode/gx1fb_core.c
+++ b/drivers/video/geode/gx1fb_core.c
@@ -376,8 +376,6 @@ static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *
376 release_mem_region(gx1_gx_base() + 0x8300, 0x100); 376 release_mem_region(gx1_gx_base() + 0x8300, 0x100);
377 } 377 }
378 378
379 pci_disable_device(pdev);
380
381 if (info) 379 if (info)
382 framebuffer_release(info); 380 framebuffer_release(info);
383 return ret; 381 return ret;
@@ -399,7 +397,6 @@ static void gx1fb_remove(struct pci_dev *pdev)
399 iounmap(par->dc_regs); 397 iounmap(par->dc_regs);
400 release_mem_region(gx1_gx_base() + 0x8300, 0x100); 398 release_mem_region(gx1_gx_base() + 0x8300, 0x100);
401 399
402 pci_disable_device(pdev);
403 pci_set_drvdata(pdev, NULL); 400 pci_set_drvdata(pdev, NULL);
404 401
405 framebuffer_release(info); 402 framebuffer_release(info);
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 89c34b15f5d4..5ef12a3dfa50 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -354,8 +354,6 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
354 pci_release_region(pdev, 2); 354 pci_release_region(pdev, 2);
355 } 355 }
356 356
357 pci_disable_device(pdev);
358
359 if (info) 357 if (info)
360 framebuffer_release(info); 358 framebuffer_release(info);
361 return ret; 359 return ret;
@@ -377,7 +375,6 @@ static void gxfb_remove(struct pci_dev *pdev)
377 iounmap(par->dc_regs); 375 iounmap(par->dc_regs);
378 pci_release_region(pdev, 2); 376 pci_release_region(pdev, 2);
379 377
380 pci_disable_device(pdev);
381 pci_set_drvdata(pdev, NULL); 378 pci_set_drvdata(pdev, NULL);
382 379
383 framebuffer_release(info); 380 framebuffer_release(info);
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 44aa2ffff973..a1f7d80f0ac1 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -2110,9 +2110,6 @@ static void i810fb_release_resource(struct fb_info *info,
2110 if (par->res_flags & MMIO_REQ) 2110 if (par->res_flags & MMIO_REQ)
2111 release_mem_region(par->mmio_start_phys, MMIO_SIZE); 2111 release_mem_region(par->mmio_start_phys, MMIO_SIZE);
2112 2112
2113 if (par->res_flags & PCI_DEVICE_ENABLED)
2114 pci_disable_device(par->dev);
2115
2116 framebuffer_release(info); 2113 framebuffer_release(info);
2117 2114
2118} 2115}
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c
new file mode 100644
index 000000000000..7b1c168c834d
--- /dev/null
+++ b/drivers/video/imacfb.c
@@ -0,0 +1,345 @@
1/*
2 * framebuffer driver for Intel Based Mac's
3 *
4 * (c) 2006 Edgar Hucek <gimli@dark-green.com>
5 * Original imac driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
6 *
7 */
8
9#include <linux/delay.h>
10#include <linux/errno.h>
11#include <linux/fb.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/ioport.h>
15#include <linux/mm.h>
16#include <linux/module.h>
17#include <linux/platform_device.h>
18#include <linux/slab.h>
19#include <linux/string.h>
20#include <linux/tty.h>
21
22#include <asm/io.h>
23
24#include <video/vga.h>
25
26typedef enum _MAC_TYPE {
27 M_I17,
28 M_I20,
29 M_MINI,
30 M_MACBOOK,
31 M_NEW
32} MAC_TYPE;
33
34/* --------------------------------------------------------------------- */
35
36static struct fb_var_screeninfo imacfb_defined __initdata = {
37 .activate = FB_ACTIVATE_NOW,
38 .height = -1,
39 .width = -1,
40 .right_margin = 32,
41 .upper_margin = 16,
42 .lower_margin = 4,
43 .vsync_len = 4,
44 .vmode = FB_VMODE_NONINTERLACED,
45};
46
47static struct fb_fix_screeninfo imacfb_fix __initdata = {
48 .id = "IMAC VGA",
49 .type = FB_TYPE_PACKED_PIXELS,
50 .accel = FB_ACCEL_NONE,
51 .visual = FB_VISUAL_TRUECOLOR,
52};
53
54static int inverse;
55static int model = M_NEW;
56static int manual_height;
57static int manual_width;
58
59#define DEFAULT_FB_MEM 1024*1024*16
60
61/* --------------------------------------------------------------------- */
62
63static int imacfb_setcolreg(unsigned regno, unsigned red, unsigned green,
64 unsigned blue, unsigned transp,
65 struct fb_info *info)
66{
67 /*
68 * Set a single color register. The values supplied are
69 * already rounded down to the hardware's capabilities
70 * (according to the entries in the `var' structure). Return
71 * != 0 for invalid regno.
72 */
73
74 if (regno >= info->cmap.len)
75 return 1;
76
77 if (regno < 16) {
78 red >>= 8;
79 green >>= 8;
80 blue >>= 8;
81 ((u32 *)(info->pseudo_palette))[regno] =
82 (red << info->var.red.offset) |
83 (green << info->var.green.offset) |
84 (blue << info->var.blue.offset);
85 }
86 return 0;
87}
88
89static struct fb_ops imacfb_ops = {
90 .owner = THIS_MODULE,
91 .fb_setcolreg = imacfb_setcolreg,
92 .fb_fillrect = cfb_fillrect,
93 .fb_copyarea = cfb_copyarea,
94 .fb_imageblit = cfb_imageblit,
95};
96
97static int __init imacfb_setup(char *options)
98{
99 char *this_opt;
100
101 if (!options || !*options)
102 return 0;
103
104 while ((this_opt = strsep(&options, ",")) != NULL) {
105 if (!*this_opt) continue;
106
107 if (!strcmp(this_opt, "inverse"))
108 inverse = 1;
109 else if (!strcmp(this_opt, "i17"))
110 model = M_I17;
111 else if (!strcmp(this_opt, "i20"))
112 model = M_I20;
113 else if (!strcmp(this_opt, "mini"))
114 model = M_MINI;
115 else if (!strcmp(this_opt, "macbook"))
116 model = M_MACBOOK;
117 else if (!strncmp(this_opt, "height:", 7))
118 manual_height = simple_strtoul(this_opt+7, NULL, 0);
119 else if (!strncmp(this_opt, "width:", 6))
120 manual_width = simple_strtoul(this_opt+6, NULL, 0);
121 }
122 return 0;
123}
124
125static int __init imacfb_probe(struct platform_device *dev)
126{
127 struct fb_info *info;
128 int err;
129 unsigned int size_vmode;
130 unsigned int size_remap;
131 unsigned int size_total;
132
133 screen_info.lfb_depth = 32;
134 screen_info.lfb_size = DEFAULT_FB_MEM / 0x10000;
135 screen_info.pages=1;
136 screen_info.blue_size = 8;
137 screen_info.blue_pos = 0;
138 screen_info.green_size = 8;
139 screen_info.green_pos = 8;
140 screen_info.red_size = 8;
141 screen_info.red_pos = 16;
142 screen_info.rsvd_size = 8;
143 screen_info.rsvd_pos = 24;
144
145 switch (model) {
146 case M_I17:
147 screen_info.lfb_width = 1440;
148 screen_info.lfb_height = 900;
149 screen_info.lfb_linelength = 1472 * 4;
150 screen_info.lfb_base = 0x80010000;
151 break;
152 case M_NEW:
153 case M_I20:
154 screen_info.lfb_width = 1680;
155 screen_info.lfb_height = 1050;
156 screen_info.lfb_linelength = 1728 * 4;
157 screen_info.lfb_base = 0x80010000;
158 break;
159 case M_MINI:
160 screen_info.lfb_width = 1024;
161 screen_info.lfb_height = 768;
162 screen_info.lfb_linelength = 2048 * 4;
163 screen_info.lfb_base = 0x80000000;
164 break;
165 case M_MACBOOK:
166 screen_info.lfb_width = 1280;
167 screen_info.lfb_height = 800;
168 screen_info.lfb_linelength = 2048 * 4;
169 screen_info.lfb_base = 0x80000000;
170 break;
171 }
172
173 /* if the user wants to manually specify height/width,
174 we will override the defaults */
175 /* TODO: eventually get auto-detection working */
176 if (manual_height > 0)
177 screen_info.lfb_height = manual_height;
178 if (manual_width > 0)
179 screen_info.lfb_width = manual_width;
180
181 imacfb_fix.smem_start = screen_info.lfb_base;
182 imacfb_defined.bits_per_pixel = screen_info.lfb_depth;
183 imacfb_defined.xres = screen_info.lfb_width;
184 imacfb_defined.yres = screen_info.lfb_height;
185 imacfb_fix.line_length = screen_info.lfb_linelength;
186
187 /* size_vmode -- that is the amount of memory needed for the
188 * used video mode, i.e. the minimum amount of
189 * memory we need. */
190 size_vmode = imacfb_defined.yres * imacfb_fix.line_length;
191
192 /* size_total -- all video memory we have. Used for
193 * entries, ressource allocation and bounds
194 * checking. */
195 size_total = screen_info.lfb_size * 65536;
196 if (size_total < size_vmode)
197 size_total = size_vmode;
198
199 /* size_remap -- the amount of video memory we are going to
200 * use for imacfb. With modern cards it is no
201 * option to simply use size_total as that
202 * wastes plenty of kernel address space. */
203 size_remap = size_vmode * 2;
204 if (size_remap < size_vmode)
205 size_remap = size_vmode;
206 if (size_remap > size_total)
207 size_remap = size_total;
208 imacfb_fix.smem_len = size_remap;
209
210#ifndef __i386__
211 screen_info.imacpm_seg = 0;
212#endif
213
214 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) {
215 printk(KERN_WARNING
216 "imacfb: cannot reserve video memory at 0x%lx\n",
217 imacfb_fix.smem_start);
218 /* We cannot make this fatal. Sometimes this comes from magic
219 spaces our resource handlers simply don't know about */
220 }
221
222 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
223 if (!info) {
224 err = -ENOMEM;
225 goto err_release_mem;
226 }
227 info->pseudo_palette = info->par;
228 info->par = NULL;
229
230 info->screen_base = ioremap(imacfb_fix.smem_start, imacfb_fix.smem_len);
231 if (!info->screen_base) {
232 printk(KERN_ERR "imacfb: abort, cannot ioremap video memory "
233 "0x%x @ 0x%lx\n",
234 imacfb_fix.smem_len, imacfb_fix.smem_start);
235 err = -EIO;
236 goto err_unmap;
237 }
238
239 printk(KERN_INFO "imacfb: framebuffer at 0x%lx, mapped to 0x%p, "
240 "using %dk, total %dk\n",
241 imacfb_fix.smem_start, info->screen_base,
242 size_remap/1024, size_total/1024);
243 printk(KERN_INFO "imacfb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
244 imacfb_defined.xres, imacfb_defined.yres,
245 imacfb_defined.bits_per_pixel, imacfb_fix.line_length,
246 screen_info.pages);
247
248 imacfb_defined.xres_virtual = imacfb_defined.xres;
249 imacfb_defined.yres_virtual = imacfb_fix.smem_len /
250 imacfb_fix.line_length;
251 printk(KERN_INFO "imacfb: scrolling: redraw\n");
252 imacfb_defined.yres_virtual = imacfb_defined.yres;
253
254 /* some dummy values for timing to make fbset happy */
255 imacfb_defined.pixclock = 10000000 / imacfb_defined.xres *
256 1000 / imacfb_defined.yres;
257 imacfb_defined.left_margin = (imacfb_defined.xres / 8) & 0xf8;
258 imacfb_defined.hsync_len = (imacfb_defined.xres / 8) & 0xf8;
259
260 imacfb_defined.red.offset = screen_info.red_pos;
261 imacfb_defined.red.length = screen_info.red_size;
262 imacfb_defined.green.offset = screen_info.green_pos;
263 imacfb_defined.green.length = screen_info.green_size;
264 imacfb_defined.blue.offset = screen_info.blue_pos;
265 imacfb_defined.blue.length = screen_info.blue_size;
266 imacfb_defined.transp.offset = screen_info.rsvd_pos;
267 imacfb_defined.transp.length = screen_info.rsvd_size;
268
269 printk(KERN_INFO "imacfb: %s: "
270 "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
271 "Truecolor",
272 screen_info.rsvd_size,
273 screen_info.red_size,
274 screen_info.green_size,
275 screen_info.blue_size,
276 screen_info.rsvd_pos,
277 screen_info.red_pos,
278 screen_info.green_pos,
279 screen_info.blue_pos);
280
281 imacfb_fix.ypanstep = 0;
282 imacfb_fix.ywrapstep = 0;
283
284 /* request failure does not faze us, as vgacon probably has this
285 * region already (FIXME) */
286 request_region(0x3c0, 32, "imacfb");
287
288 info->fbops = &imacfb_ops;
289 info->var = imacfb_defined;
290 info->fix = imacfb_fix;
291 info->flags = FBINFO_FLAG_DEFAULT;
292
293 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
294 err = -ENOMEM;
295 goto err_unmap;
296 }
297 if (register_framebuffer(info)<0) {
298 err = -EINVAL;
299 goto err_fb_dealoc;
300 }
301 printk(KERN_INFO "fb%d: %s frame buffer device\n",
302 info->node, info->fix.id);
303 return 0;
304
305err_fb_dealoc:
306 fb_dealloc_cmap(&info->cmap);
307err_unmap:
308 iounmap(info->screen_base);
309 framebuffer_release(info);
310err_release_mem:
311 release_mem_region(imacfb_fix.smem_start, size_total);
312 return err;
313}
314
315static struct platform_driver imacfb_driver = {
316 .probe = imacfb_probe,
317 .driver = {
318 .name = "imacfb",
319 },
320};
321
322static struct platform_device imacfb_device = {
323 .name = "imacfb",
324};
325
326static int __init imacfb_init(void)
327{
328 int ret;
329 char *option = NULL;
330
331 /* ignore error return of fb_get_options */
332 fb_get_options("imacfb", &option);
333 imacfb_setup(option);
334 ret = platform_driver_register(&imacfb_driver);
335
336 if (!ret) {
337 ret = platform_device_register(&imacfb_device);
338 if (ret)
339 platform_driver_unregister(&imacfb_driver);
340 }
341 return ret;
342}
343module_init(imacfb_init);
344
345MODULE_LICENSE("GPL");
diff --git a/drivers/video/macmodes.c b/drivers/video/macmodes.c
index c0385c6f7db5..d21321ca7c39 100644
--- a/drivers/video/macmodes.c
+++ b/drivers/video/macmodes.c
@@ -327,7 +327,6 @@ int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
327 } 327 }
328 return -EINVAL; 328 return -EINVAL;
329} 329}
330EXPORT_SYMBOL(mac_var_to_vmode);
331 330
332/** 331/**
333 * mac_map_monitor_sense - Convert monitor sense to vmode 332 * mac_map_monitor_sense - Convert monitor sense to vmode
@@ -371,8 +370,9 @@ EXPORT_SYMBOL(mac_map_monitor_sense);
371 * 370 *
372 */ 371 */
373 372
374int __init mac_find_mode(struct fb_var_screeninfo *var, struct fb_info *info, 373int __devinit mac_find_mode(struct fb_var_screeninfo *var,
375 const char *mode_option, unsigned int default_bpp) 374 struct fb_info *info, const char *mode_option,
375 unsigned int default_bpp)
376{ 376{
377 const struct fb_videomode *db = NULL; 377 const struct fb_videomode *db = NULL;
378 unsigned int dbsize = 0; 378 unsigned int dbsize = 0;
diff --git a/drivers/video/macmodes.h b/drivers/video/macmodes.h
index 232f5a09a499..babeb81f467d 100644
--- a/drivers/video/macmodes.h
+++ b/drivers/video/macmodes.h
@@ -55,9 +55,10 @@ extern int mac_vmode_to_var(int vmode, int cmode,
55extern int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode, 55extern int mac_var_to_vmode(const struct fb_var_screeninfo *var, int *vmode,
56 int *cmode); 56 int *cmode);
57extern int mac_map_monitor_sense(int sense); 57extern int mac_map_monitor_sense(int sense);
58extern int __init mac_find_mode(struct fb_var_screeninfo *var, 58extern int __devinit mac_find_mode(struct fb_var_screeninfo *var,
59 struct fb_info *info, const char *mode_option, 59 struct fb_info *info,
60 unsigned int default_bpp); 60 const char *mode_option,
61 unsigned int default_bpp);
61 62
62 63
63 /* 64 /*
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 26a1c618a205..ff5454601e22 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -259,6 +259,10 @@ static const struct fb_videomode modedb[] = {
259 /* 1152x768, 60 Hz, PowerBook G4 Titanium I and II */ 259 /* 1152x768, 60 Hz, PowerBook G4 Titanium I and II */
260 NULL, 60, 1152, 768, 15386, 158, 26, 29, 3, 136, 6, 260 NULL, 60, 1152, 768, 15386, 158, 26, 29, 3, 136, 6,
261 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED 261 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
262 }, {
263 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */
264 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5,
265 0, FB_VMODE_NONINTERLACED
262 }, 266 },
263}; 267};
264 268
@@ -787,8 +791,9 @@ struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
787 if (diff > d) { 791 if (diff > d) {
788 diff = d; 792 diff = d;
789 best = mode; 793 best = mode;
790 } else if (diff == d && mode->refresh > best->refresh) 794 } else if (diff == d && best &&
791 best = mode; 795 mode->refresh > best->refresh)
796 best = mode;
792 } 797 }
793 } 798 }
794 return best; 799 return best;
@@ -1016,8 +1021,6 @@ EXPORT_SYMBOL(fb_videomode_to_var);
1016EXPORT_SYMBOL(fb_var_to_videomode); 1021EXPORT_SYMBOL(fb_var_to_videomode);
1017EXPORT_SYMBOL(fb_mode_is_equal); 1022EXPORT_SYMBOL(fb_mode_is_equal);
1018EXPORT_SYMBOL(fb_add_videomode); 1023EXPORT_SYMBOL(fb_add_videomode);
1019EXPORT_SYMBOL(fb_delete_videomode);
1020EXPORT_SYMBOL(fb_destroy_modelist);
1021EXPORT_SYMBOL(fb_match_mode); 1024EXPORT_SYMBOL(fb_match_mode);
1022EXPORT_SYMBOL(fb_find_best_mode); 1025EXPORT_SYMBOL(fb_find_best_mode);
1023EXPORT_SYMBOL(fb_find_nearest_mode); 1026EXPORT_SYMBOL(fb_find_nearest_mode);
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index 24b12f71d5a8..2f156b724d1c 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -1333,17 +1333,22 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
1333 * run "setterm -powersave powerdown" to take advantage 1333 * run "setterm -powersave powerdown" to take advantage
1334 */ 1334 */
1335 struct neofb_par *par = info->par; 1335 struct neofb_par *par = info->par;
1336 int seqflags, lcdflags, dpmsflags, reg; 1336 int seqflags, lcdflags, dpmsflags, reg, tmpdisp;
1337
1338 1337
1339 /* 1338 /*
1340 * Reload the value stored in the register, if sensible. It might have 1339 * Read back the register bits related to display configuration. They might
1341 * been changed via FN keystroke. 1340 * have been changed underneath the driver via Fn key stroke.
1341 */
1342 neoUnlock();
1343 tmpdisp = vga_rgfx(NULL, 0x20) & 0x03;
1344 neoLock(&par->state);
1345
1346 /* In case we blank the screen, we want to store the possibly new
1347 * configuration in the driver. During un-blank, we re-apply this setting,
1348 * since the LCD bit will be cleared in order to switch off the backlight.
1342 */ 1349 */
1343 if (par->PanelDispCntlRegRead) { 1350 if (par->PanelDispCntlRegRead) {
1344 neoUnlock(); 1351 par->PanelDispCntlReg1 = tmpdisp;
1345 par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
1346 neoLock(&par->state);
1347 } 1352 }
1348 par->PanelDispCntlRegRead = !blank_mode; 1353 par->PanelDispCntlRegRead = !blank_mode;
1349 1354
@@ -1378,12 +1383,21 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
1378 break; 1383 break;
1379 case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */ 1384 case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */
1380 seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ 1385 seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
1381 lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ 1386 /*
1387 * During a blank operation with the LID shut, we might store "LCD off"
1388 * by mistake. Due to timing issues, the BIOS may switch the lights
1389 * back on, and we turn it back off once we "unblank".
1390 *
1391 * So here is an attempt to implement ">=" - if we are in the process
1392 * of unblanking, and the LCD bit is unset in the driver but set in the
1393 * register, we must keep it.
1394 */
1395 lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */
1382 dpmsflags = 0x00; /* no hsync/vsync suppression */ 1396 dpmsflags = 0x00; /* no hsync/vsync suppression */
1383 break; 1397 break;
1384 case FB_BLANK_UNBLANK: /* unblank */ 1398 case FB_BLANK_UNBLANK: /* unblank */
1385 seqflags = 0; /* Enable sequencer */ 1399 seqflags = 0; /* Enable sequencer */
1386 lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ 1400 lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */
1387 dpmsflags = 0x00; /* no hsync/vsync suppression */ 1401 dpmsflags = 0x00; /* no hsync/vsync suppression */
1388#ifdef CONFIG_TOSHIBA 1402#ifdef CONFIG_TOSHIBA
1389 /* Do we still need this ? */ 1403 /* Do we still need this ? */
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c
index 99c3a8e6a237..9ed640d35728 100644
--- a/drivers/video/nvidia/nv_hw.c
+++ b/drivers/video/nvidia/nv_hw.c
@@ -886,7 +886,10 @@ void NVCalcStateExt(struct nvidia_par *par,
886 case NV_ARCH_20: 886 case NV_ARCH_20:
887 case NV_ARCH_30: 887 case NV_ARCH_30:
888 default: 888 default:
889 if (((par->Chipset & 0xffff) == 0x01A0) || 889 if ((par->Chipset & 0xfff0) == 0x0240) {
890 state->arbitration0 = 256;
891 state->arbitration1 = 0x0480;
892 } else if (((par->Chipset & 0xffff) == 0x01A0) ||
890 ((par->Chipset & 0xffff) == 0x01f0)) { 893 ((par->Chipset & 0xffff) == 0x01f0)) {
891 nForceUpdateArbitrationSettings(VClk, 894 nForceUpdateArbitrationSettings(VClk,
892 pixelDepth * 8, 895 pixelDepth * 8,
@@ -1235,6 +1238,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state)
1235 break; 1238 break;
1236 case 0x0160: 1239 case 0x0160:
1237 case 0x01D0: 1240 case 0x01D0:
1241 case 0x0240:
1238 NV_WR32(par->PMC, 0x1700, 1242 NV_WR32(par->PMC, 0x1700,
1239 NV_RD32(par->PFB, 0x020C)); 1243 NV_RD32(par->PFB, 0x020C));
1240 NV_WR32(par->PMC, 0x1704, 0); 1244 NV_WR32(par->PMC, 0x1704, 0);
@@ -1359,7 +1363,9 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state)
1359 if(((par->Chipset & 0xfff0) 1363 if(((par->Chipset & 0xfff0)
1360 != 0x0160) && 1364 != 0x0160) &&
1361 ((par->Chipset & 0xfff0) 1365 ((par->Chipset & 0xfff0)
1362 != 0x0220)) 1366 != 0x0220) &&
1367 ((par->Chipset & 0xfff0)
1368 != 0x240))
1363 NV_WR32(par->PGRAPH, 1369 NV_WR32(par->PGRAPH,
1364 0x6900 + i*4, 1370 0x6900 + i*4,
1365 NV_RD32(par->PFB, 1371 NV_RD32(par->PFB,
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 03a7c1e9ce38..7b5cffb27851 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -67,359 +67,10 @@
67#define MAX_CURS 32 67#define MAX_CURS 32
68 68
69static struct pci_device_id nvidiafb_pci_tbl[] = { 69static struct pci_device_id nvidiafb_pci_tbl[] = {
70 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT, 70 {PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
71 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 71 PCI_BASE_CLASS_DISPLAY << 16, 0xff0000, 0},
72 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT2, 72 { 0, }
73 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
74 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_UTNT2,
75 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
76 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN,
77 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
78 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_VTNT2,
79 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
80 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_UVTNT2,
81 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
82 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_ITNT2,
83 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
84 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR,
85 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
86 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR,
87 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
88 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO,
89 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
90 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX,
91 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
92 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2,
93 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
94 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_GO,
95 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
96 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR,
97 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
98 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS,
99 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
100 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2,
101 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
102 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA,
103 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
104 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO,
105 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
106 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_460,
107 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
108 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440,
109 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
110 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420,
111 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
112 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_SE,
113 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
114 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO,
115 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
116 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO,
117 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
118 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_460_GO,
119 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
120 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO_M32,
121 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
122 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_500XGL,
123 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
124 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO_M64,
125 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
126 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_200,
127 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
128 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_550XGL,
129 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
130 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL,
131 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
132 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_410_GO_M16,
133 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
134 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X,
135 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
136 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X,
137 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
138 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X,
139 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
140 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_4000,
141 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
142 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO,
143 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
144 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO,
145 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
146 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL,
147 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
148 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_MAC,
149 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
150 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_280_NVS,
151 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
152 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_380_XGL,
153 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
154 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_IGEFORCE2,
155 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
156 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE3,
157 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
158 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE3_1,
159 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
160 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE3_2,
161 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
162 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_DDC,
163 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
164 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4600,
165 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
166 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4400,
167 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
168 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4200,
169 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
170 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL,
171 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
172 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL,
173 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
174 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL,
175 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
176 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800,
177 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
178 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X,
179 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
180 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE,
181 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
182 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_4200_GO,
183 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
184 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_980_XGL,
185 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
186 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_780_XGL,
187 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
188 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_700_GOGL,
189 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
190 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800_ULTRA,
191 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
192 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800,
193 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
194 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_2000,
195 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
196 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1000,
197 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
198 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600_ULTRA,
199 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
200 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600,
201 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
202 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600SE,
203 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
204 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5600,
205 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
206 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5650,
207 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
208 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO700,
209 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
210 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200,
211 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
212 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_ULTRA,
213 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
214 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_1,
215 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
216 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200SE,
217 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
218 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5200,
219 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
220 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250,
221 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
222 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250_32,
223 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
224 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200,
225 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
226 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_NVS_280_PCI,
227 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
228 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_500,
229 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
230 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5300,
231 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
232 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5100,
233 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
234 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900_ULTRA,
235 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
236 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900,
237 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
238 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900XT,
239 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
240 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5950_ULTRA,
241 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
242 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_3000,
243 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
244 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700_ULTRA,
245 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
246 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700,
247 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
248 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700LE,
249 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
250 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700VE,
251 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
252 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_1,
253 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
254 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2,
255 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
256 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000,
257 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
258 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100,
259 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
260 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5500,
261 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
262 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5100,
263 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
264 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_700,
265 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
266 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900ZT,
267 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
268 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA,
269 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
270 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800,
271 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
272 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_LE,
273 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
274 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_GT,
275 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
276 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_4000,
277 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
278 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6600_GT,
279 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
280 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6600,
281 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
282 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6610_XL,
283 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
284 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_FX_540,
285 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
286 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200,
287 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
288 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1,
289 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
290 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1,
291 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
292 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2,
293 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
294 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1,
295 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
296 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT,
297 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
298 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_QUADRO_NVS280,
299 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
300 {PCI_VENDOR_ID_NVIDIA, 0x0252,
301 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
302 {PCI_VENDOR_ID_NVIDIA, 0x0313,
303 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
304 {PCI_VENDOR_ID_NVIDIA, 0x0316,
305 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
306 {PCI_VENDOR_ID_NVIDIA, 0x0317,
307 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
308 {PCI_VENDOR_ID_NVIDIA, 0x031D,
309 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
310 {PCI_VENDOR_ID_NVIDIA, 0x031E,
311 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
312 {PCI_VENDOR_ID_NVIDIA, 0x031F,
313 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
314 {PCI_VENDOR_ID_NVIDIA, 0x0329,
315 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
316 {PCI_VENDOR_ID_NVIDIA, 0x032F,
317 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
318 {PCI_VENDOR_ID_NVIDIA, 0x0345,
319 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
320 {PCI_VENDOR_ID_NVIDIA, 0x0349,
321 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
322 {PCI_VENDOR_ID_NVIDIA, 0x034B,
323 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
324 {PCI_VENDOR_ID_NVIDIA, 0x034F,
325 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
326 {PCI_VENDOR_ID_NVIDIA, 0x00c0,
327 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
328 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_GEFORCE_6800A,
329 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
330 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_GEFORCE_6800A_LE,
331 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
332 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_GEFORCE_GO_6800,
333 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
334 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_GEFORCE_GO_6800_ULTRA,
335 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
336 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_QUADRO_FX_GO1400,
337 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
338 {PCI_VENDOR_ID_NVIDIA, 0x00cd,
339 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
340 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_QUADRO_FX_1400,
341 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
342 {PCI_VENDOR_ID_NVIDIA, 0x0142,
343 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
344 {PCI_VENDOR_ID_NVIDIA, 0x0143,
345 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
346 {PCI_VENDOR_ID_NVIDIA, 0x0144,
347 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
348 {PCI_VENDOR_ID_NVIDIA, 0x0145,
349 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
350 {PCI_VENDOR_ID_NVIDIA, 0x0146,
351 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
352 {PCI_VENDOR_ID_NVIDIA, 0x0147,
353 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
354 {PCI_VENDOR_ID_NVIDIA, 0x0148,
355 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
356 {PCI_VENDOR_ID_NVIDIA, 0x0149,
357 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
358 {PCI_VENDOR_ID_NVIDIA, 0x014b,
359 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
360 {PCI_VENDOR_ID_NVIDIA, 0x14c,
361 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
362 {PCI_VENDOR_ID_NVIDIA, 0x014d,
363 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
364 {PCI_VENDOR_ID_NVIDIA, 0x0160,
365 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
366 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200_TURBOCACHE,
367 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
368 {PCI_VENDOR_ID_NVIDIA, 0x0162,
369 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
370 {PCI_VENDOR_ID_NVIDIA, 0x0163,
371 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
372 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200,
373 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
374 {PCI_VENDOR_ID_NVIDIA, 0x0165,
375 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
376 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250,
377 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
378 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200_1,
379 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
380 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250_1,
381 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
382 {PCI_VENDOR_ID_NVIDIA, 0x0169,
383 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
384 {PCI_VENDOR_ID_NVIDIA, 0x016b,
385 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
386 {PCI_VENDOR_ID_NVIDIA, 0x016c,
387 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
388 {PCI_VENDOR_ID_NVIDIA, 0x016d,
389 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
390 {PCI_VENDOR_ID_NVIDIA, 0x016e,
391 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
392 {PCI_VENDOR_ID_NVIDIA, 0x0210,
393 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
394 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B,
395 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
396 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_LE,
397 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
398 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_GT,
399 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
400 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT,
401 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
402 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX,
403 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
404 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800,
405 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
406 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800_GTX,
407 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
408 {PCI_VENDOR_ID_NVIDIA, 0x021d,
409 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
410 {PCI_VENDOR_ID_NVIDIA, 0x021e,
411 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
412 {PCI_VENDOR_ID_NVIDIA, 0x0220,
413 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
414 {PCI_VENDOR_ID_NVIDIA, 0x0221,
415 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
416 {PCI_VENDOR_ID_NVIDIA, 0x0222,
417 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
418 {PCI_VENDOR_ID_NVIDIA, 0x0228,
419 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
420 {0,} /* terminate list */
421}; 73};
422
423MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl); 74MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl);
424 75
425/* command line data, set in nvidiafb_setup() */ 76/* command line data, set in nvidiafb_setup() */
@@ -1465,10 +1116,10 @@ static u32 __devinit nvidia_get_chipset(struct fb_info *info)
1465 struct nvidia_par *par = info->par; 1116 struct nvidia_par *par = info->par;
1466 u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device; 1117 u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device;
1467 1118
1468 printk("nvidiafb: PCI id - %x\n", id); 1119 printk(KERN_INFO PFX "Device ID: %x \n", id);
1120
1469 if ((id & 0xfff0) == 0x00f0) { 1121 if ((id & 0xfff0) == 0x00f0) {
1470 /* pci-e */ 1122 /* pci-e */
1471 printk("nvidiafb: PCI-E card\n");
1472 id = NV_RD32(par->REGS, 0x1800); 1123 id = NV_RD32(par->REGS, 0x1800);
1473 1124
1474 if ((id & 0x0000ffff) == 0x000010DE) 1125 if ((id & 0x0000ffff) == 0x000010DE)
@@ -1476,9 +1127,9 @@ static u32 __devinit nvidia_get_chipset(struct fb_info *info)
1476 else if ((id & 0xffff0000) == 0xDE100000) /* wrong endian */ 1127 else if ((id & 0xffff0000) == 0xDE100000) /* wrong endian */
1477 id = 0x10DE0000 | ((id << 8) & 0x0000ff00) | 1128 id = 0x10DE0000 | ((id << 8) & 0x0000ff00) |
1478 ((id >> 8) & 0x000000ff); 1129 ((id >> 8) & 0x000000ff);
1130 printk(KERN_INFO PFX "Subsystem ID: %x \n", id);
1479 } 1131 }
1480 1132
1481 printk("nvidiafb: Actual id - %x\n", id);
1482 return id; 1133 return id;
1483} 1134}
1484 1135
@@ -1520,6 +1171,7 @@ static u32 __devinit nvidia_get_arch(struct fb_info *info)
1520 case 0x0210: 1171 case 0x0210:
1521 case 0x0220: 1172 case 0x0220:
1522 case 0x0230: 1173 case 0x0230:
1174 case 0x0240:
1523 case 0x0290: 1175 case 0x0290:
1524 case 0x0390: 1176 case 0x0390:
1525 arch = NV_ARCH_40; 1177 arch = NV_ARCH_40;
@@ -1567,7 +1219,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1567 1219
1568 if (pci_request_regions(pd, "nvidiafb")) { 1220 if (pci_request_regions(pd, "nvidiafb")) {
1569 printk(KERN_ERR PFX "cannot request PCI regions\n"); 1221 printk(KERN_ERR PFX "cannot request PCI regions\n");
1570 goto err_out_request; 1222 goto err_out_enable;
1571 } 1223 }
1572 1224
1573 par->FlatPanel = flatpanel; 1225 par->FlatPanel = flatpanel;
@@ -1596,7 +1248,6 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1596 } 1248 }
1597 1249
1598 par->Chipset = nvidia_get_chipset(info); 1250 par->Chipset = nvidia_get_chipset(info);
1599 printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset);
1600 par->Architecture = nvidia_get_arch(info); 1251 par->Architecture = nvidia_get_arch(info);
1601 1252
1602 if (par->Architecture == 0) { 1253 if (par->Architecture == 0) {
@@ -1687,10 +1338,8 @@ err_out_free_base1:
1687 nvidia_delete_i2c_busses(par); 1338 nvidia_delete_i2c_busses(par);
1688err_out_arch: 1339err_out_arch:
1689 iounmap(par->REGS); 1340 iounmap(par->REGS);
1690err_out_free_base0: 1341 err_out_free_base0:
1691 pci_release_regions(pd); 1342 pci_release_regions(pd);
1692err_out_request:
1693 pci_disable_device(pd);
1694err_out_enable: 1343err_out_enable:
1695 kfree(info->pixmap.addr); 1344 kfree(info->pixmap.addr);
1696err_out_kfree: 1345err_out_kfree:
@@ -1720,7 +1369,6 @@ static void __exit nvidiafb_remove(struct pci_dev *pd)
1720 nvidia_delete_i2c_busses(par); 1369 nvidia_delete_i2c_busses(par);
1721 iounmap(par->REGS); 1370 iounmap(par->REGS);
1722 pci_release_regions(pd); 1371 pci_release_regions(pd);
1723 pci_disable_device(pd);
1724 kfree(info->pixmap.addr); 1372 kfree(info->pixmap.addr);
1725 framebuffer_release(info); 1373 framebuffer_release(info);
1726 pci_set_drvdata(pd, NULL); 1374 pci_set_drvdata(pd, NULL);
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index d4384ab1df65..12af58c5cf1f 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -2152,7 +2152,6 @@ err_iounmap_ctrl_base:
2152err_release_region: 2152err_release_region:
2153 pci_release_regions(pd); 2153 pci_release_regions(pd);
2154err_disable_device: 2154err_disable_device:
2155 pci_disable_device(pd);
2156err_free_pixmap: 2155err_free_pixmap:
2157 kfree(info->pixmap.addr); 2156 kfree(info->pixmap.addr);
2158err_framebuffer_release: 2157err_framebuffer_release:
@@ -2187,7 +2186,6 @@ static void __exit rivafb_remove(struct pci_dev *pd)
2187 if (par->riva.Architecture == NV_ARCH_03) 2186 if (par->riva.Architecture == NV_ARCH_03)
2188 iounmap(par->riva.PRAMIN); 2187 iounmap(par->riva.PRAMIN);
2189 pci_release_regions(pd); 2188 pci_release_regions(pd);
2190 pci_disable_device(pd);
2191 kfree(info->pixmap.addr); 2189 kfree(info->pixmap.addr);
2192 framebuffer_release(info); 2190 framebuffer_release(info);
2193 pci_set_drvdata(pd, NULL); 2191 pci_set_drvdata(pd, NULL);
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 9451932fbaf2..fbc411850686 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -641,6 +641,7 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
641 int ret; 641 int ret;
642 int irq; 642 int irq;
643 int i; 643 int i;
644 u32 lcdcon1;
644 645
645 mach_info = pdev->dev.platform_data; 646 mach_info = pdev->dev.platform_data;
646 if (mach_info == NULL) { 647 if (mach_info == NULL) {
@@ -672,6 +673,11 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
672 673
673 memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); 674 memcpy(&info->regs, &mach_info->regs, sizeof(info->regs));
674 675
676 /* Stop the video and unset ENVID if set */
677 info->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
678 lcdcon1 = readl(S3C2410_LCDCON1);
679 writel(lcdcon1 & ~S3C2410_LCDCON1_ENVID, S3C2410_LCDCON1);
680
675 info->mach_info = pdev->dev.platform_data; 681 info->mach_info = pdev->dev.platform_data;
676 682
677 fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; 683 fbinfo->fix.type = FB_TYPE_PACKED_PIXELS;
@@ -794,15 +800,14 @@ dealloc_fb:
794 * shutdown the lcd controller 800 * shutdown the lcd controller
795*/ 801*/
796 802
797static void s3c2410fb_stop_lcd(void) 803static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi)
798{ 804{
799 unsigned long flags; 805 unsigned long flags;
800 unsigned long tmp;
801 806
802 local_irq_save(flags); 807 local_irq_save(flags);
803 808
804 tmp = readl(S3C2410_LCDCON1); 809 fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
805 writel(tmp & ~S3C2410_LCDCON1_ENVID, S3C2410_LCDCON1); 810 writel(fbi->regs.lcdcon1, S3C2410_LCDCON1);
806 811
807 local_irq_restore(flags); 812 local_irq_restore(flags);
808} 813}
@@ -816,7 +821,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
816 struct s3c2410fb_info *info = fbinfo->par; 821 struct s3c2410fb_info *info = fbinfo->par;
817 int irq; 822 int irq;
818 823
819 s3c2410fb_stop_lcd(); 824 s3c2410fb_stop_lcd(info);
820 msleep(1); 825 msleep(1);
821 826
822 s3c2410fb_unmap_video_memory(info); 827 s3c2410fb_unmap_video_memory(info);
@@ -844,7 +849,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
844 struct fb_info *fbinfo = platform_get_drvdata(dev); 849 struct fb_info *fbinfo = platform_get_drvdata(dev);
845 struct s3c2410fb_info *info = fbinfo->par; 850 struct s3c2410fb_info *info = fbinfo->par;
846 851
847 s3c2410fb_stop_lcd(); 852 s3c2410fb_stop_lcd(info);
848 853
849 /* sleep before disabling the clock, we need to ensure 854 /* sleep before disabling the clock, we need to ensure
850 * the LCD DMA engine is not going to get back on the bus 855 * the LCD DMA engine is not going to get back on the bus
diff --git a/drivers/video/savage/savagefb.h b/drivers/video/savage/savagefb.h
index 58cfdfb41833..e648a6c0f6d9 100644
--- a/drivers/video/savage/savagefb.h
+++ b/drivers/video/savage/savagefb.h
@@ -147,7 +147,27 @@ struct xtimings {
147 int interlaced; 147 int interlaced;
148}; 148};
149 149
150struct savage_reg {
151 unsigned char MiscOutReg; /* Misc */
152 unsigned char CRTC[25]; /* Crtc Controller */
153 unsigned char Sequencer[5]; /* Video Sequencer */
154 unsigned char Graphics[9]; /* Video Graphics */
155 unsigned char Attribute[21]; /* Video Atribute */
150 156
157 unsigned int mode, refresh;
158 unsigned char SR08, SR0E, SR0F;
159 unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR29, SR30;
160 unsigned char SR54[8];
161 unsigned char Clock;
162 unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C;
163 unsigned char CR40, CR41, CR42, CR43, CR45;
164 unsigned char CR50, CR51, CR53, CR55, CR58, CR5B, CR5D, CR5E;
165 unsigned char CR60, CR63, CR65, CR66, CR67, CR68, CR69, CR6D, CR6F;
166 unsigned char CR86, CR88;
167 unsigned char CR90, CR91, CRB0;
168 unsigned int STREAMS[22]; /* yuck, streams regs */
169 unsigned int MMPR0, MMPR1, MMPR2, MMPR3;
170};
151/* --------------------------------------------------------------------- */ 171/* --------------------------------------------------------------------- */
152 172
153#define NR_PALETTE 256 173#define NR_PALETTE 256
@@ -167,6 +187,8 @@ struct savagefb_par {
167 struct pci_dev *pcidev; 187 struct pci_dev *pcidev;
168 savage_chipset chip; 188 savage_chipset chip;
169 struct savagefb_i2c_chan chan; 189 struct savagefb_i2c_chan chan;
190 struct savage_reg state;
191 struct savage_reg save;
170 unsigned char *edid; 192 unsigned char *edid;
171 u32 pseudo_palette[16]; 193 u32 pseudo_palette[16];
172 int paletteEnabled; 194 int paletteEnabled;
@@ -179,6 +201,7 @@ struct savagefb_par {
179 int minClock; 201 int minClock;
180 int numClocks; 202 int numClocks;
181 int clock[4]; 203 int clock[4];
204 int MCLK, REFCLK, LCDclk;
182 struct { 205 struct {
183 u8 __iomem *vbase; 206 u8 __iomem *vbase;
184 u32 pbase; 207 u32 pbase;
@@ -196,7 +219,6 @@ struct savagefb_par {
196 219
197 volatile u32 __iomem *bci_base; 220 volatile u32 __iomem *bci_base;
198 unsigned int bci_ptr; 221 unsigned int bci_ptr;
199
200 u32 cob_offset; 222 u32 cob_offset;
201 u32 cob_size; 223 u32 cob_size;
202 int cob_index; 224 int cob_index;
@@ -204,7 +226,6 @@ struct savagefb_par {
204 void (*SavageWaitIdle) (struct savagefb_par *par); 226 void (*SavageWaitIdle) (struct savagefb_par *par);
205 void (*SavageWaitFifo) (struct savagefb_par *par, int space); 227 void (*SavageWaitFifo) (struct savagefb_par *par, int space);
206 228
207 int MCLK, REFCLK, LCDclk;
208 int HorizScaleFactor; 229 int HorizScaleFactor;
209 230
210 /* Panels size */ 231 /* Panels size */
@@ -217,26 +238,6 @@ struct savagefb_par {
217 238
218 int depth; 239 int depth;
219 int vwidth; 240 int vwidth;
220
221 unsigned char MiscOutReg; /* Misc */
222 unsigned char CRTC[25]; /* Crtc Controller */
223 unsigned char Sequencer[5]; /* Video Sequencer */
224 unsigned char Graphics[9]; /* Video Graphics */
225 unsigned char Attribute[21]; /* Video Atribute */
226
227 unsigned int mode, refresh;
228 unsigned char SR08, SR0E, SR0F;
229 unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR29, SR30;
230 unsigned char SR54[8];
231 unsigned char Clock;
232 unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C;
233 unsigned char CR40, CR41, CR42, CR43, CR45;
234 unsigned char CR50, CR51, CR53, CR55, CR58, CR5B, CR5D, CR5E;
235 unsigned char CR60, CR63, CR65, CR66, CR67, CR68, CR69, CR6D, CR6F;
236 unsigned char CR86, CR88;
237 unsigned char CR90, CR91, CRB0;
238 unsigned int STREAMS[22]; /* yuck, streams regs */
239 unsigned int MMPR0, MMPR1, MMPR2, MMPR3;
240}; 241};
241 242
242#define BCI_BD_BW_DISABLE 0x10000000 243#define BCI_BD_BW_DISABLE 0x10000000
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 0da624e6524f..78883cf66a4d 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -86,15 +86,15 @@ MODULE_DESCRIPTION("FBDev driver for S3 Savage PCI/AGP Chips");
86 86
87/* --------------------------------------------------------------------- */ 87/* --------------------------------------------------------------------- */
88 88
89static void vgaHWSeqReset (struct savagefb_par *par, int start) 89static void vgaHWSeqReset(struct savagefb_par *par, int start)
90{ 90{
91 if (start) 91 if (start)
92 VGAwSEQ (0x00, 0x01, par); /* Synchronous Reset */ 92 VGAwSEQ(0x00, 0x01, par); /* Synchronous Reset */
93 else 93 else
94 VGAwSEQ (0x00, 0x03, par); /* End Reset */ 94 VGAwSEQ(0x00, 0x03, par); /* End Reset */
95} 95}
96 96
97static void vgaHWProtect (struct savagefb_par *par, int on) 97static void vgaHWProtect(struct savagefb_par *par, int on)
98{ 98{
99 unsigned char tmp; 99 unsigned char tmp;
100 100
@@ -102,10 +102,10 @@ static void vgaHWProtect (struct savagefb_par *par, int on)
102 /* 102 /*
103 * Turn off screen and disable sequencer. 103 * Turn off screen and disable sequencer.
104 */ 104 */
105 tmp = VGArSEQ (0x01, par); 105 tmp = VGArSEQ(0x01, par);
106 106
107 vgaHWSeqReset (par, 1); /* start synchronous reset */ 107 vgaHWSeqReset(par, 1); /* start synchronous reset */
108 VGAwSEQ (0x01, tmp | 0x20, par);/* disable the display */ 108 VGAwSEQ(0x01, tmp | 0x20, par);/* disable the display */
109 109
110 VGAenablePalette(par); 110 VGAenablePalette(par);
111 } else { 111 } else {
@@ -113,75 +113,76 @@ static void vgaHWProtect (struct savagefb_par *par, int on)
113 * Reenable sequencer, then turn on screen. 113 * Reenable sequencer, then turn on screen.
114 */ 114 */
115 115
116 tmp = VGArSEQ (0x01, par); 116 tmp = VGArSEQ(0x01, par);
117 117
118 VGAwSEQ (0x01, tmp & ~0x20, par);/* reenable display */ 118 VGAwSEQ(0x01, tmp & ~0x20, par);/* reenable display */
119 vgaHWSeqReset (par, 0); /* clear synchronous reset */ 119 vgaHWSeqReset(par, 0); /* clear synchronous reset */
120 120
121 VGAdisablePalette(par); 121 VGAdisablePalette(par);
122 } 122 }
123} 123}
124 124
125static void vgaHWRestore (struct savagefb_par *par) 125static void vgaHWRestore(struct savagefb_par *par, struct savage_reg *reg)
126{ 126{
127 int i; 127 int i;
128 128
129 VGAwMISC (par->MiscOutReg, par); 129 VGAwMISC(reg->MiscOutReg, par);
130 130
131 for (i = 1; i < 5; i++) 131 for (i = 1; i < 5; i++)
132 VGAwSEQ (i, par->Sequencer[i], par); 132 VGAwSEQ(i, reg->Sequencer[i], par);
133 133
134 /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or 134 /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or
135 CRTC[17] */ 135 CRTC[17] */
136 VGAwCR (17, par->CRTC[17] & ~0x80, par); 136 VGAwCR(17, reg->CRTC[17] & ~0x80, par);
137 137
138 for (i = 0; i < 25; i++) 138 for (i = 0; i < 25; i++)
139 VGAwCR (i, par->CRTC[i], par); 139 VGAwCR(i, reg->CRTC[i], par);
140 140
141 for (i = 0; i < 9; i++) 141 for (i = 0; i < 9; i++)
142 VGAwGR (i, par->Graphics[i], par); 142 VGAwGR(i, reg->Graphics[i], par);
143 143
144 VGAenablePalette(par); 144 VGAenablePalette(par);
145 145
146 for (i = 0; i < 21; i++) 146 for (i = 0; i < 21; i++)
147 VGAwATTR (i, par->Attribute[i], par); 147 VGAwATTR(i, reg->Attribute[i], par);
148 148
149 VGAdisablePalette(par); 149 VGAdisablePalette(par);
150} 150}
151 151
152static void vgaHWInit (struct fb_var_screeninfo *var, 152static void vgaHWInit(struct fb_var_screeninfo *var,
153 struct savagefb_par *par, 153 struct savagefb_par *par,
154 struct xtimings *timings) 154 struct xtimings *timings,
155 struct savage_reg *reg)
155{ 156{
156 par->MiscOutReg = 0x23; 157 reg->MiscOutReg = 0x23;
157 158
158 if (!(timings->sync & FB_SYNC_HOR_HIGH_ACT)) 159 if (!(timings->sync & FB_SYNC_HOR_HIGH_ACT))
159 par->MiscOutReg |= 0x40; 160 reg->MiscOutReg |= 0x40;
160 161
161 if (!(timings->sync & FB_SYNC_VERT_HIGH_ACT)) 162 if (!(timings->sync & FB_SYNC_VERT_HIGH_ACT))
162 par->MiscOutReg |= 0x80; 163 reg->MiscOutReg |= 0x80;
163 164
164 /* 165 /*
165 * Time Sequencer 166 * Time Sequencer
166 */ 167 */
167 par->Sequencer[0x00] = 0x00; 168 reg->Sequencer[0x00] = 0x00;
168 par->Sequencer[0x01] = 0x01; 169 reg->Sequencer[0x01] = 0x01;
169 par->Sequencer[0x02] = 0x0F; 170 reg->Sequencer[0x02] = 0x0F;
170 par->Sequencer[0x03] = 0x00; /* Font select */ 171 reg->Sequencer[0x03] = 0x00; /* Font select */
171 par->Sequencer[0x04] = 0x0E; /* Misc */ 172 reg->Sequencer[0x04] = 0x0E; /* Misc */
172 173
173 /* 174 /*
174 * CRTC Controller 175 * CRTC Controller
175 */ 176 */
176 par->CRTC[0x00] = (timings->HTotal >> 3) - 5; 177 reg->CRTC[0x00] = (timings->HTotal >> 3) - 5;
177 par->CRTC[0x01] = (timings->HDisplay >> 3) - 1; 178 reg->CRTC[0x01] = (timings->HDisplay >> 3) - 1;
178 par->CRTC[0x02] = (timings->HSyncStart >> 3) - 1; 179 reg->CRTC[0x02] = (timings->HSyncStart >> 3) - 1;
179 par->CRTC[0x03] = (((timings->HSyncEnd >> 3) - 1) & 0x1f) | 0x80; 180 reg->CRTC[0x03] = (((timings->HSyncEnd >> 3) - 1) & 0x1f) | 0x80;
180 par->CRTC[0x04] = (timings->HSyncStart >> 3); 181 reg->CRTC[0x04] = (timings->HSyncStart >> 3);
181 par->CRTC[0x05] = ((((timings->HSyncEnd >> 3) - 1) & 0x20) << 2) | 182 reg->CRTC[0x05] = ((((timings->HSyncEnd >> 3) - 1) & 0x20) << 2) |
182 (((timings->HSyncEnd >> 3)) & 0x1f); 183 (((timings->HSyncEnd >> 3)) & 0x1f);
183 par->CRTC[0x06] = (timings->VTotal - 2) & 0xFF; 184 reg->CRTC[0x06] = (timings->VTotal - 2) & 0xFF;
184 par->CRTC[0x07] = (((timings->VTotal - 2) & 0x100) >> 8) | 185 reg->CRTC[0x07] = (((timings->VTotal - 2) & 0x100) >> 8) |
185 (((timings->VDisplay - 1) & 0x100) >> 7) | 186 (((timings->VDisplay - 1) & 0x100) >> 7) |
186 ((timings->VSyncStart & 0x100) >> 6) | 187 ((timings->VSyncStart & 0x100) >> 6) |
187 (((timings->VSyncStart - 1) & 0x100) >> 5) | 188 (((timings->VSyncStart - 1) & 0x100) >> 5) |
@@ -189,27 +190,27 @@ static void vgaHWInit (struct fb_var_screeninfo *var,
189 (((timings->VTotal - 2) & 0x200) >> 4) | 190 (((timings->VTotal - 2) & 0x200) >> 4) |
190 (((timings->VDisplay - 1) & 0x200) >> 3) | 191 (((timings->VDisplay - 1) & 0x200) >> 3) |
191 ((timings->VSyncStart & 0x200) >> 2); 192 ((timings->VSyncStart & 0x200) >> 2);
192 par->CRTC[0x08] = 0x00; 193 reg->CRTC[0x08] = 0x00;
193 par->CRTC[0x09] = (((timings->VSyncStart - 1) & 0x200) >> 4) | 0x40; 194 reg->CRTC[0x09] = (((timings->VSyncStart - 1) & 0x200) >> 4) | 0x40;
194 195
195 if (timings->dblscan) 196 if (timings->dblscan)
196 par->CRTC[0x09] |= 0x80; 197 reg->CRTC[0x09] |= 0x80;
197 198
198 par->CRTC[0x0a] = 0x00; 199 reg->CRTC[0x0a] = 0x00;
199 par->CRTC[0x0b] = 0x00; 200 reg->CRTC[0x0b] = 0x00;
200 par->CRTC[0x0c] = 0x00; 201 reg->CRTC[0x0c] = 0x00;
201 par->CRTC[0x0d] = 0x00; 202 reg->CRTC[0x0d] = 0x00;
202 par->CRTC[0x0e] = 0x00; 203 reg->CRTC[0x0e] = 0x00;
203 par->CRTC[0x0f] = 0x00; 204 reg->CRTC[0x0f] = 0x00;
204 par->CRTC[0x10] = timings->VSyncStart & 0xff; 205 reg->CRTC[0x10] = timings->VSyncStart & 0xff;
205 par->CRTC[0x11] = (timings->VSyncEnd & 0x0f) | 0x20; 206 reg->CRTC[0x11] = (timings->VSyncEnd & 0x0f) | 0x20;
206 par->CRTC[0x12] = (timings->VDisplay - 1) & 0xff; 207 reg->CRTC[0x12] = (timings->VDisplay - 1) & 0xff;
207 par->CRTC[0x13] = var->xres_virtual >> 4; 208 reg->CRTC[0x13] = var->xres_virtual >> 4;
208 par->CRTC[0x14] = 0x00; 209 reg->CRTC[0x14] = 0x00;
209 par->CRTC[0x15] = (timings->VSyncStart - 1) & 0xff; 210 reg->CRTC[0x15] = (timings->VSyncStart - 1) & 0xff;
210 par->CRTC[0x16] = (timings->VSyncEnd - 1) & 0xff; 211 reg->CRTC[0x16] = (timings->VSyncEnd - 1) & 0xff;
211 par->CRTC[0x17] = 0xc3; 212 reg->CRTC[0x17] = 0xc3;
212 par->CRTC[0x18] = 0xff; 213 reg->CRTC[0x18] = 0xff;
213 214
214 /* 215 /*
215 * are these unnecessary? 216 * are these unnecessary?
@@ -220,38 +221,38 @@ static void vgaHWInit (struct fb_var_screeninfo *var,
220 /* 221 /*
221 * Graphics Display Controller 222 * Graphics Display Controller
222 */ 223 */
223 par->Graphics[0x00] = 0x00; 224 reg->Graphics[0x00] = 0x00;
224 par->Graphics[0x01] = 0x00; 225 reg->Graphics[0x01] = 0x00;
225 par->Graphics[0x02] = 0x00; 226 reg->Graphics[0x02] = 0x00;
226 par->Graphics[0x03] = 0x00; 227 reg->Graphics[0x03] = 0x00;
227 par->Graphics[0x04] = 0x00; 228 reg->Graphics[0x04] = 0x00;
228 par->Graphics[0x05] = 0x40; 229 reg->Graphics[0x05] = 0x40;
229 par->Graphics[0x06] = 0x05; /* only map 64k VGA memory !!!! */ 230 reg->Graphics[0x06] = 0x05; /* only map 64k VGA memory !!!! */
230 par->Graphics[0x07] = 0x0F; 231 reg->Graphics[0x07] = 0x0F;
231 par->Graphics[0x08] = 0xFF; 232 reg->Graphics[0x08] = 0xFF;
232 233
233 234
234 par->Attribute[0x00] = 0x00; /* standard colormap translation */ 235 reg->Attribute[0x00] = 0x00; /* standard colormap translation */
235 par->Attribute[0x01] = 0x01; 236 reg->Attribute[0x01] = 0x01;
236 par->Attribute[0x02] = 0x02; 237 reg->Attribute[0x02] = 0x02;
237 par->Attribute[0x03] = 0x03; 238 reg->Attribute[0x03] = 0x03;
238 par->Attribute[0x04] = 0x04; 239 reg->Attribute[0x04] = 0x04;
239 par->Attribute[0x05] = 0x05; 240 reg->Attribute[0x05] = 0x05;
240 par->Attribute[0x06] = 0x06; 241 reg->Attribute[0x06] = 0x06;
241 par->Attribute[0x07] = 0x07; 242 reg->Attribute[0x07] = 0x07;
242 par->Attribute[0x08] = 0x08; 243 reg->Attribute[0x08] = 0x08;
243 par->Attribute[0x09] = 0x09; 244 reg->Attribute[0x09] = 0x09;
244 par->Attribute[0x0a] = 0x0A; 245 reg->Attribute[0x0a] = 0x0A;
245 par->Attribute[0x0b] = 0x0B; 246 reg->Attribute[0x0b] = 0x0B;
246 par->Attribute[0x0c] = 0x0C; 247 reg->Attribute[0x0c] = 0x0C;
247 par->Attribute[0x0d] = 0x0D; 248 reg->Attribute[0x0d] = 0x0D;
248 par->Attribute[0x0e] = 0x0E; 249 reg->Attribute[0x0e] = 0x0E;
249 par->Attribute[0x0f] = 0x0F; 250 reg->Attribute[0x0f] = 0x0F;
250 par->Attribute[0x10] = 0x41; 251 reg->Attribute[0x10] = 0x41;
251 par->Attribute[0x11] = 0xFF; 252 reg->Attribute[0x11] = 0xFF;
252 par->Attribute[0x12] = 0x0F; 253 reg->Attribute[0x12] = 0x0F;
253 par->Attribute[0x13] = 0x00; 254 reg->Attribute[0x13] = 0x00;
254 par->Attribute[0x14] = 0x00; 255 reg->Attribute[0x14] = 0x00;
255} 256}
256 257
257/* -------------------- Hardware specific routines ------------------------- */ 258/* -------------------- Hardware specific routines ------------------------- */
@@ -304,15 +305,15 @@ savage2000_waitidle(struct savagefb_par *par)
304 while ((savage_in32(0x48C60, par) & 0x009fffff)); 305 while ((savage_in32(0x48C60, par) & 0x009fffff));
305} 306}
306 307
307 308#ifdef CONFIG_FB_SAVAGE_ACCEL
308static void 309static void
309SavageSetup2DEngine (struct savagefb_par *par) 310SavageSetup2DEngine(struct savagefb_par *par)
310{ 311{
311 unsigned long GlobalBitmapDescriptor; 312 unsigned long GlobalBitmapDescriptor;
312 313
313 GlobalBitmapDescriptor = 1 | 8 | BCI_BD_BW_DISABLE; 314 GlobalBitmapDescriptor = 1 | 8 | BCI_BD_BW_DISABLE;
314 BCI_BD_SET_BPP (GlobalBitmapDescriptor, par->depth); 315 BCI_BD_SET_BPP(GlobalBitmapDescriptor, par->depth);
315 BCI_BD_SET_STRIDE (GlobalBitmapDescriptor, par->vwidth); 316 BCI_BD_SET_STRIDE(GlobalBitmapDescriptor, par->vwidth);
316 317
317 switch(par->chip) { 318 switch(par->chip) {
318 case S3_SAVAGE3D: 319 case S3_SAVAGE3D:
@@ -361,32 +362,48 @@ SavageSetup2DEngine (struct savagefb_par *par)
361 vga_out8(0x3d5, 0x0c, par); 362 vga_out8(0x3d5, 0x0c, par);
362 363
363 /* Set stride to use GBD. */ 364 /* Set stride to use GBD. */
364 vga_out8 (0x3d4, 0x50, par); 365 vga_out8(0x3d4, 0x50, par);
365 vga_out8 (0x3d5, vga_in8(0x3d5, par) | 0xC1, par); 366 vga_out8(0x3d5, vga_in8(0x3d5, par) | 0xC1, par);
366 367
367 /* Enable 2D engine. */ 368 /* Enable 2D engine. */
368 vga_out8 (0x3d4, 0x40, par); 369 vga_out8(0x3d4, 0x40, par);
369 vga_out8 (0x3d5, 0x01, par); 370 vga_out8(0x3d5, 0x01, par);
370 371
371 savage_out32 (MONO_PAT_0, ~0, par); 372 savage_out32(MONO_PAT_0, ~0, par);
372 savage_out32 (MONO_PAT_1, ~0, par); 373 savage_out32(MONO_PAT_1, ~0, par);
373 374
374 /* Setup plane masks */ 375 /* Setup plane masks */
375 savage_out32 (0x8128, ~0, par); /* enable all write planes */ 376 savage_out32(0x8128, ~0, par); /* enable all write planes */
376 savage_out32 (0x812C, ~0, par); /* enable all read planes */ 377 savage_out32(0x812C, ~0, par); /* enable all read planes */
377 savage_out16 (0x8134, 0x27, par); 378 savage_out16(0x8134, 0x27, par);
378 savage_out16 (0x8136, 0x07, par); 379 savage_out16(0x8136, 0x07, par);
379 380
380 /* Now set the GBD */ 381 /* Now set the GBD */
381 par->bci_ptr = 0; 382 par->bci_ptr = 0;
382 par->SavageWaitFifo (par, 4); 383 par->SavageWaitFifo(par, 4);
383 384
384 BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD1 ); 385 BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD1);
385 BCI_SEND( 0 ); 386 BCI_SEND(0);
386 BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD2 ); 387 BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2);
387 BCI_SEND( GlobalBitmapDescriptor ); 388 BCI_SEND(GlobalBitmapDescriptor);
388} 389}
389 390
391static void savagefb_set_clip(struct fb_info *info)
392{
393 struct savagefb_par *par = info->par;
394 int cmd;
395
396 cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW;
397 par->bci_ptr = 0;
398 par->SavageWaitFifo(par,3);
399 BCI_SEND(cmd);
400 BCI_SEND(BCI_CLIP_TL(0, 0));
401 BCI_SEND(BCI_CLIP_BR(0xfff, 0xfff));
402}
403#else
404static void SavageSetup2DEngine(struct savagefb_par *par) {}
405
406#endif
390 407
391static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, 408static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1,
392 int min_n2, int max_n2, long freq_min, 409 int min_n2, int max_n2, long freq_min,
@@ -398,11 +415,11 @@ static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1,
398 unsigned char n1, n2, best_n1=16+2, best_n2=2, best_m=125+2; 415 unsigned char n1, n2, best_n1=16+2, best_n2=2, best_m=125+2;
399 416
400 if (freq < freq_min / (1 << max_n2)) { 417 if (freq < freq_min / (1 << max_n2)) {
401 printk (KERN_ERR "invalid frequency %ld Khz\n", freq); 418 printk(KERN_ERR "invalid frequency %ld Khz\n", freq);
402 freq = freq_min / (1 << max_n2); 419 freq = freq_min / (1 << max_n2);
403 } 420 }
404 if (freq > freq_max / (1 << min_n2)) { 421 if (freq > freq_max / (1 << min_n2)) {
405 printk (KERN_ERR "invalid frequency %ld Khz\n", freq); 422 printk(KERN_ERR "invalid frequency %ld Khz\n", freq);
406 freq = freq_max / (1 << min_n2); 423 freq = freq_max / (1 << min_n2);
407 } 424 }
408 425
@@ -453,12 +470,12 @@ static int common_calc_clock(long freq, int min_m, int min_n1, int max_n1,
453 BASE_FREQ; 470 BASE_FREQ;
454 if (m < min_m + 2 || m > 127+2) 471 if (m < min_m + 2 || m > 127+2)
455 continue; 472 continue;
456 if((m * BASE_FREQ >= freq_min * n1) && 473 if ((m * BASE_FREQ >= freq_min * n1) &&
457 (m * BASE_FREQ <= freq_max * n1)) { 474 (m * BASE_FREQ <= freq_max * n1)) {
458 diff = freq * (1 << n2) * n1 - BASE_FREQ * m; 475 diff = freq * (1 << n2) * n1 - BASE_FREQ * m;
459 if(diff < 0) 476 if (diff < 0)
460 diff = -diff; 477 diff = -diff;
461 if(diff < best_diff) { 478 if (diff < best_diff) {
462 best_diff = diff; 479 best_diff = diff;
463 best_m = m; 480 best_m = m;
464 best_n1 = n1; 481 best_n1 = n1;
@@ -468,7 +485,7 @@ static int common_calc_clock(long freq, int min_m, int min_n1, int max_n1,
468 } 485 }
469 } 486 }
470 487
471 if(max_n1 == 63) 488 if (max_n1 == 63)
472 *ndiv = (best_n1 - 2) | (best_n2 << 6); 489 *ndiv = (best_n1 - 2) | (best_n2 << 6);
473 else 490 else
474 *ndiv = (best_n1 - 2) | (best_n2 << 5); 491 *ndiv = (best_n1 - 2) | (best_n2 << 5);
@@ -488,23 +505,23 @@ static void SavagePrintRegs(void)
488 int vgaCRReg = 0x3d5; 505 int vgaCRReg = 0x3d5;
489 506
490 printk(KERN_DEBUG "SR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE " 507 printk(KERN_DEBUG "SR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE "
491 "xF" ); 508 "xF");
492 509
493 for( i = 0; i < 0x70; i++ ) { 510 for (i = 0; i < 0x70; i++) {
494 if( !(i % 16) ) 511 if (!(i % 16))
495 printk(KERN_DEBUG "\nSR%xx ", i >> 4 ); 512 printk(KERN_DEBUG "\nSR%xx ", i >> 4);
496 vga_out8( 0x3c4, i, par); 513 vga_out8(0x3c4, i, par);
497 printk(KERN_DEBUG " %02x", vga_in8(0x3c5, par) ); 514 printk(KERN_DEBUG " %02x", vga_in8(0x3c5, par));
498 } 515 }
499 516
500 printk(KERN_DEBUG "\n\nCR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC " 517 printk(KERN_DEBUG "\n\nCR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC "
501 "xD xE xF" ); 518 "xD xE xF");
502 519
503 for( i = 0; i < 0xB7; i++ ) { 520 for (i = 0; i < 0xB7; i++) {
504 if( !(i % 16) ) 521 if (!(i % 16))
505 printk(KERN_DEBUG "\nCR%xx ", i >> 4 ); 522 printk(KERN_DEBUG "\nCR%xx ", i >> 4);
506 vga_out8( vgaCRIndex, i, par); 523 vga_out8(vgaCRIndex, i, par);
507 printk(KERN_DEBUG " %02x", vga_in8(vgaCRReg, par) ); 524 printk(KERN_DEBUG " %02x", vga_in8(vgaCRReg, par));
508 } 525 }
509 526
510 printk(KERN_DEBUG "\n\n"); 527 printk(KERN_DEBUG "\n\n");
@@ -513,156 +530,309 @@ static void SavagePrintRegs(void)
513 530
514/* --------------------------------------------------------------------- */ 531/* --------------------------------------------------------------------- */
515 532
516static void savage_get_default_par(struct savagefb_par *par) 533static void savage_get_default_par(struct savagefb_par *par, struct savage_reg *reg)
517{ 534{
518 unsigned char cr3a, cr53, cr66; 535 unsigned char cr3a, cr53, cr66;
519 536
520 vga_out16 (0x3d4, 0x4838, par); 537 vga_out16(0x3d4, 0x4838, par);
521 vga_out16 (0x3d4, 0xa039, par); 538 vga_out16(0x3d4, 0xa039, par);
522 vga_out16 (0x3c4, 0x0608, par); 539 vga_out16(0x3c4, 0x0608, par);
523 540
524 vga_out8 (0x3d4, 0x66, par); 541 vga_out8(0x3d4, 0x66, par);
525 cr66 = vga_in8 (0x3d5, par); 542 cr66 = vga_in8(0x3d5, par);
526 vga_out8 (0x3d5, cr66 | 0x80, par); 543 vga_out8(0x3d5, cr66 | 0x80, par);
527 vga_out8 (0x3d4, 0x3a, par); 544 vga_out8(0x3d4, 0x3a, par);
528 cr3a = vga_in8 (0x3d5, par); 545 cr3a = vga_in8(0x3d5, par);
529 vga_out8 (0x3d5, cr3a | 0x80, par); 546 vga_out8(0x3d5, cr3a | 0x80, par);
530 vga_out8 (0x3d4, 0x53, par); 547 vga_out8(0x3d4, 0x53, par);
531 cr53 = vga_in8 (0x3d5, par); 548 cr53 = vga_in8(0x3d5, par);
532 vga_out8 (0x3d5, cr53 & 0x7f, par); 549 vga_out8(0x3d5, cr53 & 0x7f, par);
533 550
534 vga_out8 (0x3d4, 0x66, par); 551 vga_out8(0x3d4, 0x66, par);
535 vga_out8 (0x3d5, cr66, par); 552 vga_out8(0x3d5, cr66, par);
536 vga_out8 (0x3d4, 0x3a, par); 553 vga_out8(0x3d4, 0x3a, par);
537 vga_out8 (0x3d5, cr3a, par); 554 vga_out8(0x3d5, cr3a, par);
538 555
539 vga_out8 (0x3d4, 0x66, par); 556 vga_out8(0x3d4, 0x66, par);
540 vga_out8 (0x3d5, cr66, par); 557 vga_out8(0x3d5, cr66, par);
541 vga_out8 (0x3d4, 0x3a, par); 558 vga_out8(0x3d4, 0x3a, par);
542 vga_out8 (0x3d5, cr3a, par); 559 vga_out8(0x3d5, cr3a, par);
543 560
544 /* unlock extended seq regs */ 561 /* unlock extended seq regs */
545 vga_out8 (0x3c4, 0x08, par); 562 vga_out8(0x3c4, 0x08, par);
546 par->SR08 = vga_in8 (0x3c5, par); 563 reg->SR08 = vga_in8(0x3c5, par);
547 vga_out8 (0x3c5, 0x06, par); 564 vga_out8(0x3c5, 0x06, par);
548 565
549 /* now save all the extended regs we need */ 566 /* now save all the extended regs we need */
550 vga_out8 (0x3d4, 0x31, par); 567 vga_out8(0x3d4, 0x31, par);
551 par->CR31 = vga_in8 (0x3d5, par); 568 reg->CR31 = vga_in8(0x3d5, par);
552 vga_out8 (0x3d4, 0x32, par); 569 vga_out8(0x3d4, 0x32, par);
553 par->CR32 = vga_in8 (0x3d5, par); 570 reg->CR32 = vga_in8(0x3d5, par);
554 vga_out8 (0x3d4, 0x34, par); 571 vga_out8(0x3d4, 0x34, par);
555 par->CR34 = vga_in8 (0x3d5, par); 572 reg->CR34 = vga_in8(0x3d5, par);
556 vga_out8 (0x3d4, 0x36, par); 573 vga_out8(0x3d4, 0x36, par);
557 par->CR36 = vga_in8 (0x3d5, par); 574 reg->CR36 = vga_in8(0x3d5, par);
558 vga_out8 (0x3d4, 0x3a, par); 575 vga_out8(0x3d4, 0x3a, par);
559 par->CR3A = vga_in8 (0x3d5, par); 576 reg->CR3A = vga_in8(0x3d5, par);
560 vga_out8 (0x3d4, 0x40, par); 577 vga_out8(0x3d4, 0x40, par);
561 par->CR40 = vga_in8 (0x3d5, par); 578 reg->CR40 = vga_in8(0x3d5, par);
562 vga_out8 (0x3d4, 0x42, par); 579 vga_out8(0x3d4, 0x42, par);
563 par->CR42 = vga_in8 (0x3d5, par); 580 reg->CR42 = vga_in8(0x3d5, par);
564 vga_out8 (0x3d4, 0x45, par); 581 vga_out8(0x3d4, 0x45, par);
565 par->CR45 = vga_in8 (0x3d5, par); 582 reg->CR45 = vga_in8(0x3d5, par);
566 vga_out8 (0x3d4, 0x50, par); 583 vga_out8(0x3d4, 0x50, par);
567 par->CR50 = vga_in8 (0x3d5, par); 584 reg->CR50 = vga_in8(0x3d5, par);
568 vga_out8 (0x3d4, 0x51, par); 585 vga_out8(0x3d4, 0x51, par);
569 par->CR51 = vga_in8 (0x3d5, par); 586 reg->CR51 = vga_in8(0x3d5, par);
570 vga_out8 (0x3d4, 0x53, par); 587 vga_out8(0x3d4, 0x53, par);
571 par->CR53 = vga_in8 (0x3d5, par); 588 reg->CR53 = vga_in8(0x3d5, par);
572 vga_out8 (0x3d4, 0x58, par); 589 vga_out8(0x3d4, 0x58, par);
573 par->CR58 = vga_in8 (0x3d5, par); 590 reg->CR58 = vga_in8(0x3d5, par);
574 vga_out8 (0x3d4, 0x60, par); 591 vga_out8(0x3d4, 0x60, par);
575 par->CR60 = vga_in8 (0x3d5, par); 592 reg->CR60 = vga_in8(0x3d5, par);
576 vga_out8 (0x3d4, 0x66, par); 593 vga_out8(0x3d4, 0x66, par);
577 par->CR66 = vga_in8 (0x3d5, par); 594 reg->CR66 = vga_in8(0x3d5, par);
578 vga_out8 (0x3d4, 0x67, par); 595 vga_out8(0x3d4, 0x67, par);
579 par->CR67 = vga_in8 (0x3d5, par); 596 reg->CR67 = vga_in8(0x3d5, par);
580 vga_out8 (0x3d4, 0x68, par); 597 vga_out8(0x3d4, 0x68, par);
581 par->CR68 = vga_in8 (0x3d5, par); 598 reg->CR68 = vga_in8(0x3d5, par);
582 vga_out8 (0x3d4, 0x69, par); 599 vga_out8(0x3d4, 0x69, par);
583 par->CR69 = vga_in8 (0x3d5, par); 600 reg->CR69 = vga_in8(0x3d5, par);
584 vga_out8 (0x3d4, 0x6f, par); 601 vga_out8(0x3d4, 0x6f, par);
585 par->CR6F = vga_in8 (0x3d5, par); 602 reg->CR6F = vga_in8(0x3d5, par);
586 603
587 vga_out8 (0x3d4, 0x33, par); 604 vga_out8(0x3d4, 0x33, par);
588 par->CR33 = vga_in8 (0x3d5, par); 605 reg->CR33 = vga_in8(0x3d5, par);
589 vga_out8 (0x3d4, 0x86, par); 606 vga_out8(0x3d4, 0x86, par);
590 par->CR86 = vga_in8 (0x3d5, par); 607 reg->CR86 = vga_in8(0x3d5, par);
591 vga_out8 (0x3d4, 0x88, par); 608 vga_out8(0x3d4, 0x88, par);
592 par->CR88 = vga_in8 (0x3d5, par); 609 reg->CR88 = vga_in8(0x3d5, par);
593 vga_out8 (0x3d4, 0x90, par); 610 vga_out8(0x3d4, 0x90, par);
594 par->CR90 = vga_in8 (0x3d5, par); 611 reg->CR90 = vga_in8(0x3d5, par);
595 vga_out8 (0x3d4, 0x91, par); 612 vga_out8(0x3d4, 0x91, par);
596 par->CR91 = vga_in8 (0x3d5, par); 613 reg->CR91 = vga_in8(0x3d5, par);
597 vga_out8 (0x3d4, 0xb0, par); 614 vga_out8(0x3d4, 0xb0, par);
598 par->CRB0 = vga_in8 (0x3d5, par) | 0x80; 615 reg->CRB0 = vga_in8(0x3d5, par) | 0x80;
616
617 /* extended mode timing regs */
618 vga_out8(0x3d4, 0x3b, par);
619 reg->CR3B = vga_in8(0x3d5, par);
620 vga_out8(0x3d4, 0x3c, par);
621 reg->CR3C = vga_in8(0x3d5, par);
622 vga_out8(0x3d4, 0x43, par);
623 reg->CR43 = vga_in8(0x3d5, par);
624 vga_out8(0x3d4, 0x5d, par);
625 reg->CR5D = vga_in8(0x3d5, par);
626 vga_out8(0x3d4, 0x5e, par);
627 reg->CR5E = vga_in8(0x3d5, par);
628 vga_out8(0x3d4, 0x65, par);
629 reg->CR65 = vga_in8(0x3d5, par);
630
631 /* save seq extended regs for DCLK PLL programming */
632 vga_out8(0x3c4, 0x0e, par);
633 reg->SR0E = vga_in8(0x3c5, par);
634 vga_out8(0x3c4, 0x0f, par);
635 reg->SR0F = vga_in8(0x3c5, par);
636 vga_out8(0x3c4, 0x10, par);
637 reg->SR10 = vga_in8(0x3c5, par);
638 vga_out8(0x3c4, 0x11, par);
639 reg->SR11 = vga_in8(0x3c5, par);
640 vga_out8(0x3c4, 0x12, par);
641 reg->SR12 = vga_in8(0x3c5, par);
642 vga_out8(0x3c4, 0x13, par);
643 reg->SR13 = vga_in8(0x3c5, par);
644 vga_out8(0x3c4, 0x29, par);
645 reg->SR29 = vga_in8(0x3c5, par);
646
647 vga_out8(0x3c4, 0x15, par);
648 reg->SR15 = vga_in8(0x3c5, par);
649 vga_out8(0x3c4, 0x30, par);
650 reg->SR30 = vga_in8(0x3c5, par);
651 vga_out8(0x3c4, 0x18, par);
652 reg->SR18 = vga_in8(0x3c5, par);
653
654 /* Save flat panel expansion regsters. */
655 if (par->chip == S3_SAVAGE_MX) {
656 int i;
657
658 for (i = 0; i < 8; i++) {
659 vga_out8(0x3c4, 0x54+i, par);
660 reg->SR54[i] = vga_in8(0x3c5, par);
661 }
662 }
663
664 vga_out8(0x3d4, 0x66, par);
665 cr66 = vga_in8(0x3d5, par);
666 vga_out8(0x3d5, cr66 | 0x80, par);
667 vga_out8(0x3d4, 0x3a, par);
668 cr3a = vga_in8(0x3d5, par);
669 vga_out8(0x3d5, cr3a | 0x80, par);
670
671 /* now save MIU regs */
672 if (par->chip != S3_SAVAGE_MX) {
673 reg->MMPR0 = savage_in32(FIFO_CONTROL_REG, par);
674 reg->MMPR1 = savage_in32(MIU_CONTROL_REG, par);
675 reg->MMPR2 = savage_in32(STREAMS_TIMEOUT_REG, par);
676 reg->MMPR3 = savage_in32(MISC_TIMEOUT_REG, par);
677 }
678
679 vga_out8(0x3d4, 0x3a, par);
680 vga_out8(0x3d5, cr3a, par);
681 vga_out8(0x3d4, 0x66, par);
682 vga_out8(0x3d5, cr66, par);
683}
684
685static void savage_set_default_par(struct savagefb_par *par,
686 struct savage_reg *reg)
687{
688 unsigned char cr3a, cr53, cr66;
689
690 vga_out16(0x3d4, 0x4838, par);
691 vga_out16(0x3d4, 0xa039, par);
692 vga_out16(0x3c4, 0x0608, par);
693
694 vga_out8(0x3d4, 0x66, par);
695 cr66 = vga_in8(0x3d5, par);
696 vga_out8(0x3d5, cr66 | 0x80, par);
697 vga_out8(0x3d4, 0x3a, par);
698 cr3a = vga_in8(0x3d5, par);
699 vga_out8(0x3d5, cr3a | 0x80, par);
700 vga_out8(0x3d4, 0x53, par);
701 cr53 = vga_in8(0x3d5, par);
702 vga_out8(0x3d5, cr53 & 0x7f, par);
703
704 vga_out8(0x3d4, 0x66, par);
705 vga_out8(0x3d5, cr66, par);
706 vga_out8(0x3d4, 0x3a, par);
707 vga_out8(0x3d5, cr3a, par);
708
709 vga_out8(0x3d4, 0x66, par);
710 vga_out8(0x3d5, cr66, par);
711 vga_out8(0x3d4, 0x3a, par);
712 vga_out8(0x3d5, cr3a, par);
713
714 /* unlock extended seq regs */
715 vga_out8(0x3c4, 0x08, par);
716 vga_out8(0x3c5, reg->SR08, par);
717 vga_out8(0x3c5, 0x06, par);
718
719 /* now restore all the extended regs we need */
720 vga_out8(0x3d4, 0x31, par);
721 vga_out8(0x3d5, reg->CR31, par);
722 vga_out8(0x3d4, 0x32, par);
723 vga_out8(0x3d5, reg->CR32, par);
724 vga_out8(0x3d4, 0x34, par);
725 vga_out8(0x3d5, reg->CR34, par);
726 vga_out8(0x3d4, 0x36, par);
727 vga_out8(0x3d5,reg->CR36, par);
728 vga_out8(0x3d4, 0x3a, par);
729 vga_out8(0x3d5, reg->CR3A, par);
730 vga_out8(0x3d4, 0x40, par);
731 vga_out8(0x3d5, reg->CR40, par);
732 vga_out8(0x3d4, 0x42, par);
733 vga_out8(0x3d5, reg->CR42, par);
734 vga_out8(0x3d4, 0x45, par);
735 vga_out8(0x3d5, reg->CR45, par);
736 vga_out8(0x3d4, 0x50, par);
737 vga_out8(0x3d5, reg->CR50, par);
738 vga_out8(0x3d4, 0x51, par);
739 vga_out8(0x3d5, reg->CR51, par);
740 vga_out8(0x3d4, 0x53, par);
741 vga_out8(0x3d5, reg->CR53, par);
742 vga_out8(0x3d4, 0x58, par);
743 vga_out8(0x3d5, reg->CR58, par);
744 vga_out8(0x3d4, 0x60, par);
745 vga_out8(0x3d5, reg->CR60, par);
746 vga_out8(0x3d4, 0x66, par);
747 vga_out8(0x3d5, reg->CR66, par);
748 vga_out8(0x3d4, 0x67, par);
749 vga_out8(0x3d5, reg->CR67, par);
750 vga_out8(0x3d4, 0x68, par);
751 vga_out8(0x3d5, reg->CR68, par);
752 vga_out8(0x3d4, 0x69, par);
753 vga_out8(0x3d5, reg->CR69, par);
754 vga_out8(0x3d4, 0x6f, par);
755 vga_out8(0x3d5, reg->CR6F, par);
756
757 vga_out8(0x3d4, 0x33, par);
758 vga_out8(0x3d5, reg->CR33, par);
759 vga_out8(0x3d4, 0x86, par);
760 vga_out8(0x3d5, reg->CR86, par);
761 vga_out8(0x3d4, 0x88, par);
762 vga_out8(0x3d5, reg->CR88, par);
763 vga_out8(0x3d4, 0x90, par);
764 vga_out8(0x3d5, reg->CR90, par);
765 vga_out8(0x3d4, 0x91, par);
766 vga_out8(0x3d5, reg->CR91, par);
767 vga_out8(0x3d4, 0xb0, par);
768 vga_out8(0x3d5, reg->CRB0, par);
599 769
600 /* extended mode timing regs */ 770 /* extended mode timing regs */
601 vga_out8 (0x3d4, 0x3b, par); 771 vga_out8(0x3d4, 0x3b, par);
602 par->CR3B = vga_in8 (0x3d5, par); 772 vga_out8(0x3d5, reg->CR3B, par);
603 vga_out8 (0x3d4, 0x3c, par); 773 vga_out8(0x3d4, 0x3c, par);
604 par->CR3C = vga_in8 (0x3d5, par); 774 vga_out8(0x3d5, reg->CR3C, par);
605 vga_out8 (0x3d4, 0x43, par); 775 vga_out8(0x3d4, 0x43, par);
606 par->CR43 = vga_in8 (0x3d5, par); 776 vga_out8(0x3d5, reg->CR43, par);
607 vga_out8 (0x3d4, 0x5d, par); 777 vga_out8(0x3d4, 0x5d, par);
608 par->CR5D = vga_in8 (0x3d5, par); 778 vga_out8(0x3d5, reg->CR5D, par);
609 vga_out8 (0x3d4, 0x5e, par); 779 vga_out8(0x3d4, 0x5e, par);
610 par->CR5E = vga_in8 (0x3d5, par); 780 vga_out8(0x3d5, reg->CR5E, par);
611 vga_out8 (0x3d4, 0x65, par); 781 vga_out8(0x3d4, 0x65, par);
612 par->CR65 = vga_in8 (0x3d5, par); 782 vga_out8(0x3d5, reg->CR65, par);
613 783
614 /* save seq extended regs for DCLK PLL programming */ 784 /* save seq extended regs for DCLK PLL programming */
615 vga_out8 (0x3c4, 0x0e, par); 785 vga_out8(0x3c4, 0x0e, par);
616 par->SR0E = vga_in8 (0x3c5, par); 786 vga_out8(0x3c5, reg->SR0E, par);
617 vga_out8 (0x3c4, 0x0f, par); 787 vga_out8(0x3c4, 0x0f, par);
618 par->SR0F = vga_in8 (0x3c5, par); 788 vga_out8(0x3c5, reg->SR0F, par);
619 vga_out8 (0x3c4, 0x10, par); 789 vga_out8(0x3c4, 0x10, par);
620 par->SR10 = vga_in8 (0x3c5, par); 790 vga_out8(0x3c5, reg->SR10, par);
621 vga_out8 (0x3c4, 0x11, par); 791 vga_out8(0x3c4, 0x11, par);
622 par->SR11 = vga_in8 (0x3c5, par); 792 vga_out8(0x3c5, reg->SR11, par);
623 vga_out8 (0x3c4, 0x12, par); 793 vga_out8(0x3c4, 0x12, par);
624 par->SR12 = vga_in8 (0x3c5, par); 794 vga_out8(0x3c5, reg->SR12, par);
625 vga_out8 (0x3c4, 0x13, par); 795 vga_out8(0x3c4, 0x13, par);
626 par->SR13 = vga_in8 (0x3c5, par); 796 vga_out8(0x3c5, reg->SR13, par);
627 vga_out8 (0x3c4, 0x29, par); 797 vga_out8(0x3c4, 0x29, par);
628 par->SR29 = vga_in8 (0x3c5, par); 798 vga_out8(0x3c5, reg->SR29, par);
629 799
630 vga_out8 (0x3c4, 0x15, par); 800 vga_out8(0x3c4, 0x15, par);
631 par->SR15 = vga_in8 (0x3c5, par); 801 vga_out8(0x3c5, reg->SR15, par);
632 vga_out8 (0x3c4, 0x30, par); 802 vga_out8(0x3c4, 0x30, par);
633 par->SR30 = vga_in8 (0x3c5, par); 803 vga_out8(0x3c5, reg->SR30, par);
634 vga_out8 (0x3c4, 0x18, par); 804 vga_out8(0x3c4, 0x18, par);
635 par->SR18 = vga_in8 (0x3c5, par); 805 vga_out8(0x3c5, reg->SR18, par);
636 806
637 /* Save flat panel expansion regsters. */ 807 /* Save flat panel expansion regsters. */
638 if (par->chip == S3_SAVAGE_MX) { 808 if (par->chip == S3_SAVAGE_MX) {
639 int i; 809 int i;
640 810
641 for (i = 0; i < 8; i++) { 811 for (i = 0; i < 8; i++) {
642 vga_out8 (0x3c4, 0x54+i, par); 812 vga_out8(0x3c4, 0x54+i, par);
643 par->SR54[i] = vga_in8 (0x3c5, par); 813 vga_out8(0x3c5, reg->SR54[i], par);
644 } 814 }
645 } 815 }
646 816
647 vga_out8 (0x3d4, 0x66, par); 817 vga_out8(0x3d4, 0x66, par);
648 cr66 = vga_in8 (0x3d5, par); 818 cr66 = vga_in8(0x3d5, par);
649 vga_out8 (0x3d5, cr66 | 0x80, par); 819 vga_out8(0x3d5, cr66 | 0x80, par);
650 vga_out8 (0x3d4, 0x3a, par); 820 vga_out8(0x3d4, 0x3a, par);
651 cr3a = vga_in8 (0x3d5, par); 821 cr3a = vga_in8(0x3d5, par);
652 vga_out8 (0x3d5, cr3a | 0x80, par); 822 vga_out8(0x3d5, cr3a | 0x80, par);
653 823
654 /* now save MIU regs */ 824 /* now save MIU regs */
655 if (par->chip != S3_SAVAGE_MX) { 825 if (par->chip != S3_SAVAGE_MX) {
656 par->MMPR0 = savage_in32(FIFO_CONTROL_REG, par); 826 savage_out32(FIFO_CONTROL_REG, reg->MMPR0, par);
657 par->MMPR1 = savage_in32(MIU_CONTROL_REG, par); 827 savage_out32(MIU_CONTROL_REG, reg->MMPR1, par);
658 par->MMPR2 = savage_in32(STREAMS_TIMEOUT_REG, par); 828 savage_out32(STREAMS_TIMEOUT_REG, reg->MMPR2, par);
659 par->MMPR3 = savage_in32(MISC_TIMEOUT_REG, par); 829 savage_out32(MISC_TIMEOUT_REG, reg->MMPR3, par);
660 } 830 }
661 831
662 vga_out8 (0x3d4, 0x3a, par); 832 vga_out8(0x3d4, 0x3a, par);
663 vga_out8 (0x3d5, cr3a, par); 833 vga_out8(0x3d5, cr3a, par);
664 vga_out8 (0x3d4, 0x66, par); 834 vga_out8(0x3d4, 0x66, par);
665 vga_out8 (0x3d5, cr66, par); 835 vga_out8(0x3d5, cr66, par);
666} 836}
667 837
668static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb) 838static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb)
@@ -683,8 +853,8 @@ static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode
683 var->vmode = modedb->vmode; 853 var->vmode = modedb->vmode;
684} 854}
685 855
686static int savagefb_check_var (struct fb_var_screeninfo *var, 856static int savagefb_check_var(struct fb_var_screeninfo *var,
687 struct fb_info *info) 857 struct fb_info *info)
688{ 858{
689 struct savagefb_par *par = info->par; 859 struct savagefb_par *par = info->par;
690 int memlen, vramlen, mode_valid = 0; 860 int memlen, vramlen, mode_valid = 0;
@@ -750,10 +920,10 @@ static int savagefb_check_var (struct fb_var_screeninfo *var,
750 if (par->SavagePanelWidth && 920 if (par->SavagePanelWidth &&
751 (var->xres > par->SavagePanelWidth || 921 (var->xres > par->SavagePanelWidth ||
752 var->yres > par->SavagePanelHeight)) { 922 var->yres > par->SavagePanelHeight)) {
753 printk (KERN_INFO "Mode (%dx%d) larger than the LCD panel " 923 printk(KERN_INFO "Mode (%dx%d) larger than the LCD panel "
754 "(%dx%d)\n", var->xres, var->yres, 924 "(%dx%d)\n", var->xres, var->yres,
755 par->SavagePanelWidth, 925 par->SavagePanelWidth,
756 par->SavagePanelHeight); 926 par->SavagePanelHeight);
757 return -1; 927 return -1;
758 } 928 }
759 929
@@ -788,8 +958,9 @@ static int savagefb_check_var (struct fb_var_screeninfo *var,
788} 958}
789 959
790 960
791static int savagefb_decode_var (struct fb_var_screeninfo *var, 961static int savagefb_decode_var(struct fb_var_screeninfo *var,
792 struct savagefb_par *par) 962 struct savagefb_par *par,
963 struct savage_reg *reg)
793{ 964{
794 struct xtimings timings; 965 struct xtimings timings;
795 int width, dclk, i, j; /*, refresh; */ 966 int width, dclk, i, j; /*, refresh; */
@@ -799,7 +970,7 @@ static int savagefb_decode_var (struct fb_var_screeninfo *var,
799 970
800 DBG("savagefb_decode_var"); 971 DBG("savagefb_decode_var");
801 972
802 memset (&timings, 0, sizeof(timings)); 973 memset(&timings, 0, sizeof(timings));
803 974
804 if (!pixclock) pixclock = 10000; /* 10ns = 100MHz */ 975 if (!pixclock) pixclock = 10000; /* 10ns = 100MHz */
805 timings.Clock = 1000000000 / pixclock; 976 timings.Clock = 1000000000 / pixclock;
@@ -831,39 +1002,39 @@ static int savagefb_decode_var (struct fb_var_screeninfo *var,
831 * This will allocate the datastructure and initialize all of the 1002 * This will allocate the datastructure and initialize all of the
832 * generic VGA registers. 1003 * generic VGA registers.
833 */ 1004 */
834 vgaHWInit (var, par, &timings); 1005 vgaHWInit(var, par, &timings, reg);
835 1006
836 /* We need to set CR67 whether or not we use the BIOS. */ 1007 /* We need to set CR67 whether or not we use the BIOS. */
837 1008
838 dclk = timings.Clock; 1009 dclk = timings.Clock;
839 par->CR67 = 0x00; 1010 reg->CR67 = 0x00;
840 1011
841 switch( var->bits_per_pixel ) { 1012 switch(var->bits_per_pixel) {
842 case 8: 1013 case 8:
843 if( (par->chip == S3_SAVAGE2000) && (dclk >= 230000) ) 1014 if ((par->chip == S3_SAVAGE2000) && (dclk >= 230000))
844 par->CR67 = 0x10; /* 8bpp, 2 pixels/clock */ 1015 reg->CR67 = 0x10; /* 8bpp, 2 pixels/clock */
845 else 1016 else
846 par->CR67 = 0x00; /* 8bpp, 1 pixel/clock */ 1017 reg->CR67 = 0x00; /* 8bpp, 1 pixel/clock */
847 break; 1018 break;
848 case 15: 1019 case 15:
849 if ( S3_SAVAGE_MOBILE_SERIES(par->chip) || 1020 if (S3_SAVAGE_MOBILE_SERIES(par->chip) ||
850 ((par->chip == S3_SAVAGE2000) && (dclk >= 230000)) ) 1021 ((par->chip == S3_SAVAGE2000) && (dclk >= 230000)))
851 par->CR67 = 0x30; /* 15bpp, 2 pixel/clock */ 1022 reg->CR67 = 0x30; /* 15bpp, 2 pixel/clock */
852 else 1023 else
853 par->CR67 = 0x20; /* 15bpp, 1 pixels/clock */ 1024 reg->CR67 = 0x20; /* 15bpp, 1 pixels/clock */
854 break; 1025 break;
855 case 16: 1026 case 16:
856 if( S3_SAVAGE_MOBILE_SERIES(par->chip) || 1027 if (S3_SAVAGE_MOBILE_SERIES(par->chip) ||
857 ((par->chip == S3_SAVAGE2000) && (dclk >= 230000)) ) 1028 ((par->chip == S3_SAVAGE2000) && (dclk >= 230000)))
858 par->CR67 = 0x50; /* 16bpp, 2 pixel/clock */ 1029 reg->CR67 = 0x50; /* 16bpp, 2 pixel/clock */
859 else 1030 else
860 par->CR67 = 0x40; /* 16bpp, 1 pixels/clock */ 1031 reg->CR67 = 0x40; /* 16bpp, 1 pixels/clock */
861 break; 1032 break;
862 case 24: 1033 case 24:
863 par->CR67 = 0x70; 1034 reg->CR67 = 0x70;
864 break; 1035 break;
865 case 32: 1036 case 32:
866 par->CR67 = 0xd0; 1037 reg->CR67 = 0xd0;
867 break; 1038 break;
868 } 1039 }
869 1040
@@ -872,61 +1043,61 @@ static int savagefb_decode_var (struct fb_var_screeninfo *var,
872 * match. Fall back to traditional register-crunching. 1043 * match. Fall back to traditional register-crunching.
873 */ 1044 */
874 1045
875 vga_out8 (0x3d4, 0x3a, par); 1046 vga_out8(0x3d4, 0x3a, par);
876 tmp = vga_in8 (0x3d5, par); 1047 tmp = vga_in8(0x3d5, par);
877 if (1 /*FIXME:psav->pci_burst*/) 1048 if (1 /*FIXME:psav->pci_burst*/)
878 par->CR3A = (tmp & 0x7f) | 0x15; 1049 reg->CR3A = (tmp & 0x7f) | 0x15;
879 else 1050 else
880 par->CR3A = tmp | 0x95; 1051 reg->CR3A = tmp | 0x95;
881 1052
882 par->CR53 = 0x00; 1053 reg->CR53 = 0x00;
883 par->CR31 = 0x8c; 1054 reg->CR31 = 0x8c;
884 par->CR66 = 0x89; 1055 reg->CR66 = 0x89;
885 1056
886 vga_out8 (0x3d4, 0x58, par); 1057 vga_out8(0x3d4, 0x58, par);
887 par->CR58 = vga_in8 (0x3d5, par) & 0x80; 1058 reg->CR58 = vga_in8(0x3d5, par) & 0x80;
888 par->CR58 |= 0x13; 1059 reg->CR58 |= 0x13;
889 1060
890 par->SR15 = 0x03 | 0x80; 1061 reg->SR15 = 0x03 | 0x80;
891 par->SR18 = 0x00; 1062 reg->SR18 = 0x00;
892 par->CR43 = par->CR45 = par->CR65 = 0x00; 1063 reg->CR43 = reg->CR45 = reg->CR65 = 0x00;
893 1064
894 vga_out8 (0x3d4, 0x40, par); 1065 vga_out8(0x3d4, 0x40, par);
895 par->CR40 = vga_in8 (0x3d5, par) & ~0x01; 1066 reg->CR40 = vga_in8(0x3d5, par) & ~0x01;
896 1067
897 par->MMPR0 = 0x010400; 1068 reg->MMPR0 = 0x010400;
898 par->MMPR1 = 0x00; 1069 reg->MMPR1 = 0x00;
899 par->MMPR2 = 0x0808; 1070 reg->MMPR2 = 0x0808;
900 par->MMPR3 = 0x08080810; 1071 reg->MMPR3 = 0x08080810;
901 1072
902 SavageCalcClock (dclk, 1, 1, 127, 0, 4, 180000, 360000, &m, &n, &r); 1073 SavageCalcClock(dclk, 1, 1, 127, 0, 4, 180000, 360000, &m, &n, &r);
903 /* m = 107; n = 4; r = 2; */ 1074 /* m = 107; n = 4; r = 2; */
904 1075
905 if (par->MCLK <= 0) { 1076 if (par->MCLK <= 0) {
906 par->SR10 = 255; 1077 reg->SR10 = 255;
907 par->SR11 = 255; 1078 reg->SR11 = 255;
908 } else { 1079 } else {
909 common_calc_clock (par->MCLK, 1, 1, 31, 0, 3, 135000, 270000, 1080 common_calc_clock(par->MCLK, 1, 1, 31, 0, 3, 135000, 270000,
910 &par->SR11, &par->SR10); 1081 &reg->SR11, &reg->SR10);
911 /* par->SR10 = 80; // MCLK == 286000 */ 1082 /* reg->SR10 = 80; // MCLK == 286000 */
912 /* par->SR11 = 125; */ 1083 /* reg->SR11 = 125; */
913 } 1084 }
914 1085
915 par->SR12 = (r << 6) | (n & 0x3f); 1086 reg->SR12 = (r << 6) | (n & 0x3f);
916 par->SR13 = m & 0xff; 1087 reg->SR13 = m & 0xff;
917 par->SR29 = (r & 4) | (m & 0x100) >> 5 | (n & 0x40) >> 2; 1088 reg->SR29 = (r & 4) | (m & 0x100) >> 5 | (n & 0x40) >> 2;
918 1089
919 if (var->bits_per_pixel < 24) 1090 if (var->bits_per_pixel < 24)
920 par->MMPR0 -= 0x8000; 1091 reg->MMPR0 -= 0x8000;
921 else 1092 else
922 par->MMPR0 -= 0x4000; 1093 reg->MMPR0 -= 0x4000;
923 1094
924 if (timings.interlaced) 1095 if (timings.interlaced)
925 par->CR42 = 0x20; 1096 reg->CR42 = 0x20;
926 else 1097 else
927 par->CR42 = 0x00; 1098 reg->CR42 = 0x00;
928 1099
929 par->CR34 = 0x10; /* display fifo */ 1100 reg->CR34 = 0x10; /* display fifo */
930 1101
931 i = ((((timings.HTotal >> 3) - 5) & 0x100) >> 8) | 1102 i = ((((timings.HTotal >> 3) - 5) & 0x100) >> 8) |
932 ((((timings.HDisplay >> 3) - 1) & 0x100) >> 7) | 1103 ((((timings.HDisplay >> 3) - 1) & 0x100) >> 7) |
@@ -938,77 +1109,77 @@ static int savagefb_decode_var (struct fb_var_screeninfo *var,
938 if ((timings.HSyncEnd >> 3) - (timings.HSyncStart >> 3) > 32) 1109 if ((timings.HSyncEnd >> 3) - (timings.HSyncStart >> 3) > 32)
939 i |= 0x20; 1110 i |= 0x20;
940 1111
941 j = (par->CRTC[0] + ((i & 0x01) << 8) + 1112 j = (reg->CRTC[0] + ((i & 0x01) << 8) +
942 par->CRTC[4] + ((i & 0x10) << 4) + 1) / 2; 1113 reg->CRTC[4] + ((i & 0x10) << 4) + 1) / 2;
943 1114
944 if (j - (par->CRTC[4] + ((i & 0x10) << 4)) < 4) { 1115 if (j - (reg->CRTC[4] + ((i & 0x10) << 4)) < 4) {
945 if (par->CRTC[4] + ((i & 0x10) << 4) + 4 <= 1116 if (reg->CRTC[4] + ((i & 0x10) << 4) + 4 <=
946 par->CRTC[0] + ((i & 0x01) << 8)) 1117 reg->CRTC[0] + ((i & 0x01) << 8))
947 j = par->CRTC[4] + ((i & 0x10) << 4) + 4; 1118 j = reg->CRTC[4] + ((i & 0x10) << 4) + 4;
948 else 1119 else
949 j = par->CRTC[0] + ((i & 0x01) << 8) + 1; 1120 j = reg->CRTC[0] + ((i & 0x01) << 8) + 1;
950 } 1121 }
951 1122
952 par->CR3B = j & 0xff; 1123 reg->CR3B = j & 0xff;
953 i |= (j & 0x100) >> 2; 1124 i |= (j & 0x100) >> 2;
954 par->CR3C = (par->CRTC[0] + ((i & 0x01) << 8)) / 2; 1125 reg->CR3C = (reg->CRTC[0] + ((i & 0x01) << 8)) / 2;
955 par->CR5D = i; 1126 reg->CR5D = i;
956 par->CR5E = (((timings.VTotal - 2) & 0x400) >> 10) | 1127 reg->CR5E = (((timings.VTotal - 2) & 0x400) >> 10) |
957 (((timings.VDisplay - 1) & 0x400) >> 9) | 1128 (((timings.VDisplay - 1) & 0x400) >> 9) |
958 (((timings.VSyncStart) & 0x400) >> 8) | 1129 (((timings.VSyncStart) & 0x400) >> 8) |
959 (((timings.VSyncStart) & 0x400) >> 6) | 0x40; 1130 (((timings.VSyncStart) & 0x400) >> 6) | 0x40;
960 width = (var->xres_virtual * ((var->bits_per_pixel+7) / 8)) >> 3; 1131 width = (var->xres_virtual * ((var->bits_per_pixel+7) / 8)) >> 3;
961 par->CR91 = par->CRTC[19] = 0xff & width; 1132 reg->CR91 = reg->CRTC[19] = 0xff & width;
962 par->CR51 = (0x300 & width) >> 4; 1133 reg->CR51 = (0x300 & width) >> 4;
963 par->CR90 = 0x80 | (width >> 8); 1134 reg->CR90 = 0x80 | (width >> 8);
964 par->MiscOutReg |= 0x0c; 1135 reg->MiscOutReg |= 0x0c;
965 1136
966 /* Set frame buffer description. */ 1137 /* Set frame buffer description. */
967 1138
968 if (var->bits_per_pixel <= 8) 1139 if (var->bits_per_pixel <= 8)
969 par->CR50 = 0; 1140 reg->CR50 = 0;
970 else if (var->bits_per_pixel <= 16) 1141 else if (var->bits_per_pixel <= 16)
971 par->CR50 = 0x10; 1142 reg->CR50 = 0x10;
972 else 1143 else
973 par->CR50 = 0x30; 1144 reg->CR50 = 0x30;
974 1145
975 if (var->xres_virtual <= 640) 1146 if (var->xres_virtual <= 640)
976 par->CR50 |= 0x40; 1147 reg->CR50 |= 0x40;
977 else if (var->xres_virtual == 800) 1148 else if (var->xres_virtual == 800)
978 par->CR50 |= 0x80; 1149 reg->CR50 |= 0x80;
979 else if (var->xres_virtual == 1024) 1150 else if (var->xres_virtual == 1024)
980 par->CR50 |= 0x00; 1151 reg->CR50 |= 0x00;
981 else if (var->xres_virtual == 1152) 1152 else if (var->xres_virtual == 1152)
982 par->CR50 |= 0x01; 1153 reg->CR50 |= 0x01;
983 else if (var->xres_virtual == 1280) 1154 else if (var->xres_virtual == 1280)
984 par->CR50 |= 0xc0; 1155 reg->CR50 |= 0xc0;
985 else if (var->xres_virtual == 1600) 1156 else if (var->xres_virtual == 1600)
986 par->CR50 |= 0x81; 1157 reg->CR50 |= 0x81;
987 else 1158 else
988 par->CR50 |= 0xc1; /* Use GBD */ 1159 reg->CR50 |= 0xc1; /* Use GBD */
989 1160
990 if( par->chip == S3_SAVAGE2000 ) 1161 if (par->chip == S3_SAVAGE2000)
991 par->CR33 = 0x08; 1162 reg->CR33 = 0x08;
992 else 1163 else
993 par->CR33 = 0x20; 1164 reg->CR33 = 0x20;
994 1165
995 par->CRTC[0x17] = 0xeb; 1166 reg->CRTC[0x17] = 0xeb;
996 1167
997 par->CR67 |= 1; 1168 reg->CR67 |= 1;
998 1169
999 vga_out8(0x3d4, 0x36, par); 1170 vga_out8(0x3d4, 0x36, par);
1000 par->CR36 = vga_in8 (0x3d5, par); 1171 reg->CR36 = vga_in8(0x3d5, par);
1001 vga_out8 (0x3d4, 0x68, par); 1172 vga_out8(0x3d4, 0x68, par);
1002 par->CR68 = vga_in8 (0x3d5, par); 1173 reg->CR68 = vga_in8(0x3d5, par);
1003 par->CR69 = 0; 1174 reg->CR69 = 0;
1004 vga_out8 (0x3d4, 0x6f, par); 1175 vga_out8(0x3d4, 0x6f, par);
1005 par->CR6F = vga_in8 (0x3d5, par); 1176 reg->CR6F = vga_in8(0x3d5, par);
1006 vga_out8 (0x3d4, 0x86, par); 1177 vga_out8(0x3d4, 0x86, par);
1007 par->CR86 = vga_in8 (0x3d5, par); 1178 reg->CR86 = vga_in8(0x3d5, par);
1008 vga_out8 (0x3d4, 0x88, par); 1179 vga_out8(0x3d4, 0x88, par);
1009 par->CR88 = vga_in8 (0x3d5, par) | 0x08; 1180 reg->CR88 = vga_in8(0x3d5, par) | 0x08;
1010 vga_out8 (0x3d4, 0xb0, par); 1181 vga_out8(0x3d4, 0xb0, par);
1011 par->CRB0 = vga_in8 (0x3d5, par) | 0x80; 1182 reg->CRB0 = vga_in8(0x3d5, par) | 0x80;
1012 1183
1013 return 0; 1184 return 0;
1014} 1185}
@@ -1037,11 +1208,11 @@ static int savagefb_setcolreg(unsigned regno,
1037 1208
1038 switch (info->var.bits_per_pixel) { 1209 switch (info->var.bits_per_pixel) {
1039 case 8: 1210 case 8:
1040 vga_out8 (0x3c8, regno, par); 1211 vga_out8(0x3c8, regno, par);
1041 1212
1042 vga_out8 (0x3c9, red >> 10, par); 1213 vga_out8(0x3c9, red >> 10, par);
1043 vga_out8 (0x3c9, green >> 10, par); 1214 vga_out8(0x3c9, green >> 10, par);
1044 vga_out8 (0x3c9, blue >> 10, par); 1215 vga_out8(0x3c9, blue >> 10, par);
1045 break; 1216 break;
1046 1217
1047 case 16: 1218 case 16:
@@ -1075,21 +1246,21 @@ static int savagefb_setcolreg(unsigned regno,
1075 return 0; 1246 return 0;
1076} 1247}
1077 1248
1078static void savagefb_set_par_int (struct savagefb_par *par) 1249static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *reg)
1079{ 1250{
1080 unsigned char tmp, cr3a, cr66, cr67; 1251 unsigned char tmp, cr3a, cr66, cr67;
1081 1252
1082 DBG ("savagefb_set_par_int"); 1253 DBG("savagefb_set_par_int");
1083 1254
1084 par->SavageWaitIdle (par); 1255 par->SavageWaitIdle(par);
1085 1256
1086 vga_out8 (0x3c2, 0x23, par); 1257 vga_out8(0x3c2, 0x23, par);
1087 1258
1088 vga_out16 (0x3d4, 0x4838, par); 1259 vga_out16(0x3d4, 0x4838, par);
1089 vga_out16 (0x3d4, 0xa539, par); 1260 vga_out16(0x3d4, 0xa539, par);
1090 vga_out16 (0x3c4, 0x0608, par); 1261 vga_out16(0x3c4, 0x0608, par);
1091 1262
1092 vgaHWProtect (par, 1); 1263 vgaHWProtect(par, 1);
1093 1264
1094 /* 1265 /*
1095 * Some Savage/MX and /IX systems go nuts when trying to exit the 1266 * Some Savage/MX and /IX systems go nuts when trying to exit the
@@ -1099,203 +1270,202 @@ static void savagefb_set_par_int (struct savagefb_par *par)
1099 */ 1270 */
1100 1271
1101 VerticalRetraceWait(par); 1272 VerticalRetraceWait(par);
1102 vga_out8 (0x3d4, 0x67, par); 1273 vga_out8(0x3d4, 0x67, par);
1103 cr67 = vga_in8 (0x3d5, par); 1274 cr67 = vga_in8(0x3d5, par);
1104 vga_out8 (0x3d5, cr67/*par->CR67*/ & ~0x0c, par); /* no STREAMS yet */ 1275 vga_out8(0x3d5, cr67/*par->CR67*/ & ~0x0c, par); /* no STREAMS yet */
1105 1276
1106 vga_out8 (0x3d4, 0x23, par); 1277 vga_out8(0x3d4, 0x23, par);
1107 vga_out8 (0x3d5, 0x00, par); 1278 vga_out8(0x3d5, 0x00, par);
1108 vga_out8 (0x3d4, 0x26, par); 1279 vga_out8(0x3d4, 0x26, par);
1109 vga_out8 (0x3d5, 0x00, par); 1280 vga_out8(0x3d5, 0x00, par);
1110 1281
1111 /* restore extended regs */ 1282 /* restore extended regs */
1112 vga_out8 (0x3d4, 0x66, par); 1283 vga_out8(0x3d4, 0x66, par);
1113 vga_out8 (0x3d5, par->CR66, par); 1284 vga_out8(0x3d5, reg->CR66, par);
1114 vga_out8 (0x3d4, 0x3a, par); 1285 vga_out8(0x3d4, 0x3a, par);
1115 vga_out8 (0x3d5, par->CR3A, par); 1286 vga_out8(0x3d5, reg->CR3A, par);
1116 vga_out8 (0x3d4, 0x31, par); 1287 vga_out8(0x3d4, 0x31, par);
1117 vga_out8 (0x3d5, par->CR31, par); 1288 vga_out8(0x3d5, reg->CR31, par);
1118 vga_out8 (0x3d4, 0x32, par); 1289 vga_out8(0x3d4, 0x32, par);
1119 vga_out8 (0x3d5, par->CR32, par); 1290 vga_out8(0x3d5, reg->CR32, par);
1120 vga_out8 (0x3d4, 0x58, par); 1291 vga_out8(0x3d4, 0x58, par);
1121 vga_out8 (0x3d5, par->CR58, par); 1292 vga_out8(0x3d5, reg->CR58, par);
1122 vga_out8 (0x3d4, 0x53, par); 1293 vga_out8(0x3d4, 0x53, par);
1123 vga_out8 (0x3d5, par->CR53 & 0x7f, par); 1294 vga_out8(0x3d5, reg->CR53 & 0x7f, par);
1124 1295
1125 vga_out16 (0x3c4, 0x0608, par); 1296 vga_out16(0x3c4, 0x0608, par);
1126 1297
1127 /* Restore DCLK registers. */ 1298 /* Restore DCLK registers. */
1128 1299
1129 vga_out8 (0x3c4, 0x0e, par); 1300 vga_out8(0x3c4, 0x0e, par);
1130 vga_out8 (0x3c5, par->SR0E, par); 1301 vga_out8(0x3c5, reg->SR0E, par);
1131 vga_out8 (0x3c4, 0x0f, par); 1302 vga_out8(0x3c4, 0x0f, par);
1132 vga_out8 (0x3c5, par->SR0F, par); 1303 vga_out8(0x3c5, reg->SR0F, par);
1133 vga_out8 (0x3c4, 0x29, par); 1304 vga_out8(0x3c4, 0x29, par);
1134 vga_out8 (0x3c5, par->SR29, par); 1305 vga_out8(0x3c5, reg->SR29, par);
1135 vga_out8 (0x3c4, 0x15, par); 1306 vga_out8(0x3c4, 0x15, par);
1136 vga_out8 (0x3c5, par->SR15, par); 1307 vga_out8(0x3c5, reg->SR15, par);
1137 1308
1138 /* Restore flat panel expansion regsters. */ 1309 /* Restore flat panel expansion regsters. */
1139 if( par->chip == S3_SAVAGE_MX ) { 1310 if (par->chip == S3_SAVAGE_MX) {
1140 int i; 1311 int i;
1141 1312
1142 for( i = 0; i < 8; i++ ) { 1313 for (i = 0; i < 8; i++) {
1143 vga_out8 (0x3c4, 0x54+i, par); 1314 vga_out8(0x3c4, 0x54+i, par);
1144 vga_out8 (0x3c5, par->SR54[i], par); 1315 vga_out8(0x3c5, reg->SR54[i], par);
1145 } 1316 }
1146 } 1317 }
1147 1318
1148 vgaHWRestore (par); 1319 vgaHWRestore (par, reg);
1149 1320
1150 /* extended mode timing registers */ 1321 /* extended mode timing registers */
1151 vga_out8 (0x3d4, 0x53, par); 1322 vga_out8(0x3d4, 0x53, par);
1152 vga_out8 (0x3d5, par->CR53, par); 1323 vga_out8(0x3d5, reg->CR53, par);
1153 vga_out8 (0x3d4, 0x5d, par); 1324 vga_out8(0x3d4, 0x5d, par);
1154 vga_out8 (0x3d5, par->CR5D, par); 1325 vga_out8(0x3d5, reg->CR5D, par);
1155 vga_out8 (0x3d4, 0x5e, par); 1326 vga_out8(0x3d4, 0x5e, par);
1156 vga_out8 (0x3d5, par->CR5E, par); 1327 vga_out8(0x3d5, reg->CR5E, par);
1157 vga_out8 (0x3d4, 0x3b, par); 1328 vga_out8(0x3d4, 0x3b, par);
1158 vga_out8 (0x3d5, par->CR3B, par); 1329 vga_out8(0x3d5, reg->CR3B, par);
1159 vga_out8 (0x3d4, 0x3c, par); 1330 vga_out8(0x3d4, 0x3c, par);
1160 vga_out8 (0x3d5, par->CR3C, par); 1331 vga_out8(0x3d5, reg->CR3C, par);
1161 vga_out8 (0x3d4, 0x43, par); 1332 vga_out8(0x3d4, 0x43, par);
1162 vga_out8 (0x3d5, par->CR43, par); 1333 vga_out8(0x3d5, reg->CR43, par);
1163 vga_out8 (0x3d4, 0x65, par); 1334 vga_out8(0x3d4, 0x65, par);
1164 vga_out8 (0x3d5, par->CR65, par); 1335 vga_out8(0x3d5, reg->CR65, par);
1165 1336
1166 /* restore the desired video mode with cr67 */ 1337 /* restore the desired video mode with cr67 */
1167 vga_out8 (0x3d4, 0x67, par); 1338 vga_out8(0x3d4, 0x67, par);
1168 /* following part not present in X11 driver */ 1339 /* following part not present in X11 driver */
1169 cr67 = vga_in8 (0x3d5, par) & 0xf; 1340 cr67 = vga_in8(0x3d5, par) & 0xf;
1170 vga_out8 (0x3d5, 0x50 | cr67, par); 1341 vga_out8(0x3d5, 0x50 | cr67, par);
1171 udelay (10000); 1342 udelay(10000);
1172 vga_out8 (0x3d4, 0x67, par); 1343 vga_out8(0x3d4, 0x67, par);
1173 /* end of part */ 1344 /* end of part */
1174 vga_out8 (0x3d5, par->CR67 & ~0x0c, par); 1345 vga_out8(0x3d5, reg->CR67 & ~0x0c, par);
1175 1346
1176 /* other mode timing and extended regs */ 1347 /* other mode timing and extended regs */
1177 vga_out8 (0x3d4, 0x34, par); 1348 vga_out8(0x3d4, 0x34, par);
1178 vga_out8 (0x3d5, par->CR34, par); 1349 vga_out8(0x3d5, reg->CR34, par);
1179 vga_out8 (0x3d4, 0x40, par); 1350 vga_out8(0x3d4, 0x40, par);
1180 vga_out8 (0x3d5, par->CR40, par); 1351 vga_out8(0x3d5, reg->CR40, par);
1181 vga_out8 (0x3d4, 0x42, par); 1352 vga_out8(0x3d4, 0x42, par);
1182 vga_out8 (0x3d5, par->CR42, par); 1353 vga_out8(0x3d5, reg->CR42, par);
1183 vga_out8 (0x3d4, 0x45, par); 1354 vga_out8(0x3d4, 0x45, par);
1184 vga_out8 (0x3d5, par->CR45, par); 1355 vga_out8(0x3d5, reg->CR45, par);
1185 vga_out8 (0x3d4, 0x50, par); 1356 vga_out8(0x3d4, 0x50, par);
1186 vga_out8 (0x3d5, par->CR50, par); 1357 vga_out8(0x3d5, reg->CR50, par);
1187 vga_out8 (0x3d4, 0x51, par); 1358 vga_out8(0x3d4, 0x51, par);
1188 vga_out8 (0x3d5, par->CR51, par); 1359 vga_out8(0x3d5, reg->CR51, par);
1189 1360
1190 /* memory timings */ 1361 /* memory timings */
1191 vga_out8 (0x3d4, 0x36, par); 1362 vga_out8(0x3d4, 0x36, par);
1192 vga_out8 (0x3d5, par->CR36, par); 1363 vga_out8(0x3d5, reg->CR36, par);
1193 vga_out8 (0x3d4, 0x60, par); 1364 vga_out8(0x3d4, 0x60, par);
1194 vga_out8 (0x3d5, par->CR60, par); 1365 vga_out8(0x3d5, reg->CR60, par);
1195 vga_out8 (0x3d4, 0x68, par); 1366 vga_out8(0x3d4, 0x68, par);
1196 vga_out8 (0x3d5, par->CR68, par); 1367 vga_out8(0x3d5, reg->CR68, par);
1197 vga_out8 (0x3d4, 0x69, par); 1368 vga_out8(0x3d4, 0x69, par);
1198 vga_out8 (0x3d5, par->CR69, par); 1369 vga_out8(0x3d5, reg->CR69, par);
1199 vga_out8 (0x3d4, 0x6f, par); 1370 vga_out8(0x3d4, 0x6f, par);
1200 vga_out8 (0x3d5, par->CR6F, par); 1371 vga_out8(0x3d5, reg->CR6F, par);
1201 1372
1202 vga_out8 (0x3d4, 0x33, par); 1373 vga_out8(0x3d4, 0x33, par);
1203 vga_out8 (0x3d5, par->CR33, par); 1374 vga_out8(0x3d5, reg->CR33, par);
1204 vga_out8 (0x3d4, 0x86, par); 1375 vga_out8(0x3d4, 0x86, par);
1205 vga_out8 (0x3d5, par->CR86, par); 1376 vga_out8(0x3d5, reg->CR86, par);
1206 vga_out8 (0x3d4, 0x88, par); 1377 vga_out8(0x3d4, 0x88, par);
1207 vga_out8 (0x3d5, par->CR88, par); 1378 vga_out8(0x3d5, reg->CR88, par);
1208 vga_out8 (0x3d4, 0x90, par); 1379 vga_out8(0x3d4, 0x90, par);
1209 vga_out8 (0x3d5, par->CR90, par); 1380 vga_out8(0x3d5, reg->CR90, par);
1210 vga_out8 (0x3d4, 0x91, par); 1381 vga_out8(0x3d4, 0x91, par);
1211 vga_out8 (0x3d5, par->CR91, par); 1382 vga_out8(0x3d5, reg->CR91, par);
1212 1383
1213 if (par->chip == S3_SAVAGE4) { 1384 if (par->chip == S3_SAVAGE4) {
1214 vga_out8 (0x3d4, 0xb0, par); 1385 vga_out8(0x3d4, 0xb0, par);
1215 vga_out8 (0x3d5, par->CRB0, par); 1386 vga_out8(0x3d5, reg->CRB0, par);
1216 } 1387 }
1217 1388
1218 vga_out8 (0x3d4, 0x32, par); 1389 vga_out8(0x3d4, 0x32, par);
1219 vga_out8 (0x3d5, par->CR32, par); 1390 vga_out8(0x3d5, reg->CR32, par);
1220 1391
1221 /* unlock extended seq regs */ 1392 /* unlock extended seq regs */
1222 vga_out8 (0x3c4, 0x08, par); 1393 vga_out8(0x3c4, 0x08, par);
1223 vga_out8 (0x3c5, 0x06, par); 1394 vga_out8(0x3c5, 0x06, par);
1224 1395
1225 /* Restore extended sequencer regs for MCLK. SR10 == 255 indicates 1396 /* Restore extended sequencer regs for MCLK. SR10 == 255 indicates
1226 * that we should leave the default SR10 and SR11 values there. 1397 * that we should leave the default SR10 and SR11 values there.
1227 */ 1398 */
1228 if (par->SR10 != 255) { 1399 if (reg->SR10 != 255) {
1229 vga_out8 (0x3c4, 0x10, par); 1400 vga_out8(0x3c4, 0x10, par);
1230 vga_out8 (0x3c5, par->SR10, par); 1401 vga_out8(0x3c5, reg->SR10, par);
1231 vga_out8 (0x3c4, 0x11, par); 1402 vga_out8(0x3c4, 0x11, par);
1232 vga_out8 (0x3c5, par->SR11, par); 1403 vga_out8(0x3c5, reg->SR11, par);
1233 } 1404 }
1234 1405
1235 /* restore extended seq regs for dclk */ 1406 /* restore extended seq regs for dclk */
1236 vga_out8 (0x3c4, 0x0e, par); 1407 vga_out8(0x3c4, 0x0e, par);
1237 vga_out8 (0x3c5, par->SR0E, par); 1408 vga_out8(0x3c5, reg->SR0E, par);
1238 vga_out8 (0x3c4, 0x0f, par); 1409 vga_out8(0x3c4, 0x0f, par);
1239 vga_out8 (0x3c5, par->SR0F, par); 1410 vga_out8(0x3c5, reg->SR0F, par);
1240 vga_out8 (0x3c4, 0x12, par); 1411 vga_out8(0x3c4, 0x12, par);
1241 vga_out8 (0x3c5, par->SR12, par); 1412 vga_out8(0x3c5, reg->SR12, par);
1242 vga_out8 (0x3c4, 0x13, par); 1413 vga_out8(0x3c4, 0x13, par);
1243 vga_out8 (0x3c5, par->SR13, par); 1414 vga_out8(0x3c5, reg->SR13, par);
1244 vga_out8 (0x3c4, 0x29, par); 1415 vga_out8(0x3c4, 0x29, par);
1245 vga_out8 (0x3c5, par->SR29, par); 1416 vga_out8(0x3c5, reg->SR29, par);
1246 1417 vga_out8(0x3c4, 0x18, par);
1247 vga_out8 (0x3c4, 0x18, par); 1418 vga_out8(0x3c5, reg->SR18, par);
1248 vga_out8 (0x3c5, par->SR18, par);
1249 1419
1250 /* load new m, n pll values for dclk & mclk */ 1420 /* load new m, n pll values for dclk & mclk */
1251 vga_out8 (0x3c4, 0x15, par); 1421 vga_out8(0x3c4, 0x15, par);
1252 tmp = vga_in8 (0x3c5, par) & ~0x21; 1422 tmp = vga_in8(0x3c5, par) & ~0x21;
1253 1423
1254 vga_out8 (0x3c5, tmp | 0x03, par); 1424 vga_out8(0x3c5, tmp | 0x03, par);
1255 vga_out8 (0x3c5, tmp | 0x23, par); 1425 vga_out8(0x3c5, tmp | 0x23, par);
1256 vga_out8 (0x3c5, tmp | 0x03, par); 1426 vga_out8(0x3c5, tmp | 0x03, par);
1257 vga_out8 (0x3c5, par->SR15, par); 1427 vga_out8(0x3c5, reg->SR15, par);
1258 udelay (100); 1428 udelay(100);
1259 1429
1260 vga_out8 (0x3c4, 0x30, par); 1430 vga_out8(0x3c4, 0x30, par);
1261 vga_out8 (0x3c5, par->SR30, par); 1431 vga_out8(0x3c5, reg->SR30, par);
1262 vga_out8 (0x3c4, 0x08, par); 1432 vga_out8(0x3c4, 0x08, par);
1263 vga_out8 (0x3c5, par->SR08, par); 1433 vga_out8(0x3c5, reg->SR08, par);
1264 1434
1265 /* now write out cr67 in full, possibly starting STREAMS */ 1435 /* now write out cr67 in full, possibly starting STREAMS */
1266 VerticalRetraceWait(par); 1436 VerticalRetraceWait(par);
1267 vga_out8 (0x3d4, 0x67, par); 1437 vga_out8(0x3d4, 0x67, par);
1268 vga_out8 (0x3d5, par->CR67, par); 1438 vga_out8(0x3d5, reg->CR67, par);
1269 1439
1270 vga_out8 (0x3d4, 0x66, par); 1440 vga_out8(0x3d4, 0x66, par);
1271 cr66 = vga_in8 (0x3d5, par); 1441 cr66 = vga_in8(0x3d5, par);
1272 vga_out8 (0x3d5, cr66 | 0x80, par); 1442 vga_out8(0x3d5, cr66 | 0x80, par);
1273 vga_out8 (0x3d4, 0x3a, par); 1443 vga_out8(0x3d4, 0x3a, par);
1274 cr3a = vga_in8 (0x3d5, par); 1444 cr3a = vga_in8(0x3d5, par);
1275 vga_out8 (0x3d5, cr3a | 0x80, par); 1445 vga_out8(0x3d5, cr3a | 0x80, par);
1276 1446
1277 if (par->chip != S3_SAVAGE_MX) { 1447 if (par->chip != S3_SAVAGE_MX) {
1278 VerticalRetraceWait(par); 1448 VerticalRetraceWait(par);
1279 savage_out32 (FIFO_CONTROL_REG, par->MMPR0, par); 1449 savage_out32(FIFO_CONTROL_REG, reg->MMPR0, par);
1280 par->SavageWaitIdle (par); 1450 par->SavageWaitIdle(par);
1281 savage_out32 (MIU_CONTROL_REG, par->MMPR1, par); 1451 savage_out32(MIU_CONTROL_REG, reg->MMPR1, par);
1282 par->SavageWaitIdle (par); 1452 par->SavageWaitIdle(par);
1283 savage_out32 (STREAMS_TIMEOUT_REG, par->MMPR2, par); 1453 savage_out32(STREAMS_TIMEOUT_REG, reg->MMPR2, par);
1284 par->SavageWaitIdle (par); 1454 par->SavageWaitIdle(par);
1285 savage_out32 (MISC_TIMEOUT_REG, par->MMPR3, par); 1455 savage_out32(MISC_TIMEOUT_REG, reg->MMPR3, par);
1286 } 1456 }
1287 1457
1288 vga_out8 (0x3d4, 0x66, par); 1458 vga_out8(0x3d4, 0x66, par);
1289 vga_out8 (0x3d5, cr66, par); 1459 vga_out8(0x3d5, cr66, par);
1290 vga_out8 (0x3d4, 0x3a, par); 1460 vga_out8(0x3d4, 0x3a, par);
1291 vga_out8 (0x3d5, cr3a, par); 1461 vga_out8(0x3d5, cr3a, par);
1292 1462
1293 SavageSetup2DEngine (par); 1463 SavageSetup2DEngine(par);
1294 vgaHWProtect (par, 0); 1464 vgaHWProtect(par, 0);
1295} 1465}
1296 1466
1297static void savagefb_update_start (struct savagefb_par *par, 1467static void savagefb_update_start(struct savagefb_par *par,
1298 struct fb_var_screeninfo *var) 1468 struct fb_var_screeninfo *var)
1299{ 1469{
1300 int base; 1470 int base;
1301 1471
@@ -1305,8 +1475,8 @@ static void savagefb_update_start (struct savagefb_par *par,
1305 /* now program the start address registers */ 1475 /* now program the start address registers */
1306 vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par); 1476 vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par);
1307 vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par); 1477 vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par);
1308 vga_out8 (0x3d4, 0x69, par); 1478 vga_out8(0x3d4, 0x69, par);
1309 vga_out8 (0x3d5, (base & 0x7f0000) >> 16, par); 1479 vga_out8(0x3d5, (base & 0x7f0000) >> 16, par);
1310} 1480}
1311 1481
1312 1482
@@ -1325,29 +1495,14 @@ static void savagefb_set_fix(struct fb_info *info)
1325 1495
1326} 1496}
1327 1497
1328#if defined(CONFIG_FB_SAVAGE_ACCEL) 1498static int savagefb_set_par(struct fb_info *info)
1329static void savagefb_set_clip(struct fb_info *info)
1330{
1331 struct savagefb_par *par = info->par;
1332 int cmd;
1333
1334 cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW;
1335 par->bci_ptr = 0;
1336 par->SavageWaitFifo(par,3);
1337 BCI_SEND(cmd);
1338 BCI_SEND(BCI_CLIP_TL(0, 0));
1339 BCI_SEND(BCI_CLIP_BR(0xfff, 0xfff));
1340}
1341#endif
1342
1343static int savagefb_set_par (struct fb_info *info)
1344{ 1499{
1345 struct savagefb_par *par = info->par; 1500 struct savagefb_par *par = info->par;
1346 struct fb_var_screeninfo *var = &info->var; 1501 struct fb_var_screeninfo *var = &info->var;
1347 int err; 1502 int err;
1348 1503
1349 DBG("savagefb_set_par"); 1504 DBG("savagefb_set_par");
1350 err = savagefb_decode_var (var, par); 1505 err = savagefb_decode_var(var, par, &par->state);
1351 if (err) 1506 if (err)
1352 return err; 1507 return err;
1353 1508
@@ -1366,8 +1521,8 @@ static int savagefb_set_par (struct fb_info *info)
1366 par->maxClock = par->dacSpeedBpp; 1521 par->maxClock = par->dacSpeedBpp;
1367 par->minClock = 10000; 1522 par->minClock = 10000;
1368 1523
1369 savagefb_set_par_int (par); 1524 savagefb_set_par_int(par, &par->state);
1370 fb_set_cmap (&info->cmap, info); 1525 fb_set_cmap(&info->cmap, info);
1371 savagefb_set_fix(info); 1526 savagefb_set_fix(info);
1372 savagefb_set_clip(info); 1527 savagefb_set_clip(info);
1373 1528
@@ -1378,12 +1533,12 @@ static int savagefb_set_par (struct fb_info *info)
1378/* 1533/*
1379 * Pan or Wrap the Display 1534 * Pan or Wrap the Display
1380 */ 1535 */
1381static int savagefb_pan_display (struct fb_var_screeninfo *var, 1536static int savagefb_pan_display(struct fb_var_screeninfo *var,
1382 struct fb_info *info) 1537 struct fb_info *info)
1383{ 1538{
1384 struct savagefb_par *par = info->par; 1539 struct savagefb_par *par = info->par;
1385 1540
1386 savagefb_update_start (par, var); 1541 savagefb_update_start(par, var);
1387 return 0; 1542 return 0;
1388} 1543}
1389 1544
@@ -1440,6 +1595,22 @@ static int savagefb_blank(int blank, struct fb_info *info)
1440 return (blank == FB_BLANK_NORMAL) ? 1 : 0; 1595 return (blank == FB_BLANK_NORMAL) ? 1 : 0;
1441} 1596}
1442 1597
1598static void savagefb_save_state(struct fb_info *info)
1599{
1600 struct savagefb_par *par = info->par;
1601
1602 savage_get_default_par(par, &par->save);
1603}
1604
1605static void savagefb_restore_state(struct fb_info *info)
1606{
1607 struct savagefb_par *par = info->par;
1608
1609 savagefb_blank(FB_BLANK_POWERDOWN, info);
1610 savage_set_default_par(par, &par->save);
1611 savagefb_blank(FB_BLANK_UNBLANK, info);
1612}
1613
1443static struct fb_ops savagefb_ops = { 1614static struct fb_ops savagefb_ops = {
1444 .owner = THIS_MODULE, 1615 .owner = THIS_MODULE,
1445 .fb_check_var = savagefb_check_var, 1616 .fb_check_var = savagefb_check_var,
@@ -1447,6 +1618,8 @@ static struct fb_ops savagefb_ops = {
1447 .fb_setcolreg = savagefb_setcolreg, 1618 .fb_setcolreg = savagefb_setcolreg,
1448 .fb_pan_display = savagefb_pan_display, 1619 .fb_pan_display = savagefb_pan_display,
1449 .fb_blank = savagefb_blank, 1620 .fb_blank = savagefb_blank,
1621 .fb_save_state = savagefb_save_state,
1622 .fb_restore_state = savagefb_restore_state,
1450#if defined(CONFIG_FB_SAVAGE_ACCEL) 1623#if defined(CONFIG_FB_SAVAGE_ACCEL)
1451 .fb_fillrect = savagefb_fillrect, 1624 .fb_fillrect = savagefb_fillrect,
1452 .fb_copyarea = savagefb_copyarea, 1625 .fb_copyarea = savagefb_copyarea,
@@ -1479,59 +1652,59 @@ static struct fb_var_screeninfo __devinitdata savagefb_var800x600x8 = {
1479 .vmode = FB_VMODE_NONINTERLACED 1652 .vmode = FB_VMODE_NONINTERLACED
1480}; 1653};
1481 1654
1482static void savage_enable_mmio (struct savagefb_par *par) 1655static void savage_enable_mmio(struct savagefb_par *par)
1483{ 1656{
1484 unsigned char val; 1657 unsigned char val;
1485 1658
1486 DBG ("savage_enable_mmio\n"); 1659 DBG("savage_enable_mmio\n");
1487 1660
1488 val = vga_in8 (0x3c3, par); 1661 val = vga_in8(0x3c3, par);
1489 vga_out8 (0x3c3, val | 0x01, par); 1662 vga_out8(0x3c3, val | 0x01, par);
1490 val = vga_in8 (0x3cc, par); 1663 val = vga_in8(0x3cc, par);
1491 vga_out8 (0x3c2, val | 0x01, par); 1664 vga_out8(0x3c2, val | 0x01, par);
1492 1665
1493 if (par->chip >= S3_SAVAGE4) { 1666 if (par->chip >= S3_SAVAGE4) {
1494 vga_out8 (0x3d4, 0x40, par); 1667 vga_out8(0x3d4, 0x40, par);
1495 val = vga_in8 (0x3d5, par); 1668 val = vga_in8(0x3d5, par);
1496 vga_out8 (0x3d5, val | 1, par); 1669 vga_out8(0x3d5, val | 1, par);
1497 } 1670 }
1498} 1671}
1499 1672
1500 1673
1501static void savage_disable_mmio (struct savagefb_par *par) 1674static void savage_disable_mmio(struct savagefb_par *par)
1502{ 1675{
1503 unsigned char val; 1676 unsigned char val;
1504 1677
1505 DBG ("savage_disable_mmio\n"); 1678 DBG("savage_disable_mmio\n");
1506 1679
1507 if(par->chip >= S3_SAVAGE4 ) { 1680 if (par->chip >= S3_SAVAGE4) {
1508 vga_out8 (0x3d4, 0x40, par); 1681 vga_out8(0x3d4, 0x40, par);
1509 val = vga_in8 (0x3d5, par); 1682 val = vga_in8(0x3d5, par);
1510 vga_out8 (0x3d5, val | 1, par); 1683 vga_out8(0x3d5, val | 1, par);
1511 } 1684 }
1512} 1685}
1513 1686
1514 1687
1515static int __devinit savage_map_mmio (struct fb_info *info) 1688static int __devinit savage_map_mmio(struct fb_info *info)
1516{ 1689{
1517 struct savagefb_par *par = info->par; 1690 struct savagefb_par *par = info->par;
1518 DBG ("savage_map_mmio"); 1691 DBG("savage_map_mmio");
1519 1692
1520 if (S3_SAVAGE3D_SERIES (par->chip)) 1693 if (S3_SAVAGE3D_SERIES(par->chip))
1521 par->mmio.pbase = pci_resource_start (par->pcidev, 0) + 1694 par->mmio.pbase = pci_resource_start(par->pcidev, 0) +
1522 SAVAGE_NEWMMIO_REGBASE_S3; 1695 SAVAGE_NEWMMIO_REGBASE_S3;
1523 else 1696 else
1524 par->mmio.pbase = pci_resource_start (par->pcidev, 0) + 1697 par->mmio.pbase = pci_resource_start(par->pcidev, 0) +
1525 SAVAGE_NEWMMIO_REGBASE_S4; 1698 SAVAGE_NEWMMIO_REGBASE_S4;
1526 1699
1527 par->mmio.len = SAVAGE_NEWMMIO_REGSIZE; 1700 par->mmio.len = SAVAGE_NEWMMIO_REGSIZE;
1528 1701
1529 par->mmio.vbase = ioremap (par->mmio.pbase, par->mmio.len); 1702 par->mmio.vbase = ioremap(par->mmio.pbase, par->mmio.len);
1530 if (!par->mmio.vbase) { 1703 if (!par->mmio.vbase) {
1531 printk ("savagefb: unable to map memory mapped IO\n"); 1704 printk("savagefb: unable to map memory mapped IO\n");
1532 return -ENOMEM; 1705 return -ENOMEM;
1533 } else 1706 } else
1534 printk (KERN_INFO "savagefb: mapped io at %p\n", 1707 printk(KERN_INFO "savagefb: mapped io at %p\n",
1535 par->mmio.vbase); 1708 par->mmio.vbase);
1536 1709
1537 info->fix.mmio_start = par->mmio.pbase; 1710 info->fix.mmio_start = par->mmio.pbase;
@@ -1540,15 +1713,15 @@ static int __devinit savage_map_mmio (struct fb_info *info)
1540 par->bci_base = (u32 __iomem *)(par->mmio.vbase + BCI_BUFFER_OFFSET); 1713 par->bci_base = (u32 __iomem *)(par->mmio.vbase + BCI_BUFFER_OFFSET);
1541 par->bci_ptr = 0; 1714 par->bci_ptr = 0;
1542 1715
1543 savage_enable_mmio (par); 1716 savage_enable_mmio(par);
1544 1717
1545 return 0; 1718 return 0;
1546} 1719}
1547 1720
1548static void savage_unmap_mmio (struct fb_info *info) 1721static void savage_unmap_mmio(struct fb_info *info)
1549{ 1722{
1550 struct savagefb_par *par = info->par; 1723 struct savagefb_par *par = info->par;
1551 DBG ("savage_unmap_mmio"); 1724 DBG("savage_unmap_mmio");
1552 1725
1553 savage_disable_mmio(par); 1726 savage_disable_mmio(par);
1554 1727
@@ -1558,46 +1731,46 @@ static void savage_unmap_mmio (struct fb_info *info)
1558 } 1731 }
1559} 1732}
1560 1733
1561static int __devinit savage_map_video (struct fb_info *info, 1734static int __devinit savage_map_video(struct fb_info *info,
1562 int video_len) 1735 int video_len)
1563{ 1736{
1564 struct savagefb_par *par = info->par; 1737 struct savagefb_par *par = info->par;
1565 int resource; 1738 int resource;
1566 1739
1567 DBG("savage_map_video"); 1740 DBG("savage_map_video");
1568 1741
1569 if (S3_SAVAGE3D_SERIES (par->chip)) 1742 if (S3_SAVAGE3D_SERIES(par->chip))
1570 resource = 0; 1743 resource = 0;
1571 else 1744 else
1572 resource = 1; 1745 resource = 1;
1573 1746
1574 par->video.pbase = pci_resource_start (par->pcidev, resource); 1747 par->video.pbase = pci_resource_start(par->pcidev, resource);
1575 par->video.len = video_len; 1748 par->video.len = video_len;
1576 par->video.vbase = ioremap (par->video.pbase, par->video.len); 1749 par->video.vbase = ioremap(par->video.pbase, par->video.len);
1577 1750
1578 if (!par->video.vbase) { 1751 if (!par->video.vbase) {
1579 printk ("savagefb: unable to map screen memory\n"); 1752 printk("savagefb: unable to map screen memory\n");
1580 return -ENOMEM; 1753 return -ENOMEM;
1581 } else 1754 } else
1582 printk (KERN_INFO "savagefb: mapped framebuffer at %p, " 1755 printk(KERN_INFO "savagefb: mapped framebuffer at %p, "
1583 "pbase == %x\n", par->video.vbase, par->video.pbase); 1756 "pbase == %x\n", par->video.vbase, par->video.pbase);
1584 1757
1585 info->fix.smem_start = par->video.pbase; 1758 info->fix.smem_start = par->video.pbase;
1586 info->fix.smem_len = par->video.len - par->cob_size; 1759 info->fix.smem_len = par->video.len - par->cob_size;
1587 info->screen_base = par->video.vbase; 1760 info->screen_base = par->video.vbase;
1588 1761
1589#ifdef CONFIG_MTRR 1762#ifdef CONFIG_MTRR
1590 par->video.mtrr = mtrr_add (par->video.pbase, video_len, 1763 par->video.mtrr = mtrr_add(par->video.pbase, video_len,
1591 MTRR_TYPE_WRCOMB, 1); 1764 MTRR_TYPE_WRCOMB, 1);
1592#endif 1765#endif
1593 1766
1594 /* Clear framebuffer, it's all white in memory after boot */ 1767 /* Clear framebuffer, it's all white in memory after boot */
1595 memset_io (par->video.vbase, 0, par->video.len); 1768 memset_io(par->video.vbase, 0, par->video.len);
1596 1769
1597 return 0; 1770 return 0;
1598} 1771}
1599 1772
1600static void savage_unmap_video (struct fb_info *info) 1773static void savage_unmap_video(struct fb_info *info)
1601{ 1774{
1602 struct savagefb_par *par = info->par; 1775 struct savagefb_par *par = info->par;
1603 1776
@@ -1605,16 +1778,16 @@ static void savage_unmap_video (struct fb_info *info)
1605 1778
1606 if (par->video.vbase) { 1779 if (par->video.vbase) {
1607#ifdef CONFIG_MTRR 1780#ifdef CONFIG_MTRR
1608 mtrr_del (par->video.mtrr, par->video.pbase, par->video.len); 1781 mtrr_del(par->video.mtrr, par->video.pbase, par->video.len);
1609#endif 1782#endif
1610 1783
1611 iounmap (par->video.vbase); 1784 iounmap(par->video.vbase);
1612 par->video.vbase = NULL; 1785 par->video.vbase = NULL;
1613 info->screen_base = NULL; 1786 info->screen_base = NULL;
1614 } 1787 }
1615} 1788}
1616 1789
1617static int savage_init_hw (struct savagefb_par *par) 1790static int savage_init_hw(struct savagefb_par *par)
1618{ 1791{
1619 unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp; 1792 unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp;
1620 1793
@@ -1656,7 +1829,7 @@ static int savage_init_hw (struct savagefb_par *par)
1656 1829
1657 switch (par->chip) { 1830 switch (par->chip) {
1658 case S3_SAVAGE3D: 1831 case S3_SAVAGE3D:
1659 videoRam = RamSavage3D[ (config1 & 0xC0) >> 6 ] * 1024; 1832 videoRam = RamSavage3D[(config1 & 0xC0) >> 6 ] * 1024;
1660 break; 1833 break;
1661 1834
1662 case S3_SAVAGE4: 1835 case S3_SAVAGE4:
@@ -1667,22 +1840,22 @@ static int savage_init_hw (struct savagefb_par *par)
1667 * can do it different... 1840 * can do it different...
1668 */ 1841 */
1669 vga_out8(0x3d4, 0x68, par); /* memory control 1 */ 1842 vga_out8(0x3d4, 0x68, par); /* memory control 1 */
1670 if( (vga_in8(0x3d5, par) & 0xC0) == (0x01 << 6) ) 1843 if ((vga_in8(0x3d5, par) & 0xC0) == (0x01 << 6))
1671 RamSavage4[1] = 8; 1844 RamSavage4[1] = 8;
1672 1845
1673 /*FALLTHROUGH*/ 1846 /*FALLTHROUGH*/
1674 1847
1675 case S3_SAVAGE2000: 1848 case S3_SAVAGE2000:
1676 videoRam = RamSavage4[ (config1 & 0xE0) >> 5 ] * 1024; 1849 videoRam = RamSavage4[(config1 & 0xE0) >> 5] * 1024;
1677 break; 1850 break;
1678 1851
1679 case S3_SAVAGE_MX: 1852 case S3_SAVAGE_MX:
1680 case S3_SUPERSAVAGE: 1853 case S3_SUPERSAVAGE:
1681 videoRam = RamSavageMX[ (config1 & 0x0E) >> 1 ] * 1024; 1854 videoRam = RamSavageMX[(config1 & 0x0E) >> 1] * 1024;
1682 break; 1855 break;
1683 1856
1684 case S3_PROSAVAGE: 1857 case S3_PROSAVAGE:
1685 videoRam = RamSavageNB[ (config1 & 0xE0) >> 5 ] * 1024; 1858 videoRam = RamSavageNB[(config1 & 0xE0) >> 5] * 1024;
1686 break; 1859 break;
1687 1860
1688 default: 1861 default:
@@ -1693,31 +1866,31 @@ static int savage_init_hw (struct savagefb_par *par)
1693 1866
1694 videoRambytes = videoRam * 1024; 1867 videoRambytes = videoRam * 1024;
1695 1868
1696 printk (KERN_INFO "savagefb: probed videoram: %dk\n", videoRam); 1869 printk(KERN_INFO "savagefb: probed videoram: %dk\n", videoRam);
1697 1870
1698 /* reset graphics engine to avoid memory corruption */ 1871 /* reset graphics engine to avoid memory corruption */
1699 vga_out8 (0x3d4, 0x66, par); 1872 vga_out8(0x3d4, 0x66, par);
1700 cr66 = vga_in8 (0x3d5, par); 1873 cr66 = vga_in8(0x3d5, par);
1701 vga_out8 (0x3d5, cr66 | 0x02, par); 1874 vga_out8(0x3d5, cr66 | 0x02, par);
1702 udelay (10000); 1875 udelay(10000);
1703 1876
1704 vga_out8 (0x3d4, 0x66, par); 1877 vga_out8(0x3d4, 0x66, par);
1705 vga_out8 (0x3d5, cr66 & ~0x02, par); /* clear reset flag */ 1878 vga_out8(0x3d5, cr66 & ~0x02, par); /* clear reset flag */
1706 udelay (10000); 1879 udelay(10000);
1707 1880
1708 1881
1709 /* 1882 /*
1710 * reset memory interface, 3D engine, AGP master, PCI master, 1883 * reset memory interface, 3D engine, AGP master, PCI master,
1711 * master engine unit, motion compensation/LPB 1884 * master engine unit, motion compensation/LPB
1712 */ 1885 */
1713 vga_out8 (0x3d4, 0x3f, par); 1886 vga_out8(0x3d4, 0x3f, par);
1714 cr3f = vga_in8 (0x3d5, par); 1887 cr3f = vga_in8(0x3d5, par);
1715 vga_out8 (0x3d5, cr3f | 0x08, par); 1888 vga_out8(0x3d5, cr3f | 0x08, par);
1716 udelay (10000); 1889 udelay(10000);
1717 1890
1718 vga_out8 (0x3d4, 0x3f, par); 1891 vga_out8(0x3d4, 0x3f, par);
1719 vga_out8 (0x3d5, cr3f & ~0x08, par); /* clear reset flags */ 1892 vga_out8(0x3d5, cr3f & ~0x08, par); /* clear reset flags */
1720 udelay (10000); 1893 udelay(10000);
1721 1894
1722 /* Savage ramdac speeds */ 1895 /* Savage ramdac speeds */
1723 par->numClocks = 4; 1896 par->numClocks = 4;
@@ -1740,7 +1913,7 @@ static int savage_init_hw (struct savagefb_par *par)
1740 n1 = n & 0x1f; 1913 n1 = n & 0x1f;
1741 n2 = (n >> 5) & 0x03; 1914 n2 = (n >> 5) & 0x03;
1742 par->MCLK = ((1431818 * (m+2)) / (n1+2) / (1 << n2) + 50) / 100; 1915 par->MCLK = ((1431818 * (m+2)) / (n1+2) / (1 << n2) + 50) / 100;
1743 printk (KERN_INFO "savagefb: Detected current MCLK value of %d kHz\n", 1916 printk(KERN_INFO "savagefb: Detected current MCLK value of %d kHz\n",
1744 par->MCLK); 1917 par->MCLK);
1745 1918
1746 /* check for DVI/flat panel */ 1919 /* check for DVI/flat panel */
@@ -1769,12 +1942,12 @@ static int savage_init_hw (struct savagefb_par *par)
1769 /* Check LCD panel parrmation */ 1942 /* Check LCD panel parrmation */
1770 1943
1771 if (par->display_type == DISP_LCD) { 1944 if (par->display_type == DISP_LCD) {
1772 unsigned char cr6b = VGArCR( 0x6b, par); 1945 unsigned char cr6b = VGArCR(0x6b, par);
1773 1946
1774 int panelX = (VGArSEQ (0x61, par) + 1947 int panelX = (VGArSEQ(0x61, par) +
1775 ((VGArSEQ (0x66, par) & 0x02) << 7) + 1) * 8; 1948 ((VGArSEQ(0x66, par) & 0x02) << 7) + 1) * 8;
1776 int panelY = (VGArSEQ (0x69, par) + 1949 int panelY = (VGArSEQ(0x69, par) +
1777 ((VGArSEQ (0x6e, par) & 0x70) << 4) + 1); 1950 ((VGArSEQ(0x6e, par) & 0x70) << 4) + 1);
1778 1951
1779 char * sTechnology = "Unknown"; 1952 char * sTechnology = "Unknown";
1780 1953
@@ -1796,26 +1969,26 @@ static int savage_init_hw (struct savagefb_par *par)
1796 ActiveDUO = 0x80 1969 ActiveDUO = 0x80
1797 }; 1970 };
1798 1971
1799 if ((VGArSEQ (0x39, par) & 0x03) == 0) { 1972 if ((VGArSEQ(0x39, par) & 0x03) == 0) {
1800 sTechnology = "TFT"; 1973 sTechnology = "TFT";
1801 } else if ((VGArSEQ (0x30, par) & 0x01) == 0) { 1974 } else if ((VGArSEQ(0x30, par) & 0x01) == 0) {
1802 sTechnology = "DSTN"; 1975 sTechnology = "DSTN";
1803 } else { 1976 } else {
1804 sTechnology = "STN"; 1977 sTechnology = "STN";
1805 } 1978 }
1806 1979
1807 printk (KERN_INFO "savagefb: %dx%d %s LCD panel detected %s\n", 1980 printk(KERN_INFO "savagefb: %dx%d %s LCD panel detected %s\n",
1808 panelX, panelY, sTechnology, 1981 panelX, panelY, sTechnology,
1809 cr6b & ActiveLCD ? "and active" : "but not active"); 1982 cr6b & ActiveLCD ? "and active" : "but not active");
1810 1983
1811 if( cr6b & ActiveLCD ) { 1984 if (cr6b & ActiveLCD) {
1812 /* 1985 /*
1813 * If the LCD is active and panel expansion is enabled, 1986 * If the LCD is active and panel expansion is enabled,
1814 * we probably want to kill the HW cursor. 1987 * we probably want to kill the HW cursor.
1815 */ 1988 */
1816 1989
1817 printk (KERN_INFO "savagefb: Limiting video mode to " 1990 printk(KERN_INFO "savagefb: Limiting video mode to "
1818 "%dx%d\n", panelX, panelY ); 1991 "%dx%d\n", panelX, panelY);
1819 1992
1820 par->SavagePanelWidth = panelX; 1993 par->SavagePanelWidth = panelX;
1821 par->SavagePanelHeight = panelY; 1994 par->SavagePanelHeight = panelY;
@@ -1824,9 +1997,10 @@ static int savage_init_hw (struct savagefb_par *par)
1824 par->display_type = DISP_CRT; 1997 par->display_type = DISP_CRT;
1825 } 1998 }
1826 1999
1827 savage_get_default_par (par); 2000 savage_get_default_par(par, &par->state);
2001 par->save = par->state;
1828 2002
1829 if( S3_SAVAGE4_SERIES(par->chip) ) { 2003 if (S3_SAVAGE4_SERIES(par->chip)) {
1830 /* 2004 /*
1831 * The Savage4 and ProSavage have COB coherency bugs which 2005 * The Savage4 and ProSavage have COB coherency bugs which
1832 * render the buffer useless. We disable it. 2006 * render the buffer useless. We disable it.
@@ -1845,9 +2019,9 @@ static int savage_init_hw (struct savagefb_par *par)
1845 return videoRambytes; 2019 return videoRambytes;
1846} 2020}
1847 2021
1848static int __devinit savage_init_fb_info (struct fb_info *info, 2022static int __devinit savage_init_fb_info(struct fb_info *info,
1849 struct pci_dev *dev, 2023 struct pci_dev *dev,
1850 const struct pci_device_id *id) 2024 const struct pci_device_id *id)
1851{ 2025{
1852 struct savagefb_par *par = info->par; 2026 struct savagefb_par *par = info->par;
1853 int err = 0; 2027 int err = 0;
@@ -1863,63 +2037,63 @@ static int __devinit savage_init_fb_info (struct fb_info *info,
1863 switch (info->fix.accel) { 2037 switch (info->fix.accel) {
1864 case FB_ACCEL_SUPERSAVAGE: 2038 case FB_ACCEL_SUPERSAVAGE:
1865 par->chip = S3_SUPERSAVAGE; 2039 par->chip = S3_SUPERSAVAGE;
1866 snprintf (info->fix.id, 16, "SuperSavage"); 2040 snprintf(info->fix.id, 16, "SuperSavage");
1867 break; 2041 break;
1868 case FB_ACCEL_SAVAGE4: 2042 case FB_ACCEL_SAVAGE4:
1869 par->chip = S3_SAVAGE4; 2043 par->chip = S3_SAVAGE4;
1870 snprintf (info->fix.id, 16, "Savage4"); 2044 snprintf(info->fix.id, 16, "Savage4");
1871 break; 2045 break;
1872 case FB_ACCEL_SAVAGE3D: 2046 case FB_ACCEL_SAVAGE3D:
1873 par->chip = S3_SAVAGE3D; 2047 par->chip = S3_SAVAGE3D;
1874 snprintf (info->fix.id, 16, "Savage3D"); 2048 snprintf(info->fix.id, 16, "Savage3D");
1875 break; 2049 break;
1876 case FB_ACCEL_SAVAGE3D_MV: 2050 case FB_ACCEL_SAVAGE3D_MV:
1877 par->chip = S3_SAVAGE3D; 2051 par->chip = S3_SAVAGE3D;
1878 snprintf (info->fix.id, 16, "Savage3D-MV"); 2052 snprintf(info->fix.id, 16, "Savage3D-MV");
1879 break; 2053 break;
1880 case FB_ACCEL_SAVAGE2000: 2054 case FB_ACCEL_SAVAGE2000:
1881 par->chip = S3_SAVAGE2000; 2055 par->chip = S3_SAVAGE2000;
1882 snprintf (info->fix.id, 16, "Savage2000"); 2056 snprintf(info->fix.id, 16, "Savage2000");
1883 break; 2057 break;
1884 case FB_ACCEL_SAVAGE_MX_MV: 2058 case FB_ACCEL_SAVAGE_MX_MV:
1885 par->chip = S3_SAVAGE_MX; 2059 par->chip = S3_SAVAGE_MX;
1886 snprintf (info->fix.id, 16, "Savage/MX-MV"); 2060 snprintf(info->fix.id, 16, "Savage/MX-MV");
1887 break; 2061 break;
1888 case FB_ACCEL_SAVAGE_MX: 2062 case FB_ACCEL_SAVAGE_MX:
1889 par->chip = S3_SAVAGE_MX; 2063 par->chip = S3_SAVAGE_MX;
1890 snprintf (info->fix.id, 16, "Savage/MX"); 2064 snprintf(info->fix.id, 16, "Savage/MX");
1891 break; 2065 break;
1892 case FB_ACCEL_SAVAGE_IX_MV: 2066 case FB_ACCEL_SAVAGE_IX_MV:
1893 par->chip = S3_SAVAGE_MX; 2067 par->chip = S3_SAVAGE_MX;
1894 snprintf (info->fix.id, 16, "Savage/IX-MV"); 2068 snprintf(info->fix.id, 16, "Savage/IX-MV");
1895 break; 2069 break;
1896 case FB_ACCEL_SAVAGE_IX: 2070 case FB_ACCEL_SAVAGE_IX:
1897 par->chip = S3_SAVAGE_MX; 2071 par->chip = S3_SAVAGE_MX;
1898 snprintf (info->fix.id, 16, "Savage/IX"); 2072 snprintf(info->fix.id, 16, "Savage/IX");
1899 break; 2073 break;
1900 case FB_ACCEL_PROSAVAGE_PM: 2074 case FB_ACCEL_PROSAVAGE_PM:
1901 par->chip = S3_PROSAVAGE; 2075 par->chip = S3_PROSAVAGE;
1902 snprintf (info->fix.id, 16, "ProSavagePM"); 2076 snprintf(info->fix.id, 16, "ProSavagePM");
1903 break; 2077 break;
1904 case FB_ACCEL_PROSAVAGE_KM: 2078 case FB_ACCEL_PROSAVAGE_KM:
1905 par->chip = S3_PROSAVAGE; 2079 par->chip = S3_PROSAVAGE;
1906 snprintf (info->fix.id, 16, "ProSavageKM"); 2080 snprintf(info->fix.id, 16, "ProSavageKM");
1907 break; 2081 break;
1908 case FB_ACCEL_S3TWISTER_P: 2082 case FB_ACCEL_S3TWISTER_P:
1909 par->chip = S3_PROSAVAGE; 2083 par->chip = S3_PROSAVAGE;
1910 snprintf (info->fix.id, 16, "TwisterP"); 2084 snprintf(info->fix.id, 16, "TwisterP");
1911 break; 2085 break;
1912 case FB_ACCEL_S3TWISTER_K: 2086 case FB_ACCEL_S3TWISTER_K:
1913 par->chip = S3_PROSAVAGE; 2087 par->chip = S3_PROSAVAGE;
1914 snprintf (info->fix.id, 16, "TwisterK"); 2088 snprintf(info->fix.id, 16, "TwisterK");
1915 break; 2089 break;
1916 case FB_ACCEL_PROSAVAGE_DDR: 2090 case FB_ACCEL_PROSAVAGE_DDR:
1917 par->chip = S3_PROSAVAGE; 2091 par->chip = S3_PROSAVAGE;
1918 snprintf (info->fix.id, 16, "ProSavageDDR"); 2092 snprintf(info->fix.id, 16, "ProSavageDDR");
1919 break; 2093 break;
1920 case FB_ACCEL_PROSAVAGE_DDRK: 2094 case FB_ACCEL_PROSAVAGE_DDRK:
1921 par->chip = S3_PROSAVAGE; 2095 par->chip = S3_PROSAVAGE;
1922 snprintf (info->fix.id, 16, "ProSavage8"); 2096 snprintf(info->fix.id, 16, "ProSavage8");
1923 break; 2097 break;
1924 } 2098 }
1925 2099
@@ -1960,7 +2134,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info,
1960 info->pixmap.buf_align = 4; 2134 info->pixmap.buf_align = 4;
1961 info->pixmap.access_align = 32; 2135 info->pixmap.access_align = 32;
1962 2136
1963 err = fb_alloc_cmap (&info->cmap, NR_PALETTE, 0); 2137 err = fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
1964 if (!err) 2138 if (!err)
1965 info->flags |= FBINFO_HWACCEL_COPYAREA | 2139 info->flags |= FBINFO_HWACCEL_COPYAREA |
1966 FBINFO_HWACCEL_FILLRECT | 2140 FBINFO_HWACCEL_FILLRECT |
@@ -1972,8 +2146,8 @@ static int __devinit savage_init_fb_info (struct fb_info *info,
1972 2146
1973/* --------------------------------------------------------------------- */ 2147/* --------------------------------------------------------------------- */
1974 2148
1975static int __devinit savagefb_probe (struct pci_dev* dev, 2149static int __devinit savagefb_probe(struct pci_dev* dev,
1976 const struct pci_device_id* id) 2150 const struct pci_device_id* id)
1977{ 2151{
1978 struct fb_info *info; 2152 struct fb_info *info;
1979 struct savagefb_par *par; 2153 struct savagefb_par *par;
@@ -2085,12 +2259,12 @@ static int __devinit savagefb_probe (struct pci_dev* dev,
2085 fb_destroy_modedb(info->monspecs.modedb); 2259 fb_destroy_modedb(info->monspecs.modedb);
2086 info->monspecs.modedb = NULL; 2260 info->monspecs.modedb = NULL;
2087 2261
2088 err = register_framebuffer (info); 2262 err = register_framebuffer(info);
2089 if (err < 0) 2263 if (err < 0)
2090 goto failed; 2264 goto failed;
2091 2265
2092 printk (KERN_INFO "fb: S3 %s frame buffer device\n", 2266 printk(KERN_INFO "fb: S3 %s frame buffer device\n",
2093 info->fix.id); 2267 info->fix.id);
2094 2268
2095 /* 2269 /*
2096 * Our driver data 2270 * Our driver data
@@ -2103,10 +2277,10 @@ static int __devinit savagefb_probe (struct pci_dev* dev,
2103#ifdef CONFIG_FB_SAVAGE_I2C 2277#ifdef CONFIG_FB_SAVAGE_I2C
2104 savagefb_delete_i2c_busses(info); 2278 savagefb_delete_i2c_busses(info);
2105#endif 2279#endif
2106 fb_alloc_cmap (&info->cmap, 0, 0); 2280 fb_alloc_cmap(&info->cmap, 0, 0);
2107 savage_unmap_video(info); 2281 savage_unmap_video(info);
2108 failed_video: 2282 failed_video:
2109 savage_unmap_mmio (info); 2283 savage_unmap_mmio(info);
2110 failed_mmio: 2284 failed_mmio:
2111 kfree(info->pixmap.addr); 2285 kfree(info->pixmap.addr);
2112 failed_init: 2286 failed_init:
@@ -2117,7 +2291,7 @@ static int __devinit savagefb_probe (struct pci_dev* dev,
2117 return err; 2291 return err;
2118} 2292}
2119 2293
2120static void __devexit savagefb_remove (struct pci_dev *dev) 2294static void __devexit savagefb_remove(struct pci_dev *dev)
2121{ 2295{
2122 struct fb_info *info = pci_get_drvdata(dev); 2296 struct fb_info *info = pci_get_drvdata(dev);
2123 2297
@@ -2129,16 +2303,16 @@ static void __devexit savagefb_remove (struct pci_dev *dev)
2129 * we will be leaving hooks that could cause 2303 * we will be leaving hooks that could cause
2130 * oopsen laying around. 2304 * oopsen laying around.
2131 */ 2305 */
2132 if (unregister_framebuffer (info)) 2306 if (unregister_framebuffer(info))
2133 printk (KERN_WARNING "savagefb: danger danger! " 2307 printk(KERN_WARNING "savagefb: danger danger! "
2134 "Oopsen imminent!\n"); 2308 "Oopsen imminent!\n");
2135 2309
2136#ifdef CONFIG_FB_SAVAGE_I2C 2310#ifdef CONFIG_FB_SAVAGE_I2C
2137 savagefb_delete_i2c_busses(info); 2311 savagefb_delete_i2c_busses(info);
2138#endif 2312#endif
2139 fb_alloc_cmap (&info->cmap, 0, 0); 2313 fb_alloc_cmap(&info->cmap, 0, 0);
2140 savage_unmap_video (info); 2314 savage_unmap_video(info);
2141 savage_unmap_mmio (info); 2315 savage_unmap_mmio(info);
2142 kfree(info->pixmap.addr); 2316 kfree(info->pixmap.addr);
2143 pci_release_regions(dev); 2317 pci_release_regions(dev);
2144 framebuffer_release(info); 2318 framebuffer_release(info);
@@ -2151,7 +2325,7 @@ static void __devexit savagefb_remove (struct pci_dev *dev)
2151 } 2325 }
2152} 2326}
2153 2327
2154static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) 2328static int savagefb_suspend(struct pci_dev* dev, pm_message_t state)
2155{ 2329{
2156 struct fb_info *info = pci_get_drvdata(dev); 2330 struct fb_info *info = pci_get_drvdata(dev);
2157 struct savagefb_par *par = info->par; 2331 struct savagefb_par *par = info->par;
@@ -2177,6 +2351,7 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
2177 info->fbops->fb_sync(info); 2351 info->fbops->fb_sync(info);
2178 2352
2179 savagefb_blank(FB_BLANK_POWERDOWN, info); 2353 savagefb_blank(FB_BLANK_POWERDOWN, info);
2354 savage_set_default_par(par, &par->save);
2180 savage_disable_mmio(par); 2355 savage_disable_mmio(par);
2181 pci_save_state(dev); 2356 pci_save_state(dev);
2182 pci_disable_device(dev); 2357 pci_disable_device(dev);
@@ -2186,7 +2361,7 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
2186 return 0; 2361 return 0;
2187} 2362}
2188 2363
2189static int savagefb_resume (struct pci_dev* dev) 2364static int savagefb_resume(struct pci_dev* dev)
2190{ 2365{
2191 struct fb_info *info = pci_get_drvdata(dev); 2366 struct fb_info *info = pci_get_drvdata(dev);
2192 struct savagefb_par *par = info->par; 2367 struct savagefb_par *par = info->par;
@@ -2210,15 +2385,15 @@ static int savagefb_resume (struct pci_dev* dev)
2210 pci_set_power_state(dev, PCI_D0); 2385 pci_set_power_state(dev, PCI_D0);
2211 pci_restore_state(dev); 2386 pci_restore_state(dev);
2212 2387
2213 if(pci_enable_device(dev)) 2388 if (pci_enable_device(dev))
2214 DBG("err"); 2389 DBG("err");
2215 2390
2216 pci_set_master(dev); 2391 pci_set_master(dev);
2217 savage_enable_mmio(par); 2392 savage_enable_mmio(par);
2218 savage_init_hw(par); 2393 savage_init_hw(par);
2219 savagefb_set_par (info); 2394 savagefb_set_par(info);
2395 fb_set_suspend(info, 0);
2220 savagefb_blank(FB_BLANK_UNBLANK, info); 2396 savagefb_blank(FB_BLANK_UNBLANK, info);
2221 fb_set_suspend (info, 0);
2222 release_console_sem(); 2397 release_console_sem();
2223 2398
2224 return 0; 2399 return 0;
@@ -2311,10 +2486,10 @@ static struct pci_driver savagefb_driver = {
2311 2486
2312/* **************************** exit-time only **************************** */ 2487/* **************************** exit-time only **************************** */
2313 2488
2314static void __exit savage_done (void) 2489static void __exit savage_done(void)
2315{ 2490{
2316 DBG("savage_done"); 2491 DBG("savage_done");
2317 pci_unregister_driver (&savagefb_driver); 2492 pci_unregister_driver(&savagefb_driver);
2318} 2493}
2319 2494
2320 2495
@@ -2345,7 +2520,7 @@ static int __init savagefb_init(void)
2345 return -ENODEV; 2520 return -ENODEV;
2346 2521
2347 savagefb_setup(option); 2522 savagefb_setup(option);
2348 return pci_register_driver (&savagefb_driver); 2523 return pci_register_driver(&savagefb_driver);
2349 2524
2350} 2525}
2351 2526
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 8adf5bf91eee..c63c0e721b82 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -275,7 +275,7 @@ sisfb_search_mode(char *name, BOOLEAN quiet)
275static void __devinit 275static void __devinit
276sisfb_get_vga_mode_from_kernel(void) 276sisfb_get_vga_mode_from_kernel(void)
277{ 277{
278#if (defined(__i386__) || defined(__x86_64__)) && defined(CONFIG_VIDEO_SELECT) 278#ifdef CONFIG_X86
279 char mymode[32]; 279 char mymode[32];
280 int mydepth = screen_info.lfb_depth; 280 int mydepth = screen_info.lfb_depth;
281 281
diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c
index 9b707771d757..67f429e93189 100644
--- a/drivers/video/skeletonfb.c
+++ b/drivers/video/skeletonfb.c
@@ -906,11 +906,6 @@ static void __exit xxxfb_exit(void)
906} 906}
907#endif 907#endif
908 908
909MODULE_LICENSE("GPL");
910module_init(xxxfb_init);
911module_exit(xxxfb_exit);
912
913
914 /* 909 /*
915 * Setup 910 * Setup
916 */ 911 */
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index 7398bd48ba6c..6c2c78ab9827 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -26,7 +26,6 @@
26#include <linux/selection.h> 26#include <linux/selection.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <video/tgafb.h> 28#include <video/tgafb.h>
29#include <linux/selection.h>
30 29
31/* 30/*
32 * Local functions. 31 * Local functions.
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index b0b9acfdd430..5718924b677f 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -51,7 +51,7 @@ static int inverse = 0;
51static int mtrr = 0; /* disable mtrr */ 51static int mtrr = 0; /* disable mtrr */
52static int vram_remap __initdata = 0; /* Set amount of memory to be used */ 52static int vram_remap __initdata = 0; /* Set amount of memory to be used */
53static int vram_total __initdata = 0; /* Set total amount of memory */ 53static int vram_total __initdata = 0; /* Set total amount of memory */
54static int pmi_setpal = 0; /* pmi for palette changes ??? */ 54static int pmi_setpal = 1; /* pmi for palette changes ??? */
55static int ypan = 0; /* 0..nothing, 1..ypan, 2..ywrap */ 55static int ypan = 0; /* 0..nothing, 1..ypan, 2..ywrap */
56static unsigned short *pmi_base = NULL; 56static unsigned short *pmi_base = NULL;
57static void (*pmi_start)(void); 57static void (*pmi_start)(void);
@@ -80,15 +80,30 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var,
80 return 0; 80 return 0;
81} 81}
82 82
83static void vesa_setpalette(int regno, unsigned red, unsigned green, 83static int vesa_setpalette(int regno, unsigned red, unsigned green,
84 unsigned blue) 84 unsigned blue)
85{ 85{
86 int shift = 16 - depth; 86 int shift = 16 - depth;
87 int err = -EINVAL;
88
89/*
90 * Try VGA registers first...
91 */
92 if (vga_compat) {
93 outb_p(regno, dac_reg);
94 outb_p(red >> shift, dac_val);
95 outb_p(green >> shift, dac_val);
96 outb_p(blue >> shift, dac_val);
97 err = 0;
98 }
87 99
88#ifdef __i386__ 100#ifdef __i386__
89 struct { u_char blue, green, red, pad; } entry; 101/*
102 * Fallback to the PMI....
103 */
104 if (err && pmi_setpal) {
105 struct { u_char blue, green, red, pad; } entry;
90 106
91 if (pmi_setpal) {
92 entry.red = red >> shift; 107 entry.red = red >> shift;
93 entry.green = green >> shift; 108 entry.green = green >> shift;
94 entry.blue = blue >> shift; 109 entry.blue = blue >> shift;
@@ -102,26 +117,19 @@ static void vesa_setpalette(int regno, unsigned red, unsigned green,
102 "d" (regno), /* EDX */ 117 "d" (regno), /* EDX */
103 "D" (&entry), /* EDI */ 118 "D" (&entry), /* EDI */
104 "S" (&pmi_pal)); /* ESI */ 119 "S" (&pmi_pal)); /* ESI */
105 return; 120 err = 0;
106 } 121 }
107#endif 122#endif
108 123
109/* 124 return err;
110 * without protected mode interface and if VGA compatible,
111 * try VGA registers...
112 */
113 if (vga_compat) {
114 outb_p(regno, dac_reg);
115 outb_p(red >> shift, dac_val);
116 outb_p(green >> shift, dac_val);
117 outb_p(blue >> shift, dac_val);
118 }
119} 125}
120 126
121static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, 127static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
122 unsigned blue, unsigned transp, 128 unsigned blue, unsigned transp,
123 struct fb_info *info) 129 struct fb_info *info)
124{ 130{
131 int err = 0;
132
125 /* 133 /*
126 * Set a single color register. The values supplied are 134 * Set a single color register. The values supplied are
127 * already rounded down to the hardware's capabilities 135 * already rounded down to the hardware's capabilities
@@ -133,7 +141,7 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
133 return 1; 141 return 1;
134 142
135 if (info->var.bits_per_pixel == 8) 143 if (info->var.bits_per_pixel == 8)
136 vesa_setpalette(regno,red,green,blue); 144 err = vesa_setpalette(regno,red,green,blue);
137 else if (regno < 16) { 145 else if (regno < 16) {
138 switch (info->var.bits_per_pixel) { 146 switch (info->var.bits_per_pixel) {
139 case 16: 147 case 16:
@@ -164,7 +172,7 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
164 } 172 }
165 } 173 }
166 174
167 return 0; 175 return err;
168} 176}
169 177
170static struct fb_ops vesafb_ops = { 178static struct fb_ops vesafb_ops = {
@@ -460,9 +468,7 @@ static struct platform_driver vesafb_driver = {
460 }, 468 },
461}; 469};
462 470
463static struct platform_device vesafb_device = { 471static struct platform_device *vesafb_device;
464 .name = "vesafb",
465};
466 472
467static int __init vesafb_init(void) 473static int __init vesafb_init(void)
468{ 474{
@@ -475,10 +481,19 @@ static int __init vesafb_init(void)
475 ret = platform_driver_register(&vesafb_driver); 481 ret = platform_driver_register(&vesafb_driver);
476 482
477 if (!ret) { 483 if (!ret) {
478 ret = platform_device_register(&vesafb_device); 484 vesafb_device = platform_device_alloc("vesafb", 0);
479 if (ret) 485
486 if (vesafb_device)
487 ret = platform_device_add(vesafb_device);
488 else
489 ret = -ENOMEM;
490
491 if (ret) {
492 platform_device_put(vesafb_device);
480 platform_driver_unregister(&vesafb_driver); 493 platform_driver_unregister(&vesafb_driver);
494 }
481 } 495 }
496
482 return ret; 497 return ret;
483} 498}
484module_init(vesafb_init); 499module_init(vesafb_init);
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c
index 77eed1fd9943..d073ffb6e1f9 100644
--- a/drivers/video/vfb.c
+++ b/drivers/video/vfb.c
@@ -398,12 +398,6 @@ static int __init vfb_setup(char *options)
398 * Initialisation 398 * Initialisation
399 */ 399 */
400 400
401static void vfb_platform_release(struct device *device)
402{
403 // This is called when the reference count goes to zero.
404 dev_err(device, "This driver is broken, please bug the authors so they will fix it.\n");
405}
406
407static int __init vfb_probe(struct platform_device *dev) 401static int __init vfb_probe(struct platform_device *dev)
408{ 402{
409 struct fb_info *info; 403 struct fb_info *info;
@@ -482,13 +476,7 @@ static struct platform_driver vfb_driver = {
482 }, 476 },
483}; 477};
484 478
485static struct platform_device vfb_device = { 479static struct platform_device *vfb_device;
486 .name = "vfb",
487 .id = 0,
488 .dev = {
489 .release = vfb_platform_release,
490 }
491};
492 480
493static int __init vfb_init(void) 481static int __init vfb_init(void)
494{ 482{
@@ -508,10 +496,19 @@ static int __init vfb_init(void)
508 ret = platform_driver_register(&vfb_driver); 496 ret = platform_driver_register(&vfb_driver);
509 497
510 if (!ret) { 498 if (!ret) {
511 ret = platform_device_register(&vfb_device); 499 vfb_device = platform_device_alloc("vfb", 0);
512 if (ret) 500
501 if (vfb_device)
502 ret = platform_device_add(vfb_device);
503 else
504 ret = -ENOMEM;
505
506 if (ret) {
507 platform_device_put(vfb_device);
513 platform_driver_unregister(&vfb_driver); 508 platform_driver_unregister(&vfb_driver);
509 }
514 } 510 }
511
515 return ret; 512 return ret;
516} 513}
517 514
@@ -520,7 +517,7 @@ module_init(vfb_init);
520#ifdef MODULE 517#ifdef MODULE
521static void __exit vfb_exit(void) 518static void __exit vfb_exit(void)
522{ 519{
523 platform_device_unregister(&vfb_device); 520 platform_device_unregister(vfb_device);
524 platform_driver_unregister(&vfb_driver); 521 platform_driver_unregister(&vfb_driver);
525} 522}
526 523
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index 4fd2a272e03d..3c404c9bd36c 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -1334,9 +1334,8 @@ static int vga16fb_setup(char *options)
1334} 1334}
1335#endif 1335#endif
1336 1336
1337static int __init vga16fb_probe(struct device *device) 1337static int __init vga16fb_probe(struct platform_device *dev)
1338{ 1338{
1339 struct platform_device *dev = to_platform_device(device);
1340 struct fb_info *info; 1339 struct fb_info *info;
1341 struct vga16fb_par *par; 1340 struct vga16fb_par *par;
1342 int i; 1341 int i;
@@ -1403,7 +1402,7 @@ static int __init vga16fb_probe(struct device *device)
1403 1402
1404 printk(KERN_INFO "fb%d: %s frame buffer device\n", 1403 printk(KERN_INFO "fb%d: %s frame buffer device\n",
1405 info->node, info->fix.id); 1404 info->node, info->fix.id);
1406 dev_set_drvdata(device, info); 1405 platform_set_drvdata(dev, info);
1407 1406
1408 return 0; 1407 return 0;
1409 1408
@@ -1417,9 +1416,9 @@ static int __init vga16fb_probe(struct device *device)
1417 return ret; 1416 return ret;
1418} 1417}
1419 1418
1420static int vga16fb_remove(struct device *device) 1419static int vga16fb_remove(struct platform_device *dev)
1421{ 1420{
1422 struct fb_info *info = dev_get_drvdata(device); 1421 struct fb_info *info = platform_get_drvdata(dev);
1423 1422
1424 if (info) { 1423 if (info) {
1425 unregister_framebuffer(info); 1424 unregister_framebuffer(info);
@@ -1432,16 +1431,15 @@ static int vga16fb_remove(struct device *device)
1432 return 0; 1431 return 0;
1433} 1432}
1434 1433
1435static struct device_driver vga16fb_driver = { 1434static struct platform_driver vga16fb_driver = {
1436 .name = "vga16fb",
1437 .bus = &platform_bus_type,
1438 .probe = vga16fb_probe, 1435 .probe = vga16fb_probe,
1439 .remove = vga16fb_remove, 1436 .remove = vga16fb_remove,
1437 .driver = {
1438 .name = "vga16fb",
1439 },
1440}; 1440};
1441 1441
1442static struct platform_device vga16fb_device = { 1442static struct platform_device *vga16fb_device;
1443 .name = "vga16fb",
1444};
1445 1443
1446static int __init vga16fb_init(void) 1444static int __init vga16fb_init(void)
1447{ 1445{
@@ -1454,12 +1452,20 @@ static int __init vga16fb_init(void)
1454 1452
1455 vga16fb_setup(option); 1453 vga16fb_setup(option);
1456#endif 1454#endif
1457 ret = driver_register(&vga16fb_driver); 1455 ret = platform_driver_register(&vga16fb_driver);
1458 1456
1459 if (!ret) { 1457 if (!ret) {
1460 ret = platform_device_register(&vga16fb_device); 1458 vga16fb_device = platform_device_alloc("vga16fb", 0);
1461 if (ret) 1459
1462 driver_unregister(&vga16fb_driver); 1460 if (vga16fb_device)
1461 ret = platform_device_add(vga16fb_device);
1462 else
1463 ret = -ENOMEM;
1464
1465 if (ret) {
1466 platform_device_put(vga16fb_device);
1467 platform_driver_unregister(&vga16fb_driver);
1468 }
1463 } 1469 }
1464 1470
1465 return ret; 1471 return ret;
@@ -1467,8 +1473,8 @@ static int __init vga16fb_init(void)
1467 1473
1468static void __exit vga16fb_exit(void) 1474static void __exit vga16fb_exit(void)
1469{ 1475{
1470 platform_device_unregister(&vga16fb_device); 1476 platform_device_unregister(vga16fb_device);
1471 driver_unregister(&vga16fb_driver); 1477 platform_driver_unregister(&vga16fb_driver);
1472} 1478}
1473 1479
1474MODULE_LICENSE("GPL"); 1480MODULE_LICENSE("GPL");