-
- {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}
-};
-
-static struct fb_fix_screeninfo mc68328_fix __initdata = {
- .id = "mc68328";
- .smem_len = 160 * 160 /8;
- .type = FB_TYPE_PACKED_PIXELS;
- .accel = FB_ACCEL_NONE;
-};
-
-#define NUM_TOTAL_MODES arraysize(mc68328_fb_predefined)
-#define NUM_PREDEF_MODES (3)
-
-static int mc68328fb_inverse = 0;
-static int mc68328fb_mode = 0;
-static int mc68328fbCursorMode = 0;
-
- /*
- * Some default modes
- */
-
-#define PALM_DEFMODE (1)
-#define CYBER16_DEFMODE (2)
-
- /*
- * Interface used by the world
- */
-int mc68328_fb_init(void);
-
-static int mc68328fb_setcolreg(u_int regno, u_int red, u_int green,
- u_int blue, u_int transp);
-static void mc68328fb_blank(int blank, struct fb_info *info);
-
- /*
- * Accelerated Functions used by the low level console driver
- */
-
-void mc68328_WaitQueue(u_short fifo);
-void mc68328_WaitBlit(void);
-void mc68328_BitBLT(u_short curx, u_short cury, u_short destx,
- u_short desty, u_short width, u_short height,
- u_short mode);
-void mc68328_RectFill(u_short x, u_short y, u_short width, u_short height,
- u_short mode, u_short color);
-void mc68328_MoveCursor(u_short x, u_short y);
-
- /*
- * Internal routines
- */
-static int get_video_mode(const char *name);
-
- /*
- * 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.
- */
-
-static int mc68328fb_setcolreg(u_int regno, u_int red, u_int green,
- u_int blue, u_int transp)
-{
- return 1;
-#if 0
- if (regno > 255)
- return (1);
-
- *(mc68328Regs + 0x3c8) = (char) regno;
- mc68328_colour_table[regno][0] = red & 0xff;
- mc68328_colour_table[regno][1] = green & 0xff;
- mc68328_colour_table[regno][2] = blue & 0xff;
- mc68328_colour_table[regno][3] = transp;
-
- *(mc68328Regs + 0x3c9) = (red & 0xff) >> 2;
- *(mc68328Regs + 0x3c9) = (green & 0xff) >> 2;
- *(mc68328Regs + 0x3c9) = (blue & 0xff) >> 2;
-
- return (0);
-#endif
+#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
+ switch (info->fix.visual) {
+ case FB_VISUAL_TRUECOLOR:
+ case FB_VISUAL_PSEUDOCOLOR:
+ red = CNVT_TOHW(red, info->var.red.length);
+ green = CNVT_TOHW(green, info->var.green.length);
+ blue = CNVT_TOHW(blue, info->var.blue.length);
+ transp = CNVT_TOHW(transp, info->var.transp.length);
+ break;
+ case FB_VISUAL_DIRECTCOLOR:
+ red = CNVT_TOHW(red, 8); /* expect 8 bit DAC */
+ green = CNVT_TOHW(green, 8);
+ blue = CNVT_TOHW(blue, 8);
+ /* hey, there is bug in transp handling... */
+ transp = CNVT_TOHW(transp, 8);
+ break;
+ }
+#undef CNVT_TOHW
+ /* Truecolor has hardware independent palette */
+ if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
+ u32 v;
+
+ if (regno >= 16)
+ return 1;
+
+ v = (red << info->var.red.offset) |
+ (green << info->var.green.offset) |
+ (blue << info->var.blue.offset) |
+ (transp << info->var.transp.offset);
+ switch (info->var.bits_per_pixel) {
+ case 8:
+ break;
+ case 16:
+ ((u32 *) (info->pseudo_palette))[regno] = v;
+ break;
+ case 24:
+ case 32:
+ ((u32 *) (info->pseudo_palette))[regno] = v;
+ break;
+ }
+ return 0;
+ }
+ return 0;