changeset 5013:52c008dd6e93

min() moved out of #if, applied brightness/contrast patch by Brian J. Murrell
author arpi
date Sun, 10 Mar 2002 03:36:16 +0000
parents 13eacaebe7bb
children 4458e43871d3
files drivers/mga_vid.c drivers/mga_vid.h
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/drivers/mga_vid.c	Sun Mar 10 03:01:06 2002 +0000
+++ b/drivers/mga_vid.c	Sun Mar 10 03:36:16 2002 +0000
@@ -97,11 +97,11 @@
 static uint32_t mga_param_buff_size=0;
 static uint32_t mga_param_buff_len=0;
 
+#define min(x,y) (((x)<(y))?(x):(y))
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
 #include <linux/ctype.h>
 
-#define min(x,y) (((x)<(y))?(x):(y))
-
 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
 {
         unsigned long result = 0,value;
@@ -1141,6 +1141,8 @@
 static int mga_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
 	int frame;
+	uint32_t tmp;
+
 
 	switch(cmd) 
 	{
@@ -1231,6 +1233,22 @@
 			mga_vid_frame_sel(frame);
 		break;
 
+		case MGA_VID_GET_LUMA:
+			tmp = regs.beslumactl - 0x80;
+			if (copy_to_user((uint32_t *) arg, &tmp, sizeof(uint32_t)))
+			{
+				printk(KERN_ERR "mga_vid: failed copy %p to userspace %p\n",
+					   &tmp, (uint32_t *) arg);
+				return(-EFAULT);
+			}
+		break;
+			
+		case MGA_VID_SET_LUMA:
+			tmp = arg;
+			regs.beslumactl = tmp + 0x80;
+			mga_vid_write_regs(0);
+		break;
+			
 	        default:
 			printk(KERN_ERR "mga_vid: Invalid ioctl\n");
 			return (-EINVAL);
--- a/drivers/mga_vid.h	Sun Mar 10 03:01:06 2002 +0000
+++ b/drivers/mga_vid.h	Sun Mar 10 03:36:16 2002 +0000
@@ -47,6 +47,8 @@
 #define MGA_VID_ON        _IO ('J', 2)
 #define MGA_VID_OFF       _IO ('J', 3)
 #define MGA_VID_FSEL _IOR('J', 4, int)
+#define MGA_VID_GET_LUMA _IOR('J', 5, int)
+#define MGA_VID_SET_LUMA _IOR('J', 6, int)
 
 #define MGA_G200 0x1234
 #define MGA_G400 0x5678