|
@@ -7,17 +7,39 @@
|
|
#include <linux/vt_kern.h>
|
|
#include <linux/vt_kern.h>
|
|
#include <linux/kbd_kern.h>
|
|
#include <linux/kbd_kern.h>
|
|
#include <linux/console.h>
|
|
#include <linux/console.h>
|
|
|
|
+#include <linux/module.h>
|
|
#include "power.h"
|
|
#include "power.h"
|
|
|
|
|
|
#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
|
|
#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
|
|
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
|
|
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
|
|
|
|
|
|
static int orig_fgconsole, orig_kmsg;
|
|
static int orig_fgconsole, orig_kmsg;
|
|
|
|
+static int disable_vt_switch;
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Normally during a suspend, we allocate a new console and switch to it.
|
|
|
|
+ * When we resume, we switch back to the original console. This switch
|
|
|
|
+ * can be slow, so on systems where the framebuffer can handle restoration
|
|
|
|
+ * of video registers anyways, there's little point in doing the console
|
|
|
|
+ * switch. This function allows you to disable it by passing it '0'.
|
|
|
|
+ */
|
|
|
|
+void pm_set_vt_switch(int do_switch)
|
|
|
|
+{
|
|
|
|
+ acquire_console_sem();
|
|
|
|
+ disable_vt_switch = !do_switch;
|
|
|
|
+ release_console_sem();
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(pm_set_vt_switch);
|
|
|
|
|
|
int pm_prepare_console(void)
|
|
int pm_prepare_console(void)
|
|
{
|
|
{
|
|
acquire_console_sem();
|
|
acquire_console_sem();
|
|
|
|
|
|
|
|
+ if (disable_vt_switch) {
|
|
|
|
+ release_console_sem();
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
orig_fgconsole = fg_console;
|
|
orig_fgconsole = fg_console;
|
|
|
|
|
|
if (vc_allocate(SUSPEND_CONSOLE)) {
|
|
if (vc_allocate(SUSPEND_CONSOLE)) {
|
|
@@ -50,9 +72,12 @@ int pm_prepare_console(void)
|
|
void pm_restore_console(void)
|
|
void pm_restore_console(void)
|
|
{
|
|
{
|
|
acquire_console_sem();
|
|
acquire_console_sem();
|
|
|
|
+ if (disable_vt_switch) {
|
|
|
|
+ release_console_sem();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
set_console(orig_fgconsole);
|
|
set_console(orig_fgconsole);
|
|
release_console_sem();
|
|
release_console_sem();
|
|
kmsg_redirect = orig_kmsg;
|
|
kmsg_redirect = orig_kmsg;
|
|
- return;
|
|
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|