drivers/video/msm: update to new kernel
[safe/jmp/linux-2.6] / drivers / video / sa1100fb.c
index ab2b211..cdaa873 100644 (file)
@@ -66,7 +66,7 @@
  *     - FrameBuffer memory is now allocated at run-time when the
  *       driver is initialized.    
  *
- * 2000/04/10: Nicolas Pitre <nico@cam.org>
+ * 2000/04/10: Nicolas Pitre <nico@fluxnic.net>
  *     - Big cleanup for dynamic selection of machine type at run time.
  *
  * 2000/07/19: Jamey Hicks <jamey@crl.dec.com>
  *     - convert dma address types to dma_addr_t
  *     - remove unused 'montype' stuff
  *     - remove redundant zero inits of init_var after the initial
- *       memzero.
+ *       memset.
  *     - remove allow_modeset (acornfb idea does not belong here)
  *
  * 2001/05/28: <rmk@arm.linux.org.uk>
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
+#include <linux/mm.h>
 #include <linux/fb.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
+#include <linux/mutex.h>
+#include <linux/io.h>
 
-#include <asm/hardware.h>
-#include <asm/io.h>
+#include <mach/hardware.h>
 #include <asm/mach-types.h>
-#include <asm/arch/assabet.h>
-#include <asm/arch/shannon.h>
+#include <mach/assabet.h>
+#include <mach/shannon.h>
 
 /*
  * debugging?
 extern void (*sa1100fb_backlight_power)(int on);
 extern void (*sa1100fb_lcd_power)(int on);
 
-/*
- * IMHO this looks wrong.  In 8BPP, length should be 8.
- */
-static struct sa1100fb_rgb rgb_8 = {
+static struct sa1100fb_rgb rgb_4 = {
        .red    = { .offset = 0,  .length = 4, },
        .green  = { .offset = 0,  .length = 4, },
        .blue   = { .offset = 0,  .length = 4, },
        .transp = { .offset = 0,  .length = 0, },
 };
 
+static struct sa1100fb_rgb rgb_8 = {
+       .red    = { .offset = 0,  .length = 8, },
+       .green  = { .offset = 0,  .length = 8, },
+       .blue   = { .offset = 0,  .length = 8, },
+       .transp = { .offset = 0,  .length = 0, },
+};
+
 static struct sa1100fb_rgb def_rgb_16 = {
        .red    = { .offset = 11, .length = 5, },
        .green  = { .offset = 5,  .length = 6, },
@@ -249,22 +255,6 @@ static struct sa1100fb_mach_info pal_info __initdata = {
 #endif
 #endif
 
-#ifdef CONFIG_SA1100_H3800
-static struct sa1100fb_mach_info h3800_info __initdata = {
-       .pixclock       = 174757,       .bpp            = 16,
-       .xres           = 320,          .yres           = 240,
-
-       .hsync_len      = 3,            .vsync_len      = 3,
-       .left_margin    = 12,           .upper_margin   = 10,
-       .right_margin   = 17,           .lower_margin   = 1,
-
-       .cmap_static    = 1,
-
-       .lccr0          = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
-       .lccr3          = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
-};
-#endif
-
 #ifdef CONFIG_SA1100_H3600
 static struct sa1100fb_mach_info h3600_info __initdata = {
        .pixclock       = 174757,       .bpp            = 16,
@@ -430,11 +420,6 @@ sa1100fb_get_machine_info(struct sa1100fb_info *fbi)
                fbi->rgb[RGB_16] = &h3600_rgb_16;
        }
 #endif
-#ifdef CONFIG_SA1100_H3800
-       if (machine_is_h3800()) {
-               inf = &h3800_info;
-       }
-#endif
 #ifdef CONFIG_SA1100_COLLIE
        if (machine_is_collie()) {
                inf = &collie_info;
@@ -632,7 +617,7 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel);
        switch (var->bits_per_pixel) {
        case 4:
-               rgbidx = RGB_8;
+               rgbidx = RGB_4;
                break;
        case 8:
                rgbidx = RGB_8;
@@ -1107,7 +1092,7 @@ static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state)
 {
        u_int old_state;
 
-       down(&fbi->ctrlr_sem);
+       mutex_lock(&fbi->ctrlr_lock);
 
        old_state = fbi->state;
 
@@ -1192,7 +1177,7 @@ static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state)
                }
                break;
        }
-       up(&fbi->ctrlr_sem);
+       mutex_unlock(&fbi->ctrlr_lock);
 }
 
 /*
@@ -1401,6 +1386,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
        fbi->fb.monspecs        = monspecs;
        fbi->fb.pseudo_palette  = (fbi + 1);
 
+       fbi->rgb[RGB_4]         = &rgb_4;
        fbi->rgb[RGB_8]         = &rgb_8;
        fbi->rgb[RGB_16]        = &def_rgb_16;
 
@@ -1444,7 +1430,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
 
        init_waitqueue_head(&fbi->ctrlr_wait);
        INIT_WORK(&fbi->task, sa1100fb_task);
-       init_MUTEX(&fbi->ctrlr_sem);
+       mutex_init(&fbi->ctrlr_lock);
 
        return fbi;
 }