From patchwork Fri Nov 2 21:43:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 1690751 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id C13F63FCDE for ; Fri, 2 Nov 2012 21:44:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E69479E9CD for ; Fri, 2 Nov 2012 14:44:21 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy8-pub.bluehost.com (oproxy8-pub.bluehost.com [69.89.22.20]) by gabe.freedesktop.org (Postfix) with SMTP id 2C0A29E753 for ; Fri, 2 Nov 2012 14:43:47 -0700 (PDT) Received: (qmail 19710 invoked by uid 0); 2 Nov 2012 21:43:46 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy8.bluehost.com with SMTP; 2 Nov 2012 21:43:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=FDYQ1jDIqLR3u5F/29W/N/0l3/s99V6BHD+AA3IEjNU=; b=lHpwaJZqLuPBPTQi+Z3zbkTete6WdHiyBLi1M0hBJTEnwIaCH9bNQbgziKmGbaELW2Sdkr50PVfbITUn+wR61YZPPQag5Oycudtz8ycV7n7hdgQrUt3kQgGZBny4SeZX; Received: from [67.161.37.189] (port=52541 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TUP1l-00072S-QT; Fri, 02 Nov 2012 15:43:45 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Fri, 2 Nov 2012 14:43:40 -0700 Message-Id: <1351892621-4840-2-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1351892621-4840-1-git-send-email-jbarnes@virtuousgeek.org> References: <1351892621-4840-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Cc: rjw@sisk.pl Subject: [Intel-gfx] [PATCH 1/2] PM: make VT switching to the suspend console optional X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.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 --- 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);