patch-1.3.45 linux/drivers/char/console.c

Next file: linux/drivers/char/vesa_blank.c
Previous file: linux/drivers/cdrom/sjcd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.44/linux/drivers/char/console.c linux/drivers/char/console.c
@@ -134,6 +134,7 @@
 extern void register_console(void (*proc)(const char *));
 extern void vesa_blank(void);
 extern void vesa_unblank(void);
+extern void vesa_powerdown(void);
 extern void compute_shiftstate(void);
 extern void reset_palette(int currcons);
 extern void set_palette(void);
@@ -169,6 +170,7 @@
 
        int console_blanked = 0;
 static int blankinterval = 10*60*HZ;
+static int vesa_off_interval = 0;
 static long blank_origin, blank__origin, unblank_origin;
 
 struct vc vc_cons [MAX_NR_CONSOLES];
@@ -1150,6 +1152,9 @@
 		case 13: /* unblank the screen */
 			unblank_screen();
 			break;
+		case 14: /* set vesa powerdown interval */
+			vesa_off_interval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ;
+			break;
 	}
 }
 
@@ -1826,6 +1831,7 @@
 	if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
 		return;
 	if (console_blanked) {
+		timer_table[BLANK_TIMER].fn = unblank_screen;
 		timer_table[BLANK_TIMER].expires = 0;
 		timer_active |= 1<<BLANK_TIMER;
 	} else if (blankinterval) {
@@ -2058,6 +2064,14 @@
 	return kmem_start;
 }
 
+void vesa_powerdown_screen(void)
+{
+	timer_active &= ~(1<<BLANK_TIMER);
+	timer_table[BLANK_TIMER].fn = unblank_screen;
+
+	vesa_powerdown();
+}
+
 void do_blank_screen(int nopowersave)
 {
 	int currcons;
@@ -2065,8 +2079,14 @@
 	if (console_blanked)
 		return;
 
-	timer_active &= ~(1<<BLANK_TIMER);
-	timer_table[BLANK_TIMER].fn = unblank_screen;
+	if(vesa_off_interval && !nopowersave) {
+		timer_table[BLANK_TIMER].fn = vesa_powerdown_screen;
+		timer_table[BLANK_TIMER].expires = jiffies + vesa_off_interval;
+		timer_active |= (1<<BLANK_TIMER);
+	} else {
+		timer_active &= ~(1<<BLANK_TIMER);
+		timer_table[BLANK_TIMER].fn = unblank_screen;
+	}
 
 	/* try not to lose information by blanking, and not to waste memory */
 	currcons = fg_console;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this