diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /drivers/video/retz3fb.c | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'drivers/video/retz3fb.c')
-rw-r--r-- | drivers/video/retz3fb.c | 144 |
1 files changed, 83 insertions, 61 deletions
diff --git a/drivers/video/retz3fb.c b/drivers/video/retz3fb.c index 1ee42692f..dbc6eb022 100644 --- a/drivers/video/retz3fb.c +++ b/drivers/video/retz3fb.c @@ -109,6 +109,7 @@ struct retz3_fb_info { unsigned long physregs; int currcon; int current_par_valid; /* set to 0 by memset */ + int blitbusy; struct display disp; struct retz3fb_par current_par; unsigned char color_table [256][3]; @@ -169,7 +170,10 @@ under "programs/Xserver/hw/xfree86/doc/modeDB.txt". * Predefined Video Modes */ -static struct fb_videomode retz3fb_predefined[] __initdata = { +static struct { + const char *name; + struct fb_var_screeninfo var; +} retz3fb_predefined[] __initdata = { /* * NB: it is very important to adjust the pixel-clock to the color-depth. */ @@ -178,11 +182,7 @@ static struct fb_videomode retz3fb_predefined[] __initdata = { "640x480", { /* 640x480, 8 bpp */ 640, 480, 640, 480, 0, 0, 8, 0, {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, -#if 1 0, 0, -1, -1, FB_ACCEL_NONE, 39722, 48, 16, 33, 10, 96, 2, -#else - 0, 0, -1, -1, FB_ACCELF_TEXT, 38461, 28, 32, 12, 10, 96, 2, -#endif FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,FB_VMODE_NONINTERLACED } }, @@ -265,7 +265,7 @@ static int z3fb_mode __initdata = 0; * Interface used by the world */ -void retz3fb_setup(char *options, int *ints); +int retz3fb_setup(char *options); static int retz3fb_open(struct fb_info *info, int user); static int retz3fb_release(struct fb_info *info, int user); @@ -290,7 +290,7 @@ static int retz3fb_ioctl(struct inode *inode, struct file *file, * Interface to the low level console driver */ -void retz3fb_init(void); +int retz3fb_init(void); static int z3fb_switch(int con, struct fb_info *info); static int z3fb_updatevar(int con, struct fb_info *info); static void z3fb_blank(int blank, struct fb_info *info); @@ -346,7 +346,7 @@ static void retz3fb_set_disp(int con, struct fb_info *info); static int get_video_mode(const char *name); -/* -------------------- Hardware specific routines -------------------------- */ +/* -------------------- Hardware specific routines ------------------------- */ static unsigned short find_fq(unsigned int freq) { @@ -490,7 +490,7 @@ static int retz3_set_video(struct fb_info *info, #endif if (data.v_total >= 1024) - printk("MAYDAY: v_total >= 1024; bailing out!\n"); + printk(KERN_ERR "MAYDAY: v_total >= 1024; bailing out!\n"); reg_w(regs, GREG_MISC_OUTPUT_W, 0xe3 | ((clocksel & 3) * 0x04)); reg_w(regs, GREG_FEATURE_CONTROL_W, 0x00); @@ -770,7 +770,7 @@ static int retz3_set_video(struct fb_info *info, reg_w(regs, 0x83c6, 0xe0); break; default: - printk("Illegal color-depth: %i\n", bpp); + printk(KERN_INFO "Illegal color-depth: %i\n", bpp); } reg_w(regs, VDAC_ADDRESS, 0x00); @@ -794,9 +794,9 @@ static int retz3_encode_fix(struct fb_info *info, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, retz3fb_name); - fix->smem_start = (char *)(zinfo->physfbmem); + fix->smem_start = zinfo->physfbmem; fix->smem_len = zinfo->fbsize; - fix->mmio_start = (char *)(zinfo->physregs); + fix->mmio_start = zinfo->physregs; fix->mmio_len = 0x00c00000; fix->type = FB_TYPE_PACKED_PIXELS; @@ -959,6 +959,21 @@ static int retz3_getcolreg(unsigned int regno, unsigned int *red, } +static inline void retz3_busy(struct display *p) +{ + struct retz3_fb_info *zinfo = retz3info(p->fb_info); + volatile unsigned char *acm = zinfo->base + ACM_OFFSET; + unsigned char blt_status; + + if (zinfo->blitbusy) { + do{ + blt_status = *((acm) + (ACM_START_STATUS + 2)); + }while ((blt_status & 1) == 0); + zinfo->blitbusy = 0; + } +} + + static void retz3_bitblt (struct display *p, unsigned short srcx, unsigned short srcy, unsigned short destx, unsigned short desty, @@ -973,7 +988,6 @@ static void retz3_bitblt (struct display *p, unsigned short mod; unsigned long tmp; unsigned long pat, src, dst; - unsigned char blt_status; int i, xres_virtual = var->xres_virtual; short bpp = (var->bits_per_pixel & 0xff); @@ -983,16 +997,7 @@ static void retz3_bitblt (struct display *p, tmp = mask | (mask << 16); -#if 0 - /* - * Check for blitter finished before we start messing with the - * pattern. - */ - do{ - blt_status = *(((volatile unsigned char *)acm) + - (ACM_START_STATUS + 2)); - }while ((blt_status & 1) == 0); -#endif + retz3_busy(p); i = 0; do{ @@ -1042,23 +1047,7 @@ static void retz3_bitblt (struct display *p, *(((volatile unsigned char *)acm) + ACM_START_STATUS) = 0x00; *(((volatile unsigned char *)acm) + ACM_START_STATUS) = 0x01; - - /* - * No reason to wait for the blitter to finish, it is better - * just to check if it has finished before we use it again. - */ -#if 1 -#if 0 - while ((*(((volatile unsigned char *)acm) + - (ACM_START_STATUS + 2)) & 1) == 0); -#else - do{ - blt_status = *(((volatile unsigned char *)acm) + - (ACM_START_STATUS + 2)); - } - while ((blt_status & 1) == 0); -#endif -#endif + zinfo->blitbusy = 1; } #if 0 @@ -1192,7 +1181,6 @@ static int retz3fb_get_var(struct fb_var_screeninfo *var, int con, } -#if 1 static void retz3fb_set_disp(int con, struct fb_info *info) { struct fb_fix_screeninfo fix; @@ -1243,7 +1231,6 @@ static void retz3fb_set_disp(int con, struct fb_info *info) break; } } -#endif /* @@ -1407,12 +1394,12 @@ static struct fb_ops retz3fb_ops = { }; -__initfunc(void retz3fb_setup(char *options, int *ints)) +int __init retz3fb_setup(char *options) { char *this_opt; if (!options || !*options) - return; + return 0; for (this_opt = strtok(options, ","); this_opt; this_opt = strtok(NULL, ",")){ @@ -1422,9 +1409,10 @@ __initfunc(void retz3fb_setup(char *options, int *ints)) } else if (!strncmp(this_opt, "font:", 5)) { strncpy(fontname, this_opt+5, 39); fontname[39] = '\0'; - }else + } else z3fb_mode = get_video_mode(this_opt); } + return 0; } @@ -1432,7 +1420,7 @@ __initfunc(void retz3fb_setup(char *options, int *ints)) * Initialization */ -__initfunc(void retz3fb_init(void)) +int __init retz3fb_init(void) { unsigned long board_addr, board_size; unsigned int key; @@ -1444,10 +1432,10 @@ __initfunc(void retz3fb_init(void)) short i; if (!(key = zorro_find(ZORRO_PROD_MACROSYSTEMS_RETINA_Z3, 0, 0))) - return; + return -ENXIO; if (!(zinfo = kmalloc(sizeof(struct retz3_fb_info), GFP_KERNEL))) - return; + return -ENOMEM; memset(zinfo, 0, sizeof(struct retz3_fb_info)); cd = zorro_get_board (key); @@ -1505,13 +1493,15 @@ __initfunc(void retz3fb_init(void)) do_install_cmap(0, fb_info); if (register_framebuffer(fb_info) < 0) - return; + return -EINVAL; - printk("fb%d: %s frame buffer device, using %ldK of video memory\n", + printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n", GET_FB_IDX(fb_info->node), fb_info->modename,zinfo->fbsize>>10); /* TODO: This driver cannot be unloaded yet */ MOD_INC_USE_COUNT; + + return 0; } @@ -1576,11 +1566,11 @@ static void z3fb_blank(int blank, struct fb_info *info) * Get a Video Mode */ -__initfunc(static int get_video_mode(const char *name)) +static int __init get_video_mode(const char *name) { short i; - for (i = 0; i <= NUM_TOTAL_MODES; i++) + for (i = 0; i < NUM_TOTAL_MODES; i++) if (!strcmp(name, retz3fb_predefined[i].name)){ retz3fb_default = retz3fb_predefined[i].var; return i; @@ -1592,8 +1582,7 @@ __initfunc(static int get_video_mode(const char *name)) #ifdef MODULE int init_module(void) { - retz3fb_init(); - return 0; + return retz3fb_init(); } void cleanup_module(void) @@ -1613,8 +1602,8 @@ void cleanup_module(void) */ #ifdef FBCON_HAS_CFB8 -static void fbcon_retz3_8_bmove(struct display *p, int sy, int sx, - int dy, int dx, int height, int width) +static void retz3_8_bmove(struct display *p, int sy, int sx, + int dy, int dx, int height, int width) { int fontwidth = fontwidth(p); @@ -1633,8 +1622,8 @@ static void fbcon_retz3_8_bmove(struct display *p, int sy, int sx, 0xffff); } -static void fbcon_retz3_8_clear(struct vc_data *conp, struct display *p, - int sy, int sx, int height, int width) +static void retz3_8_clear(struct vc_data *conp, struct display *p, + int sy, int sx, int height, int width) { unsigned short col; int fontwidth = fontwidth(p); @@ -1657,9 +1646,42 @@ static void fbcon_retz3_8_clear(struct vc_data *conp, struct display *p, col); } + +static void retz3_putc(struct vc_data *conp, struct display *p, int c, + int yy, int xx) +{ + retz3_busy(p); + fbcon_cfb8_putc(conp, p, c, yy, xx); +} + + +static void retz3_putcs(struct vc_data *conp, struct display *p, + const unsigned short *s, int count, + int yy, int xx) +{ + retz3_busy(p); + fbcon_cfb8_putcs(conp, p, s, count, yy, xx); +} + + +static void retz3_revc(struct display *p, int xx, int yy) +{ + retz3_busy(p); + fbcon_cfb8_revc(p, xx, yy); +} + + +static void retz3_clear_margins(struct vc_data* conp, struct display* p, + int bottom_only) +{ + retz3_busy(p); + fbcon_cfb8_clear_margins(conp, p, bottom_only); +} + + static struct display_switch fbcon_retz3_8 = { - fbcon_cfb8_setup, fbcon_retz3_8_bmove, fbcon_retz3_8_clear, - fbcon_cfb8_putc, fbcon_cfb8_putcs, fbcon_cfb8_revc, NULL, NULL, - fbcon_cfb8_clear_margins, FONTWIDTH(8) + fbcon_cfb8_setup, retz3_8_bmove, retz3_8_clear, + retz3_putc, retz3_putcs, retz3_revc, NULL, NULL, + retz3_clear_margins, FONTWIDTH(8) }; #endif |