From: Samuel Thibault <Samuel.Thibault@ens-lyon.fr>

Some fixes for console blanking: on some laptops, doing VESA blanking after
the bios did an apm blanking because of a screen closure thrashes the
recovery (the video board doesn't seem to have synchronisation registers
correctly initialized, since the LCD panel progressively turns white, maybe
damaging it ?).

I hence moved the schedule for vesa powerdown after the apm blank hook
call, so that if it succeeds, it won't be called.  I also moved the apm
unblank & palette restoration after the vesa unblank, to have a more lifo
scheme (also required, or the screen remains black).

Btw, why del_timer_sync was called twice in timer_do_blank_screen when
vesa_off_interval==0 ?



 25-akpm/drivers/char/vt.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff -puN drivers/char/vt.c~console-blanking-fix drivers/char/vt.c
--- 25/drivers/char/vt.c~console-blanking-fix	Tue Jun  3 13:18:21 2003
+++ 25-akpm/drivers/char/vt.c	Tue Jun  3 13:18:26 2003
@@ -2712,14 +2712,7 @@ static void timer_do_blank_screen(int en
 	hide_cursor(currcons);
 	if (!from_timer_handler)
 		del_timer_sync(&console_timer);
-	if (vesa_off_interval) {
-		console_timer.function = vesa_powerdown_screen;
-		mod_timer(&console_timer, jiffies + vesa_off_interval);
-	} else {
-		if (!from_timer_handler)
-			del_timer_sync(&console_timer);
-		console_timer.function = unblank_screen_t;
-	}
+	console_timer.function = unblank_screen_t;
 
 	save_screen(currcons);
 	/* In case we need to reset origin, blanking hook returns 1 */
@@ -2730,6 +2723,12 @@ static void timer_do_blank_screen(int en
 
 	if (console_blank_hook && console_blank_hook(1))
 		return;
+
+	if (vesa_off_interval) {
+		console_timer.function = vesa_powerdown_screen;
+		mod_timer(&console_timer, jiffies + vesa_off_interval);
+	}
+
     	if (vesa_blank_mode)
 		sw->con_blank(vc_cons[currcons].d, vesa_blank_mode + 1);
 }
@@ -2771,12 +2770,12 @@ void unblank_screen(void)
 	}
 
 	console_blanked = 0;
-	if (console_blank_hook)
-		console_blank_hook(0);
-	set_palette(currcons);
 	if (sw->con_blank(vc_cons[currcons].d, 0))
 		/* Low-level driver cannot restore -> do it ourselves */
 		update_screen(fg_console);
+	if (console_blank_hook)
+		console_blank_hook(0);
+	set_palette(currcons);
 	set_cursor(fg_console);
 }
 

_