changeset 4728:dab19bd91cde

Add module parameters: contrast and brightness, so when you need those permanently adjusted just add lines to /etc/modules or sth. insmod mga_vid.o mga_brightness=100 mga_contrast=-79
author eyck
date Sat, 16 Feb 2002 19:58:39 +0000
parents cbef9b843e6d
children f51bd827ed1c
files drivers/mga_vid.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/drivers/mga_vid.c	Sat Feb 16 13:41:32 2002 +0000
+++ b/drivers/mga_vid.c	Sat Feb 16 19:58:39 2002 +0000
@@ -202,8 +202,6 @@
 
 
 	//configurable stuff
-	int brightness;
-	int contrast;
 	int blackie;
 
 } bes_registers_t;
@@ -248,10 +246,15 @@
 
 static uint32_t mga_top_reserved = 0;	// reserved space for console font (matroxfb + fastfont)
 
+static int mga_brightness = 0;	// initial brightness
+static int mga_contrast = 0;	// initial contrast
+
 //static int mga_force_memsize = 0;
 
 MODULE_PARM(mga_ram_size, "i");
 MODULE_PARM(mga_top_reserved, "i");
+MODULE_PARM(mga_brightness, "i");
+MODULE_PARM(mga_contrast, "i");
 
 static struct pci_dev *pci_dev;
 
@@ -744,9 +747,9 @@
 	regs.besglobctl |= (1<<5) + (1<<7);
 	
 	// brightness ; default is 0x7f;
-	regs.beslumactl = (regs.brightness << 16);
+	regs.beslumactl = (mga_brightness << 16);
 	// contrast:
-	regs.beslumactl|= ((regs.contrast+0x80)<<0);
+	regs.beslumactl|= ((mga_contrast+0x80)<<0);
 
 	//Setup destination window boundaries
 	besleft = x > 0 ? x : 0;
@@ -1368,8 +1371,8 @@
     len += sprintf(&mga_param_buff[len],"MMIO: %p\n",mga_mmio_base);
     len += sprintf(&mga_param_buff[len],"Configurable stuff:\n");
     len += sprintf(&mga_param_buff[len],"~~~~~~~~~~~~~~~~~~~\n");
-    len += sprintf(&mga_param_buff[len],PARAM_BRIGHTNESS"%d\n",regs.brightness);
-    len += sprintf(&mga_param_buff[len],PARAM_CONTRAST"%d\n",regs.contrast);
+    len += sprintf(&mga_param_buff[len],PARAM_BRIGHTNESS"%d\n",mga_brightness);
+    len += sprintf(&mga_param_buff[len],PARAM_CONTRAST"%d\n",mga_contrast);
     len += sprintf(&mga_param_buff[len],PARAM_BLACKIE"%s\n",regs.blackie?"on":"off");
     mga_param_buff_len = len;
     // check boundaries of mga_param_buff before writing to it!!!
@@ -1396,7 +1399,7 @@
 		brightness=simple_strtol(&buf[strlen(PARAM_BRIGHTNESS)],NULL,10);
 		if (brightness>127 || brightness<-128) { brightness=0;} 
 //		printk(KERN_DEBUG "mga_vid: brightness modified ( %d ) \n",brightness);
-		regs.brightness=brightness;
+		mga_brightness=brightness;
 	} else 
 	if(memcmp(buf,PARAM_CONTRAST,min(count,strlen(PARAM_CONTRAST))) == 0)
 	{
@@ -1404,7 +1407,7 @@
 		contrast=simple_strtol(&buf[strlen(PARAM_CONTRAST)],NULL,10);
 		if (contrast>127 || contrast<-128) { contrast=0;} 
 //		printk(KERN_DEBUG "mga_vid: contrast modified ( %d ) \n",contrast);
-		regs.contrast=contrast;
+		mga_contrast=contrast;
 	} else 
 
         if(memcmp(buf,PARAM_BLACKIE,min(count,strlen(PARAM_BLACKIE))) == 0)