All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: linux-kernel@vger.kernel.org
Cc: intel-gfx@lists.freedesktop.org, linux-pm@vger.kernel.org, rjw@sisk.pl
Subject: [PATCH 2/3] fb: add support for drivers not needing VT switch at suspend/resume time
Date: Mon,  4 Feb 2013 13:37:21 +0000	[thread overview]
Message-ID: <1359985042-2610-2-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1359985042-2610-1-git-send-email-jbarnes@virtuousgeek.org>

Use the new PM routines to indicate whether we need to VT switch at suspend
and resume time.  When a new driver is bound, set its flag accordingly,
and when unbound, remove it from the PM's console tracking list.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/video/fbmem.c |    7 +++++++
 include/linux/fb.h    |    2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 3ff0105..240d783 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1643,6 +1643,11 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 	if (!fb_info->modelist.prev || !fb_info->modelist.next)
 		INIT_LIST_HEAD(&fb_info->modelist);
 
+	if (fb_info->skip_vt_switch)
+		pm_vt_switch_required(fb_info->dev, false);
+	else
+		pm_vt_switch_required(fb_info->dev, true);
+
 	fb_var_to_videomode(&mode, &fb_info->var);
 	fb_add_videomode(&mode, &fb_info->modelist);
 	registered_fb[i] = fb_info;
@@ -1673,6 +1678,8 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
 	if (ret)
 		return -EINVAL;
 
+	pm_vt_switch_unregister(fb_info->dev);
+
 	unlink_framebuffer(fb_info);
 	if (fb_info->pixmap.addr &&
 	    (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7a9571..9a7538a 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -499,6 +499,8 @@ struct fb_info {
 			resource_size_t size;
 		} ranges[0];
 	} *apertures;
+
+	bool skip_vt_switch; /* no VT switch on suspend/resume required */
 };
 
 static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: linux-kernel@vger.kernel.org
Cc: rjw@sisk.pl, intel-gfx@lists.freedesktop.org, linux-pm@vger.kernel.org
Subject: [PATCH 2/3] fb: add support for drivers not needing VT switch at suspend/resume time
Date: Mon,  4 Feb 2013 13:37:21 +0000	[thread overview]
Message-ID: <1359985042-2610-2-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1359985042-2610-1-git-send-email-jbarnes@virtuousgeek.org>

Use the new PM routines to indicate whether we need to VT switch at suspend
and resume time.  When a new driver is bound, set its flag accordingly,
and when unbound, remove it from the PM's console tracking list.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/video/fbmem.c |    7 +++++++
 include/linux/fb.h    |    2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 3ff0105..240d783 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1643,6 +1643,11 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 	if (!fb_info->modelist.prev || !fb_info->modelist.next)
 		INIT_LIST_HEAD(&fb_info->modelist);
 
+	if (fb_info->skip_vt_switch)
+		pm_vt_switch_required(fb_info->dev, false);
+	else
+		pm_vt_switch_required(fb_info->dev, true);
+
 	fb_var_to_videomode(&mode, &fb_info->var);
 	fb_add_videomode(&mode, &fb_info->modelist);
 	registered_fb[i] = fb_info;
@@ -1673,6 +1678,8 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
 	if (ret)
 		return -EINVAL;
 
+	pm_vt_switch_unregister(fb_info->dev);
+
 	unlink_framebuffer(fb_info);
 	if (fb_info->pixmap.addr &&
 	    (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7a9571..9a7538a 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -499,6 +499,8 @@ struct fb_info {
 			resource_size_t size;
 		} ranges[0];
 	} *apertures;
+
+	bool skip_vt_switch; /* no VT switch on suspend/resume required */
 };
 
 static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
-- 
1.7.9.5

  reply	other threads:[~2013-02-04 13:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 13:37 [PATCH 1/3] PM: make VT switching to the suspend console optional v3 Jesse Barnes
2013-02-04 13:37 ` Jesse Barnes [this message]
2013-02-04 13:37   ` [PATCH 2/3] fb: add support for drivers not needing VT switch at suspend/resume time Jesse Barnes
2013-02-04 13:37 ` [PATCH 3/3] drm/i915: support resume without VT switch v2 Jesse Barnes
2013-02-04 13:37   ` Jesse Barnes
2013-02-06  9:20   ` [Intel-gfx] " Daniel Vetter
2013-02-04 20:26 ` [PATCH 1/3] PM: make VT switching to the suspend console optional v3 Rafael J. Wysocki
2013-02-05 13:55   ` Jesse Barnes
2013-02-05 22:02     ` Rafael J. Wysocki
2013-02-06  9:21       ` [Intel-gfx] " Daniel Vetter
2013-02-05 22:01 ` Rafael J. Wysocki

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=1359985042-2610-2-git-send-email-jbarnes@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.