Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2004-02-14 17:33:50 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-02-14 17:33:50 -0800
commit9b74976dffbf95bc95c5e55d5e6c93d78e7bb53e (patch)
treed6e9952f665c2dd08f3faa6a9d99ec6a7acb30ed
parentf8048030ca79c46fdd9ce3e909972d4099aa8e8c (diff)
[PATCH] fbcon notified of suspend/resume
This makes fbcon ask for notification of events from fbdev to deal with suspend/resume (stop cursor on suspend, refresh screen on resume). Could probably do more (like dealing better with the cursor timer), but this simple implementation works fine enough for now.
-rw-r--r--drivers/video/console/fbcon.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index d5842613e3d5..97e02476b294 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2266,6 +2266,39 @@ static int fbcon_set_origin(struct vc_data *vc)
return 0;
}
+static void fbcon_suspended(struct fb_info *info)
+{
+ /* Clear cursor, restore saved data */
+ info->cursor.enable = 0;
+ info->fbops->fb_cursor(info, &info->cursor);
+}
+
+static void fbcon_resumed(struct fb_info *info)
+{
+ struct vc_data *vc;
+
+ if (info->currcon < 0)
+ return;
+ vc = vc_cons[info->currcon].d;
+
+ update_screen(vc->vc_num);
+}
+static int fbcon_event_notify(struct notifier_block *self,
+ unsigned long action, void *data)
+{
+ struct fb_info *info = (struct fb_info *) data;
+
+ switch(action) {
+ case FB_EVENT_SUSPEND:
+ fbcon_suspended(info);
+ break;
+ case FB_EVENT_RESUME:
+ fbcon_resumed(info);
+ break;
+ }
+ return 0;
+}
+
/*
* The console `switch' structure for the frame buffer based console
*/
@@ -2292,16 +2325,35 @@ const struct consw fb_con = {
.con_resize = fbcon_resize,
};
+static struct notifier_block fbcon_event_notifer = {
+ .notifier_call = fbcon_event_notify,
+};
+
+static int fbcon_event_notifier_registered;
+
int __init fb_console_init(void)
{
if (!num_registered_fb)
return -ENODEV;
take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
+ acquire_console_sem();
+ if (!fbcon_event_notifier_registered) {
+ fb_register_client(&fbcon_event_notifer);
+ fbcon_event_notifier_registered = 1;
+ }
+ release_console_sem();
+
return 0;
}
void __exit fb_console_exit(void)
{
+ acquire_console_sem();
+ if (fbcon_event_notifier_registered) {
+ fb_unregister_client(&fbcon_event_notifer);
+ fbcon_event_notifier_registered = 0;
+ }
+ release_console_sem();
give_up_console(&fb_con);
}