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;
} }
}
} }
This diff is collapsed.
...@@ -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,
......
This diff is collapsed.
/*
* 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