fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / video / maxinefb.c
index 572ed22..38c8d38 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/mm.h>
-#include <linux/tty.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 static struct fb_info fb_info;
 
 static struct fb_var_screeninfo maxinefb_defined = {
-       .xres           = 1024,
-       .yres           = 768,
-       .xres_virtual   = 1024,
-       .yres_virtual   = 768,
-       .bits_per_pixel = 8,
-       .red.length     = 8,
-       .green.length   = 8,
-       .blue.length    = 8,
-       .activate       = FB_ACTIVATE_NOW,
-       .height         = -1,
-       .width          = -1,
-       .vmode          = FB_VMODE_NONINTERLACED,
+       .xres =         1024,
+       .yres =         768,
+       .xres_virtual = 1024,
+       .yres_virtual = 768,
+       .bits_per_pixel =8,
+       .activate =     FB_ACTIVATE_NOW,
+       .height =       -1,
+       .width =        -1,
+       .vmode =        FB_VMODE_NONINTERLACED,
 };
 
 static struct fb_fix_screeninfo maxinefb_fix = {
-       .id             = "Maxine onboard graphics 1024x768x8",
-       .smem_len       = (1024*768),
-       .type           = FB_TYPE_PACKED_PIXELS,
-       .visual         = FB_VISUAL_PSEUDOCOLOR,
-       .line_length    = 1024,
+       .id =           "Maxine",
+       .smem_len =     (1024*768),
+       .type =         FB_TYPE_PACKED_PIXELS,
+       .visual =       FB_VISUAL_PSEUDOCOLOR,
+       .line_length  1024,
 };
 
-/* Reference to machine type set in arch/mips/dec/prom/identify.c, KM */
-extern unsigned long mips_machtype;
-
 /* Handle the funny Inmos RamDAC/video controller ... */
 
 void maxinefb_ims332_write_register(int regno, register unsigned int val)
@@ -100,12 +93,12 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green,
        /* value to be written into the palette reg. */
        unsigned long hw_colorvalue = 0;
 
-       red   >>= 8;    /* The cmap fields are 16 bits    */
-       green >>= 8;    /* wide, but the harware colormap */
-       blue  >>= 8;    /* registers are only 8 bits wide */
+       red   >>= 8;    /* The cmap fields are 16 bits    */
+       green >>= 8;    /* wide, but the harware colormap */
+       blue  >>= 8;    /* registers are only 8 bits wide */
 
        hw_colorvalue = (blue << 16) + (green << 8) + (red);
-       
+
        maxinefb_ims332_write_register(IMS332_REG_COLOR_PALETTE + regno,
                                       hw_colorvalue);
        return 0;
@@ -113,19 +106,21 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green,
 
 static struct fb_ops maxinefb_ops = {
        .owner          = THIS_MODULE,
-       .fb_setcolreg   = maxinefb_setcolreg,   
+       .fb_setcolreg   = maxinefb_setcolreg,
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = cfb_copyarea,
-       .fb_imageblit   = cfb_imageblit,                
-       .fb_cursor      = soft_cursor,
+       .fb_imageblit   = cfb_imageblit,
 };
 
 int __init maxinefb_init(void)
 {
-       volatile unsigned char *fboff;
+       unsigned long fboff;
        unsigned long fb_start;
        int i;
 
+       if (fb_get_options("maxinefb", NULL))
+               return -ENODEV;
+
        /* Validate we're on the proper machine type */
        if (mips_machtype != MACH_DS5000_XX) {
                return -EINVAL;
@@ -139,7 +134,7 @@ int __init maxinefb_init(void)
 
        /* Clear screen */
        for (fboff = fb_start; fboff < fb_start + 0x1ffff; fboff++)
-               *fboff = 0x0;
+               *(volatile unsigned char *)fboff = 0x0;
 
        maxinefb_fix.smem_start = fb_start;
        
@@ -156,10 +151,10 @@ int __init maxinefb_init(void)
        }
 
        fb_info.fbops = &maxinefb_ops;
-       fb_info.screen_base = (char *) maxinefb_fix.smem_start;
+       fb_info.screen_base = (char *)maxinefb_fix.smem_start;
        fb_info.var = maxinefb_defined;
        fb_info.fix = maxinefb_fix;
-       fb_info.flags = FBINFO_FLAG_DEFAULT;
+       fb_info.flags = FBINFO_DEFAULT;
 
        fb_alloc_cmap(&fb_info.cmap, 256, 0);
 
@@ -175,7 +170,7 @@ static void __exit maxinefb_exit(void)
 
 #ifdef MODULE
 MODULE_LICENSE("GPL");
-module_init(maxinefb_init);
 #endif
+module_init(maxinefb_init);
 module_exit(maxinefb_exit);