From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: rjw@sisk.pl
Subject: [PATCH 1/2] PM: make VT switching to the suspend console optional
Date: Fri, 2 Nov 2012 14:43:40 -0700 [thread overview]
Message-ID: <1351892621-4840-2-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1351892621-4840-1-git-send-email-jbarnes@virtuousgeek.org>
KMS drivers can potentially restore the display configuration without
userspace help. Such drivers can set a new global, pm_vt_switch, to
false if they support this feature. In that case, the PM layer won't VT
switch to the suspend console at suspend time and then back to the
original VT on resume, but rather leave things alone for a nicer looking
suspend and resume sequence.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
include/linux/pm.h | 3 +++
kernel/power/console.c | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 007e687..d8e7efb 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -35,6 +35,9 @@ extern void (*pm_idle)(void);
extern void (*pm_power_off)(void);
extern void (*pm_power_off_prepare)(void);
+/* VT switch to the suspend console or not */
+extern bool pm_vt_switch; /* defaults to true in console.c */
+
/*
* Device power management
*/
diff --git a/kernel/power/console.c b/kernel/power/console.c
index b1dc456..65376b4 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -13,9 +13,13 @@
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
static int orig_fgconsole, orig_kmsg;
+bool pm_vt_switch = true;
int pm_prepare_console(void)
{
+ if (!pm_vt_switch)
+ return 0;
+
orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1);
if (orig_fgconsole < 0)
return 1;
@@ -26,6 +30,9 @@ int pm_prepare_console(void)
void pm_restore_console(void)
{
+ if (!pm_vt_switch)
+ return;
+
if (orig_fgconsole >= 0) {
vt_move_to_console(orig_fgconsole, 0);
vt_kmsg_redirect(orig_kmsg);
--
1.7.9.5
next prev parent reply other threads:[~2012-11-02 21:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 21:43 [RFC] Suspend/resume without VT switches Jesse Barnes
2012-11-02 21:43 ` Jesse Barnes [this message]
2012-11-02 23:43 ` [PATCH 1/2] PM: make VT switching to the suspend console optional Alan Cox
2012-11-03 0:20 ` Jesse Barnes
2012-11-03 0:42 ` Alan Cox
2012-11-03 0:40 ` Jesse Barnes
2012-11-02 21:43 ` [PATCH 2/2] drm/i915: support resume without VT switch Jesse Barnes
2012-11-02 21:51 ` [RFC] Suspend/resume without VT switches Rafael J. Wysocki
2012-11-02 23:29 ` Jesse Barnes
2012-11-02 23:38 ` Rafael J. Wysocki
2012-11-03 0:22 ` Jesse Barnes
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=1351892621-4840-2-git-send-email-jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
/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
all inboxes | Powered by JetHome®