Commit 596e800f authored by James Simmons's avatar James Simmons

More porting to new api.

parent 6c369b2b
...@@ -45,7 +45,7 @@ obj-$(CONFIG_FB_ACORN) += acornfb.o ...@@ -45,7 +45,7 @@ obj-$(CONFIG_FB_ACORN) += acornfb.o
obj-$(CONFIG_FB_AMIGA) += amifb.o obj-$(CONFIG_FB_AMIGA) += amifb.o
obj-$(CONFIG_FB_PM2) += pm2fb.o obj-$(CONFIG_FB_PM2) += pm2fb.o
obj-$(CONFIG_FB_APOLLO) += dnfb.o obj-$(CONFIG_FB_APOLLO) += dnfb.o
obj-$(CONFIG_FB_Q40) += q40fb.o obj-$(CONFIG_FB_Q40) += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_ATARI) += atafb.o obj-$(CONFIG_FB_ATARI) += atafb.o
obj-$(CONFIG_FB_ATY128) += aty128fb.o obj-$(CONFIG_FB_ATY128) += aty128fb.o
obj-$(CONFIG_FB_RADEON) += radeonfb.o obj-$(CONFIG_FB_RADEON) += radeonfb.o
...@@ -73,7 +73,7 @@ obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimg ...@@ -73,7 +73,7 @@ obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimg
obj-$(CONFIG_FB_VGA16) += vga16fb.o fbcon-vga-planes.o obj-$(CONFIG_FB_VGA16) += vga16fb.o fbcon-vga-planes.o
obj-$(CONFIG_FB_VIRGE) += virgefb.o obj-$(CONFIG_FB_VIRGE) += virgefb.o
obj-$(CONFIG_FB_G364) += g364fb.o obj-$(CONFIG_FB_G364) += g364fb.o
obj-$(CONFIG_FB_FM2) += fm2fb.o obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_CREATOR) += creatorfb.o sbusfb.o obj-$(CONFIG_FB_CREATOR) += creatorfb.o sbusfb.o
obj-$(CONFIG_FB_CGSIX) += cgsixfb.o sbusfb.o obj-$(CONFIG_FB_CGSIX) += cgsixfb.o sbusfb.o
obj-$(CONFIG_FB_BWTWO) += bwtwofb.o sbusfb.o obj-$(CONFIG_FB_BWTWO) += bwtwofb.o sbusfb.o
...@@ -114,7 +114,7 @@ obj-$(CONFIG_FB_BWTWO) += bwtwofb.o ...@@ -114,7 +114,7 @@ obj-$(CONFIG_FB_BWTWO) += bwtwofb.o
obj-$(CONFIG_FB_HGA) += hgafb.o obj-$(CONFIG_FB_HGA) += hgafb.o
obj-$(CONFIG_FB_SA1100) += sa1100fb.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o
obj-$(CONFIG_FB_VIRTUAL) += vfb.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o
obj-$(CONFIG_FB_HIT) += hitfb.o obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_E1355) += epson1355fb.o obj-$(CONFIG_FB_E1355) += epson1355fb.o
obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o
obj-$(CONFIG_FB_VOODOO1) += sstfb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o
......
...@@ -70,6 +70,8 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image) ...@@ -70,6 +70,8 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
src = image->data; src = image->data;
if (image->depth == 1) {
if (p->fix.visual == FB_VISUAL_TRUECOLOR) { if (p->fix.visual == FB_VISUAL_TRUECOLOR) {
fgx = fgcolor = ((u32 *)(p->pseudo_palette))[image->fg_color]; fgx = fgcolor = ((u32 *)(p->pseudo_palette))[image->fg_color];
bgx = bgcolor = ((u32 *)(p->pseudo_palette))[image->bg_color]; bgx = bgcolor = ((u32 *)(p->pseudo_palette))[image->bg_color];
...@@ -106,4 +108,5 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image) ...@@ -106,4 +108,5 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
l =- pad; l =- pad;
dst1 += p->fix.line_length; dst1 += p->fix.line_length;
} }
}
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* *
* Written for 2.0.x by Steffen A. Mork * Written for 2.0.x by Steffen A. Mork
* Ported to 2.1.x by Geert Uytterhoeven * Ported to 2.1.x by Geert Uytterhoeven
* Ported to new api by James Simmons
* *
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for * License. See the file COPYING in the main directory of this archive for
...@@ -18,12 +19,9 @@ ...@@ -18,12 +19,9 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/zorro.h> #include <linux/zorro.h>
#include <asm/io.h> #include <asm/io.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#include <video/fbcon-cfb32.h>
/* /*
* Some technical notes: * Some technical notes:
...@@ -117,7 +115,6 @@ ...@@ -117,7 +115,6 @@
* *
*/ */
/* /*
* definitions * definitions
*/ */
...@@ -130,29 +127,22 @@ ...@@ -130,29 +127,22 @@
#define FRAMEMASTER_COMPL 4 #define FRAMEMASTER_COMPL 4
#define FRAMEMASTER_ROM 8 #define FRAMEMASTER_ROM 8
struct FrameMaster_fb_par
{
int xres;
int yres;
int bpp;
int pixclock;
};
static unsigned long fm2fb_mem_phys;
static void *fm2fb_mem;
static unsigned long fm2fb_reg_phys;
static volatile unsigned char *fm2fb_reg; static volatile unsigned char *fm2fb_reg;
static struct display disp; #define arraysize(x) (sizeof(x)/sizeof(*(x)))
static struct fb_info fb_info;
static struct { u_char red, green, blue, pad; } palette[16];
#ifdef FBCON_HAS_CFB32
static u32 fbcon_cfb32_cmap[16];
#endif
static struct fb_fix_screeninfo fb_fix; static struct fb_info fb_info;
static struct fb_var_screeninfo fb_var; static u32 pseudo_palette[17];
static struct display display;
static struct fb_fix_screeninfo fb_fix __initdata = {
smem_len: FRAMEMASTER_REG,
type: FB_TYPE_PACKED_PIXELS,
visual: FB_VISUAL_TRUECOLOR,
line_length: (768 << 2),
mmio_len: (8),
accel: FB_ACCEL_NONE,
};
static int fm2fb_mode __initdata = -1; static int fm2fb_mode __initdata = -1;
...@@ -175,123 +165,56 @@ static struct fb_var_screeninfo fb_var_modes[] __initdata = { ...@@ -175,123 +165,56 @@ static struct fb_var_screeninfo fb_var_modes[] __initdata = {
} }
}; };
/* /*
* Interface used by the world * Interface used by the world
*/ */
int fm2fb_init(void);
static int fm2fb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info);
static int fm2fb_get_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info);
static int fm2fb_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info);
static int fm2fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info);
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info); u_int transp, struct fb_info *info);
static int fm2fb_blank(int blank, struct fb_info *info); static int fm2fb_blank(int blank, struct fb_info *info);
/*
* Interface to the low level console driver
*/
int fm2fb_init(void);
static int fm2fbcon_switch(int con, struct fb_info *info);
static int fm2fbcon_updatevar(int con, struct fb_info *info);
/*
* Internal routines
*/
static int fm2fb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
u_int *transp, struct fb_info *info);
static struct fb_ops fm2fb_ops = { static struct fb_ops fm2fb_ops = {
owner: THIS_MODULE, owner: THIS_MODULE,
fb_get_fix: fm2fb_get_fix, fb_get_fix: gen_get_fix,
fb_get_var: fm2fb_get_var, fb_get_var: gen_get_var,
fb_set_var: fm2fb_set_var, fb_set_var: gen_set_var,
fb_get_cmap: fm2fb_get_cmap, fb_get_cmap: gen_get_cmap,
fb_set_cmap: gen_set_cmap, fb_set_cmap: gen_set_cmap,
fb_setcolreg: fm2fb_setcolreg, fb_setcolreg: fm2fb_setcolreg,
fb_blank: fm2fb_blank, fb_blank: fm2fb_blank,
fb_fillrect: cfb_fillrect,
fb_copyarea: cfb_copyarea,
fb_imageblit: cfb_imageblit,
}; };
/* /*
* Get the Fixed Part of the Display * Blank the display.
*/ */
static int fm2fb_blank(int blank, struct fb_info *info)
static int fm2fb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info)
{ {
memcpy(fix, &fb_fix, sizeof(fb_fix)); unsigned char t = FRAMEMASTER_ROM;
return 0;
}
/*
* Get the User Defined Part of the Display
*/
static int fm2fb_get_var(struct fb_var_screeninfo *var, int con, if (!blank)
struct fb_info *info) t |= FRAMEMASTER_ENABLE | FRAMEMASTER_NOLACE;
{ fm2fb_reg[0] = t;
memcpy(var, &fb_var, sizeof(fb_var));
return 0;
} }
/* /*
* Set the User Defined Part of the Display * 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 fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
static int fm2fb_set_var(struct fb_var_screeninfo *var, int con, u_int transp, struct fb_info *info)
struct fb_info *info)
{ {
struct display *display; if (regno > 15)
int oldbpp = -1, err; return 1;
red >>= 8;
if (con >= 0) green >>= 8;
display = &fb_display[con]; blue >>= 8;
else
display = &disp; /* used during initialization */
if (var->xres > fb_var.xres || var->yres > fb_var.yres ||
var->xres_virtual > fb_var.xres_virtual ||
var->yres_virtual > fb_var.yres_virtual ||
var->bits_per_pixel > fb_var.bits_per_pixel ||
var->nonstd ||
(var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
return -EINVAL;
memcpy(var, &fb_var, sizeof(fb_var));
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
oldbpp = display->var.bits_per_pixel;
display->var = *var;
}
if (oldbpp != var->bits_per_pixel) {
if ((err = fb_alloc_cmap(&display->cmap, 0, 0)))
return err;
do_install_cmap(con, info);
}
return 0;
}
/*
* Get the Colormap
*/
static int fm2fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, ((u32*)(info->pseudo_palette))[regno] = (red << 16) | (green << 8) | blue;
struct fb_info *info)
{
if (con == info->currcon) /* current console? */
return fb_get_cmap(cmap, kspc, fm2fb_getcolreg, info);
else if (fb_display[con].cmap.len) /* non default colormap? */
fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
else
fb_copy_cmap(fb_default_cmap(256), cmap, kspc ? 0 : 2);
return 0; return 0;
} }
...@@ -301,9 +224,9 @@ static int fm2fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, ...@@ -301,9 +224,9 @@ static int fm2fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
int __init fm2fb_init(void) int __init fm2fb_init(void)
{ {
int is_fm;
struct zorro_dev *z = NULL; struct zorro_dev *z = NULL;
unsigned long *ptr; unsigned long *ptr;
int is_fm;
int x, y; int x, y;
while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
...@@ -313,84 +236,58 @@ int __init fm2fb_init(void) ...@@ -313,84 +236,58 @@ int __init fm2fb_init(void)
is_fm = 0; is_fm = 0;
else else
continue; continue;
if (!request_mem_region(z->resource.start, FRAMEMASTER_SIZE, "fm2fb")) if (!request_mem_region(z->resource.start, FRAMEMASTER_SIZE, "fm2fb"))
continue; continue;
/* assigning memory to kernel space */ /* assigning memory to kernel space */
fm2fb_mem_phys = z->resource.start; fb_fix.smem_start = z->resource.start;
fm2fb_mem = ioremap(fm2fb_mem_phys, FRAMEMASTER_SIZE); fb_info.screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
fm2fb_reg_phys = fm2fb_mem_phys+FRAMEMASTER_REG; fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
fm2fb_reg = (unsigned char *)(fm2fb_mem+FRAMEMASTER_REG); fm2fb_reg = (unsigned char *)(fb_info.screen_base+FRAMEMASTER_REG);
strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
/* make EBU color bars on display */ /* make EBU color bars on display */
ptr = (unsigned long *)fm2fb_mem; ptr = (unsigned long *)fb_fix.smem_start;
for (y = 0; y < 576; y++) { for (y = 0; y < 576; y++) {
for (x = 0; x < 96; x++) *ptr++ = 0xffffff; /* white */ for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
for (x = 0; x < 96; x++) *ptr++ = 0xffff00; /* yellow */ for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
for (x = 0; x < 96; x++) *ptr++ = 0x00ffff; /* cyan */ for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
for (x = 0; x < 96; x++) *ptr++ = 0x00ff00; /* green */ for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
for (x = 0; x < 96; x++) *ptr++ = 0xff00ff; /* magenta */ for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
for (x = 0; x < 96; x++) *ptr++ = 0xff0000; /* red */ for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
for (x = 0; x < 96; x++) *ptr++ = 0x0000ff; /* blue */ for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
for (x = 0; x < 96; x++) *ptr++ = 0x000000; /* black */ for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
} }
fm2fb_blank(0, NULL); fm2fb_blank(0, NULL);
if (fm2fb_mode == -1) if (fm2fb_mode == -1)
fm2fb_mode = FM2FB_MODE_PAL; fm2fb_mode = FM2FB_MODE_PAL;
fb_var = fb_var_modes[fm2fb_mode];
strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
fb_fix.smem_start = fm2fb_mem_phys;
fb_fix.smem_len = FRAMEMASTER_REG;
fb_fix.type = FB_TYPE_PACKED_PIXELS;
fb_fix.type_aux = 0;
fb_fix.visual = FB_VISUAL_TRUECOLOR;
fb_fix.line_length = 768<<2;
fb_fix.mmio_start = fm2fb_reg_phys;
fb_fix.mmio_len = 8;
fb_fix.accel = FB_ACCEL_NONE;
disp.var = fb_var;
disp.cmap.start = 0;
disp.cmap.len = 0;
disp.cmap.red = disp.cmap.green = disp.cmap.blue = disp.cmap.transp = NULL;
disp.visual = fb_fix.visual;
disp.type = fb_fix.type;
disp.type_aux = fb_fix.type_aux;
disp.ypanstep = 0;
disp.ywrapstep = 0;
disp.line_length = fb_fix.line_length;
disp.can_soft_blank = 1;
disp.inverse = 0;
#ifdef FBCON_HAS_CFB32
disp.dispsw = &fbcon_cfb32;
disp.dispsw_data = &fbcon_cfb32_cmap;
#else
disp.dispsw = &fbcon_dummy;
#endif
disp.scrollmode = SCROLL_YREDRAW;
strcpy(fb_info.modename, fb_fix.id); strcpy(fb_info.modename, fb_fix.id);
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fbops = &fm2fb_ops; fb_info.fbops = &fm2fb_ops;
fb_info.screen_base = (char *)fm2fb_mem; fb_info.var = fb_var_modes[fm2fb_mode];
fb_info.currcon = -1; fb_info.screen_base = (char *)fb_fix.smem_start;
fb_info.disp = &disp; fb_info.pseudo_palette = pseudo_palette;
fb_info.fontname[0] = '\0'; fb_info.fix = fb_fix;
fb_info.changevar = NULL;
fb_info.switch_con = &fm2fbcon_switch;
fb_info.updatevar = &fm2fbcon_updatevar;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.flags = FBINFO_FLAG_DEFAULT;
fm2fb_set_var(&fb_var, -1, &fb_info); /* The below feilds will go away !!!! */
fb_info.currcon = -1;
strcpy(fb_info.modename, fb_info.fix.id);
fb_info.disp = &display;
fb_info.switch_con = gen_switch;
fb_info.updatevar = gen_update_var;
fb_alloc_cmap(&fb_info.cmap, 16, 0);
gen_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return -EINVAL; return -EINVAL;
printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.node), printk("fb%d: %s frame buffer device\n", GET_FB_IDX(fb_info.node), fb_fix.id);
fb_fix.id);
return 0; return 0;
} }
return -ENXIO; return -ENXIO;
...@@ -412,83 +309,4 @@ int __init fm2fb_setup(char *options) ...@@ -412,83 +309,4 @@ int __init fm2fb_setup(char *options)
return 0; return 0;
} }
static int fm2fbcon_switch(int con, struct fb_info *info)
{
/* Do we have to save the colormap? */
if (fb_display[info->currcon].cmap.len)
fb_get_cmap(&fb_display[info->currcon].cmap, 1, fm2fb_getcolreg, info);
info->currcon = con;
/* Install new colormap */
do_install_cmap(con, info);
return 0;
}
/*
* Update the `var' structure (called by fbcon.c)
*/
static int fm2fbcon_updatevar(int con, struct fb_info *info)
{
/* Nothing */
return 0;
}
/*
* Blank the display.
*/
static int fm2fb_blank(int blank, struct fb_info *info)
{
unsigned char t = FRAMEMASTER_ROM;
if (!blank)
t |= FRAMEMASTER_ENABLE | FRAMEMASTER_NOLACE;
fm2fb_reg[0] = t;
return 0;
}
/*
* Read a single color register and split it into
* colors/transparent. Return != 0 for invalid regno.
*/
static int fm2fb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
u_int *transp, struct fb_info *info)
{
if (regno > 15)
return 1;
*red = (palette[regno].red<<8) | palette[regno].red;
*green = (palette[regno].green<<8) | palette[regno].green;
*blue = (palette[regno].blue<<8) | palette[regno].blue;
*transp = 0;
return 0;
}
/*
* 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 fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
if (regno > 15)
return 1;
red >>= 8;
green >>= 8;
blue >>= 8;
palette[regno].red = red;
palette[regno].green = green;
palette[regno].blue = blue;
#ifdef FBCON_HAS_CFB32
fbcon_cfb32_cmap[regno] = (red << 16) | (green << 8) | blue;
#endif
return 0;
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -386,44 +386,6 @@ static int __init hga_card_detect(void) ...@@ -386,44 +386,6 @@ static int __init hga_card_detect(void)
* *
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/**
* hga_get_fix - get the fixed part of the display
* @fix:struct fb_fix_screeninfo to fill in
* @con:unused
* @info:pointer to fb_info object containing info for current hga board
*
* This wrapper function copies @info->fix to @fix.
* A zero is returned on success and %-EINVAL for failure.
*/
int hga_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
{
CHKINFO(-EINVAL);
DPRINTK("hga_get_fix: con:%d, info:%x, fb_info:%x\n", con, (unsigned)info, (unsigned)&fb_info);
*fix = info->fix;
return 0;
}
/**
* hga_get_var - get the user defined part of the display
* @var:struct fb_var_screeninfo to fill in
* @con:unused
* @info:pointer to fb_info object containing info for current hga board
*
* This wrapper function copies @info->var to @var.
* A zero is returned on success and %-EINVAL for failure.
*/
int hga_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
{
CHKINFO(-EINVAL);
DPRINTK("hga_get_var: con:%d, info:%x, fb_info:%x\n", con, (unsigned)info, (unsigned)&fb_info);
*var = info->var;
return 0;
}
/** /**
* hga_set_var - set the user defined part of the display * hga_set_var - set the user defined part of the display
* @var:new video mode * @var:new video mode
...@@ -596,8 +558,8 @@ static int hgafb_blank(int blank_mode, struct fb_info *info) ...@@ -596,8 +558,8 @@ static int hgafb_blank(int blank_mode, struct fb_info *info)
static struct fb_ops hgafb_ops = { static struct fb_ops hgafb_ops = {
owner: THIS_MODULE, owner: THIS_MODULE,
fb_get_fix: hga_get_fix, fb_get_fix: gen_get_fix,
fb_get_var: hga_get_var, fb_get_var: gen_get_var,
fb_set_var: hga_set_var, fb_set_var: hga_set_var,
fb_get_cmap: hga_get_cmap, fb_get_cmap: hga_get_cmap,
fb_set_cmap: gen_set_cmap, fb_set_cmap: gen_set_cmap,
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/nubus.h> #include <linux/nubus.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/fb.h>
#include <asm/machvec.h> #include <asm/machvec.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -28,156 +29,32 @@ ...@@ -28,156 +29,32 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/hd64461.h> #include <asm/hd64461.h>
#include <linux/fb.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
struct hitfb_par static struct fb_var_screeninfo hitfb_var __initdata = {
{ activate: FB_ACTIVATE_NOW,
int x, y; height: -1,
int bpp; width: -1,
vmode: FB_VMODE_NONINTERLACED,
}; };
static struct fb_fix_screeninfo hitfb_fix __initdata = {
struct hitfb_info { id: "Hitachi HD64461",
struct fb_info_gen gen; type: FB_TYPE_PACKED_PIXELS,
struct display disp; visual: FB_VISUAL_TRUECOLOR,
struct hitfb_par current_par; accel_flags: FB_ACCEL_NONE,
struct fb_var_screeninfo default_var;
int current_par_valid;
unsigned long hit_videobase, hit_videosize;
union {
#ifdef FBCON_HAS_CFB16
u16 cfb16[16];
#endif
} fbcon_cmap;
} fb_info = {
{},
{},
{},
{},
0, 0, 0,
{},
}; };
static u16 pseudo_palette[17];
static struct display display;
struct fb_info fb_info;
static void hitfb_set_par(const void *fb_par, struct fb_info_gen *info); static int hitfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
static int hitfb_encode_var(struct fb_var_screeninfo *var, const void *fb_par,
struct fb_info_gen *info);
static void hitfb_detect(void)
{
struct hitfb_par par;
unsigned short lcdclor, ldr3, ldvntr;
fb_info.hit_videobase = CONFIG_HD64461_IOBASE + 0x02000000;
fb_info.hit_videosize = (MACH_HP680 || MACH_HP690) ? 1024*1024 : 512*1024;
lcdclor = inw(HD64461_LCDCLOR);
ldvntr = inw(HD64461_LDVNTR);
ldr3 = inw(HD64461_LDR3);
switch(ldr3&15) {
default:
case 4:
par.bpp = 8;
par.x = lcdclor;
break;
case 8:
par.bpp = 16;
par.x = lcdclor/2;
break;
}
par.y = ldvntr+1;
hitfb_set_par(&par, NULL);
hitfb_encode_var(&fb_info.default_var, &par, NULL);
}
static int hitfb_encode_fix(struct fb_fix_screeninfo *fix, const void *fb_par,
struct fb_info_gen *info)
{ {
const struct hitfb_par *par = fb_par;
memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, "Hitachi HD64461");
fix->smem_start = fb_info.hit_videobase;
fix->smem_len = fb_info.hit_videosize;
fix->type = FB_TYPE_PACKED_PIXELS;
fix->type_aux = 0;
fix->visual = (par->bpp == 8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
fix->xpanstep = 0;
fix->ypanstep = 0;
fix->ywrapstep = 0;
switch(par->bpp) {
default:
case 8:
fix->line_length = par->x;
break;
case 16:
fix->line_length = par->x*2;
break;
}
return 0;
}
static int hitfb_decode_var(const struct fb_var_screeninfo *var, void *fb_par,
struct fb_info_gen *info)
{
struct hitfb_par *par = fb_par;
par->x = var->xres;
par->y = var->yres;
par->bpp = var->bits_per_pixel;
return 0;
}
static int hitfb_encode_var(struct fb_var_screeninfo *var, const void *fb_par,
struct fb_info_gen *info)
{
const struct hitfb_par *par = fb_par;
memset(var, 0, sizeof(*var));
var->xres = par->x;
var->yres = par->y;
var->xres_virtual = var->xres; var->xres_virtual = var->xres;
var->yres_virtual = var->yres; var->yres_virtual = var->yres;
var->xoffset = 0;
var->yoffset = 0;
var->bits_per_pixel = par->bpp;
var->grayscale = 0;
var->transp.offset = 0;
var->transp.length = 0;
var->transp.msb_right = 0;
var->nonstd = 0;
var->activate = 0;
var->height = -1;
var->width = -1;
var->vmode = FB_VMODE_NONINTERLACED;
var->pixclock = 0;
var->sync = 0;
var->left_margin = 0;
var->right_margin = 0;
var->upper_margin = 0;
var->lower_margin = 0;
var->hsync_len = 0;
var->vsync_len = 0;
switch (var->bits_per_pixel) { switch (var->bits_per_pixel) {
case 8: case 8:
var->red.offset = 0; var->red.offset = 0;
var->red.length = 8; var->red.length = 8;
...@@ -188,7 +65,6 @@ static int hitfb_encode_var(struct fb_var_screeninfo *var, const void *fb_par, ...@@ -188,7 +65,6 @@ static int hitfb_encode_var(struct fb_var_screeninfo *var, const void *fb_par,
var->transp.offset = 0; var->transp.offset = 0;
var->transp.length = 0; var->transp.length = 0;
break; break;
case 16: /* RGB 565 */ case 16: /* RGB 565 */
var->red.offset = 11; var->red.offset = 11;
var->red.length = 5; var->red.length = 5;
...@@ -200,47 +76,26 @@ static int hitfb_encode_var(struct fb_var_screeninfo *var, const void *fb_par, ...@@ -200,47 +76,26 @@ static int hitfb_encode_var(struct fb_var_screeninfo *var, const void *fb_par,
var->transp.length = 0; var->transp.length = 0;
break; break;
} }
var->red.msb_right = 0;
var->green.msb_right = 0;
var->blue.msb_right = 0;
var->transp.msb_right = 0;
return 0; return 0;
} }
static int hitfb_set_par(struct fb_info *info)
static void hitfb_get_par(void *par, struct fb_info_gen *info)
{
*(struct hitfb_par *)par = fb_info.current_par;
}
static void hitfb_set_par(const void *fb_par, struct fb_info_gen *info)
{
const struct hitfb_par *par = fb_par;
fb_info.current_par = *par;
fb_info.current_par_valid = 1;
}
static int hitfb_getcolreg(unsigned regno, unsigned *red, unsigned *green,
unsigned *blue, unsigned *transp,
struct fb_info *info)
{ {
if (regno > 255) info->fix.visual = (info->var.bits_per_pixel == 8) ?
return 1; FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
outw(regno<<8, HD64461_CPTRAR);
*red = inw(HD64461_CPTRDR)<<10;
*green = inw(HD64461_CPTRDR)<<10;
*blue = inw(HD64461_CPTRDR)<<10;
*transp = 0;
switch(info->var.bits_per_pixel) {
default:
case 8:
info->fix.line_length = info->var.xres;
break;
case 16:
info->fix.line_length = info->var.xres*2;
break;
}
return 0; return 0;
} }
static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green, static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
struct fb_info *info) struct fb_info *info)
...@@ -248,16 +103,16 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -248,16 +103,16 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green,
if (regno > 255) if (regno > 255)
return 1; return 1;
outw(regno<<8, HD64461_CPTWAR); outw(regno << 8, HD64461_CPTWAR);
outw(red>>10, HD64461_CPTWDR); outw(red >> 10, HD64461_CPTWDR);
outw(green>>10, HD64461_CPTWDR); outw(green >> 10, HD64461_CPTWDR);
outw(blue>>10, HD64461_CPTWDR); outw(blue >> 10, HD64461_CPTWDR);
if(regno<16) { if (regno < 16) {
switch(fb_info.current_par.bpp) { switch(info->var.bits_per_pixel) {
#ifdef FBCON_HAS_CFB16 #ifdef FBCON_HAS_CFB16
case 16: case 16:
fb_info.fbcon_cmap.cfb16[regno] = ((u16 *)(info->pseudo_palette))[regno] =
((red & 0xf800) ) | ((red & 0xf800) ) |
((green & 0xfc00) >> 5) | ((green & 0xfc00) >> 5) |
((blue & 0xf800) >> 11); ((blue & 0xf800) >> 11);
...@@ -265,109 +120,73 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -265,109 +120,73 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green,
#endif #endif
} }
} }
return 0;
}
static int hitfb_pan_display(const struct fb_var_screeninfo *var,
struct fb_info_gen *info)
{
if (!fb_info.current_par_valid)
return -EINVAL;
return 0; return 0;
} }
static struct fb_ops hitfb_ops = {
owner: THIS_MODULE,
fb_get_fix: gen_get_fix,
fb_get_var: gen_get_var,
fb_set_var: gen_set_var,
fb_get_cmap: gen_get_cmap,
fb_set_cmap: gen_set_cmap,
fb_check_var: hitfb_check_var,
fb_set_par: hitfb_set_par,
fb_setcolreg: hitfb_setcolreg,
fb_fillrect: cfb_fillrect,
fb_copyarea: cfb_copyarea,
fb_imageblit: cfb_imageblit,
};
static int hitfb_blank(int blank_mode, struct fb_info_gen *info) int __init hitfb_init(void)
{ {
if (!fb_info.current_par_valid) unsigned short lcdclor, ldr3, ldvntr;
return 1;
return 0;
}
static void hitfb_set_disp(const void *fb_par, struct display *disp, hitfb_fix.smem_start = CONFIG_HD64461_IOBASE + 0x02000000;
struct fb_info_gen *info) hitfb_fix.smem_len = (MACH_HP680 || MACH_HP690) ? 1024*1024 : 512*1024;
{
const struct hitfb_par *par = fb_par;
disp->scrollmode = SCROLL_YREDRAW; lcdclor = inw(HD64461_LCDCLOR);
ldvntr = inw(HD64461_LDVNTR);
ldr3 = inw(HD64461_LDR3);
switch(((struct hitfb_par *)par)->bpp) { switch (ldr3&15) {
#ifdef FBCON_HAS_CFB8 default:
case 8: case 4:
disp->dispsw = &fbcon_cfb8; hitfb_var.bits_per_pixel = 8;
hitfb_var.xres = lcdclor;
break; break;
#endif case 8:
#ifdef FBCON_HAS_CFB16 hitfb_var.bits_per_pixel = 16;
case 16: hitfb_var.xres = lcdclor/2;
disp->dispsw = &fbcon_cfb16;
disp->dispsw_data = fb_info.fbcon_cmap.cfb16;
break; break;
#endif
default:
disp->dispsw = &fbcon_dummy;
} }
} hitfb_var.yres = ldvntr+1;
fb_info.node = NODEV;
fb_info.fbops = &hitfb_ops;
fb_info.var = hitfb_var;
fb_info.fix = hitfb_fix;
fb_info.pseudo_palette = pseudo_palette;
fb_info.flags = FBINFO_FLAG_DEFAULT;
struct fbgen_hwswitch hitfb_switch = { strcpy(fb_info.modename, fb_info.fix.id);
hitfb_detect, fb_info.currcon = -1;
hitfb_encode_fix, fb_info.disp = &display;
hitfb_decode_var, fb_info.changevar = NULL;
hitfb_encode_var, fb_info.switch_con = gen_switch;
hitfb_get_par, fb_info.updatevar = gen_update_var;
hitfb_set_par, fb_info.screen_base = (void *) hitfb_fix.smem_start;
hitfb_getcolreg,
hitfb_pan_display,
hitfb_blank,
hitfb_set_disp
};
static struct fb_ops hitfb_ops = { size = (fb_info.var.bits_per_pixel == 8) ? 256 : 16;
owner: THIS_MODULE, fb_alloc_cmap(&fb_info.cmap, size, 0);
fb_get_fix: fbgen_get_fix,
fb_get_var: fbgen_get_var,
fb_set_var: fbgen_set_var,
fb_get_cmap: fbgen_get_cmap,
fb_set_cmap: fbgen_set_cmap,
fb_setcolreg: hitfb_setcolreg,
fb_pan_display: fbgen_pan_display,
fb_blank: fbgen_blank,
};
gen_set_var(&fb_info.var, -1, &fb_info);
int __init hitfb_init(void) if (register_framebuffer(&fb_info) < 0)
{ return -EINVAL;
strcpy(fb_info.gen.info.modename, "Hitachi HD64461");
fb_info.gen.info.node = NODEV;
fb_info.gen.info.flags = FBINFO_FLAG_DEFAULT;
fb_info.gen.info.fbops = &hitfb_ops;
fb_info.gen.info.disp = &fb_info.disp;
fb_info.gen.info.currcon = 1;
fb_info.gen.info.changevar = NULL;
fb_info.gen.info.switch_con = &fbgen_switch;
fb_info.gen.info.updatevar = &fbgen_update_var;
fb_info.gen.parsize = sizeof(struct hitfb_par);
fb_info.gen.fbhw = &hitfb_switch;
fb_info.gen.fbhw->detect();
fb_info.screen_base = (void *)fb_info.hit_videobase;
fbgen_get_var(&fb_info.disp.var, -1, &fb_info.gen.info);
fb_info.disp.var.activate = FB_ACTIVATE_NOW;
fbgen_do_set_var(&fb_info.disp.var, 1, &fb_info.gen);
fbgen_set_disp(-1, &fb_info.gen);
do_install_cmap(0, &fb_info.gen);
if(register_framebuffer(&fb_info.gen.info)<0) return -EINVAL;
printk(KERN_INFO "fb%d: %s frame buffer device\n", printk(KERN_INFO "fb%d: %s frame buffer device\n",
GET_FB_IDX(fb_info.gen.info.node), fb_info.gen.info.modename); GET_FB_IDX(fb_info.node), fb_info.fix.id);
return 0; return 0;
} }
...@@ -392,7 +211,6 @@ void cleanup_module(void) ...@@ -392,7 +211,6 @@ void cleanup_module(void)
} }
#endif #endif
/* /*
* Local variables: * Local variables:
* c-basic-offset: 4 * c-basic-offset: 4
......
/*
* linux/drivers/video/q40fb.c -- Q40 frame buffer device
*
* Copyright (C) 2001
*
* Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details.
*/
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -9,181 +21,68 @@ ...@@ -9,181 +21,68 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/segment.h>
#include <asm/system.h> #include <asm/system.h>
/*#include <asm/irq.h>*/
#include <asm/q40_master.h> #include <asm/q40_master.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#include <video/fbcon-cfb16.h>
#define FBIOSETSCROLLMODE 0x4611
#define Q40_PHYS_SCREEN_ADDR 0xFE800000 #define Q40_PHYS_SCREEN_ADDR 0xFE800000
static u16 fbcon_cmap_cfb16[16]; static u32 pseudo_palette[17];
static struct fb_info fb_info;
static struct display display;
static struct fb_fix_screeninfo q40fb_fix __initdata = {
id: "Q40",
smem_len: 1024*1024,
type: FB_TYPE_PACKED_PIXELS,
visual: FB_VISUAL_TRUECOLOR,
line_length: 1024*2,
accel_flags: FB_ACCEL_NONE,
};
static struct fb_var_screeninfo q40fb_var __initdata = {
xres: 1024,
yres: 512,
xres_virtual: 1024,
yres_virtual: 512,
bits_per_pixel: 16,
red: {6, 5, 0},
green: {11, 5, 0},
blue: {0, 6, 0},
activate: FB_ACTIVATE_NOW,
height: 230,
width: 300,
vmode: FB_VMODE_NONINTERLACED,
};
/* frame buffer operations */ /* frame buffer operations */
int q40fb_init(void);
static int q40fb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info);
static int q40fb_get_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info);
static int q40fb_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info);
static int q40fb_get_cmap(struct fb_cmap *cmap,int kspc,int con,
struct fb_info *info);
static int q40fb_set_cmap(struct fb_cmap *cmap,int kspc,int con,
struct fb_info *info);
static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green, static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
const struct fb_info *info); struct fb_info *info);
static int q40con_switch(int con, struct fb_info *info);
static int q40con_updatevar(int con, struct fb_info *info);
static void q40fb_set_disp(int con, struct fb_info *info);
static struct display disp[MAX_NR_CONSOLES];
static struct fb_info fb_info;
static struct fb_ops q40fb_ops = { static struct fb_ops q40fb_ops = {
owner: THIS_MODULE, owner: THIS_MODULE,
fb_get_fix: q40fb_get_fix, fb_get_fix: gen_get_fix,
fb_get_var: q40fb_get_var, fb_get_var: gen_get_var,
fb_set_var: q40fb_set_var, fb_set_var: gen_set_var,
fb_get_cmap: q40fb_get_cmap, fb_get_cmap: gen_get_cmap,
fb_set_cmap: q40fb_set_cmap, fb_set_cmap: gen_set_cmap,
fb_setcolreg: q40fb_setcolreg, fb_setcolreg: q40fb_setcolreg,
fb_fillrect: cfb_fillrect,
fb_copyarea: cfb_copyarea,
fb_imageblit: cfb_imageblit,
}; };
static char q40fb_name[]="Q40";
static int q40fb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info)
{
memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id,"Q40");
fix->smem_start = info->screen_base;
fix->smem_len=1024*1024;
fix->type=FB_TYPE_PACKED_PIXELS;
fix->type_aux=0;
fix->visual=FB_VISUAL_TRUECOLOR; /* good approximation so far ..*/;
fix->xpanstep=0;
fix->ypanstep=0;
fix->ywrapstep=0;
fix->line_length=1024*2;
/* no mmio,accel ...*/
return 0;
}
static int q40fb_get_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info)
{
memset(var, 0, sizeof(struct fb_var_screeninfo));
var->xres=1024;
var->yres=512;
var->xres_virtual=1024;
var->yres_virtual=512;
var->xoffset=0;
var->yoffset=0;
var->bits_per_pixel=16;
var->grayscale=0;
var->nonstd=0;
var->activate=FB_ACTIVATE_NOW;
var->height=230; /* approx for my 17" monitor, more important */
var->width=300; /* than the absolute values is the unusual aspect ratio*/
var->red.offset=6; /*6*/
var->red.length=5;
var->green.offset=11; /*11*/
var->green.length=5;
var->blue.offset=0;
var->blue.length=6;
var->transp.length=0;
var->pixclock=0;
var->left_margin=0;
var->right_margin=0;
var->hsync_len=0;
var->vsync_len=0;
var->sync=0;
var->vmode=FB_VMODE_NONINTERLACED;
return 0;
}
static int q40fb_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info)
{
if(var->xres!=1024)
return -EINVAL;
if(var->yres!=512)
return -EINVAL;
if(var->xres_virtual!=1024)
return -EINVAL;
if(var->yres_virtual!=512)
return -EINVAL;
if(var->xoffset!=0)
return -EINVAL;
if(var->yoffset!=0)
return -EINVAL;
if(var->bits_per_pixel!=16)
return -EINVAL;
if(var->grayscale!=0)
return -EINVAL;
if(var->nonstd!=0)
return -EINVAL;
if(var->activate!=FB_ACTIVATE_NOW)
return -EINVAL;
if(var->pixclock!=0)
return -EINVAL;
if(var->left_margin!=0)
return -EINVAL;
if(var->right_margin!=0)
return -EINVAL;
if(var->hsync_len!=0)
return -EINVAL;
if(var->vsync_len!=0)
return -EINVAL;
if(var->sync!=0)
return -EINVAL;
if(var->vmode!=FB_VMODE_NONINTERLACED)
return -EINVAL;
return 0;
}
static int q40_getcolreg(unsigned regno, unsigned *red, unsigned *green,
unsigned *blue, unsigned *transp,
struct fb_info *info)
{
/*
* Read a single color register and split it into colors/transparent.
* The return values must have a 16 bit magnitude.
* Return != 0 for invalid regno.
*/
if (regno>=16) return 1;
*transp=0;
*green = ((fbcon_cmap_cfb16[regno]>>11) & 31)<<11;
*red = ((fbcon_cmap_cfb16[regno]>>6) & 31)<<11;
*blue = ((fbcon_cmap_cfb16[regno]) & 63)<<10;
return 0;
}
static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green, static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
const struct fb_info *info) struct fb_info *info)
{ {
/* /*
* Set a single color register. The values supplied have a 16 bit * Set a single color register. The values supplied have a 16 bit
...@@ -196,119 +95,43 @@ static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -196,119 +95,43 @@ static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
blue>>=10; blue>>=10;
if (regno < 16) { if (regno < 16) {
fbcon_cmap_cfb16[regno] = ((red & 31) <<6) | info->pseudo_palette[regno] = ((red & 31) <<6) |
((green & 31) << 11) | ((green & 31) << 11) |
(blue & 63); (blue & 63);
} }
return 0; return 0;
} }
static int q40fb_get_cmap(struct fb_cmap *cmap, int kspc, int con, int q40fb_init(void)
struct fb_info *info)
{
#if 1
if (con == info->currcon) /* current console? */
return fb_get_cmap(cmap, kspc, q40_getcolreg, info);
else if (fb_display[con].cmap.len) /* non default colormap? */
fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
else
fb_copy_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel),
cmap, kspc ? 0 : 2);
return 0;
#else
printk(KERN_ERR "get cmap not supported\n");
return -EINVAL;
#endif
}
static int q40fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{ {
#if 1
int err;
if (!fb_display[con].cmap.len) { /* no colormap allocated? */
if ((err = fb_alloc_cmap(&fb_display[con].cmap,
1<<fb_display[con].var.bits_per_pixel,
0)))
return err;
}
if (con == info->currcon) /* current console? */
return fb_set_cmap(cmap, kspc, info);
else
fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
return 0;
#else
printk(KERN_ERR "set cmap not supported\n");
return -EINVAL;
#endif
}
static void q40fb_set_disp(int con, struct fb_info *info)
{
struct fb_fix_screeninfo fix;
struct display *display;
q40fb_get_fix(&fix, con, info);
if (con>=0)
display = &fb_display[con];
else
display = &disp[0];
if (con<0) con=0;
display->visual = fix.visual;
display->type = fix.type;
display->type_aux = fix.type_aux;
display->ypanstep = fix.ypanstep;
display->ywrapstep = fix.ywrapstep;
display->can_soft_blank = 0;
display->inverse = 0;
display->line_length = fix.line_length;
display->scrollmode = SCROLL_YREDRAW;
#ifdef FBCON_HAS_CFB16
display->dispsw = &fbcon_cfb16;
disp->dispsw_data = fbcon_cmap_cfb16;
#else
display->dispsw = &fbcon_dummy;
#endif
}
int __init q40fb_init(void)
{
if ( !MACH_IS_Q40) if ( !MACH_IS_Q40)
return -ENXIO; return -ENXIO;
#if 0
fb_info.screen_base = kernel_map(Q40_PHYS_SCREEN_ADDR, 1024*1024,
KERNELMAP_NO_COPYBACK, NULL);
#else
fb_info.screen_base = Q40_PHYS_SCREEN_ADDR; /* mapped in q40/config.c */
#endif
fb_info.changevar=NULL; /* mapped in q40/config.c */
strcpy(&fb_info.modename[0],q40fb_name); q40fb_fix.smem_start = Q40_PHYS_SCREEN_ADDR;
fb_info.fontname[0]=0;
fb_info.disp=disp; fb_info.var = q40fb_var;
fb_info.currcon = -1; fb_info.fix = q40fb_fix;
fb_info.switch_con=&q40con_switch;
fb_info.updatevar=&q40con_updatevar;
fb_info.node = NODEV; fb_info.node = NODEV;
fb_info.fbops = &q40fb_ops; fb_info.fbops = &q40fb_ops;
fb_info.flags = FBINFO_FLAG_DEFAULT; /* not as module for now */ fb_info.flags = FBINFO_FLAG_DEFAULT; /* not as module for now */
fb_info.pseudo_palette = pseudo_palette;
fb_info.screen_base = (char *) q40fb_fix.smem_start;
/* The below feilds will go away !!!! */
fb_info.currcon = -1;
strcpy(fb_info.modename, fb_info.fix.id);
fb_info.disp = &display;
fb_info.switch_con = gen_switch;
fb_info.updatevar = gen_update_var;
fb_alloc_cmap(&fb_info.cmap, 16, 0);
master_outb(3,DISPLAY_CONTROL_REG); gen_set_disp(-1, &fb_info);
q40fb_get_var(&disp[0].var, 0, &fb_info); master_outb(3, DISPLAY_CONTROL_REG);
q40fb_set_disp(-1, &fb_info);
if (register_framebuffer(&fb_info) < 0) { if (register_framebuffer(&fb_info) < 0) {
printk(KERN_ERR "unable to register Q40 frame buffer\n"); printk(KERN_ERR "Unable to register Q40 frame buffer\n");
return -EINVAL; return -EINVAL;
} }
...@@ -317,16 +140,4 @@ int __init q40fb_init(void) ...@@ -317,16 +140,4 @@ int __init q40fb_init(void)
return 0; return 0;
} }
static int q40con_switch(int con, struct fb_info *info)
{
info->currcon=con;
return 0;
}
static int q40con_updatevar(int con, struct fb_info *info)
{
return 0;
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment