--- drivers/video/aty/aty128fb.c	2007-05-28 23:48:06.000000000 +0200
+++ drivers/video/aty/aty128fb.c	2007-06-09 16:44:07.000000000 +0200
@@ -419,10 +419,11 @@
 	struct fb_info *next;
 	int	asleep;
 	int	lock_blank;
-
+#if 0	/* MR */
 	u8	red[32];		/* see aty128fb_setcolreg */
 	u8	green[64];
 	u8	blue[32];
+#endif
 	u32	pseudo_palette[16];	/* used for TRUECOLOR */
 };
 
@@ -693,6 +694,7 @@
 static void aty128_init_engine(struct aty128fb_par *par)
 {
 	u32 pitch_value;
+	u_int regno;	/* MR */
 
 	wait_for_idle(par);
 
@@ -752,6 +754,12 @@
 	/* default write mask */
 	aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF);
 
+	/* Pre-set palette for direct color mode */	/* MR */
+	for (regno=0; regno<256; regno++) {
+		aty_st_8(PALETTE_INDEX, regno);
+		aty_st_le32(PALETTE_DATA, (regno<<16)|(regno<<8)|regno);
+	}
+
 	/* Wait for all the writes to be completed before returning */
 	wait_for_idle(par);
 }
@@ -1029,7 +1037,7 @@
 	if (bpp != 16)
 		depth = bpp;
 	else
-		depth = (var->green.length == 6) ? 16 : 15;
+		depth = (var->green.length == 5) ? 15 : 16;
 
 	/* check for mode eligibility
 	 * accept only non interlaced modes */
@@ -1608,6 +1616,7 @@
 }
 
 
+#if 0	/* MR */
 /*
  *  Helper function to store a single palette register
  */
@@ -1633,6 +1642,7 @@
 	aty_st_8(PALETTE_INDEX, regno);
 	aty_st_le32(PALETTE_DATA, (red<<16)|(green<<8)|blue);
 }
+#endif
 
 static int aty128fb_sync(struct fb_info *info)
 {
@@ -2192,64 +2202,26 @@
  *  rounded down to the hardware's capabilities (according to the
  *  entries in the var structure). Return != 0 for invalid regno.
  */
+
+/* Remark: no setting of hardware registers due to 1:1 translation */	/* MR */
+
 static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 			      u_int transp, struct fb_info *info)
 {
-	struct aty128fb_par *par = info->par;
 
-	if (regno > 255
-	    || (par->crtc.depth == 16 && regno > 63)
-	    || (par->crtc.depth == 15 && regno > 31))
+	if (regno >= 16)
 		return 1;
 
-	red >>= 8;
-	green >>= 8;
-	blue >>= 8;
-
-	if (regno < 16) {
-		int i;
-		u32 *pal = info->pseudo_palette;
-
-		switch (par->crtc.depth) {
-		case 15:
-			pal[regno] = (regno << 10) | (regno << 5) | regno;
-			break;
-		case 16:
-			pal[regno] = (regno << 11) | (regno << 6) | regno;
-			break;
-		case 24:
-			pal[regno] = (regno << 16) | (regno << 8) | regno;
-			break;
-		case 32:
-			i = (regno << 8) | regno;
-			pal[regno] = (i << 16) | i;
-			break;
-		}
-	}
-
-	if (par->crtc.depth == 16 && regno > 0) {
-		/*
-		 * With the 5-6-5 split of bits for RGB at 16 bits/pixel, we
-		 * have 32 slots for R and B values but 64 slots for G values.
-		 * Thus the R and B values go in one slot but the G value
-		 * goes in a different slot, and we have to avoid disturbing
-		 * the other fields in the slots we touch.
-		 */
-		par->green[regno] = green;
-		if (regno < 32) {
-			par->red[regno] = red;
-			par->blue[regno] = blue;
-			aty128_st_pal(regno * 8, red, par->green[regno*2],
-				      blue, par);
-		}
-		red = par->red[regno/2];
-		blue = par->blue[regno/2];
-		regno <<= 2;
-	} else if (par->crtc.bpp == 16)
-		regno <<= 3;
-	aty128_st_pal(regno, red, green, blue, par);
+	red   = ( (red   & 0xffff) >> (16-info->var.red.length)   );
+	green = ( (green & 0xffff) >> (16-info->var.green.length) );
+	blue  = ( (blue  & 0xffff) >> (16-info->var.blue.length)  );
+	((u32 *)(info->pseudo_palette))[regno] =
+		(red   << info->var.red.offset)   |
+		(green << info->var.green.offset) |
+		(blue  << info->var.blue.offset);
 
 	return 0;
+
 }
 
 #define ATY_MIRROR_LCD_ON	0x00000001

