30 #include <linux/module.h>
31 #include <linux/kernel.h>
32 #include <linux/errno.h>
33 #include <linux/string.h>
38 #include <asm/uaccess.h>
42 #if defined(CONFIG_M68VZ328)
44 #elif defined(CONFIG_M68EZ328)
46 #elif defined(CONFIG_M68328)
49 #error wrong architecture for the MC68x328 frame buffer device
52 #if defined(CONFIG_FB_68328_INVERT)
53 #define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO01
55 #define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO10
59 static u_long videomemorysize;
62 static u32 mc68x328fb_pseudo_palette[16];
98 static int mc68x328fb_set_par(
struct fb_info *
info);
105 static struct fb_ops mc68x328fb_ops = {
106 .fb_check_var = mc68x328fb_check_var,
107 .fb_set_par = mc68x328fb_set_par,
108 .fb_setcolreg = mc68x328fb_setcolreg,
109 .fb_pan_display = mc68x328fb_pan_display,
113 .fb_mmap = mc68x328fb_mmap,
120 static u_long get_line_length(
int xres_virtual,
int bpp)
124 length = xres_virtual *
bpp;
125 length = (length + 31) & ~31;
200 var->
green.offset = 0;
201 var->
green.length = 1;
202 var->
blue.offset = 0;
203 var->
blue.length = 1;
210 var->
green.offset = 0;
211 var->
green.length = 8;
212 var->
blue.offset = 0;
213 var->
blue.length = 8;
221 var->
green.offset = 5;
222 var->
green.length = 5;
223 var->
blue.offset = 10;
224 var->
blue.length = 5;
230 var->
green.offset = 5;
231 var->
green.length = 6;
232 var->
blue.offset = 11;
233 var->
blue.length = 5;
241 var->
green.offset = 8;
242 var->
green.length = 8;
243 var->
blue.offset = 16;
244 var->
blue.length = 8;
251 var->
green.offset = 8;
252 var->
green.length = 8;
253 var->
blue.offset = 16;
254 var->
blue.length = 8;
259 var->
red.msb_right = 0;
260 var->
green.msb_right = 0;
261 var->
blue.msb_right = 0;
262 var->
transp.msb_right = 0;
271 static int mc68x328fb_set_par(
struct fb_info *info)
273 info->
fix.line_length = get_line_length(info->
var.xres_virtual,
274 info->
var.bits_per_pixel);
294 if (info->
var.grayscale) {
297 (red * 77 + green * 151 + blue * 28) >> 8;
321 #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
322 switch (info->
fix.visual) {
346 v = (red << info->
var.red.offset) |
347 (green << info->
var.green.offset) |
348 (blue << info->
var.blue.offset) |
349 (transp << info->
var.transp.offset);
350 switch (info->
var.bits_per_pixel) {
381 if (var->
xoffset + info->
var.xres > info->
var.xres_virtual ||
403 vma->
vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
418 if (!options || !*options)
421 while ((this_opt =
strsep(&options,
",")) !=
NULL) {
424 if (!
strncmp(this_opt,
"disable", 7))
425 mc68x328fb_enable = 0;
447 mc68x328fb_default.xres =
LXMAX;
448 mc68x328fb_default.yres =
LYMAX+1;
449 mc68x328fb_default.xres_virtual = mc68x328fb_default.xres;
450 mc68x328fb_default.yres_virtual = mc68x328fb_default.yres;
451 mc68x328fb_default.bits_per_pixel = 1 + (
LPICF & 0x01);
453 videomemorysize = (mc68x328fb_default.xres_virtual+7) / 8 *
454 mc68x328fb_default.yres_virtual * mc68x328fb_default.bits_per_pixel;
463 get_line_length(mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel);
464 fb_info.
fix.visual = (mc68x328fb_default.bits_per_pixel) == 1 ?
485 mc68x328fb_default.xres_virtual, mc68x328fb_default.yres_virtual,
486 1 << mc68x328fb_default.bits_per_pixel, videomemory);
495 static void __exit mc68x328fb_cleanup(
void)