r1907

dslinux_gpf at dslinux.in-berlin.de dslinux_gpf at dslinux.in-berlin.de
Wed Sep 19 18:11:08 CEST 2007


Author: gpf
Date: 2007-09-19 18:11:03 +0200 (Wed, 19 Sep 2007)
New Revision: 1907

Log:
adds support for FBIOGET_VBLANK, and FB_VBLANK_HAVE_VCOUNT flag


Modified: trunk/linux-2.6.x/drivers/video/ndsfb.c
===================================================================
--- trunk/linux-2.6.x/drivers/video/ndsfb.c	2007-09-18 19:34:23 UTC (rev 1906)
+++ trunk/linux-2.6.x/drivers/video/ndsfb.c	2007-09-19 16:11:03 UTC (rev 1907)
@@ -25,6 +25,7 @@
 #include <asm/arch/power.h>
 #include <asm/io.h>
 
+#define	VCOUNT		     (*(volatile u16*)0x04000006)
 #define DISPLAY_CR       (*(volatile u32*)0x04000000)
 #define SUB_DISPLAY_CR   (*(volatile u32*)0x04001000)
 
@@ -225,6 +226,7 @@
 static int ndsfb_blank(int blank_mode, struct fb_info *info);
 static int ndsfb_open(struct fb_info *info, int user);
 static int ndsfb_release(struct fb_info *info, int user);
+static int ndsfb_ioctl(struct inode *inode, struct file *file,unsigned int cmd, unsigned long arg, struct fb_info *info);
 
 static struct fb_ops ndsfb_ops = {
 	.fb_check_var = ndsfb_check_var,
@@ -238,7 +240,8 @@
 	.fb_mmap = ndsfb_mmap,
 	.fb_blank = ndsfb_blank,
 	.fb_open = ndsfb_open,
-	.fb_release = ndsfb_release
+	.fb_release = ndsfb_release,
+	.fb_ioctl	= ndsfb_ioctl
 };
 
 extern void ndstouch_open_fb1(void);
@@ -452,7 +455,44 @@
 	return 0;
 }
 
+static int ndsfb_get_vblank(struct fb_vblank *vblank)
+{
+	memset(vblank, 0, sizeof(&vblank));
+	vblank->flags = FB_VBLANK_HAVE_VCOUNT;
+	vblank->vcount = readw(VCOUNT);
+	return 0;
+}
+
     /*
+     * ioctl
+     */
+
+static int ndsfb_ioctl(struct inode *inode, struct file *file,
+			  unsigned int cmd, unsigned long arg,
+			  struct fb_info *info)
+{
+	void __user *argp = (void __user *)arg;
+	u32 val, old_mode;
+	int retval = -EFAULT;
+ 
+	switch (cmd) {
+		case FBIOGET_VBLANK:
+			{
+				struct fb_vblank vblank;
+				int err;
+
+				err = ndsfb_get_vblank(&vblank);
+				if (err)
+					return err;
+				if (copy_to_user(argp, &vblank, sizeof(vblank)))
+					return -EFAULT;
+				return 0;
+			}
+	}
+	return -ENOTTY;
+}
+
+    /*
      *  Set a single color register. The values supplied are already
      *  rounded down to the hardware's capabilities (according to the
      *  entries in the var structure). Return != 0 for invalid regno.




More information about the dslinux-commit mailing list