diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/drivers/video/fbcon.c linux/drivers/video/fbcon.c --- linux.orig/drivers/video/fbcon.c Thu Jan 10 20:17:41 2002 +++ linux/drivers/video/fbcon.c Wed Dec 26 16:50:52 2001 @@ -75,6 +75,7 @@ #include #include #include +#include #include #include @@ -137,6 +138,12 @@ static void fbcon_free_font(struct display *); static int fbcon_set_origin(struct vc_data *); +#ifdef CONFIG_PM +static int pm_fbcon_request(struct pm_dev *dev, pm_request_t rqst, void *data); +static struct pm_dev *pm_fbcon; +static int fbcon_sleeping; +#endif + /* * Emmanuel: fbcon will now use a hardware cursor if the * low-level driver provides a non-NULL dispsw->cursor pointer, @@ -233,6 +240,7 @@ static struct timer_list cursor_timer = { function: cursor_timer_handler }; +static int use_timer_cursor; static void cursor_timer_handler(unsigned long dev_addr) { @@ -457,11 +465,16 @@ #endif if (irqres) { + use_timer_cursor = 1; cursor_blink_rate = DEFAULT_CURSOR_BLINK_RATE; cursor_timer.expires = jiffies+HZ/50; add_timer(&cursor_timer); } +#ifdef CONFIG_PM + pm_fbcon = pm_register(PM_SYS_DEV, PM_SYS_VGA, pm_fbcon_request); +#endif + return display_desc; } @@ -1558,6 +1571,10 @@ if (blank < 0) /* Entering graphics mode */ return 0; +#ifdef CONFIG_PM + if (fbcon_sleeping) + return 0; +#endif /* CONFIG_PM */ fbcon_cursor(p->conp, blank ? CM_ERASE : CM_DRAW); @@ -2446,6 +2463,39 @@ return done ? (LOGO_H + fontheight(p) - 1) / fontheight(p) : 0 ; } + +#ifdef CONFIG_PM +/* console.c doesn't do enough here */ +static int +pm_fbcon_request(struct pm_dev *dev, pm_request_t rqst, void *data) +{ + unsigned long flags; + + switch (rqst) + { + case PM_RESUME: + acquire_console_sem(); + fbcon_sleeping = 0; + if (use_timer_cursor) { + cursor_timer.expires = jiffies+HZ/50; + add_timer(&cursor_timer); + } + release_console_sem(); + break; + case PM_SUSPEND: + acquire_console_sem(); + save_flags(flags); + cli(); + if (use_timer_cursor) + del_timer(&cursor_timer); + fbcon_sleeping = 1; + restore_flags(flags); + release_console_sem(); + break; + } + return 0; +} +#endif /* CONFIG_PM */ /* * The console `switch' structure for the frame buffer based console