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

Next file: linux/drivers/char/cs8420.h
Previous file: linux/drivers/char/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/drivers/char/console.c linux/drivers/char/console.c
@@ -95,6 +95,7 @@
 #include <linux/apm_bios.h>
 #endif
 #include <linux/bootmem.h>
+#include <linux/acpi.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -201,6 +202,11 @@
 #define DO_UPDATE IS_VISIBLE
 #endif
 
+static int acpi_con_transition(struct acpi_dev *dev, acpi_dstate_t state);
+static struct acpi_dev_info acpi_con_info
+	= {ACPI_SYS_DEV, ACPI_VGA_HID, acpi_con_transition};
+static struct acpi_dev *acpi_con = NULL;
+
 static inline unsigned short *screenpos(int currcons, int offset, int viewed)
 {
 	unsigned short *p;
@@ -654,6 +660,9 @@
 	    screenbuf = (unsigned short *) q;
 	    kmalloced = 1;
 	    vc_init(currcons, video_num_lines, video_num_columns, 1);
+
+	    if (!acpi_con)
+		    acpi_con = acpi_register(&acpi_con_info, 0);
 	}
 	return 0;
 }
@@ -1991,6 +2000,8 @@
 	if (!printable || test_and_set_bit(0, &printing))
 		return;
 
+	acpi_access(acpi_con);
+
 	if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1))
 		currcons = kmsg_redirect - 1;
 
@@ -2148,6 +2159,7 @@
 {
 	int	retval;
 
+	acpi_access(acpi_con);
 	retval = do_con_write(tty, from_user, buf, count);
 	con_flush_chars(tty);
 
@@ -2156,6 +2168,7 @@
 
 static void con_put_char(struct tty_struct *tty, unsigned char ch)
 {
+	acpi_access(acpi_con);
 	do_con_write(tty, 0, &ch, 1);
 }
 
@@ -2221,6 +2234,7 @@
 {
 	struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
 
+	acpi_access(acpi_con);
 	set_cursor(vt->vc_num);
 }
 
@@ -2806,6 +2820,21 @@
 	}
 }
 
+static int acpi_con_transition(struct acpi_dev *dev, acpi_dstate_t state)
+{
+	switch (state)
+	{
+	case ACPI_D0:
+		unblank_screen();
+		break;
+	case ACPI_D1:
+	case ACPI_D2:
+	case ACPI_D3:
+		do_blank_screen(0);
+		break;
+	}
+	return 0;
+}
 
 /*
  *	Visible symbols for modules

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)