linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / video / neofb.c
index 59a6f5f..b961d56 100644 (file)
  *
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #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/fb.h>
@@ -163,20 +165,20 @@ static int neoFindMode(int xres, int yres, int depth)
 
        switch (depth) {
        case 8:
-               size = ARRAY_SIZE(bios8);
+               size = sizeof(bios8) / sizeof(biosMode);
                mode = bios8;
                break;
        case 16:
-               size = ARRAY_SIZE(bios16);
+               size = sizeof(bios16) / sizeof(biosMode);
                mode = bios16;
                break;
        case 24:
-               size = ARRAY_SIZE(bios24);
+               size = sizeof(bios24) / sizeof(biosMode);
                mode = bios24;
                break;
 #ifdef NO_32BIT_SUPPORT_YET
        case 32:
-               size = ARRAY_SIZE(bios32);
+               size = sizeof(bios32) / sizeof(biosMode);
                mode = bios32;
                break;
 #endif
@@ -1331,22 +1333,17 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
         *  run "setterm -powersave powerdown" to take advantage
         */
        struct neofb_par *par = info->par;
-       int seqflags, lcdflags, dpmsflags, reg, tmpdisp;
+       int seqflags, lcdflags, dpmsflags, reg;
 
-       /*
-        * Read back the register bits related to display configuration. They might
-        * have been changed underneath the driver via Fn key stroke.
-        */
-       neoUnlock();
-       tmpdisp = vga_rgfx(NULL, 0x20) & 0x03;
-       neoLock(&par->state);
 
-       /* In case we blank the screen, we want to store the possibly new
-        * configuration in the driver. During un-blank, we re-apply this setting,
-        * since the LCD bit will be cleared in order to switch off the backlight.
+       /*
+        * Reload the value stored in the register, if sensible. It might have
+        * been changed via FN keystroke.
         */
        if (par->PanelDispCntlRegRead) {
-               par->PanelDispCntlReg1 = tmpdisp;
+               neoUnlock();
+               par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
+               neoLock(&par->state);
        }
        par->PanelDispCntlRegRead = !blank_mode;
 
@@ -1381,21 +1378,12 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
                break;
        case FB_BLANK_NORMAL:           /* just blank screen (backlight stays on) */
                seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
-               /*
-                * During a blank operation with the LID shut, we might store "LCD off"
-                * by mistake. Due to timing issues, the BIOS may switch the lights
-                * back on, and we turn it back off once we "unblank".
-                *
-                * So here is an attempt to implement ">=" - if we are in the process
-                * of unblanking, and the LCD bit is unset in the driver but set in the
-                * register, we must keep it.
-                */
-               lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */
+               lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */
                dpmsflags = 0x00;       /* no hsync/vsync suppression */
                break;
        case FB_BLANK_UNBLANK:          /* unblank */
                seqflags = 0;                   /* Enable sequencer */
-               lcdflags = ((par->PanelDispCntlReg1 | tmpdisp) & 0x02); /* LCD normal */
+               lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */
                dpmsflags = 0x00;       /* no hsync/vsync suppression */
 #ifdef CONFIG_TOSHIBA
                /* Do we still need this ? */