The patch titled savagefb: VGA state save and restore has been added to the -mm tree. Its filename is savagefb-vga-state-save-and-restore.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: savagefb: VGA state save and restore From: "Antonino A. Daplas" <adaplas@xxxxxxxxx> Allow the saving and restoration of VGA text mode. The state is saved on the first open and restored on the last close. Because of the VGA registers are linearly mapped to the MMIO space, MMIO access is used which is not limited to X86 platforms nor to the primary display device. An echo 0 > /sys/class/vtconsole/vtcon1/bind will convert the display from graphics to text mode. Signed-off-by: Antonino Daplas <adaplas@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/video/Makefile | 2 - drivers/video/savage/savagefb.h | 10 ++++- drivers/video/savage/savagefb_driver.c | 39 +++++++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff -puN drivers/video/Makefile~savagefb-vga-state-save-and-restore drivers/video/Makefile --- a/drivers/video/Makefile~savagefb-vga-state-save-and-restore +++ a/drivers/video/Makefile @@ -38,7 +38,7 @@ obj-$(CONFIG_FB_ATY128) += aty/ macmo obj-$(CONFIG_FB_RADEON) += aty/ obj-$(CONFIG_FB_SIS) += sis/ obj-$(CONFIG_FB_KYRO) += kyro/ -obj-$(CONFIG_FB_SAVAGE) += savage/ +obj-$(CONFIG_FB_SAVAGE) += savage/ vgastate.o obj-$(CONFIG_FB_GEODE) += geode/ obj-$(CONFIG_FB_MBX) += mbx/ obj-$(CONFIG_FB_I810) += vgastate.o diff -puN drivers/video/savage/savagefb.h~savagefb-vga-state-save-and-restore drivers/video/savage/savagefb.h --- a/drivers/video/savage/savagefb.h~savagefb-vga-state-save-and-restore +++ a/drivers/video/savage/savagefb.h @@ -15,6 +15,8 @@ #include <linux/i2c.h> #include <linux/i2c-id.h> #include <linux/i2c-algo-bit.h> +#include <linux/mutex.h> +#include <video/vga.h> #include "../edid.h" #ifdef SAVAGEFB_DEBUG @@ -189,8 +191,12 @@ struct savagefb_par { struct savagefb_i2c_chan chan; struct savage_reg state; struct savage_reg save; + struct savage_reg initial; + struct vgastate vgastate; + struct mutex open_lock; unsigned char *edid; u32 pseudo_palette[16]; + u32 open_count; int paletteEnabled; int pm_state; int display_type; @@ -203,7 +209,7 @@ struct savagefb_par { int clock[4]; int MCLK, REFCLK, LCDclk; struct { - u8 __iomem *vbase; + void __iomem *vbase; u32 pbase; u32 len; #ifdef CONFIG_MTRR @@ -212,7 +218,7 @@ struct savagefb_par { } video; struct { - volatile u8 __iomem *vbase; + void __iomem *vbase; u32 pbase; u32 len; } mmio; diff -puN drivers/video/savage/savagefb_driver.c~savagefb-vga-state-save-and-restore drivers/video/savage/savagefb_driver.c --- a/drivers/video/savage/savagefb_driver.c~savagefb-vga-state-save-and-restore +++ a/drivers/video/savage/savagefb_driver.c @@ -1623,8 +1623,46 @@ static void savagefb_restore_state(struc savagefb_blank(FB_BLANK_UNBLANK, info); } +static int savagefb_open(struct fb_info *info, int user) +{ + struct savagefb_par *par = info->par; + + mutex_lock(&par->open_lock); + + if (!par->open_count) { + memset(&par->vgastate, 0, sizeof(par->vgastate)); + par->vgastate.flags = VGA_SAVE_CMAP | VGA_SAVE_FONTS | + VGA_SAVE_MODE; + par->vgastate.vgabase = par->mmio.vbase + 0x8000; + save_vga(&par->vgastate); + savage_get_default_par(par, &par->initial); + } + + par->open_count++; + mutex_unlock(&par->open_lock); + return 0; +} + +static int savagefb_release(struct fb_info *info, int user) +{ + struct savagefb_par *par = info->par; + + mutex_lock(&par->open_lock); + + if (par->open_count == 1) { + savage_set_default_par(par, &par->initial); + restore_vga(&par->vgastate); + } + + par->open_count--; + mutex_unlock(&par->open_lock); + return 0; +} + static struct fb_ops savagefb_ops = { .owner = THIS_MODULE, + .fb_open = savagefb_open, + .fb_release = savagefb_release, .fb_check_var = savagefb_check_var, .fb_set_par = savagefb_set_par, .fb_setcolreg = savagefb_setcolreg, @@ -2173,6 +2211,7 @@ static int __devinit savagefb_probe(stru if (!info) return -ENOMEM; par = info->par; + mutex_init(&par->open_lock); err = pci_enable_device(dev); if (err) goto failed_enable; _ Patches currently in -mm which might be from adaplas@xxxxxxxxx are origin.patch fbdev-add-ultrasharp-uxga-to-broken-monitor-database.patch intelfb-fix-ring-space-calculation.patch nvidiafb-bring-back-generic-ddc-reading.patch fbdev-ignore-vesa-modes-if-framebuffer-is-disabled.patch fbdev-fix-obvious-bug-in-show_pan.patch neofb-fill-transp-msb_right-with-the-correct.patch atyfb-kill-dead-code.patch fbdev-mm-deferred-io-support.patch fbdev-mm-deferred-io-support-fix.patch fbdev-mm-deferred-io-support-fix-2.patch fbdev-hecuba-framebuffer-driver.patch fbdev-hecuba-framebuffer-driver-fix.patch nvidiafb-fix-reversed-ddc-port.patch vt-expose-system-wide-utf-8-default-setting-via-sysfs.patch fbdev-dont-show-logo-if-driver-or-fbcon-are-modular.patch rivafb-nvidiafb-enable-hardware-monitoring.patch rivafb-handle-i2c-bus-creation-failure.patch rivafb-nvidiafb-various-cleanups.patch rivafb-fixed-reversed-ddc-ports.patch nvidiafb-ensure-that-crtc-registers-are-accessible.patch nvidiafb-access-crt-registers-safely.patch skeletonfb-various-corrections.patch epson1355fbc-fix-error-handling-code.patch nvidiafb-vga-state-save-and-restore.patch savagefb-rework-i2c-bit-access.patch savagefb-vga-state-save-and-restore.patch fbdev-link-vgastateo-using-kconfig.patch fbcon-delay-screen-update-when-setting-the-mode-of.patch nvidiafb-fix-sparse-warning.patch rivafb-fix-io-access.patch fbdev-kill-sparse-warning-in-deferred-io.patch fbdev-add-sparse-annotations-in-svgalibc.patch arcfb-kill-sparse-warning.patch s3fb-add-sparse-annotations.patch hecubafb-kill-sparse-warnings.patch i810fb-fix-incorrect-frequency-mask.patch vt-add-documentation-for-new-boot-sysfs-options.patch skeletonfb-documentation-error-fixes.patch fbdev-add-drawing-functions-for-framebuffers-in-system.patch arcfb-use-sys-instead-of-cfb-drawing-functions.patch hecubafb-use-sys-instead-of-cfb-drawing-functions.patch vfb-use-sys-instead-of-cfb-drawing-functions.patch fbdev-pass-struct-fb_info-to-fb_read-and-fb_write.patch fbdev-add-fb_read-fb_write-functions-for-framebuffers.patch arcfb-us-fb_sys_read.patch hecubafb-us-fb_sys_read.patch vfb-us-fb_sys_read-and-fb_sys_write.patch fbdev-consolidate-common-drawing-functions-into-a.patch fbdev-advertise-limitation-of-drawing-engine.patch fbcon-font-setting-should-check-limitation-of-driver.patch vga16fb-restrict-to-blit-rectangles-with-widths-of.patch s3fb-limit-8x16-rectangles-when-tileblitting-is-enabled.patch fbdev-add-tile-operation-to-get-the-maximum-length.patch s3fb-implement-fb_get_tilemax.patch fbcon-check-if-the-character-count-can-be-handled.patch fbdev-save-the-activate-field-before-calling-fb_check_var.patch s3fb-driver-fixes.patch vmlfb-framebuffer-driver-for-intel-vermilion-range.patch nvidiafb-rivafb-switch-to-pci_get-refcounting.patch pm2fb-3dlabs-permedia-2v-reference-board-added.patch pm2fb-permedia-2v-memory-clock-setting.patch pm2fb-pixclock-setting-restriction.patch nvidiafb-prevent-triggering-of-softlockup.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html