From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>,
Patrick Mochel <mochel@osdl.org>
Subject: [PM] save/restore screen support for ACPI S3 sleep
Date: Sun, 27 Jul 2003 00:56:46 +0200 [thread overview]
Message-ID: <20030726225646.GA519@elf.ucw.cz> (raw)
Hi!
This way console should be correctly restored after S3...
[Prototype should be added to include/linux/suspend.h].
kernel/suspend.c part only moves code out of "SWSUSP_ONLY"
section.
Index: linux/drivers/acpi/sleep/main.c
===================================================================
--- linux.orig/drivers/acpi/sleep/main.c 2003-07-22 13:39:42.000000000 +0200
+++ linux/drivers/acpi/sleep/main.c 2003-07-22 12:53:27.000000000 +0200
@@ -226,6 +234,7 @@
if (state == ACPI_STATE_S4 && !acpi_gbl_FACS->S4bios_f)
return AE_ERROR;
+ prepare_suspend_console();
/*
* TBD: S1 can be done without device_suspend. Make a CONFIG_XX
* to handle however when S1 failed without device_suspend.
@@ -270,6 +279,7 @@
/* reset firmware waking vector */
acpi_set_firmware_waking_vector((acpi_physical_address) 0);
thaw_processes();
+ restore_console();
return status;
}
Index: linux/kernel/suspend.c
===================================================================
--- linux.orig/kernel/suspend.c 2003-07-22 13:39:43.000000000 +0200
+++ linux/kernel/suspend.c 2003-07-22 13:46:26.000000000 +0200
@@ -5,7 +5,7 @@
* machine suspend feature using pretty near only high-level routines
*
* Copyright (C) 1998-2001 Gabor Kuti <seasons@fornax.hu>
- * Copyright (C) 1998,2001,2002 Pavel Machek <pavel@suse.cz>
+ * Copyright (C) 1998,2001-2003 Pavel Machek <pavel@suse.cz>
*
* I'd like to thank the following people for their work:
*
@@ 1,-1 1,-1 @@
+int prepare_suspend_console(void)
+{
+ orig_loglevel = console_loglevel;
+ console_loglevel = new_loglevel;
+
+#ifdef CONFIG_VT
+ orig_fgconsole = fg_console;
+#ifdef SUSPEND_CONSOLE
+ if(vc_allocate(SUSPEND_CONSOLE))
+ /* we can't have a free VC for now. Too bad,
+ * we don't want to mess the screen for now. */
+ return 1;
+
+ set_console (SUSPEND_CONSOLE);
+ if (vt_waitactive(SUSPEND_CONSOLE)) {
+ printk(KERN_ERR "Bummer. Can't switch VCs.\n");
+ return 1;
+ }
+ orig_kmsg = kmsg_redirect;
+ kmsg_redirect = SUSPEND_CONSOLE;
+#endif
+#endif
+ return 0;
+}
+
+void restore_console(void)
+{
+ console_loglevel = orig_loglevel;
+#ifdef SUSPEND_CONSOLE
+ set_console (orig_fgconsole);
+#endif
+ return;
+}
+
+#ifdef CONFIG_SOFTWARE_SUSPEND
/*
* Saving part...
*/
@@ -569,39 +603,6 @@
return pagedir;
}
-static int prepare_suspend_console(void)
-{
- orig_loglevel = console_loglevel;
- console_loglevel = new_loglevel;
-
-#ifdef CONFIG_VT
- orig_fgconsole = fg_console;
-#ifdef SUSPEND_CONSOLE
- if(vc_allocate(SUSPEND_CONSOLE))
- /* we can't have a free VC for now. Too bad,
- * we don't want to mess the screen for now. */
- return 1;
-
- set_console (SUSPEND_CONSOLE);
- if(vt_waitactive(SUSPEND_CONSOLE)) {
- PRINTK("Bummer. Can't switch VCs.");
- return 1;
- }
- orig_kmsg = kmsg_redirect;
- kmsg_redirect = SUSPEND_CONSOLE;
-#endif
-#endif
- return 0;
-}
-
-static void restore_console(void)
-{
- console_loglevel = orig_loglevel;
-#ifdef SUSPEND_CONSOLE
- set_console (orig_fgconsole);
-#endif
- return;
-}
static int prepare_suspend_processes(void)
{
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
next reply other threads:[~2003-07-26 22:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-26 22:56 Pavel Machek [this message]
2003-08-05 1:03 ` [PM] save/restore screen support for ACPI S3 sleep Patrick Mochel
2003-08-05 9:17 ` Pavel Machek
2003-08-05 15:57 ` Patrick Mochel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030726225646.GA519@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).