X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fvideo%2Fbw2.c;h=6577fdfdfc16ac2050874318dcabc03922ef8a20;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=b3ab23b0725bc56e3fc77faa9df16f0dacb93747;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index b3ab23b07..6577fdfdf 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c @@ -35,9 +35,8 @@ static int bw2_blank(int, struct fb_info *); -static int bw2_mmap(struct fb_info *, struct file *, struct vm_area_struct *); -static int bw2_ioctl(struct inode *, struct file *, unsigned int, - unsigned long, struct fb_info *); +static int bw2_mmap(struct fb_info *, struct vm_area_struct *); +static int bw2_ioctl(struct fb_info *, unsigned int, unsigned long); /* * Frame buffer operations @@ -51,7 +50,9 @@ static struct fb_ops bw2_ops = { .fb_imageblit = cfb_imageblit, .fb_mmap = bw2_mmap, .fb_ioctl = bw2_ioctl, - .fb_cursor = soft_cursor, +#ifdef CONFIG_COMPAT + .fb_compat_ioctl = sbusfb_compat_ioctl, +#endif }; /* OBio addresses for the bwtwo registers */ @@ -110,7 +111,7 @@ struct bw2_regs { struct bw2_par { spinlock_t lock; - struct bw2_regs *regs; + struct bw2_regs __iomem *regs; u32 flags; #define BW2_FLAG_BLANKED 0x00000001 @@ -119,7 +120,6 @@ struct bw2_par { unsigned long fbsize; struct sbus_dev *sdev; - struct list_head list; }; /** @@ -131,24 +131,24 @@ static int bw2_blank(int blank, struct fb_info *info) { struct bw2_par *par = (struct bw2_par *) info->par; - struct bw2_regs *regs = par->regs; + struct bw2_regs __iomem *regs = par->regs; unsigned long flags; u8 val; spin_lock_irqsave(&par->lock, flags); switch (blank) { - case 0: /* Unblanking */ + case FB_BLANK_UNBLANK: /* Unblanking */ val = sbus_readb(®s->control); val |= BWTWO_CTL_ENABLE_VIDEO; sbus_writeb(val, ®s->control); par->flags &= ~BW2_FLAG_BLANKED; break; - case 1: /* Normal blanking */ - case 2: /* VESA blank (vsync off) */ - case 3: /* VESA blank (hsync off) */ - case 4: /* Poweroff */ + case FB_BLANK_NORMAL: /* Normal blanking */ + case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ + case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ + case FB_BLANK_POWERDOWN: /* Poweroff */ val = sbus_readb(®s->control); val &= ~BWTWO_CTL_ENABLE_VIDEO; sbus_writeb(val, ®s->control); @@ -168,7 +168,7 @@ static struct sbus_mmap_map bw2_mmap_map[] = { { .size = 0 } }; -static int bw2_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) +static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct bw2_par *par = (struct bw2_par *)info->par; @@ -180,8 +180,7 @@ static int bw2_mmap(struct fb_info *info, struct file *file, struct vm_area_stru vma); } -static int bw2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg, struct fb_info *info) +static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { struct bw2_par *par = (struct bw2_par *) info->par; @@ -281,7 +280,7 @@ static void bw2_do_default_mode(struct bw2_par *par, struct fb_info *info, prom_halt(); } for ( ; *p; p += 2) { - u8 *regp = &((u8 *)par->regs)[p[0]]; + u8 __iomem *regp = &((u8 __iomem *)par->regs)[p[0]]; sbus_writeb(p[1], regp); } } @@ -323,13 +322,12 @@ static void bw2_init_one(struct sbus_dev *sdev) resp = &res; all->info.var.xres = all->info.var.xres_virtual = 1152; all->info.var.yres = all->info.var.yres_virtual = 900; - all->info.bits_per_pixel = 1; + all->info.var.bits_per_pixel = 1; linebytes = 1152 / 8; } else #else { - if (!sdev) - BUG(); + BUG_ON(!sdev); all->par.physbase = sdev->reg_addrs[0].phys_addr; resp = &sdev->resource[0]; sbusfb_fill_var(&all->info.var, (sdev ? sdev->prom_node : 0), 1); @@ -337,9 +335,12 @@ static void bw2_init_one(struct sbus_dev *sdev) all->info.var.xres); } #endif + all->info.var.red.length = all->info.var.green.length = + all->info.var.blue.length = all->info.var.bits_per_pixel; + all->info.var.red.offset = all->info.var.green.offset = + all->info.var.blue.offset = 0; - all->par.regs = (struct bw2_regs *) - sbus_ioremap(resp, BWTWO_REGISTER_OFFSET, + all->par.regs = sbus_ioremap(resp, BWTWO_REGISTER_OFFSET, sizeof(struct bw2_regs), "bw2 regs"); if (sdev && !prom_getbool(sdev->prom_node, "width")) @@ -347,17 +348,16 @@ static void bw2_init_one(struct sbus_dev *sdev) all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); - all->info.flags = FBINFO_FLAG_DEFAULT; + all->info.flags = FBINFO_DEFAULT; all->info.fbops = &bw2_ops; #if defined(CONFIG_SPARC32) if (sdev) - all->info.screen_base = (char *) + all->info.screen_base = (char __iomem *) prom_getintdefault(sdev->prom_node, "address", 0); #endif if (!all->info.screen_base) - all->info.screen_base = (char *) + all->info.screen_base = sbus_ioremap(resp, 0, all->par.fbsize, "bw2 ram"); - all->info.currcon = -1; all->info.par = &all->par; bw2_blank(0, &all->info); @@ -382,6 +382,9 @@ int __init bw2_init(void) struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("bw2fb", NULL)) + return -ENODEV; + #ifdef CONFIG_SUN4 bw2_init_one(NULL); #endif @@ -412,8 +415,9 @@ bw2_setup(char *arg) return 0; } -#ifdef MODULE module_init(bw2_init); + +#ifdef MODULE module_exit(bw2_exit); #endif