linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] FBDEV: vga16fb + save/restore state
@ 2002-12-04 17:26 Antonino Daplas
  0 siblings, 0 replies; only message in thread
From: Antonino Daplas @ 2002-12-04 17:26 UTC (permalink / raw)
  To: Linux Fbdev development list; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Hi,

Attached is a patch against linux-2.5.50 + James Simmons' fbdev.diff.

Added support to save and restore VGA text mode.

Tony





[-- Attachment #2: vga16fb_state.diff --]
[-- Type: text/x-patch, Size: 2840 bytes --]

diff -Naur linux-2.5.50-js/drivers/video/Makefile linux/drivers/video/Makefile
--- linux-2.5.50-js/drivers/video/Makefile	2002-12-04 15:22:38.000000000 +0000
+++ linux/drivers/video/Makefile	2002-12-04 15:22:12.000000000 +0000
@@ -50,7 +50,8 @@
 obj-$(CONFIG_FB_S3TRIO)           += S3triofb.o
 obj-$(CONFIG_FB_TGA)              += tgafb.o
 obj-$(CONFIG_FB_VESA)             += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o 
-obj-$(CONFIG_FB_VGA16)            += vga16fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o 
+obj-$(CONFIG_FB_VGA16)            += vga16fb.o cfbfillrect.o cfbcopyarea.o \
+	                             cfbimgblt.o vgastate.o 
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
 obj-$(CONFIG_FB_G364)             += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_FM2)              += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
diff -Naur linux-2.5.50-js/drivers/video/vga16fb.c linux/drivers/video/vga16fb.c
--- linux-2.5.50-js/drivers/video/vga16fb.c	2002-12-04 15:22:42.000000000 +0000
+++ linux/drivers/video/vga16fb.c	2002-12-04 15:21:26.000000000 +0000
@@ -7,7 +7,8 @@
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
- * archive for more details.  */
+ * archive for more details.  
+ */
 
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -69,6 +70,8 @@
 		unsigned char	ModeControl;		/* CRT-Controller:17h */
 		unsigned char	ClockingMode;		/* Seq-Controller:01h */
 	} vga_state;
+	struct fb_vgastate state;
+	atomic_t ref_count;
 	int palette_blanked, vesa_blanked, mode, isVGA;
 	u8 misc, pel_msk, vss, clkdiv;
 	u8 crtc[VGA_CRT_C];
@@ -295,6 +298,34 @@
 			       
 #define FAIL(X) return -EINVAL
 
+static int vga16fb_open(struct fb_info *info, int user)
+{
+	struct vga16fb_par *par = (struct vga16fb_par *) info->par;
+	int cnt = atomic_read(&par->ref_count);
+
+	if (!cnt) {
+		memset(&par->state, 0, sizeof(struct fb_vgastate));
+		par->state.flags = 8;
+		fb_save_vga(&par->state);
+	}
+	atomic_inc(&par->ref_count);
+	return 0;
+}
+
+static int vga16fb_release(struct fb_info *info, int user)
+{
+	struct vga16fb_par *par = (struct vga16fb_par *) info->par;
+	int cnt = atomic_read(&par->ref_count);
+
+	if (!cnt)
+		return -EINVAL;
+	if (cnt == 1)
+		fb_restore_vga(&par->state);
+	atomic_dec(&par->ref_count);
+
+	return 0;
+}
+
 static int vga16fb_check_var(struct fb_var_screeninfo *var,
 			     struct fb_info *info)
 {
@@ -1346,6 +1377,8 @@
 
 static struct fb_ops vga16fb_ops = {
 	.owner		= THIS_MODULE,
+	.fb_open        = vga16fb_open,
+	.fb_release     = vga16fb_release,
 	.fb_check_var	= vga16fb_check_var,
 	.fb_set_par	= vga16fb_set_par,
 	.fb_setcolreg 	= vga16fb_setcolreg,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-04 17:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-04 17:26 [PATCH 2/3] FBDEV: vga16fb + save/restore state Antonino Daplas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).