Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / video / 68328fb.c
index 5e9bcf5..78488bb 100644 (file)
@@ -102,8 +102,7 @@ static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                         u_int transp, struct fb_info *info);
 static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
                           struct fb_info *info);
-static int mc68x328fb_mmap(struct fb_info *info, struct file *file,
-                   struct vm_area_struct *vma);
+static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma);
 
 static struct fb_ops mc68x328fb_ops = {
        .fb_check_var   = mc68x328fb_check_var,
@@ -113,7 +112,6 @@ static struct fb_ops mc68x328fb_ops = {
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = cfb_copyarea,
        .fb_imageblit   = cfb_imageblit,
-       .fb_cursor      = soft_cursor,
        .fb_mmap        = mc68x328fb_mmap,
 };
 
@@ -199,6 +197,15 @@ static int mc68x328fb_check_var(struct fb_var_screeninfo *var,
         */
        switch (var->bits_per_pixel) {
        case 1:
+               var->red.offset = 0;
+               var->red.length = 1;
+               var->green.offset = 0;
+               var->green.length = 1;
+               var->blue.offset = 0;
+               var->blue.length = 1;
+               var->transp.offset = 0;
+               var->transp.length = 0;
+               break;
        case 8:
                var->red.offset = 0;
                var->red.length = 8;
@@ -390,8 +397,7 @@ static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
      *  Most drivers don't need their own mmap function 
      */
 
-static int mc68x328fb_mmap(struct fb_info *info, struct file *file,
-                   struct vm_area_struct *vma)
+static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
 #ifndef MMU
        /* this is uClinux (no MMU) specific code */
@@ -430,6 +436,13 @@ int __init mc68x328fb_setup(char *options)
 
 int __init mc68x328fb_init(void)
 {
+#ifndef MODULE
+       char *option = NULL;
+
+       if (fb_get_options("68328fb", &option))
+               return -ENODEV;
+       mc68x328fb_setup(option);
+#endif
        /*
         *  initialize the default mode from the LCD controller registers
         */
@@ -452,8 +465,12 @@ int __init mc68x328fb_init(void)
                get_line_length(mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel);
        fb_info.fix.visual = (mc68x328fb_default.bits_per_pixel) == 1 ?
                MC68X328FB_MONO_VISUAL : FB_VISUAL_PSEUDOCOLOR;
+       if (fb_info.var.bits_per_pixel == 1) {
+               fb_info.var.red.length = fb_info.var.green.length = fb_info.var.blue.length = 1;
+               fb_info.var.red.offset = fb_info.var.green.offset = fb_info.var.blue.offset = 0;
+       }
        fb_info.pseudo_palette = &mc68x328fb_pseudo_palette;
-       fb_info.flags = FBINFO_FLAG_DEFAULT;
+       fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
 
        fb_alloc_cmap(&fb_info.cmap, 256, 0);
 
@@ -471,6 +488,8 @@ int __init mc68x328fb_init(void)
        return 0;
 }
 
+module_init(mc68x328fb_init);
+
 #ifdef MODULE
 
 static void __exit mc68x328fb_cleanup(void)
@@ -478,7 +497,6 @@ static void __exit mc68x328fb_cleanup(void)
        unregister_framebuffer(&fb_info);
 }
 
-module_init(mc68x328fb_init);
 module_exit(mc68x328fb_cleanup);
 
 MODULE_LICENSE("GPL");