summaryrefslogtreecommitdiffstats
path: root/drivers/video/retz3fb.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
commitc7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch)
tree3682407a599b8f9f03fc096298134cafba1c9b2f /drivers/video/retz3fb.c
parent1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff)
o Merge with Linux 2.1.116.
o New Newport console code. o New G364 console code.
Diffstat (limited to 'drivers/video/retz3fb.c')
-rw-r--r--drivers/video/retz3fb.c103
1 files changed, 54 insertions, 49 deletions
diff --git a/drivers/video/retz3fb.c b/drivers/video/retz3fb.c
index 82dcc2877..548f88602 100644
--- a/drivers/video/retz3fb.c
+++ b/drivers/video/retz3fb.c
@@ -20,8 +20,6 @@
* for more details.
*/
-
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -81,6 +79,8 @@ struct retz3fb_par {
int hsync_len; /* length of horizontal sync */
int vsync_len; /* length of vertical sync */
int vmode;
+
+ int accel;
};
struct display_data {
@@ -196,7 +196,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},
- 0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 38461, 28, 32, 12, 10, 96, 2,
+ 0, 0, -1, -1, FB_ACCELF_TEXT, 38461, 28, 32, 12, 10, 96, 2,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
}
},
@@ -208,7 +208,7 @@ static struct fb_videomode retz3fb_predefined[] __initdata = {
"800x600", { /* 800x600, 8 bpp */
800, 600, 800, 600, 0, 0, 8, 0,
{0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 27778, 64, 24, 22, 1, 120, 2,
+ 0, 0, -1, -1, FB_ACCELF_TEXT, 27778, 64, 24, 22, 1, 120, 2,
FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
}
},
@@ -220,21 +220,21 @@ static struct fb_videomode retz3fb_predefined[] __initdata = {
"1024x768i", { /* 1024x768, 8 bpp, interlaced */
1024, 768, 1024, 768, 0, 0, 8, 0,
{0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 22222, 40, 40, 32, 9, 160, 8,
+ 0, 0, -1, -1, FB_ACCELF_TEXT, 22222, 40, 40, 32, 9, 160, 8,
FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED
}
}, {
"640x480-16", { /* 640x480, 16 bpp */
640, 480, 640, 480, 0, 0, 16, 0,
{11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 38461/2, 28, 32, 12, 10, 96, 2,
+ 0, 0, -1, -1, 0, 38461/2, 28, 32, 12, 10, 96, 2,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
}
}, {
"640x480-24", { /* 640x480, 24 bpp */
640, 480, 640, 480, 0, 0, 24, 0,
{8, 8, 8}, {8, 8, 8}, {8, 8, 8}, {0, 0, 0},
- 0, 0, -1, -1, FB_ACCEL_NCR77C32BLT, 38461/3, 28, 32, 12, 10, 96, 2,
+ 0, 0, -1, -1, 0, 38461/3, 28, 32, 12, 10, 96, 2,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
}
},
@@ -255,8 +255,8 @@ static int z3fb_mode __initdata = 0;
void retz3fb_setup(char *options, int *ints);
-static int retz3fb_open(struct fb_info *info);
-static int retz3fb_release(struct fb_info *info);
+static int retz3fb_open(struct fb_info *info, int user);
+static int retz3fb_release(struct fb_info *info, int user);
static int retz3fb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info);
static int retz3fb_get_var(struct fb_var_screeninfo *var, int con,
@@ -278,7 +278,7 @@ static int retz3fb_ioctl(struct inode *inode, struct file *file,
* Interface to the low level console driver
*/
-unsigned long retz3fb_init(unsigned long mem_start);
+void 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);
@@ -288,7 +288,7 @@ static void z3fb_blank(int blank, struct fb_info *info);
* Text console acceleration
*/
-#ifdef CONFIG_FBCON_CFB8
+#ifdef FBCON_HAS_CFB8
static struct display_switch fbcon_retz3_8;
#endif
@@ -834,12 +834,11 @@ static int retz3_init(void)
static int retz3_encode_fix(struct fb_fix_screeninfo *fix,
struct retz3fb_par *par)
{
- short i;
-
+ memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, retz3fb_name);
fix->smem_start = (char *)z3_fbmem;
fix->smem_len = z3_size;
- fix->mmio_start = (unsigned char *)z3_regs;
+ fix->mmio_start = (char *)z3_regs;
fix->mmio_len = 0x00c00000;
fix->type = FB_TYPE_PACKED_PIXELS;
@@ -854,10 +853,7 @@ static int retz3_encode_fix(struct fb_fix_screeninfo *fix,
fix->ywrapstep = 0;
fix->line_length = 0;
- fix->accel = FB_ACCEL_NCR77C32BLT;
-
- for (i = 0; i < arraysize(fix->reserved); i++)
- fix->reserved[i] = 0;
+ fix->accel = FB_ACCEL_NCR_77C32BLT;
return 0;
}
@@ -891,6 +887,11 @@ static int retz3_decode_var(struct fb_var_screeninfo *var,
par->hsync_len = var->hsync_len;
par->vsync_len = var->vsync_len;
+ if (var->accel_flags & FB_ACCELF_TEXT)
+ par->accel = FB_ACCELF_TEXT;
+ else
+ par->accel = 0;
+
return 0;
}
@@ -903,8 +904,7 @@ static int retz3_decode_var(struct fb_var_screeninfo *var,
static int retz3_encode_var(struct fb_var_screeninfo *var,
struct retz3fb_par *par)
{
- short i;
-
+ memset(var, 0, sizeof(struct fb_var_screeninfo));
var->xres = par->xres;
var->yres = par->yres;
var->xres_virtual = par->xres_vir;
@@ -926,7 +926,7 @@ static int retz3_encode_var(struct fb_var_screeninfo *var,
var->height = -1;
var->width = -1;
- var->accel = FB_ACCEL_NCR77C32BLT;
+ var->accel_flags = (par->accel && par->bpp == 8) ? FB_ACCELF_TEXT : 0;
var->pixclock = par->pixclock;
@@ -938,9 +938,6 @@ static int retz3_encode_var(struct fb_var_screeninfo *var,
var->hsync_len = par->hsync_len;
var->vsync_len = par->vsync_len;
- for (i = 0; i < arraysize(var->reserved); i++)
- var->reserved[i] = 0;
-
var->vmode = par->vmode;
return 0;
}
@@ -1202,7 +1199,7 @@ static void do_install_cmap(int con, struct fb_info *info)
* Open/Release the frame buffer device
*/
-static int retz3fb_open(struct fb_info *info)
+static int retz3fb_open(struct fb_info *info, int user)
{
/*
* Nothing, only a usage count for the moment
@@ -1212,7 +1209,7 @@ static int retz3fb_open(struct fb_info *info)
return 0;
}
-static int retz3fb_release(struct fb_info *info)
+static int retz3fb_release(struct fb_info *info, int user)
{
MOD_DEC_USE_COUNT;
return 0;
@@ -1272,7 +1269,7 @@ static void retz3fb_set_disp(int con, struct fb_info *info)
if (con == -1)
con = 0;
- display->screen_base = (unsigned char *)fix.smem_start;
+ display->screen_base = fix.smem_start;
display->visual = fix.visual;
display->type = fix.type;
display->type_aux = fix.type_aux;
@@ -1281,12 +1278,16 @@ static void retz3fb_set_disp(int con, struct fb_info *info)
display->can_soft_blank = 1;
display->inverse = z3fb_inverse;
switch (display->var.bits_per_pixel) {
-#ifdef CONFIG_FBCON_CFB8
+#ifdef FBCON_HAS_CFB8
case 8:
- display->dispsw = &fbcon_retz3_8;
+ if (display->var.accel_flags & FB_ACCELF_TEXT) {
+ display->dispsw = &fbcon_retz3_8;
+#warning FIXME: We should reinit the graphics engine here
+ } else
+ display->dispsw = &fbcon_cfb8;
break;
#endif
-#ifdef CONFIG_FBCON_CFB16
+#ifdef FBCON_HAS_CFB16
case 16:
display->dispsw = &fbcon_cfb16;
break;
@@ -1305,7 +1306,7 @@ static void retz3fb_set_disp(int con, struct fb_info *info)
static int retz3fb_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info)
{
- int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp;
+ int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldaccel;
struct display *display;
if (con >= 0)
@@ -1326,12 +1327,14 @@ static int retz3fb_set_var(struct fb_var_screeninfo *var, int con,
oldvxres = display->var.xres_virtual;
oldvyres = display->var.yres_virtual;
oldbpp = display->var.bits_per_pixel;
+ oldaccel = display->var.accel_flags;
display->var = *var;
if (oldxres != var->xres || oldyres != var->yres ||
oldvxres != var->xres_virtual ||
oldvyres != var->yres_virtual ||
- oldbpp != var->bits_per_pixel) {
+ oldbpp != var->bits_per_pixel ||
+ oldaccel != var->accel_flags) {
struct fb_fix_screeninfo fix;
retz3fb_get_fix(&fix, con, info);
@@ -1346,12 +1349,16 @@ static int retz3fb_set_var(struct fb_var_screeninfo *var, int con,
display->can_soft_blank = 1;
display->inverse = z3fb_inverse;
switch (display->var.bits_per_pixel) {
-#ifdef CONFIG_FBCON_CFB8
+#ifdef FBCON_HAS_CFB8
case 8:
- display->dispsw = &fbcon_retz3_8;
+ if (var->accel_flags & FB_ACCELF_TEXT) {
+ display->dispsw = &fbcon_retz3_8;
+#warning FIXME: We should reinit the graphics engine here
+ } else
+ display->dispsw = &fbcon_cfb8;
break;
#endif
-#ifdef CONFIG_FBCON_CFB16
+#ifdef FBCON_HAS_CFB16
case 16:
display->dispsw = &fbcon_cfb16;
break;
@@ -1448,7 +1455,7 @@ static int retz3fb_ioctl(struct inode *inode, struct file *file,
static struct fb_ops retz3fb_ops = {
retz3fb_open, retz3fb_release, retz3fb_get_fix, retz3fb_get_var,
retz3fb_set_var, retz3fb_get_cmap, retz3fb_set_cmap,
- retz3fb_pan_display, NULL, retz3fb_ioctl
+ retz3fb_pan_display, retz3fb_ioctl
};
@@ -1478,9 +1485,8 @@ __initfunc(void retz3fb_setup(char *options, int *ints))
* Initialization
*/
-__initfunc(unsigned long retz3fb_init(unsigned long mem_start))
+__initfunc(void retz3fb_init(void))
{
- int err;
unsigned long board_addr, board_size;
unsigned int key;
const struct ConfigDev *cd;
@@ -1488,7 +1494,7 @@ __initfunc(unsigned long retz3fb_init(unsigned long mem_start))
struct retz3fb_par par;
if (!(key = zorro_find(ZORRO_PROD_MACROSYSTEMS_RETINA_Z3, 0, 0)))
- return mem_start;
+ return;
cd = zorro_get_board (key);
zorro_config_board (key, 0);
@@ -1496,7 +1502,7 @@ __initfunc(unsigned long retz3fb_init(unsigned long mem_start))
board_size = (unsigned long)cd->cd_BoardSize;
z3_mem = kernel_map (board_addr, board_size,
- KERNELMAP_NOCACHE_SER, &mem_start);
+ KERNELMAP_NOCACHE_SER, NULL);
z3_regs = (char*) z3_mem;
z3_fbmem = z3_mem + VIDEO_MEM_OFFSET;
@@ -1518,10 +1524,6 @@ __initfunc(unsigned long retz3fb_init(unsigned long mem_start))
fb_info.updatevar = &z3fb_updatevar;
fb_info.blank = &z3fb_blank;
- err = register_framebuffer(&fb_info);
- if (err < 0)
- return mem_start;
-
if (z3fb_mode == -1)
retz3fb_default = retz3fb_predefined[0].var;
@@ -1535,13 +1537,14 @@ __initfunc(unsigned long retz3fb_init(unsigned long mem_start))
do_install_cmap(0, &fb_info);
+ if (register_framebuffer(&fb_info) < 0)
+ return;
+
printk("fb%d: %s frame buffer device, using %ldK of video memory\n",
GET_FB_IDX(fb_info.node), fb_info.modename, z3_size>>10);
/* TODO: This driver cannot be unloaded yet */
MOD_INC_USE_COUNT;
-
- return mem_start;
}
@@ -1604,7 +1607,8 @@ __initfunc(static int get_video_mode(const char *name))
#ifdef MODULE
int init_module(void)
{
- return(retz3fb_init(NULL));
+ retz3fb_init();
+ return 0;
}
void cleanup_module(void)
@@ -1623,7 +1627,7 @@ void cleanup_module(void)
* Text console acceleration
*/
-#ifdef CONFIG_FBCON_CFB8
+#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)
{
@@ -1670,6 +1674,7 @@ static void fbcon_retz3_8_clear(struct vc_data *conp, struct display *p, int
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
+ fbcon_cfb8_putc, fbcon_cfb8_putcs, fbcon_cfb8_revc, NULL, NULL,
+ fbcon_cfb8_clear_margins, FONTWIDTH(8)
};
#endif