X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fvideo%2Fpvr2fb.c;h=a93618bc9d274527fd627f4decdabb96347ff05f;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=5f63f10af805ca2580de9f1070ec5a62764237bc;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index 5f63f10af..a93618bc9 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c @@ -4,7 +4,7 @@ * Dreamcast. * * Copyright (c) 2001 M. R. Brown - * Copyright (c) 2001, 2002, 2003, 2004 Paul Mundt + * Copyright (c) 2001, 2002, 2003, 2004, 2005 Paul Mundt * * This file is part of the LinuxDC project (linuxdc.sourceforge.net). * @@ -33,7 +33,7 @@ * Then, when it's time to convert back to hardware settings, the only * constants are the borderstart_* offsets, all other values are derived from * the fb video mode: - * + * * // PAL * borderstart_h = 116; * borderstart_v = 44; @@ -53,10 +53,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -189,7 +187,7 @@ static short do_blank = 0; /* (Un)Blank the screen */ static unsigned int is_blanked = 0; /* Is the screen blanked? */ #ifdef CONFIG_SH_STORE_QUEUES -static struct sq_mapping *pvr2fb_map; +static unsigned long pvr2fb_map; #endif #ifdef CONFIG_SH_DMA @@ -211,26 +209,27 @@ static int pvr2fb_set_par(struct fb_info *info); static void pvr2_update_display(struct fb_info *info); static void pvr2_init_display(struct fb_info *info); static void pvr2_do_blank(void); -static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id, struct pt_regs *fp); +static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id); static int pvr2_init_cable(void); static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val, int size); +#ifdef CONFIG_SH_DMA static ssize_t pvr2fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos); +#endif static struct fb_ops pvr2fb_ops = { - .owner = THIS_MODULE, - .fb_setcolreg = pvr2fb_setcolreg, - .fb_blank = pvr2fb_blank, - .fb_check_var = pvr2fb_check_var, - .fb_set_par = pvr2fb_set_par, + .owner = THIS_MODULE, + .fb_setcolreg = pvr2fb_setcolreg, + .fb_blank = pvr2fb_blank, + .fb_check_var = pvr2fb_check_var, + .fb_set_par = pvr2fb_set_par, #ifdef CONFIG_SH_DMA .fb_write = pvr2fb_write, #endif .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, - .fb_cursor = soft_cursor, }; static struct fb_videomode pvr2_modedb[] __initdata = { @@ -627,7 +626,7 @@ static void pvr2_do_blank(void) is_blanked = do_blank > 0 ? do_blank : 0; } -static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id, struct pt_regs *fp) +static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id) { struct fb_info *info = dev_id; @@ -786,7 +785,7 @@ static int __init pvr2fb_common_init(void) goto out_err; } - fb_memset((unsigned long)fb_info->screen_base, 0, pvr2_fix.smem_len); + fb_memset(fb_info->screen_base, 0, pvr2_fix.smem_len); pvr2_fix.ypanstep = nopan ? 0 : 1; pvr2_fix.ywrapstep = nowrap ? 0 : 1; @@ -795,7 +794,7 @@ static int __init pvr2fb_common_init(void) fb_info->fix = pvr2_fix; fb_info->par = currentpar; fb_info->pseudo_palette = (void *)(fb_info->par + 1); - fb_info->flags = FBINFO_FLAG_DEFAULT; + fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; if (video_output == VO_VGA) defmode = DEFMODE_VGA; @@ -823,7 +822,7 @@ static int __init pvr2fb_common_init(void) modememused >> 10, (unsigned long)(fb_info->fix.smem_len >> 10)); printk("fb%d: Mode %dx%d-%d pitch = %ld cable: %s video output: %s\n", fb_info->node, fb_info->var.xres, fb_info->var.yres, - fb_info->var.bits_per_pixel, + fb_info->var.bits_per_pixel, get_line_length(fb_info->var.xres, fb_info->var.bits_per_pixel), (char *)pvr2_get_param(cables, NULL, cable_type, 3), (char *)pvr2_get_param(outputs, NULL, video_output, 3)); @@ -832,10 +831,10 @@ static int __init pvr2fb_common_init(void) printk(KERN_NOTICE "fb%d: registering with SQ API\n", fb_info->node); pvr2fb_map = sq_remap(fb_info->fix.smem_start, fb_info->fix.smem_len, - fb_info->fix.id); + fb_info->fix.id, pgprot_val(PAGE_SHARED)); printk(KERN_NOTICE "fb%d: Mapped video memory to SQ addr 0x%lx\n", - fb_info->node, pvr2fb_map->sq_addr); + fb_info->node, pvr2fb_map); #endif return 0; @@ -906,6 +905,15 @@ static int __init pvr2fb_dc_init(void) static void pvr2fb_dc_exit(void) { + if (fb_info->screen_base) { + iounmap(fb_info->screen_base); + fb_info->screen_base = NULL; + } + if (currentpar->mmio_base) { + iounmap((void *)currentpar->mmio_base); + currentpar->mmio_base = 0; + } + free_irq(HW_EVENT_VSYNC, 0); #ifdef CONFIG_SH_DMA free_dma(pvr2dma); @@ -940,11 +948,22 @@ static int __devinit pvr2fb_pci_probe(struct pci_dev *pdev, pvr2_fix.mmio_start = pci_resource_start(pdev, 1); pvr2_fix.mmio_len = pci_resource_len(pdev, 1); + fb_info->device = &pdev->dev; + return pvr2fb_common_init(); } static void __devexit pvr2fb_pci_remove(struct pci_dev *pdev) { + if (fb_info->screen_base) { + iounmap(fb_info->screen_base); + fb_info->screen_base = NULL; + } + if (currentpar->mmio_base) { + iounmap((void *)currentpar->mmio_base); + currentpar->mmio_base = 0; + } + pci_release_regions(pdev); } @@ -965,7 +984,7 @@ static struct pci_driver pvr2fb_pci_driver = { static int __init pvr2fb_pci_init(void) { - return pci_module_init(&pvr2fb_pci_driver); + return pci_register_driver(&pvr2fb_pci_driver); } static void pvr2fb_pci_exit(void) @@ -1057,10 +1076,16 @@ int __init pvr2fb_init(void) int i, ret = -ENODEV; int size; +#ifndef MODULE + char *option = NULL; + + if (fb_get_options("pvr2fb", &option)) + return -ENODEV; + pvr2fb_setup(option); +#endif size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); fb_info = kmalloc(size, GFP_KERNEL); - if (!fb_info) { printk(KERN_ERR "Failed to allocate memory for fb_info\n"); return -ENOMEM; @@ -1108,9 +1133,7 @@ static void __exit pvr2fb_exit(void) kfree(fb_info); } -#ifdef MODULE module_init(pvr2fb_init); -#endif module_exit(pvr2fb_exit); MODULE_AUTHOR("Paul Mundt , M. R. Brown ");