Date: Mon, 6 Oct 1997 15:59:08 +0200 (MET DST)
From: Juergen Orschiedt <juergen.orschiedt@zx.basf-ag.de>
Sender: Juergen Orschiedt <orschied@kassandra.zx.basf-ag.de>
Reply-To: juergen.orschiedt@zx.basf-ag.de
Subject: Re: L68K: patch for atafb - no more thermografic penguine
To: rnhodek@faui22c.informatik.uni-erlangen.de
Cc: linux-m68k@lists.linux-m68k.org
In-Reply-To: <9710061326.AA02742@faui21.informatik.uni-erlangen.de>

On  6 Oct , Roman Hodek wrote:

> Damn... can't find it also in my patch archive, so here it is again...
> 

Ok, to avoid rejects during patching forget the previous one.
Here are the changes for the DAC-handling.

diff -u -N --recursive --exclude-from=/home/jor/diff-excludes /usr/src/clean/linux-2.1.57/drivers/video/atafb.c /usr/src/linux-2.1.57/drivers/video/atafb.c
--- /usr/src/clean/linux-2.1.57/drivers/video/atafb.c	Fri Oct  3 16:12:23 1997
+++ /usr/src/linux-2.1.57/drivers/video/atafb.c	Sun Oct  5 12:45:06 1997
@@ -26,8 +26,15 @@
  *                Video mode switch on Falcon now done at next VBL interrupt
  *                to avoid the annoying right shift of the screen.
  *   - 23 Sep 97: Juergen: added xres_virtual for cards like ProMST
- *                The external-part is legacy, therefore hardware-specific functions
- *                like panning/hardwarescrolling/blanking isn't supported.
+ *                The external-part is legacy, therefore hardware-specific
+ *                functions like panning/hardwarescrolling/blanking isn't
+ *				  supported.
+ *   - 29 Sep 97: Juergen: added Romans suggestion for pan_display
+ *				  (var->xoffset was changed even if no set_screen_base avail.)
+ *	 - 05 Oct 97: Juergen: extfb (PACKED_PIXEL) is FB_PSEUDOCOLOR 'cause
+ *				  we know how to set the colors
+ *				  ext_*palette: read from ext_colors (former MV300_colors)
+ *							    write to ext_colors and RAMDAC
  *
  * To do:
  *   - For the Falcon it is not possible to set random video modes on
@@ -217,7 +224,7 @@
 just keep track of the set colors in our own array here, and use that!
 */
 
-static struct { unsigned char red,green,blue,pad; } MV300_color[256];
+static struct { unsigned char red,green,blue,pad; } ext_color[256];
 #endif /* ATAFB_EXT */
 
@@ -2248,28 +2258,11 @@
 	if (! external_vgaiobase)
 		return 1;
 
-	switch (external_card_type) {
-	  case IS_VGA:
-	    OUTB(0x3c7, regno);
-	    DACDelay;
-	    *red=INB(0x3c9) & colmask;
-	    DACDelay;
-	    *green=INB(0x3c9) & colmask;
-	    DACDelay;
-	    *blue=INB(0x3c9) & colmask;
-	    DACDelay;
-	    return 0;
-	    
-	  case IS_MV300:
-	    *red = MV300_color[regno].red;
-	    *green = MV300_color[regno].green;
-	    *blue = MV300_color[regno].blue;
+	    *red   = ext_color[regno].red;
+	    *green = ext_color[regno].green;
+	    *blue  = ext_color[regno].blue;
 	    *transp=0;
 	    return 0;
-
-	  default:
-	    return 1;
-	  }
 }
 	
 static int ext_setcolreg( unsigned regno, unsigned red,
@@ -2281,6 +2274,10 @@
 	if (! external_vgaiobase)
 		return 1;
 
+	ext_color[regno].red = red;
+	ext_color[regno].green = green;
+	ext_color[regno].blue = blue;
+
 	switch (external_card_type) {
 	  case IS_VGA:
 	    OUTB(0x3c8, regno);
@@ -2294,9 +2291,6 @@
 	    return 0;
 
 	  case IS_MV300:
-	    MV300_color[regno].red = red;
-	    MV300_color[regno].green = green;
-	    MV300_color[regno].blue = blue;
 	    OUTB((MV300_reg[regno] << 2)+1, red);
 	    OUTB((MV300_reg[regno] << 2)+1, green);
 	    OUTB((MV300_reg[regno] << 2)+1, blue);
@@ -2340,17 +2334,14 @@
 static int pan_display( struct fb_var_screeninfo *var,
                         struct atari_fb_par *par )
 {
-	if (!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset)
+	if (!fbhw->set_screen_base ||
+		(!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset))
 		return -EINVAL;
-	else
-		var->xoffset = up(var->xoffset, 16);
+	var->xoffset = up(var->xoffset, 16);
 	par->screen_base = screen_base +
 	        (var->yoffset * fb_display[currcon].var.xres_virtual + var->xoffset)
 	        * fb_display[currcon].var.bits_per_pixel / 8;
-	if (fbhw->set_screen_base)
-		fbhw->set_screen_base (par->screen_base);
-	else
-		return -EINVAL;
+	fbhw->set_screen_base (par->screen_base);
 	return 0;
 }





