aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/pvr2fb.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-07-06 14:38:51 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-07-06 14:38:51 -0400
commite9705a77f50c1fd52356f4f0e515455273aae416 (patch)
treeeb6ba32acd0fff557bacffbec6e1e742871abae1 /drivers/video/pvr2fb.c
parent989e5ab3e8159f563b3fda5317febee5af040983 (diff)
fb: pvr2fb: Fix up section mismatch warnings.
A few minor things were broken here. fix and var screeninfo should have been __devinitdata, board_list[] gets renamed to board_driver[] so the modpost matching does the right thing, and we properly discard some of the unused exit sections. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/pvr2fb.c')
-rw-r--r--drivers/video/pvr2fb.c89
1 files changed, 42 insertions, 47 deletions
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index df2909ae704c..1b06ff5aafdf 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -147,16 +147,16 @@ static struct pvr2fb_par {
147 147
148static struct fb_info *fb_info; 148static struct fb_info *fb_info;
149 149
150static struct fb_fix_screeninfo pvr2_fix __initdata = { 150static struct fb_fix_screeninfo pvr2_fix __devinitdata = {
151 .id = "NEC PowerVR2", 151 .id = "NEC PowerVR2",
152 .type = FB_TYPE_PACKED_PIXELS, 152 .type = FB_TYPE_PACKED_PIXELS,
153 .visual = FB_VISUAL_TRUECOLOR, 153 .visual = FB_VISUAL_TRUECOLOR,
154 .ypanstep = 1, 154 .ypanstep = 1,
155 .ywrapstep = 1, 155 .ywrapstep = 1,
156 .accel = FB_ACCEL_NONE, 156 .accel = FB_ACCEL_NONE,
157}; 157};
158 158
159static struct fb_var_screeninfo pvr2_var __initdata = { 159static struct fb_var_screeninfo pvr2_var __devinitdata = {
160 .xres = 640, 160 .xres = 640,
161 .yres = 480, 161 .yres = 480,
162 .xres_virtual = 640, 162 .xres_virtual = 640,
@@ -195,10 +195,6 @@ static unsigned int shdma = PVR2_CASCADE_CHAN;
195static unsigned int pvr2dma = ONCHIP_NR_DMA_CHANNELS; 195static unsigned int pvr2dma = ONCHIP_NR_DMA_CHANNELS;
196#endif 196#endif
197 197
198/* Interface used by the world */
199
200int pvr2fb_setup(char*);
201
202static int pvr2fb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue, 198static int pvr2fb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue,
203 unsigned int transp, struct fb_info *info); 199 unsigned int transp, struct fb_info *info);
204static int pvr2fb_blank(int blank, struct fb_info *info); 200static int pvr2fb_blank(int blank, struct fb_info *info);
@@ -227,7 +223,7 @@ static struct fb_ops pvr2fb_ops = {
227#ifdef CONFIG_SH_DMA 223#ifdef CONFIG_SH_DMA
228 .fb_write = pvr2fb_write, 224 .fb_write = pvr2fb_write,
229#endif 225#endif
230 .fb_fillrect = cfb_fillrect, 226 .fb_fillrect = cfb_fillrect,
231 .fb_copyarea = cfb_copyarea, 227 .fb_copyarea = cfb_copyarea,
232 .fb_imageblit = cfb_imageblit, 228 .fb_imageblit = cfb_imageblit,
233}; 229};
@@ -252,7 +248,7 @@ static struct fb_videomode pvr2_modedb[] __initdata = {
252 /* 640x480 @ 60hz (VGA) */ 248 /* 640x480 @ 60hz (VGA) */
253 "vga_640x480", 60, 640, 480, VGA_CLK, 38, 33, 0, 18, 146, 26, 249 "vga_640x480", 60, 640, 480, VGA_CLK, 38, 33, 0, 18, 146, 26,
254 0, FB_VMODE_YWRAP 250 0, FB_VMODE_YWRAP
255 }, 251 },
256}; 252};
257 253
258#define NUM_TOTAL_MODES ARRAY_SIZE(pvr2_modedb) 254#define NUM_TOTAL_MODES ARRAY_SIZE(pvr2_modedb)
@@ -293,7 +289,7 @@ static void set_color_bitfields(struct fb_var_screeninfo *var)
293{ 289{
294 switch (var->bits_per_pixel) { 290 switch (var->bits_per_pixel) {
295 case 16: /* RGB 565 */ 291 case 16: /* RGB 565 */
296 pvr2fb_set_pal_type(PAL_RGB565); 292 pvr2fb_set_pal_type(PAL_RGB565);
297 var->red.offset = 11; var->red.length = 5; 293 var->red.offset = 11; var->red.length = 5;
298 var->green.offset = 5; var->green.length = 6; 294 var->green.offset = 5; var->green.length = 6;
299 var->blue.offset = 0; var->blue.length = 5; 295 var->blue.offset = 0; var->blue.length = 5;
@@ -306,7 +302,7 @@ static void set_color_bitfields(struct fb_var_screeninfo *var)
306 var->transp.offset = 0; var->transp.length = 0; 302 var->transp.offset = 0; var->transp.length = 0;
307 break; 303 break;
308 case 32: /* ARGB 8888 */ 304 case 32: /* ARGB 8888 */
309 pvr2fb_set_pal_type(PAL_ARGB8888); 305 pvr2fb_set_pal_type(PAL_ARGB8888);
310 var->red.offset = 16; var->red.length = 8; 306 var->red.offset = 16; var->red.length = 8;
311 var->green.offset = 8; var->green.length = 8; 307 var->green.offset = 8; var->green.length = 8;
312 var->blue.offset = 0; var->blue.length = 8; 308 var->blue.offset = 0; var->blue.length = 8;
@@ -379,13 +375,13 @@ static int pvr2fb_set_par(struct fb_info *info)
379 var->vmode &= FB_VMODE_MASK; 375 var->vmode &= FB_VMODE_MASK;
380 if (var->vmode & FB_VMODE_INTERLACED && video_output != VO_VGA) 376 if (var->vmode & FB_VMODE_INTERLACED && video_output != VO_VGA)
381 par->is_interlaced = 1; 377 par->is_interlaced = 1;
382 /* 378 /*
383 * XXX: Need to be more creative with this (i.e. allow doublecan for 379 * XXX: Need to be more creative with this (i.e. allow doublecan for
384 * PAL/NTSC output). 380 * PAL/NTSC output).
385 */ 381 */
386 if (var->vmode & FB_VMODE_DOUBLE && video_output == VO_VGA) 382 if (var->vmode & FB_VMODE_DOUBLE && video_output == VO_VGA)
387 par->is_doublescan = 1; 383 par->is_doublescan = 1;
388 384
389 par->hsync_total = var->left_margin + var->xres + var->right_margin + 385 par->hsync_total = var->left_margin + var->xres + var->right_margin +
390 var->hsync_len; 386 var->hsync_len;
391 par->vsync_total = var->upper_margin + var->yres + var->lower_margin + 387 par->vsync_total = var->upper_margin + var->yres + var->lower_margin +
@@ -408,7 +404,7 @@ static int pvr2fb_set_par(struct fb_info *info)
408 } else { 404 } else {
409 /* VGA mode */ 405 /* VGA mode */
410 /* XXX: What else needs to be checked? */ 406 /* XXX: What else needs to be checked? */
411 /* 407 /*
412 * XXX: We have a little freedom in VGA modes, what ranges 408 * XXX: We have a little freedom in VGA modes, what ranges
413 * should be here (i.e. hsync/vsync totals, etc.)? 409 * should be here (i.e. hsync/vsync totals, etc.)?
414 */ 410 */
@@ -419,8 +415,8 @@ static int pvr2fb_set_par(struct fb_info *info)
419 /* Calculate the remainding offsets */ 415 /* Calculate the remainding offsets */
420 par->diwstart_h = par->borderstart_h + var->left_margin; 416 par->diwstart_h = par->borderstart_h + var->left_margin;
421 par->diwstart_v = par->borderstart_v + var->upper_margin; 417 par->diwstart_v = par->borderstart_v + var->upper_margin;
422 par->borderstop_h = par->diwstart_h + var->xres + 418 par->borderstop_h = par->diwstart_h + var->xres +
423 var->right_margin; 419 var->right_margin;
424 par->borderstop_v = par->diwstart_v + var->yres + 420 par->borderstop_v = par->diwstart_v + var->yres +
425 var->lower_margin; 421 var->lower_margin;
426 422
@@ -465,12 +461,12 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
465 set_color_bitfields(var); 461 set_color_bitfields(var);
466 462
467 if (var->vmode & FB_VMODE_YWRAP) { 463 if (var->vmode & FB_VMODE_YWRAP) {
468 if (var->xoffset || var->yoffset < 0 || 464 if (var->xoffset || var->yoffset < 0 ||
469 var->yoffset >= var->yres_virtual) { 465 var->yoffset >= var->yres_virtual) {
470 var->xoffset = var->yoffset = 0; 466 var->xoffset = var->yoffset = 0;
471 } else { 467 } else {
472 if (var->xoffset > var->xres_virtual - var->xres || 468 if (var->xoffset > var->xres_virtual - var->xres ||
473 var->yoffset > var->yres_virtual - var->yres || 469 var->yoffset > var->yres_virtual - var->yres ||
474 var->xoffset < 0 || var->yoffset < 0) 470 var->xoffset < 0 || var->yoffset < 0)
475 var->xoffset = var->yoffset = 0; 471 var->xoffset = var->yoffset = 0;
476 } 472 }
@@ -478,7 +474,7 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
478 var->xoffset = var->yoffset = 0; 474 var->xoffset = var->yoffset = 0;
479 } 475 }
480 476
481 /* 477 /*
482 * XXX: Need to be more creative with this (i.e. allow doublecan for 478 * XXX: Need to be more creative with this (i.e. allow doublecan for
483 * PAL/NTSC output). 479 * PAL/NTSC output).
484 */ 480 */
@@ -507,7 +503,7 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
507 var->vsync_len = par->borderstop_v + 503 var->vsync_len = par->borderstop_v +
508 (par->vsync_total - par->borderstop_v); 504 (par->vsync_total - par->borderstop_v);
509 } 505 }
510 506
511 hsync_total = var->left_margin + var->xres + var->right_margin + 507 hsync_total = var->left_margin + var->xres + var->right_margin +
512 var->hsync_len; 508 var->hsync_len;
513 vtotal = var->upper_margin + var->yres + var->lower_margin + 509 vtotal = var->upper_margin + var->yres + var->lower_margin +
@@ -531,7 +527,7 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
531 } 527 }
532 } 528 }
533 } 529 }
534 530
535 /* Check memory sizes */ 531 /* Check memory sizes */
536 line_length = get_line_length(var->xres_virtual, var->bits_per_pixel); 532 line_length = get_line_length(var->xres_virtual, var->bits_per_pixel);
537 if (line_length * var->yres_virtual > info->fix.smem_len) 533 if (line_length * var->yres_virtual > info->fix.smem_len)
@@ -552,7 +548,7 @@ static void pvr2_update_display(struct fb_info *info)
552 DISP_DIWADDRS); 548 DISP_DIWADDRS);
553} 549}
554 550
555/* 551/*
556 * Initialize the video mode. Currently, the 16bpp and 24bpp modes aren't 552 * Initialize the video mode. Currently, the 16bpp and 24bpp modes aren't
557 * very stable. It's probably due to the fact that a lot of the 2D video 553 * very stable. It's probably due to the fact that a lot of the 2D video
558 * registers are still undocumented. 554 * registers are still undocumented.
@@ -592,18 +588,18 @@ static void pvr2_init_display(struct fb_info *info)
592 /* display window start position */ 588 /* display window start position */
593 fb_writel(par->diwstart_h, DISP_DIWHSTRT); 589 fb_writel(par->diwstart_h, DISP_DIWHSTRT);
594 fb_writel((par->diwstart_v << 16) | par->diwstart_v, DISP_DIWVSTRT); 590 fb_writel((par->diwstart_v << 16) | par->diwstart_v, DISP_DIWVSTRT);
595 591
596 /* misc. settings */ 592 /* misc. settings */
597 fb_writel((0x16 << 16) | par->is_lowres, DISP_DIWCONF); 593 fb_writel((0x16 << 16) | par->is_lowres, DISP_DIWCONF);
598 594
599 /* clock doubler (for VGA), scan doubler, display enable */ 595 /* clock doubler (for VGA), scan doubler, display enable */
600 fb_writel(((video_output == VO_VGA) << 23) | 596 fb_writel(((video_output == VO_VGA) << 23) |
601 (par->is_doublescan << 1) | 1, DISP_DIWMODE); 597 (par->is_doublescan << 1) | 1, DISP_DIWMODE);
602 598
603 /* bits per pixel */ 599 /* bits per pixel */
604 fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE); 600 fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE);
605 601
606 /* video enable, color sync, interlace, 602 /* video enable, color sync, interlace,
607 * hsync and vsync polarity (currently unused) */ 603 * hsync and vsync polarity (currently unused) */
608 fb_writel(0x100 | ((par->is_interlaced /*|4*/) << 4), DISP_SYNCCONF); 604 fb_writel(0x100 | ((par->is_interlaced /*|4*/) << 4), DISP_SYNCCONF);
609} 605}
@@ -657,7 +653,7 @@ static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id)
657static int pvr2_init_cable(void) 653static int pvr2_init_cable(void)
658{ 654{
659 if (cable_type < 0) { 655 if (cable_type < 0) {
660 fb_writel((fb_readl(PCTRA) & 0xfff0ffff) | 0x000a0000, 656 fb_writel((fb_readl(PCTRA) & 0xfff0ffff) | 0x000a0000,
661 PCTRA); 657 PCTRA);
662 cable_type = (fb_readw(PDTRA) >> 8) & 3; 658 cable_type = (fb_readw(PDTRA) >> 8) & 3;
663 } 659 }
@@ -687,7 +683,7 @@ static ssize_t pvr2fb_write(struct fb_info *info, const char *buf,
687 pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL); 683 pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
688 if (!pages) 684 if (!pages)
689 return -ENOMEM; 685 return -ENOMEM;
690 686
691 down_read(&current->mm->mmap_sem); 687 down_read(&current->mm->mmap_sem);
692 ret = get_user_pages(current, current->mm, (unsigned long)buf, 688 ret = get_user_pages(current, current->mm, (unsigned long)buf,
693 nr_pages, WRITE, 0, pages, NULL); 689 nr_pages, WRITE, 0, pages, NULL);
@@ -700,7 +696,7 @@ static ssize_t pvr2fb_write(struct fb_info *info, const char *buf,
700 } 696 }
701 697
702 dma_configure_channel(shdma, 0x12c1); 698 dma_configure_channel(shdma, 0x12c1);
703 699
704 dst = (unsigned long)fb_info->screen_base + *ppos; 700 dst = (unsigned long)fb_info->screen_base + *ppos;
705 start = (unsigned long)page_address(pages[0]); 701 start = (unsigned long)page_address(pages[0]);
706 end = (unsigned long)page_address(pages[nr_pages]); 702 end = (unsigned long)page_address(pages[nr_pages]);
@@ -744,7 +740,7 @@ out_unmap:
744 kfree(pages); 740 kfree(pages);
745 741
746 return ret; 742 return ret;
747} 743}
748#endif /* CONFIG_SH_DMA */ 744#endif /* CONFIG_SH_DMA */
749 745
750/** 746/**
@@ -772,14 +768,14 @@ static int __init pvr2fb_common_init(void)
772 768
773 fb_info->screen_base = ioremap_nocache(pvr2_fix.smem_start, 769 fb_info->screen_base = ioremap_nocache(pvr2_fix.smem_start,
774 pvr2_fix.smem_len); 770 pvr2_fix.smem_len);
775 771
776 if (!fb_info->screen_base) { 772 if (!fb_info->screen_base) {
777 printk(KERN_ERR "pvr2fb: Failed to remap smem space\n"); 773 printk(KERN_ERR "pvr2fb: Failed to remap smem space\n");
778 goto out_err; 774 goto out_err;
779 } 775 }
780 776
781 par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start, 777 par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start,
782 pvr2_fix.mmio_len); 778 pvr2_fix.mmio_len);
783 if (!par->mmio_base) { 779 if (!par->mmio_base) {
784 printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n"); 780 printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n");
785 goto out_err; 781 goto out_err;
@@ -820,7 +816,7 @@ static int __init pvr2fb_common_init(void)
820 printk("fb%d: %s (rev %ld.%ld) frame buffer device, using %ldk/%ldk of video memory\n", 816 printk("fb%d: %s (rev %ld.%ld) frame buffer device, using %ldk/%ldk of video memory\n",
821 fb_info->node, fb_info->fix.id, (rev >> 4) & 0x0f, rev & 0x0f, 817 fb_info->node, fb_info->fix.id, (rev >> 4) & 0x0f, rev & 0x0f,
822 modememused >> 10, (unsigned long)(fb_info->fix.smem_len >> 10)); 818 modememused >> 10, (unsigned long)(fb_info->fix.smem_len >> 10));
823 printk("fb%d: Mode %dx%d-%d pitch = %ld cable: %s video output: %s\n", 819 printk("fb%d: Mode %dx%d-%d pitch = %ld cable: %s video output: %s\n",
824 fb_info->node, fb_info->var.xres, fb_info->var.yres, 820 fb_info->node, fb_info->var.xres, fb_info->var.yres,
825 fb_info->var.bits_per_pixel, 821 fb_info->var.bits_per_pixel,
826 get_line_length(fb_info->var.xres, fb_info->var.bits_per_pixel), 822 get_line_length(fb_info->var.xres, fb_info->var.bits_per_pixel),
@@ -878,8 +874,8 @@ static int __init pvr2fb_dc_init(void)
878 video_output = VO_NTSC; 874 video_output = VO_NTSC;
879 } 875 }
880 } 876 }
881 877
882 /* 878 /*
883 * Nothing exciting about the DC PVR2 .. only a measly 8MiB. 879 * Nothing exciting about the DC PVR2 .. only a measly 8MiB.
884 */ 880 */
885 pvr2_fix.smem_start = 0xa5000000; /* RAM starts here */ 881 pvr2_fix.smem_start = 0xa5000000; /* RAM starts here */
@@ -903,7 +899,7 @@ static int __init pvr2fb_dc_init(void)
903 return pvr2fb_common_init(); 899 return pvr2fb_common_init();
904} 900}
905 901
906static void pvr2fb_dc_exit(void) 902static void __exit pvr2fb_dc_exit(void)
907{ 903{
908 if (fb_info->screen_base) { 904 if (fb_info->screen_base) {
909 iounmap(fb_info->screen_base); 905 iounmap(fb_info->screen_base);
@@ -987,7 +983,7 @@ static int __init pvr2fb_pci_init(void)
987 return pci_register_driver(&pvr2fb_pci_driver); 983 return pci_register_driver(&pvr2fb_pci_driver);
988} 984}
989 985
990static void pvr2fb_pci_exit(void) 986static void __exit pvr2fb_pci_exit(void)
991{ 987{
992 pci_unregister_driver(&pvr2fb_pci_driver); 988 pci_unregister_driver(&pvr2fb_pci_driver);
993} 989}
@@ -1021,7 +1017,7 @@ static int __init pvr2_get_param(const struct pvr2_params *p, const char *s,
1021 */ 1017 */
1022 1018
1023#ifndef MODULE 1019#ifndef MODULE
1024int __init pvr2fb_setup(char *options) 1020static int __init pvr2fb_setup(char *options)
1025{ 1021{
1026 char *this_opt; 1022 char *this_opt;
1027 char cable_arg[80]; 1023 char cable_arg[80];
@@ -1061,7 +1057,7 @@ static struct pvr2_board {
1061 int (*init)(void); 1057 int (*init)(void);
1062 void (*exit)(void); 1058 void (*exit)(void);
1063 char name[16]; 1059 char name[16];
1064} board_list[] = { 1060} board_driver[] = {
1065#ifdef CONFIG_SH_DREAMCAST 1061#ifdef CONFIG_SH_DREAMCAST
1066 { pvr2fb_dc_init, pvr2fb_dc_exit, "Sega DC PVR2" }, 1062 { pvr2fb_dc_init, pvr2fb_dc_exit, "Sega DC PVR2" },
1067#endif 1063#endif
@@ -1071,7 +1067,7 @@ static struct pvr2_board {
1071 { 0, }, 1067 { 0, },
1072}; 1068};
1073 1069
1074int __init pvr2fb_init(void) 1070static int __init pvr2fb_init(void)
1075{ 1071{
1076 int i, ret = -ENODEV; 1072 int i, ret = -ENODEV;
1077 int size; 1073 int size;
@@ -1095,8 +1091,8 @@ int __init pvr2fb_init(void)
1095 1091
1096 currentpar = (struct pvr2fb_par *)(fb_info + 1); 1092 currentpar = (struct pvr2fb_par *)(fb_info + 1);
1097 1093
1098 for (i = 0; i < ARRAY_SIZE(board_list); i++) { 1094 for (i = 0; i < ARRAY_SIZE(board_driver); i++) {
1099 struct pvr2_board *pvr_board = board_list + i; 1095 struct pvr2_board *pvr_board = board_driver + i;
1100 1096
1101 if (!pvr_board->init) 1097 if (!pvr_board->init)
1102 continue; 1098 continue;
@@ -1118,13 +1114,13 @@ static void __exit pvr2fb_exit(void)
1118{ 1114{
1119 int i; 1115 int i;
1120 1116
1121 for (i = 0; i < ARRAY_SIZE(board_list); i++) { 1117 for (i = 0; i < ARRAY_SIZE(board_driver); i++) {
1122 struct pvr2_board *pvr_board = board_list + i; 1118 struct pvr2_board *pvr_board = board_driver + i;
1123 1119
1124 if (pvr_board->exit) 1120 if (pvr_board->exit)
1125 pvr_board->exit(); 1121 pvr_board->exit();
1126 } 1122 }
1127 1123
1128#ifdef CONFIG_SH_STORE_QUEUES 1124#ifdef CONFIG_SH_STORE_QUEUES
1129 sq_unmap(pvr2fb_map); 1125 sq_unmap(pvr2fb_map);
1130#endif 1126#endif
@@ -1139,4 +1135,3 @@ module_exit(pvr2fb_exit);
1139MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, M. R. Brown <mrbrown@0xd6.org>"); 1135MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, M. R. Brown <mrbrown@0xd6.org>");
1140MODULE_DESCRIPTION("Framebuffer driver for NEC PowerVR 2 based graphics boards"); 1136MODULE_DESCRIPTION("Framebuffer driver for NEC PowerVR 2 based graphics boards");
1141MODULE_LICENSE("GPL"); 1137MODULE_LICENSE("GPL");
1142