diff options
Diffstat (limited to 'drivers/video')
105 files changed, 2626 insertions, 2426 deletions
diff --git a/drivers/video/68328fb.c b/drivers/video/68328fb.c index 3b0ddc55236b..78488bb41aeb 100644 --- a/drivers/video/68328fb.c +++ b/drivers/video/68328fb.c | |||
@@ -102,8 +102,7 @@ static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
102 | u_int transp, struct fb_info *info); | 102 | u_int transp, struct fb_info *info); |
103 | static int mc68x328fb_pan_display(struct fb_var_screeninfo *var, | 103 | static int mc68x328fb_pan_display(struct fb_var_screeninfo *var, |
104 | struct fb_info *info); | 104 | struct fb_info *info); |
105 | static int mc68x328fb_mmap(struct fb_info *info, struct file *file, | 105 | static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma); |
106 | struct vm_area_struct *vma); | ||
107 | 106 | ||
108 | static struct fb_ops mc68x328fb_ops = { | 107 | static struct fb_ops mc68x328fb_ops = { |
109 | .fb_check_var = mc68x328fb_check_var, | 108 | .fb_check_var = mc68x328fb_check_var, |
@@ -398,8 +397,7 @@ static int mc68x328fb_pan_display(struct fb_var_screeninfo *var, | |||
398 | * Most drivers don't need their own mmap function | 397 | * Most drivers don't need their own mmap function |
399 | */ | 398 | */ |
400 | 399 | ||
401 | static int mc68x328fb_mmap(struct fb_info *info, struct file *file, | 400 | static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
402 | struct vm_area_struct *vma) | ||
403 | { | 401 | { |
404 | #ifndef MMU | 402 | #ifndef MMU |
405 | /* this is uClinux (no MMU) specific code */ | 403 | /* this is uClinux (no MMU) specific code */ |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index cc8e3bf5001b..3e153d313bb0 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -993,12 +993,6 @@ config FB_ATY_GENERIC_LCD | |||
993 | Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility, | 993 | Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility, |
994 | Rage XC, or Rage XL chipset. | 994 | Rage XC, or Rage XL chipset. |
995 | 995 | ||
996 | config FB_ATY_XL_INIT | ||
997 | bool "Rage XL No-BIOS Init support" | ||
998 | depends on FB_ATY_CT | ||
999 | help | ||
1000 | Say Y here to support booting a Rage XL without BIOS support. | ||
1001 | |||
1002 | config FB_ATY_GX | 996 | config FB_ATY_GX |
1003 | bool "Mach64 GX support" if PCI | 997 | bool "Mach64 GX support" if PCI |
1004 | depends on FB_ATY | 998 | depends on FB_ATY |
@@ -1151,7 +1145,7 @@ config FB_VOODOO1 | |||
1151 | 1145 | ||
1152 | config FB_CYBLA | 1146 | config FB_CYBLA |
1153 | tristate "Cyberblade/i1 support" | 1147 | tristate "Cyberblade/i1 support" |
1154 | depends on FB && PCI | 1148 | depends on FB && PCI && X86_32 && !64BIT |
1155 | select FB_CFB_IMAGEBLIT | 1149 | select FB_CFB_IMAGEBLIT |
1156 | select VIDEO_SELECT | 1150 | select VIDEO_SELECT |
1157 | ---help--- | 1151 | ---help--- |
@@ -1376,7 +1370,7 @@ config FB_PXA | |||
1376 | 1370 | ||
1377 | This driver is also available as a module ( = code which can be | 1371 | This driver is also available as a module ( = code which can be |
1378 | inserted and removed from the running kernel whenever you want). The | 1372 | inserted and removed from the running kernel whenever you want). The |
1379 | module will be called vfb. If you want to compile it as a module, | 1373 | module will be called pxafb. If you want to compile it as a module, |
1380 | say M here and read <file:Documentation/modules.txt>. | 1374 | say M here and read <file:Documentation/modules.txt>. |
1381 | 1375 | ||
1382 | If unsure, say N. | 1376 | If unsure, say N. |
@@ -1409,7 +1403,7 @@ config FB_W100 | |||
1409 | 1403 | ||
1410 | This driver is also available as a module ( = code which can be | 1404 | This driver is also available as a module ( = code which can be |
1411 | inserted and removed from the running kernel whenever you want). The | 1405 | inserted and removed from the running kernel whenever you want). The |
1412 | module will be called vfb. If you want to compile it as a module, | 1406 | module will be called w100fb. If you want to compile it as a module, |
1413 | say M here and read <file:Documentation/modules.txt>. | 1407 | say M here and read <file:Documentation/modules.txt>. |
1414 | 1408 | ||
1415 | If unsure, say N. | 1409 | If unsure, say N. |
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 750cebb18306..b058273527bb 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c | |||
@@ -883,7 +883,7 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
883 | * Note that we are entered with the kernel locked. | 883 | * Note that we are entered with the kernel locked. |
884 | */ | 884 | */ |
885 | static int | 885 | static int |
886 | acornfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 886 | acornfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
887 | { | 887 | { |
888 | unsigned long off, start; | 888 | unsigned long off, start; |
889 | u32 len; | 889 | u32 len; |
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index a3c2c45e29e0..b2187175d03f 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -21,12 +21,11 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/ioport.h> | 22 | #include <linux/ioport.h> |
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/amba/bus.h> | ||
25 | #include <linux/amba/clcd.h> | ||
26 | #include <linux/clk.h> | ||
24 | 27 | ||
25 | #include <asm/sizes.h> | 28 | #include <asm/sizes.h> |
26 | #include <asm/hardware/amba.h> | ||
27 | #include <asm/hardware/clock.h> | ||
28 | |||
29 | #include <asm/hardware/amba_clcd.h> | ||
30 | 29 | ||
31 | #define to_clcd(info) container_of(info, struct clcd_fb, fb) | 30 | #define to_clcd(info) container_of(info, struct clcd_fb, fb) |
32 | 31 | ||
@@ -308,7 +307,7 @@ static int clcdfb_blank(int blank_mode, struct fb_info *info) | |||
308 | return 0; | 307 | return 0; |
309 | } | 308 | } |
310 | 309 | ||
311 | static int clcdfb_mmap(struct fb_info *info, struct file *file, | 310 | static int clcdfb_mmap(struct fb_info *info, |
312 | struct vm_area_struct *vma) | 311 | struct vm_area_struct *vma) |
313 | { | 312 | { |
314 | struct clcd_fb *fb = to_clcd(info); | 313 | struct clcd_fb *fb = to_clcd(info); |
@@ -346,10 +345,6 @@ static int clcdfb_register(struct clcd_fb *fb) | |||
346 | goto out; | 345 | goto out; |
347 | } | 346 | } |
348 | 347 | ||
349 | ret = clk_use(fb->clk); | ||
350 | if (ret) | ||
351 | goto free_clk; | ||
352 | |||
353 | fb->fb.fix.mmio_start = fb->dev->res.start; | 348 | fb->fb.fix.mmio_start = fb->dev->res.start; |
354 | fb->fb.fix.mmio_len = SZ_4K; | 349 | fb->fb.fix.mmio_len = SZ_4K; |
355 | 350 | ||
@@ -357,7 +352,7 @@ static int clcdfb_register(struct clcd_fb *fb) | |||
357 | if (!fb->regs) { | 352 | if (!fb->regs) { |
358 | printk(KERN_ERR "CLCD: unable to remap registers\n"); | 353 | printk(KERN_ERR "CLCD: unable to remap registers\n"); |
359 | ret = -ENOMEM; | 354 | ret = -ENOMEM; |
360 | goto unuse_clk; | 355 | goto free_clk; |
361 | } | 356 | } |
362 | 357 | ||
363 | fb->fb.fbops = &clcdfb_ops; | 358 | fb->fb.fbops = &clcdfb_ops; |
@@ -427,8 +422,6 @@ static int clcdfb_register(struct clcd_fb *fb) | |||
427 | printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); | 422 | printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); |
428 | 423 | ||
429 | iounmap(fb->regs); | 424 | iounmap(fb->regs); |
430 | unuse_clk: | ||
431 | clk_unuse(fb->clk); | ||
432 | free_clk: | 425 | free_clk: |
433 | clk_put(fb->clk); | 426 | clk_put(fb->clk); |
434 | out: | 427 | out: |
@@ -489,7 +482,6 @@ static int clcdfb_remove(struct amba_device *dev) | |||
489 | clcdfb_disable(fb); | 482 | clcdfb_disable(fb); |
490 | unregister_framebuffer(&fb->fb); | 483 | unregister_framebuffer(&fb->fb); |
491 | iounmap(fb->regs); | 484 | iounmap(fb->regs); |
492 | clk_unuse(fb->clk); | ||
493 | clk_put(fb->clk); | 485 | clk_put(fb->clk); |
494 | 486 | ||
495 | fb->board->remove(fb); | 487 | fb->board->remove(fb); |
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index d549e215f3c5..3033c72dea20 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -590,6 +590,8 @@ static u_short maxfmode, chipset; | |||
590 | #define highw(x) ((u_long)(x)>>16 & 0xffff) | 590 | #define highw(x) ((u_long)(x)>>16 & 0xffff) |
591 | #define loww(x) ((u_long)(x) & 0xffff) | 591 | #define loww(x) ((u_long)(x) & 0xffff) |
592 | 592 | ||
593 | #define custom amiga_custom | ||
594 | |||
593 | #define VBlankOn() custom.intena = IF_SETCLR|IF_COPER | 595 | #define VBlankOn() custom.intena = IF_SETCLR|IF_COPER |
594 | #define VBlankOff() custom.intena = IF_COPER | 596 | #define VBlankOff() custom.intena = IF_COPER |
595 | 597 | ||
@@ -1129,9 +1131,7 @@ static void amifb_copyarea(struct fb_info *info, | |||
1129 | const struct fb_copyarea *region); | 1131 | const struct fb_copyarea *region); |
1130 | static void amifb_imageblit(struct fb_info *info, | 1132 | static void amifb_imageblit(struct fb_info *info, |
1131 | const struct fb_image *image); | 1133 | const struct fb_image *image); |
1132 | static int amifb_ioctl(struct inode *inode, struct file *file, | 1134 | static int amifb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); |
1133 | unsigned int cmd, unsigned long arg, | ||
1134 | struct fb_info *info); | ||
1135 | 1135 | ||
1136 | 1136 | ||
1137 | /* | 1137 | /* |
@@ -1164,8 +1164,8 @@ static void ami_update_display(void); | |||
1164 | static void ami_init_display(void); | 1164 | static void ami_init_display(void); |
1165 | static void ami_do_blank(void); | 1165 | static void ami_do_blank(void); |
1166 | static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix); | 1166 | static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix); |
1167 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data); | 1167 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data); |
1168 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data); | 1168 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data); |
1169 | static int ami_get_cursorstate(struct fb_cursorstate *state); | 1169 | static int ami_get_cursorstate(struct fb_cursorstate *state); |
1170 | static int ami_set_cursorstate(struct fb_cursorstate *state); | 1170 | static int ami_set_cursorstate(struct fb_cursorstate *state); |
1171 | static void ami_set_sprite(void); | 1171 | static void ami_set_sprite(void); |
@@ -2170,15 +2170,15 @@ static void amifb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
2170 | * Amiga Frame Buffer Specific ioctls | 2170 | * Amiga Frame Buffer Specific ioctls |
2171 | */ | 2171 | */ |
2172 | 2172 | ||
2173 | static int amifb_ioctl(struct inode *inode, struct file *file, | 2173 | static int amifb_ioctl(struct fb_info *info, |
2174 | unsigned int cmd, unsigned long arg, | 2174 | unsigned int cmd, unsigned long arg) |
2175 | struct fb_info *info) | ||
2176 | { | 2175 | { |
2177 | union { | 2176 | union { |
2178 | struct fb_fix_cursorinfo fix; | 2177 | struct fb_fix_cursorinfo fix; |
2179 | struct fb_var_cursorinfo var; | 2178 | struct fb_var_cursorinfo var; |
2180 | struct fb_cursorstate state; | 2179 | struct fb_cursorstate state; |
2181 | } crsr; | 2180 | } crsr; |
2181 | void __user *argp = (void __user *)arg; | ||
2182 | int i; | 2182 | int i; |
2183 | 2183 | ||
2184 | switch (cmd) { | 2184 | switch (cmd) { |
@@ -2186,33 +2186,32 @@ static int amifb_ioctl(struct inode *inode, struct file *file, | |||
2186 | i = ami_get_fix_cursorinfo(&crsr.fix); | 2186 | i = ami_get_fix_cursorinfo(&crsr.fix); |
2187 | if (i) | 2187 | if (i) |
2188 | return i; | 2188 | return i; |
2189 | return copy_to_user((void *)arg, &crsr.fix, | 2189 | return copy_to_user(argp, &crsr.fix, |
2190 | sizeof(crsr.fix)) ? -EFAULT : 0; | 2190 | sizeof(crsr.fix)) ? -EFAULT : 0; |
2191 | 2191 | ||
2192 | case FBIOGET_VCURSORINFO: | 2192 | case FBIOGET_VCURSORINFO: |
2193 | i = ami_get_var_cursorinfo(&crsr.var, | 2193 | i = ami_get_var_cursorinfo(&crsr.var, |
2194 | ((struct fb_var_cursorinfo *)arg)->data); | 2194 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2195 | if (i) | 2195 | if (i) |
2196 | return i; | 2196 | return i; |
2197 | return copy_to_user((void *)arg, &crsr.var, | 2197 | return copy_to_user(argp, &crsr.var, |
2198 | sizeof(crsr.var)) ? -EFAULT : 0; | 2198 | sizeof(crsr.var)) ? -EFAULT : 0; |
2199 | 2199 | ||
2200 | case FBIOPUT_VCURSORINFO: | 2200 | case FBIOPUT_VCURSORINFO: |
2201 | if (copy_from_user(&crsr.var, (void *)arg, | 2201 | if (copy_from_user(&crsr.var, argp, sizeof(crsr.var))) |
2202 | sizeof(crsr.var))) | ||
2203 | return -EFAULT; | 2202 | return -EFAULT; |
2204 | return ami_set_var_cursorinfo(&crsr.var, | 2203 | return ami_set_var_cursorinfo(&crsr.var, |
2205 | ((struct fb_var_cursorinfo *)arg)->data); | 2204 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2206 | 2205 | ||
2207 | case FBIOGET_CURSORSTATE: | 2206 | case FBIOGET_CURSORSTATE: |
2208 | i = ami_get_cursorstate(&crsr.state); | 2207 | i = ami_get_cursorstate(&crsr.state); |
2209 | if (i) | 2208 | if (i) |
2210 | return i; | 2209 | return i; |
2211 | return copy_to_user((void *)arg, &crsr.state, | 2210 | return copy_to_user(argp, &crsr.state, |
2212 | sizeof(crsr.state)) ? -EFAULT : 0; | 2211 | sizeof(crsr.state)) ? -EFAULT : 0; |
2213 | 2212 | ||
2214 | case FBIOPUT_CURSORSTATE: | 2213 | case FBIOPUT_CURSORSTATE: |
2215 | if (copy_from_user(&crsr.state, (void *)arg, | 2214 | if (copy_from_user(&crsr.state, argp, |
2216 | sizeof(crsr.state))) | 2215 | sizeof(crsr.state))) |
2217 | return -EFAULT; | 2216 | return -EFAULT; |
2218 | return ami_set_cursorstate(&crsr.state); | 2217 | return ami_set_cursorstate(&crsr.state); |
@@ -3325,7 +3324,7 @@ static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix) | |||
3325 | return 0; | 3324 | return 0; |
3326 | } | 3325 | } |
3327 | 3326 | ||
3328 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | 3327 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data) |
3329 | { | 3328 | { |
3330 | struct amifb_par *par = ¤tpar; | 3329 | struct amifb_par *par = ¤tpar; |
3331 | register u_short *lspr, *sspr; | 3330 | register u_short *lspr, *sspr; |
@@ -3347,14 +3346,14 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3347 | var->yspot = par->crsr.spot_y; | 3346 | var->yspot = par->crsr.spot_y; |
3348 | if (size > var->height*var->width) | 3347 | if (size > var->height*var->width) |
3349 | return -ENAMETOOLONG; | 3348 | return -ENAMETOOLONG; |
3350 | if (!access_ok(VERIFY_WRITE, (void *)data, size)) | 3349 | if (!access_ok(VERIFY_WRITE, data, size)) |
3351 | return -EFAULT; | 3350 | return -EFAULT; |
3352 | delta = 1<<par->crsr.fmode; | 3351 | delta = 1<<par->crsr.fmode; |
3353 | lspr = lofsprite + (delta<<1); | 3352 | lspr = lofsprite + (delta<<1); |
3354 | if (par->bplcon0 & BPC0_LACE) | 3353 | if (par->bplcon0 & BPC0_LACE) |
3355 | sspr = shfsprite + (delta<<1); | 3354 | sspr = shfsprite + (delta<<1); |
3356 | else | 3355 | else |
3357 | sspr = 0; | 3356 | sspr = NULL; |
3358 | for (height = (short)var->height-1; height >= 0; height--) { | 3357 | for (height = (short)var->height-1; height >= 0; height--) { |
3359 | bits = 0; words = delta; datawords = 0; | 3358 | bits = 0; words = delta; datawords = 0; |
3360 | for (width = (short)var->width-1; width >= 0; width--) { | 3359 | for (width = (short)var->width-1; width >= 0; width--) { |
@@ -3400,7 +3399,7 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3400 | return 0; | 3399 | return 0; |
3401 | } | 3400 | } |
3402 | 3401 | ||
3403 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | 3402 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data) |
3404 | { | 3403 | { |
3405 | struct amifb_par *par = ¤tpar; | 3404 | struct amifb_par *par = ¤tpar; |
3406 | register u_short *lspr, *sspr; | 3405 | register u_short *lspr, *sspr; |
@@ -3427,7 +3426,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3427 | return -EINVAL; | 3426 | return -EINVAL; |
3428 | if (!var->height) | 3427 | if (!var->height) |
3429 | return -EINVAL; | 3428 | return -EINVAL; |
3430 | if (!access_ok(VERIFY_READ, (void *)data, var->width*var->height)) | 3429 | if (!access_ok(VERIFY_READ, data, var->width*var->height)) |
3431 | return -EFAULT; | 3430 | return -EFAULT; |
3432 | delta = 1<<fmode; | 3431 | delta = 1<<fmode; |
3433 | lofsprite = shfsprite = (u_short *)spritememory; | 3432 | lofsprite = shfsprite = (u_short *)spritememory; |
@@ -3442,13 +3441,13 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3442 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) | 3441 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) |
3443 | return -EINVAL; | 3442 | return -EINVAL; |
3444 | memset(lspr, 0, (var->height+2)<<fmode<<2); | 3443 | memset(lspr, 0, (var->height+2)<<fmode<<2); |
3445 | sspr = 0; | 3444 | sspr = NULL; |
3446 | } | 3445 | } |
3447 | for (height = (short)var->height-1; height >= 0; height--) { | 3446 | for (height = (short)var->height-1; height >= 0; height--) { |
3448 | bits = 16; words = delta; datawords = 0; | 3447 | bits = 16; words = delta; datawords = 0; |
3449 | for (width = (short)var->width-1; width >= 0; width--) { | 3448 | for (width = (short)var->width-1; width >= 0; width--) { |
3450 | unsigned long tdata = 0; | 3449 | unsigned long tdata = 0; |
3451 | get_user(tdata, (char *)data); | 3450 | get_user(tdata, data); |
3452 | data++; | 3451 | data++; |
3453 | #ifdef __mc68000__ | 3452 | #ifdef __mc68000__ |
3454 | asm volatile ( | 3453 | asm volatile ( |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 2784f0a9d693..df8e5667b348 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -366,7 +366,8 @@ static void arcfb_lcd_update(struct arcfb_par *par, unsigned int dx, | |||
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | void arcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 369 | static void arcfb_fillrect(struct fb_info *info, |
370 | const struct fb_fillrect *rect) | ||
370 | { | 371 | { |
371 | struct arcfb_par *par = info->par; | 372 | struct arcfb_par *par = info->par; |
372 | 373 | ||
@@ -376,7 +377,8 @@ void arcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
376 | arcfb_lcd_update(par, rect->dx, rect->dy, rect->width, rect->height); | 377 | arcfb_lcd_update(par, rect->dx, rect->dy, rect->width, rect->height); |
377 | } | 378 | } |
378 | 379 | ||
379 | void arcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 380 | static void arcfb_copyarea(struct fb_info *info, |
381 | const struct fb_copyarea *area) | ||
380 | { | 382 | { |
381 | struct arcfb_par *par = info->par; | 383 | struct arcfb_par *par = info->par; |
382 | 384 | ||
@@ -386,7 +388,7 @@ void arcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
386 | arcfb_lcd_update(par, area->dx, area->dy, area->width, area->height); | 388 | arcfb_lcd_update(par, area->dx, area->dy, area->width, area->height); |
387 | } | 389 | } |
388 | 390 | ||
389 | void arcfb_imageblit(struct fb_info *info, const struct fb_image *image) | 391 | static void arcfb_imageblit(struct fb_info *info, const struct fb_image *image) |
390 | { | 392 | { |
391 | struct arcfb_par *par = info->par; | 393 | struct arcfb_par *par = info->par; |
392 | 394 | ||
@@ -397,9 +399,8 @@ void arcfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
397 | image->height); | 399 | image->height); |
398 | } | 400 | } |
399 | 401 | ||
400 | static int arcfb_ioctl(struct inode *inode, struct file *file, | 402 | static int arcfb_ioctl(struct fb_info *info, |
401 | unsigned int cmd, unsigned long arg, | 403 | unsigned int cmd, unsigned long arg) |
402 | struct fb_info *info) | ||
403 | { | 404 | { |
404 | void __user *argp = (void __user *)arg; | 405 | void __user *argp = (void __user *)arg; |
405 | struct arcfb_par *par = info->par; | 406 | struct arcfb_par *par = info->par; |
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index c64de59398f4..69f75547865d 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -549,7 +549,7 @@ asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) | |||
549 | if (!request_mem_region(addr, size, "asiliantfb")) | 549 | if (!request_mem_region(addr, size, "asiliantfb")) |
550 | return -EBUSY; | 550 | return -EBUSY; |
551 | 551 | ||
552 | p = framebuffer_alloc(sizeof(u32) * 256, &dp->dev); | 552 | p = framebuffer_alloc(sizeof(u32) * 16, &dp->dev); |
553 | if (!p) { | 553 | if (!p) { |
554 | release_mem_region(addr, size); | 554 | release_mem_region(addr, size); |
555 | return -ENOMEM; | 555 | return -ENOMEM; |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 15ec1295bc29..e69ab65f7843 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -2571,8 +2571,7 @@ atafb_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info) | |||
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | static int | 2573 | static int |
2574 | atafb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 2574 | atafb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
2575 | unsigned long arg, int con, struct fb_info *info) | ||
2576 | { | 2575 | { |
2577 | switch (cmd) { | 2576 | switch (cmd) { |
2578 | #ifdef FBCMD_GET_CURRENTPAR | 2577 | #ifdef FBCMD_GET_CURRENTPAR |
diff --git a/drivers/video/aty/Makefile b/drivers/video/aty/Makefile index 9dec96249ffb..18521397a6e3 100644 --- a/drivers/video/aty/Makefile +++ b/drivers/video/aty/Makefile | |||
@@ -5,7 +5,6 @@ obj-$(CONFIG_FB_RADEON) += radeonfb.o | |||
5 | atyfb-y := atyfb_base.o mach64_accel.o mach64_cursor.o | 5 | atyfb-y := atyfb_base.o mach64_accel.o mach64_cursor.o |
6 | atyfb-$(CONFIG_FB_ATY_GX) += mach64_gx.o | 6 | atyfb-$(CONFIG_FB_ATY_GX) += mach64_gx.o |
7 | atyfb-$(CONFIG_FB_ATY_CT) += mach64_ct.o | 7 | atyfb-$(CONFIG_FB_ATY_CT) += mach64_ct.o |
8 | atyfb-$(CONFIG_FB_ATY_XL_INIT) += xlinit.o | ||
9 | 8 | ||
10 | atyfb-objs := $(atyfb-y) | 9 | atyfb-objs := $(atyfb-y) |
11 | 10 | ||
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index e686185a076d..bfc8a93b2c73 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -431,8 +431,7 @@ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
431 | static int aty128fb_pan_display(struct fb_var_screeninfo *var, | 431 | static int aty128fb_pan_display(struct fb_var_screeninfo *var, |
432 | struct fb_info *fb); | 432 | struct fb_info *fb); |
433 | static int aty128fb_blank(int blank, struct fb_info *fb); | 433 | static int aty128fb_blank(int blank, struct fb_info *fb); |
434 | static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 434 | static int aty128fb_ioctl(struct fb_info *info, u_int cmd, unsigned long arg); |
435 | u_long arg, struct fb_info *info); | ||
436 | static int aty128fb_sync(struct fb_info *info); | 435 | static int aty128fb_sync(struct fb_info *info); |
437 | 436 | ||
438 | /* | 437 | /* |
@@ -2108,8 +2107,7 @@ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
2108 | /* in param: u32* backlight value: 0 to 15 */ | 2107 | /* in param: u32* backlight value: 0 to 15 */ |
2109 | #define FBIO_ATY128_SET_MIRROR _IOW('@', 2, __u32) | 2108 | #define FBIO_ATY128_SET_MIRROR _IOW('@', 2, __u32) |
2110 | 2109 | ||
2111 | static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 2110 | static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
2112 | u_long arg, struct fb_info *info) | ||
2113 | { | 2111 | { |
2114 | struct aty128fb_par *par = info->par; | 2112 | struct aty128fb_par *par = info->par; |
2115 | u32 value; | 2113 | u32 value; |
diff --git a/drivers/video/aty/atyfb.h b/drivers/video/aty/atyfb.h index 09de173c1164..e9b7a64c1ac4 100644 --- a/drivers/video/aty/atyfb.h +++ b/drivers/video/aty/atyfb.h | |||
@@ -50,6 +50,7 @@ struct pll_info { | |||
50 | int sclk, mclk, mclk_pm, xclk; | 50 | int sclk, mclk, mclk_pm, xclk; |
51 | int ref_div; | 51 | int ref_div; |
52 | int ref_clk; | 52 | int ref_clk; |
53 | int ecp_max; | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | typedef struct { | 56 | typedef struct { |
@@ -354,6 +355,5 @@ static inline void wait_for_idle(struct atyfb_par *par) | |||
354 | 355 | ||
355 | extern void aty_reset_engine(const struct atyfb_par *par); | 356 | extern void aty_reset_engine(const struct atyfb_par *par); |
356 | extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); | 357 | extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); |
357 | extern int atyfb_xl_init(struct fb_info *info); | ||
358 | extern void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par); | 358 | extern void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par); |
359 | extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); | 359 | extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 3fefdb0cbf07..485be386a8ff 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -109,9 +109,18 @@ | |||
109 | #define GUI_RESERVE (1 * PAGE_SIZE) | 109 | #define GUI_RESERVE (1 * PAGE_SIZE) |
110 | 110 | ||
111 | /* FIXME: remove the FAIL definition */ | 111 | /* FIXME: remove the FAIL definition */ |
112 | #define FAIL(msg) do { printk(KERN_CRIT "atyfb: " msg "\n"); return -EINVAL; } while (0) | 112 | #define FAIL(msg) do { \ |
113 | #define FAIL_MAX(msg, x, _max_) do { if(x > _max_) { printk(KERN_CRIT "atyfb: " msg " %x(%x)\n", x, _max_); return -EINVAL; } } while (0) | 113 | if (!(var->activate & FB_ACTIVATE_TEST)) \ |
114 | 114 | printk(KERN_CRIT "atyfb: " msg "\n"); \ | |
115 | return -EINVAL; \ | ||
116 | } while (0) | ||
117 | #define FAIL_MAX(msg, x, _max_) do { \ | ||
118 | if (x > _max_) { \ | ||
119 | if (!(var->activate & FB_ACTIVATE_TEST)) \ | ||
120 | printk(KERN_CRIT "atyfb: " msg " %x(%x)\n", x, _max_); \ | ||
121 | return -EINVAL; \ | ||
122 | } \ | ||
123 | } while (0) | ||
115 | #ifdef DEBUG | 124 | #ifdef DEBUG |
116 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "atyfb: " fmt, ## args) | 125 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "atyfb: " fmt, ## args) |
117 | #else | 126 | #else |
@@ -229,13 +238,12 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
229 | u_int transp, struct fb_info *info); | 238 | u_int transp, struct fb_info *info); |
230 | static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); | 239 | static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); |
231 | static int atyfb_blank(int blank, struct fb_info *info); | 240 | static int atyfb_blank(int blank, struct fb_info *info); |
232 | static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 241 | static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg); |
233 | u_long arg, struct fb_info *info); | ||
234 | extern void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); | 242 | extern void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); |
235 | extern void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); | 243 | extern void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); |
236 | extern void atyfb_imageblit(struct fb_info *info, const struct fb_image *image); | 244 | extern void atyfb_imageblit(struct fb_info *info, const struct fb_image *image); |
237 | #ifdef __sparc__ | 245 | #ifdef __sparc__ |
238 | static int atyfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma); | 246 | static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma); |
239 | #endif | 247 | #endif |
240 | static int atyfb_sync(struct fb_info *info); | 248 | static int atyfb_sync(struct fb_info *info); |
241 | 249 | ||
@@ -340,6 +348,7 @@ static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, }; | |||
340 | #define ATI_CHIP_264VT3 (M64F_VT | M64F_INTEGRATED | M64F_VT_BUS | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL) | 348 | #define ATI_CHIP_264VT3 (M64F_VT | M64F_INTEGRATED | M64F_VT_BUS | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL) |
341 | #define ATI_CHIP_264VT4 (M64F_VT | M64F_INTEGRATED | M64F_GTB_DSP) | 349 | #define ATI_CHIP_264VT4 (M64F_VT | M64F_INTEGRATED | M64F_GTB_DSP) |
342 | 350 | ||
351 | /* FIXME what is this chip? */ | ||
343 | #define ATI_CHIP_264LT (M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP) | 352 | #define ATI_CHIP_264LT (M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP) |
344 | 353 | ||
345 | /* make sets shorter */ | 354 | /* make sets shorter */ |
@@ -359,58 +368,60 @@ static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, }; | |||
359 | static struct { | 368 | static struct { |
360 | u16 pci_id; | 369 | u16 pci_id; |
361 | const char *name; | 370 | const char *name; |
362 | int pll, mclk, xclk; | 371 | int pll, mclk, xclk, ecp_max; |
363 | u32 features; | 372 | u32 features; |
364 | } aty_chips[] __devinitdata = { | 373 | } aty_chips[] __devinitdata = { |
365 | #ifdef CONFIG_FB_ATY_GX | 374 | #ifdef CONFIG_FB_ATY_GX |
366 | /* Mach64 GX */ | 375 | /* Mach64 GX */ |
367 | { PCI_CHIP_MACH64GX, "ATI888GX00 (Mach64 GX)", 135, 50, 50, ATI_CHIP_88800GX }, | 376 | { PCI_CHIP_MACH64GX, "ATI888GX00 (Mach64 GX)", 135, 50, 50, 0, ATI_CHIP_88800GX }, |
368 | { PCI_CHIP_MACH64CX, "ATI888CX00 (Mach64 CX)", 135, 50, 50, ATI_CHIP_88800CX }, | 377 | { PCI_CHIP_MACH64CX, "ATI888CX00 (Mach64 CX)", 135, 50, 50, 0, ATI_CHIP_88800CX }, |
369 | #endif /* CONFIG_FB_ATY_GX */ | 378 | #endif /* CONFIG_FB_ATY_GX */ |
370 | 379 | ||
371 | #ifdef CONFIG_FB_ATY_CT | 380 | #ifdef CONFIG_FB_ATY_CT |
372 | { PCI_CHIP_MACH64CT, "ATI264CT (Mach64 CT)", 135, 60, 60, ATI_CHIP_264CT }, | 381 | { PCI_CHIP_MACH64CT, "ATI264CT (Mach64 CT)", 135, 60, 60, 0, ATI_CHIP_264CT }, |
373 | { PCI_CHIP_MACH64ET, "ATI264ET (Mach64 ET)", 135, 60, 60, ATI_CHIP_264ET }, | 382 | { PCI_CHIP_MACH64ET, "ATI264ET (Mach64 ET)", 135, 60, 60, 0, ATI_CHIP_264ET }, |
374 | { PCI_CHIP_MACH64VT, "ATI264VT? (Mach64 VT)", 170, 67, 67, ATI_CHIP_264VT }, | 383 | |
375 | { PCI_CHIP_MACH64GT, "3D RAGE (Mach64 GT)", 135, 63, 63, ATI_CHIP_264GT }, | 384 | /* FIXME what is this chip? */ |
376 | /* FIXME { ...ATI_264GU, maybe ATI_CHIP_264GTDVD }, */ | 385 | { PCI_CHIP_MACH64LT, "ATI264LT (Mach64 LT)", 135, 63, 63, 0, ATI_CHIP_264LT }, |
377 | { PCI_CHIP_MACH64GU, "3D RAGE II+ (Mach64 GTB)", 200, 67, 67, ATI_CHIP_264GTB }, | 386 | |
378 | { PCI_CHIP_MACH64VU, "ATI264VTB (Mach64 VU)", 200, 67, 67, ATI_CHIP_264VT3 }, | 387 | { PCI_CHIP_MACH64VT, "ATI264VT (Mach64 VT)", 170, 67, 67, 80, ATI_CHIP_264VT }, |
379 | 388 | { PCI_CHIP_MACH64GT, "3D RAGE (Mach64 GT)", 135, 63, 63, 80, ATI_CHIP_264GT }, | |
380 | { PCI_CHIP_MACH64LT, "3D RAGE LT (Mach64 LT)", 135, 63, 63, ATI_CHIP_264LT }, | 389 | |
381 | /* FIXME chipset maybe ATI_CHIP_264LTPRO ? */ | 390 | { PCI_CHIP_MACH64VU, "ATI264VT3 (Mach64 VU)", 200, 67, 67, 80, ATI_CHIP_264VT3 }, |
382 | { PCI_CHIP_MACH64LG, "3D RAGE LT-G (Mach64 LG)", 230, 63, 63, ATI_CHIP_264LTG | M64F_LT_LCD_REGS | M64F_G3_PB_1024x768 }, | 391 | { PCI_CHIP_MACH64GU, "3D RAGE II+ (Mach64 GU)", 200, 67, 67, 100, ATI_CHIP_264GTB }, |
383 | 392 | ||
384 | { PCI_CHIP_MACH64VV, "ATI264VT4 (Mach64 VV)", 230, 83, 83, ATI_CHIP_264VT4 }, | 393 | { PCI_CHIP_MACH64LG, "3D RAGE LT (Mach64 LG)", 230, 63, 63, 100, ATI_CHIP_264LTG | M64F_LT_LCD_REGS | M64F_G3_PB_1024x768 }, |
385 | 394 | ||
386 | { PCI_CHIP_MACH64GV, "3D RAGE IIC (Mach64 GV, PCI)", 230, 83, 83, ATI_CHIP_264GT2C }, | 395 | { PCI_CHIP_MACH64VV, "ATI264VT4 (Mach64 VV)", 230, 83, 83, 100, ATI_CHIP_264VT4 }, |
387 | { PCI_CHIP_MACH64GW, "3D RAGE IIC (Mach64 GW, AGP)", 230, 83, 83, ATI_CHIP_264GT2C }, | 396 | |
388 | { PCI_CHIP_MACH64GY, "3D RAGE IIC (Mach64 GY, PCI)", 230, 83, 83, ATI_CHIP_264GT2C }, | 397 | { PCI_CHIP_MACH64GV, "3D RAGE IIC (Mach64 GV, PCI)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, |
389 | { PCI_CHIP_MACH64GZ, "3D RAGE IIC (Mach64 GZ, AGP)", 230, 83, 83, ATI_CHIP_264GT2C }, | 398 | { PCI_CHIP_MACH64GW, "3D RAGE IIC (Mach64 GW, AGP)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, |
390 | 399 | { PCI_CHIP_MACH64GY, "3D RAGE IIC (Mach64 GY, PCI)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, | |
391 | { PCI_CHIP_MACH64GB, "3D RAGE PRO (Mach64 GB, BGA, AGP)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 400 | { PCI_CHIP_MACH64GZ, "3D RAGE IIC (Mach64 GZ, AGP)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, |
392 | { PCI_CHIP_MACH64GD, "3D RAGE PRO (Mach64 GD, BGA, AGP 1x)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 401 | |
393 | { PCI_CHIP_MACH64GI, "3D RAGE PRO (Mach64 GI, BGA, PCI)", 230, 100, 100, ATI_CHIP_264GTPRO | M64F_MAGIC_VRAM_SIZE }, | 402 | { PCI_CHIP_MACH64GB, "3D RAGE PRO (Mach64 GB, BGA, AGP)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, |
394 | { PCI_CHIP_MACH64GP, "3D RAGE PRO (Mach64 GP, PQFP, PCI)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 403 | { PCI_CHIP_MACH64GD, "3D RAGE PRO (Mach64 GD, BGA, AGP 1x)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, |
395 | { PCI_CHIP_MACH64GQ, "3D RAGE PRO (Mach64 GQ, PQFP, PCI, limited 3D)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 404 | { PCI_CHIP_MACH64GI, "3D RAGE PRO (Mach64 GI, BGA, PCI)", 230, 100, 100, 125, ATI_CHIP_264GTPRO | M64F_MAGIC_VRAM_SIZE }, |
396 | 405 | { PCI_CHIP_MACH64GP, "3D RAGE PRO (Mach64 GP, PQFP, PCI)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, | |
397 | { PCI_CHIP_MACH64LB, "3D RAGE LT PRO (Mach64 LB, AGP)", 236, 75, 100, ATI_CHIP_264LTPRO }, | 406 | { PCI_CHIP_MACH64GQ, "3D RAGE PRO (Mach64 GQ, PQFP, PCI, limited 3D)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, |
398 | { PCI_CHIP_MACH64LD, "3D RAGE LT PRO (Mach64 LD, AGP)", 230, 100, 100, ATI_CHIP_264LTPRO }, | 407 | |
399 | { PCI_CHIP_MACH64LI, "3D RAGE LT PRO (Mach64 LI, PCI)", 230, 100, 100, ATI_CHIP_264LTPRO | M64F_G3_PB_1_1 | M64F_G3_PB_1024x768 }, | 408 | { PCI_CHIP_MACH64LB, "3D RAGE LT PRO (Mach64 LB, AGP)", 236, 75, 100, 135, ATI_CHIP_264LTPRO }, |
400 | { PCI_CHIP_MACH64LP, "3D RAGE LT PRO (Mach64 LP, PCI)", 230, 100, 100, ATI_CHIP_264LTPRO }, | 409 | { PCI_CHIP_MACH64LD, "3D RAGE LT PRO (Mach64 LD, AGP)", 230, 100, 100, 135, ATI_CHIP_264LTPRO }, |
401 | { PCI_CHIP_MACH64LQ, "3D RAGE LT PRO (Mach64 LQ, PCI)", 230, 100, 100, ATI_CHIP_264LTPRO }, | 410 | { PCI_CHIP_MACH64LI, "3D RAGE LT PRO (Mach64 LI, PCI)", 230, 100, 100, 135, ATI_CHIP_264LTPRO | M64F_G3_PB_1_1 | M64F_G3_PB_1024x768 }, |
402 | 411 | { PCI_CHIP_MACH64LP, "3D RAGE LT PRO (Mach64 LP, PCI)", 230, 100, 100, 135, ATI_CHIP_264LTPRO }, | |
403 | { PCI_CHIP_MACH64GM, "3D RAGE XL (Mach64 GM, AGP)", 230, 83, 63, ATI_CHIP_264XL }, | 412 | { PCI_CHIP_MACH64LQ, "3D RAGE LT PRO (Mach64 LQ, PCI)", 230, 100, 100, 135, ATI_CHIP_264LTPRO }, |
404 | { PCI_CHIP_MACH64GN, "3D RAGE XL (Mach64 GN, AGP)", 230, 83, 63, ATI_CHIP_264XL }, | 413 | |
405 | { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66/BGA)", 230, 83, 63, ATI_CHIP_264XL }, | 414 | { PCI_CHIP_MACH64GM, "3D RAGE XL (Mach64 GM, AGP 2x)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
406 | { PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33MHz)", 235, 83, 63, ATI_CHIP_264XL | M64F_SDRAM_MAGIC_PLL }, | 415 | { PCI_CHIP_MACH64GN, "3D RAGE XC (Mach64 GN, AGP 2x)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
407 | { PCI_CHIP_MACH64GL, "3D RAGE XL (Mach64 GL, PCI)", 230, 83, 63, ATI_CHIP_264XL }, | 416 | { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
408 | { PCI_CHIP_MACH64GS, "3D RAGE XL (Mach64 GS, PCI)", 230, 83, 63, ATI_CHIP_264XL }, | 417 | { PCI_CHIP_MACH64GL, "3D RAGE XC (Mach64 GL, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
409 | 418 | { PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL | M64F_SDRAM_MAGIC_PLL }, | |
410 | { PCI_CHIP_MACH64LM, "3D RAGE Mobility P/M (Mach64 LM, AGP 2x)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 419 | { PCI_CHIP_MACH64GS, "3D RAGE XC (Mach64 GS, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
411 | { PCI_CHIP_MACH64LN, "3D RAGE Mobility L (Mach64 LN, AGP 2x)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 420 | |
412 | { PCI_CHIP_MACH64LR, "3D RAGE Mobility P/M (Mach64 LR, PCI)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 421 | { PCI_CHIP_MACH64LM, "3D RAGE Mobility P/M (Mach64 LM, AGP 2x)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, |
413 | { PCI_CHIP_MACH64LS, "3D RAGE Mobility L (Mach64 LS, PCI)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 422 | { PCI_CHIP_MACH64LN, "3D RAGE Mobility L (Mach64 LN, AGP 2x)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, |
423 | { PCI_CHIP_MACH64LR, "3D RAGE Mobility P/M (Mach64 LR, PCI)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, | ||
424 | { PCI_CHIP_MACH64LS, "3D RAGE Mobility L (Mach64 LS, PCI)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, | ||
414 | #endif /* CONFIG_FB_ATY_CT */ | 425 | #endif /* CONFIG_FB_ATY_CT */ |
415 | }; | 426 | }; |
416 | 427 | ||
@@ -431,6 +442,7 @@ static int __devinit correct_chipset(struct atyfb_par *par) | |||
431 | par->pll_limits.pll_max = aty_chips[i].pll; | 442 | par->pll_limits.pll_max = aty_chips[i].pll; |
432 | par->pll_limits.mclk = aty_chips[i].mclk; | 443 | par->pll_limits.mclk = aty_chips[i].mclk; |
433 | par->pll_limits.xclk = aty_chips[i].xclk; | 444 | par->pll_limits.xclk = aty_chips[i].xclk; |
445 | par->pll_limits.ecp_max = aty_chips[i].ecp_max; | ||
434 | par->features = aty_chips[i].features; | 446 | par->features = aty_chips[i].features; |
435 | 447 | ||
436 | chip_id = aty_ld_le32(CONFIG_CHIP_ID, par); | 448 | chip_id = aty_ld_le32(CONFIG_CHIP_ID, par); |
@@ -450,39 +462,63 @@ static int __devinit correct_chipset(struct atyfb_par *par) | |||
450 | #endif | 462 | #endif |
451 | #ifdef CONFIG_FB_ATY_CT | 463 | #ifdef CONFIG_FB_ATY_CT |
452 | case PCI_CHIP_MACH64VT: | 464 | case PCI_CHIP_MACH64VT: |
453 | rev &= 0xc7; | 465 | switch (rev & 0x07) { |
454 | if(rev == 0x00) { | 466 | case 0x00: |
455 | name = "ATI264VTA3 (Mach64 VT)"; | 467 | switch (rev & 0xc0) { |
456 | par->pll_limits.pll_max = 170; | 468 | case 0x00: |
457 | par->pll_limits.mclk = 67; | 469 | name = "ATI264VT (A3) (Mach64 VT)"; |
458 | par->pll_limits.xclk = 67; | 470 | par->pll_limits.pll_max = 170; |
459 | par->features = ATI_CHIP_264VT; | 471 | par->pll_limits.mclk = 67; |
460 | } else if(rev == 0x40) { | 472 | par->pll_limits.xclk = 67; |
461 | name = "ATI264VTA4 (Mach64 VT)"; | 473 | par->pll_limits.ecp_max = 80; |
474 | par->features = ATI_CHIP_264VT; | ||
475 | break; | ||
476 | case 0x40: | ||
477 | name = "ATI264VT2 (A4) (Mach64 VT)"; | ||
478 | par->pll_limits.pll_max = 200; | ||
479 | par->pll_limits.mclk = 67; | ||
480 | par->pll_limits.xclk = 67; | ||
481 | par->pll_limits.ecp_max = 80; | ||
482 | par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; | ||
483 | break; | ||
484 | } | ||
485 | break; | ||
486 | case 0x01: | ||
487 | name = "ATI264VT3 (B1) (Mach64 VT)"; | ||
462 | par->pll_limits.pll_max = 200; | 488 | par->pll_limits.pll_max = 200; |
463 | par->pll_limits.mclk = 67; | 489 | par->pll_limits.mclk = 67; |
464 | par->pll_limits.xclk = 67; | 490 | par->pll_limits.xclk = 67; |
465 | par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; | 491 | par->pll_limits.ecp_max = 80; |
466 | } else { | 492 | par->features = ATI_CHIP_264VTB; |
467 | name = "ATI264VTB (Mach64 VT)"; | 493 | break; |
494 | case 0x02: | ||
495 | name = "ATI264VT3 (B2) (Mach64 VT)"; | ||
468 | par->pll_limits.pll_max = 200; | 496 | par->pll_limits.pll_max = 200; |
469 | par->pll_limits.mclk = 67; | 497 | par->pll_limits.mclk = 67; |
470 | par->pll_limits.xclk = 67; | 498 | par->pll_limits.xclk = 67; |
471 | par->features = ATI_CHIP_264VTB; | 499 | par->pll_limits.ecp_max = 80; |
500 | par->features = ATI_CHIP_264VT3; | ||
501 | break; | ||
472 | } | 502 | } |
473 | break; | 503 | break; |
474 | case PCI_CHIP_MACH64GT: | 504 | case PCI_CHIP_MACH64GT: |
475 | rev &= 0x07; | 505 | switch (rev & 0x07) { |
476 | if(rev == 0x01) { | 506 | case 0x01: |
507 | name = "3D RAGE II (Mach64 GT)"; | ||
477 | par->pll_limits.pll_max = 170; | 508 | par->pll_limits.pll_max = 170; |
478 | par->pll_limits.mclk = 67; | 509 | par->pll_limits.mclk = 67; |
479 | par->pll_limits.xclk = 67; | 510 | par->pll_limits.xclk = 67; |
511 | par->pll_limits.ecp_max = 80; | ||
480 | par->features = ATI_CHIP_264GTB; | 512 | par->features = ATI_CHIP_264GTB; |
481 | } else if(rev == 0x02) { | 513 | break; |
514 | case 0x02: | ||
515 | name = "3D RAGE II+ (Mach64 GT)"; | ||
482 | par->pll_limits.pll_max = 200; | 516 | par->pll_limits.pll_max = 200; |
483 | par->pll_limits.mclk = 67; | 517 | par->pll_limits.mclk = 67; |
484 | par->pll_limits.xclk = 67; | 518 | par->pll_limits.xclk = 67; |
519 | par->pll_limits.ecp_max = 100; | ||
485 | par->features = ATI_CHIP_264GTB; | 520 | par->features = ATI_CHIP_264GTB; |
521 | break; | ||
486 | } | 522 | } |
487 | break; | 523 | break; |
488 | #endif | 524 | #endif |
@@ -692,7 +728,7 @@ static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc) | |||
692 | aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | | 728 | aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | |
693 | (SHADOW_EN | SHADOW_RW_EN), par); | 729 | (SHADOW_EN | SHADOW_RW_EN), par); |
694 | 730 | ||
695 | DPRINTK("set secondary CRT to %ix%i %c%c\n", | 731 | DPRINTK("set shadow CRT to %ix%i %c%c\n", |
696 | ((((crtc->shadow_h_tot_disp>>16) & 0xff) + 1)<<3), (((crtc->shadow_v_tot_disp>>16) & 0x7ff) + 1), | 732 | ((((crtc->shadow_h_tot_disp>>16) & 0xff) + 1)<<3), (((crtc->shadow_v_tot_disp>>16) & 0x7ff) + 1), |
697 | (crtc->shadow_h_sync_strt_wid & 0x200000)?'N':'P', (crtc->shadow_v_sync_strt_wid & 0x200000)?'N':'P'); | 733 | (crtc->shadow_h_sync_strt_wid & 0x200000)?'N':'P', (crtc->shadow_v_sync_strt_wid & 0x200000)?'N':'P'); |
698 | 734 | ||
@@ -840,11 +876,14 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
840 | know if one is connected. So it's better to fail then. | 876 | know if one is connected. So it's better to fail then. |
841 | */ | 877 | */ |
842 | if (crtc->lcd_gen_cntl & CRT_ON) { | 878 | if (crtc->lcd_gen_cntl & CRT_ON) { |
843 | PRINTKI("Disable lcd panel, because video mode does not fit.\n"); | 879 | if (!(var->activate & FB_ACTIVATE_TEST)) |
880 | PRINTKI("Disable LCD panel, because video mode does not fit.\n"); | ||
844 | crtc->lcd_gen_cntl &= ~LCD_ON; | 881 | crtc->lcd_gen_cntl &= ~LCD_ON; |
845 | /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ | 882 | /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ |
846 | } else { | 883 | } else { |
847 | FAIL("Video mode exceeds size of lcd panel.\nConnect this computer to a conventional monitor if you really need this mode."); | 884 | if (!(var->activate & FB_ACTIVATE_TEST)) |
885 | PRINTKE("Video mode exceeds size of LCD panel.\nConnect this computer to a conventional monitor if you really need this mode.\n"); | ||
886 | return -EINVAL; | ||
848 | } | 887 | } |
849 | } | 888 | } |
850 | } | 889 | } |
@@ -858,9 +897,9 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
858 | vmode &= ~(FB_VMODE_DOUBLE | FB_VMODE_INTERLACED); | 897 | vmode &= ~(FB_VMODE_DOUBLE | FB_VMODE_INTERLACED); |
859 | 898 | ||
860 | /* This is horror! When we simulate, say 640x480 on an 800x600 | 899 | /* This is horror! When we simulate, say 640x480 on an 800x600 |
861 | lcd monitor, the CRTC should be programmed 800x600 values for | 900 | LCD monitor, the CRTC should be programmed 800x600 values for |
862 | the non visible part, but 640x480 for the visible part. | 901 | the non visible part, but 640x480 for the visible part. |
863 | This code has been tested on a laptop with it's 1400x1050 lcd | 902 | This code has been tested on a laptop with it's 1400x1050 LCD |
864 | monitor and a conventional monitor both switched on. | 903 | monitor and a conventional monitor both switched on. |
865 | Tested modes: 1280x1024, 1152x864, 1024x768, 800x600, | 904 | Tested modes: 1280x1024, 1152x864, 1024x768, 800x600, |
866 | works with little glitches also with DOUBLESCAN modes | 905 | works with little glitches also with DOUBLESCAN modes |
@@ -955,16 +994,6 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
955 | vdisplay = yres; | 994 | vdisplay = yres; |
956 | if(vmode & FB_VMODE_DOUBLE) | 995 | if(vmode & FB_VMODE_DOUBLE) |
957 | vdisplay <<= 1; | 996 | vdisplay <<= 1; |
958 | if(vmode & FB_VMODE_INTERLACED) { | ||
959 | vdisplay >>= 1; | ||
960 | |||
961 | /* The prefered mode for the lcd is not interlaced, so disable it if | ||
962 | it was enabled. For doublescan there is no problem, because we can | ||
963 | compensate for it in the hardware stretching (we stretch half as much) | ||
964 | */ | ||
965 | vmode &= ~FB_VMODE_INTERLACED; | ||
966 | /*crtc->gen_cntl &= ~CRTC_INTERLACE_EN;*/ | ||
967 | } | ||
968 | crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); | 997 | crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); |
969 | crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | | 998 | crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | |
970 | /*TVCLK_PM_EN | VCLK_DAC_PM_EN |*/ | 999 | /*TVCLK_PM_EN | VCLK_DAC_PM_EN |*/ |
@@ -980,7 +1009,7 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
980 | crtc->horz_stretching &= | 1009 | crtc->horz_stretching &= |
981 | ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | AUTO_HORZ_RATIO | | 1010 | ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | AUTO_HORZ_RATIO | |
982 | HORZ_STRETCH_MODE | HORZ_STRETCH_EN); | 1011 | HORZ_STRETCH_MODE | HORZ_STRETCH_EN); |
983 | if (xres < par->lcd_width) { | 1012 | if (xres < par->lcd_width && crtc->lcd_gen_cntl & LCD_ON) { |
984 | do { | 1013 | do { |
985 | /* | 1014 | /* |
986 | * The horizontal blender misbehaves when HDisplay is less than a | 1015 | * The horizontal blender misbehaves when HDisplay is less than a |
@@ -1042,7 +1071,7 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
1042 | } while (0); | 1071 | } while (0); |
1043 | } | 1072 | } |
1044 | 1073 | ||
1045 | if (vdisplay < par->lcd_height) { | 1074 | if (vdisplay < par->lcd_height && crtc->lcd_gen_cntl & LCD_ON) { |
1046 | crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | | 1075 | crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | |
1047 | (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); | 1076 | (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); |
1048 | 1077 | ||
@@ -1065,9 +1094,8 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
1065 | #endif /* CONFIG_FB_ATY_GENERIC_LCD */ | 1094 | #endif /* CONFIG_FB_ATY_GENERIC_LCD */ |
1066 | 1095 | ||
1067 | if (M64_HAS(MAGIC_FIFO)) { | 1096 | if (M64_HAS(MAGIC_FIFO)) { |
1068 | /* Not VTB/GTB */ | 1097 | /* FIXME: display FIFO low watermark values */ |
1069 | /* FIXME: magic FIFO values */ | 1098 | crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_FIFO_LWM); |
1070 | crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC2_PIX_WIDTH); | ||
1071 | } | 1099 | } |
1072 | crtc->dp_pix_width = dp_pix_width; | 1100 | crtc->dp_pix_width = dp_pix_width; |
1073 | crtc->dp_chain_mask = dp_chain_mask; | 1101 | crtc->dp_chain_mask = dp_chain_mask; |
@@ -1184,7 +1212,8 @@ static int aty_crtc_to_var(const struct crtc *crtc, struct fb_var_screeninfo *va | |||
1184 | var->transp.length = 8; | 1212 | var->transp.length = 8; |
1185 | break; | 1213 | break; |
1186 | default: | 1214 | default: |
1187 | FAIL("Invalid pixel width"); | 1215 | PRINTKE("Invalid pixel width\n"); |
1216 | return -EINVAL; | ||
1188 | } | 1217 | } |
1189 | 1218 | ||
1190 | /* output */ | 1219 | /* output */ |
@@ -1241,7 +1270,8 @@ static int atyfb_set_par(struct fb_info *info) | |||
1241 | pixclock = atyfb_get_pixclock(var, par); | 1270 | pixclock = atyfb_get_pixclock(var, par); |
1242 | 1271 | ||
1243 | if (pixclock == 0) { | 1272 | if (pixclock == 0) { |
1244 | FAIL("Invalid pixclock"); | 1273 | PRINTKE("Invalid pixclock\n"); |
1274 | return -EINVAL; | ||
1245 | } else { | 1275 | } else { |
1246 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &par->pll))) | 1276 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &par->pll))) |
1247 | return err; | 1277 | return err; |
@@ -1446,7 +1476,9 @@ static int atyfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1446 | pixclock = atyfb_get_pixclock(var, par); | 1476 | pixclock = atyfb_get_pixclock(var, par); |
1447 | 1477 | ||
1448 | if (pixclock == 0) { | 1478 | if (pixclock == 0) { |
1449 | FAIL("Invalid pixclock"); | 1479 | if (!(var->activate & FB_ACTIVATE_TEST)) |
1480 | PRINTKE("Invalid pixclock\n"); | ||
1481 | return -EINVAL; | ||
1450 | } else { | 1482 | } else { |
1451 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &pll))) | 1483 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &pll))) |
1452 | return err; | 1484 | return err; |
@@ -1706,8 +1738,7 @@ struct atyclk { | |||
1706 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) | 1738 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
1707 | #endif | 1739 | #endif |
1708 | 1740 | ||
1709 | static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 1741 | static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
1710 | u_long arg, struct fb_info *info) | ||
1711 | { | 1742 | { |
1712 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 1743 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
1713 | #ifdef __sparc__ | 1744 | #ifdef __sparc__ |
@@ -1812,7 +1843,7 @@ static int atyfb_sync(struct fb_info *info) | |||
1812 | } | 1843 | } |
1813 | 1844 | ||
1814 | #ifdef __sparc__ | 1845 | #ifdef __sparc__ |
1815 | static int atyfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 1846 | static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
1816 | { | 1847 | { |
1817 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 1848 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
1818 | unsigned int size, page, map_size = 0; | 1849 | unsigned int size, page, map_size = 0; |
@@ -2291,10 +2322,6 @@ static int __init aty_init(struct fb_info *info, const char *name) | |||
2291 | par->dac_ops = &aty_dac_ct; | 2322 | par->dac_ops = &aty_dac_ct; |
2292 | par->pll_ops = &aty_pll_ct; | 2323 | par->pll_ops = &aty_pll_ct; |
2293 | par->bus_type = PCI; | 2324 | par->bus_type = PCI; |
2294 | #ifdef CONFIG_FB_ATY_XL_INIT | ||
2295 | if (IS_XL(par->pci_id)) | ||
2296 | atyfb_xl_init(info); | ||
2297 | #endif | ||
2298 | par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07); | 2325 | par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07); |
2299 | ramname = aty_ct_ram[par->ram_type]; | 2326 | ramname = aty_ct_ram[par->ram_type]; |
2300 | /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */ | 2327 | /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */ |
@@ -2638,16 +2665,16 @@ static int __init store_video_par(char *video_str, unsigned char m64_num) | |||
2638 | static int atyfb_blank(int blank, struct fb_info *info) | 2665 | static int atyfb_blank(int blank, struct fb_info *info) |
2639 | { | 2666 | { |
2640 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 2667 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
2641 | u8 gen_cntl; | 2668 | u32 gen_cntl; |
2642 | 2669 | ||
2643 | if (par->lock_blank || par->asleep) | 2670 | if (par->lock_blank || par->asleep) |
2644 | return 0; | 2671 | return 0; |
2645 | 2672 | ||
2646 | #ifdef CONFIG_PMAC_BACKLIGHT | 2673 | #ifdef CONFIG_PMAC_BACKLIGHT |
2647 | if ((_machine == _MACH_Pmac) && blank) | 2674 | if ((_machine == _MACH_Pmac) && blank > FB_BLANK_NORMAL) |
2648 | set_backlight_enable(0); | 2675 | set_backlight_enable(0); |
2649 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2676 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
2650 | if (par->lcd_table && blank && | 2677 | if (par->lcd_table && blank > FB_BLANK_NORMAL && |
2651 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | 2678 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { |
2652 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); | 2679 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); |
2653 | pm &= ~PWR_BLON; | 2680 | pm &= ~PWR_BLON; |
@@ -2655,31 +2682,31 @@ static int atyfb_blank(int blank, struct fb_info *info) | |||
2655 | } | 2682 | } |
2656 | #endif | 2683 | #endif |
2657 | 2684 | ||
2658 | gen_cntl = aty_ld_8(CRTC_GEN_CNTL, par); | 2685 | gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par); |
2659 | switch (blank) { | 2686 | switch (blank) { |
2660 | case FB_BLANK_UNBLANK: | 2687 | case FB_BLANK_UNBLANK: |
2661 | gen_cntl &= ~(0x4c); | 2688 | gen_cntl &= ~0x400004c; |
2662 | break; | 2689 | break; |
2663 | case FB_BLANK_NORMAL: | 2690 | case FB_BLANK_NORMAL: |
2664 | gen_cntl |= 0x40; | 2691 | gen_cntl |= 0x4000040; |
2665 | break; | 2692 | break; |
2666 | case FB_BLANK_VSYNC_SUSPEND: | 2693 | case FB_BLANK_VSYNC_SUSPEND: |
2667 | gen_cntl |= 0x8; | 2694 | gen_cntl |= 0x4000048; |
2668 | break; | 2695 | break; |
2669 | case FB_BLANK_HSYNC_SUSPEND: | 2696 | case FB_BLANK_HSYNC_SUSPEND: |
2670 | gen_cntl |= 0x4; | 2697 | gen_cntl |= 0x4000044; |
2671 | break; | 2698 | break; |
2672 | case FB_BLANK_POWERDOWN: | 2699 | case FB_BLANK_POWERDOWN: |
2673 | gen_cntl |= 0x4c; | 2700 | gen_cntl |= 0x400004c; |
2674 | break; | 2701 | break; |
2675 | } | 2702 | } |
2676 | aty_st_8(CRTC_GEN_CNTL, gen_cntl, par); | 2703 | aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); |
2677 | 2704 | ||
2678 | #ifdef CONFIG_PMAC_BACKLIGHT | 2705 | #ifdef CONFIG_PMAC_BACKLIGHT |
2679 | if ((_machine == _MACH_Pmac) && !blank) | 2706 | if ((_machine == _MACH_Pmac) && blank <= FB_BLANK_NORMAL) |
2680 | set_backlight_enable(1); | 2707 | set_backlight_enable(1); |
2681 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2708 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
2682 | if (par->lcd_table && !blank && | 2709 | if (par->lcd_table && blank <= FB_BLANK_NORMAL && |
2683 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | 2710 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { |
2684 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); | 2711 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); |
2685 | pm |= PWR_BLON; | 2712 | pm |= PWR_BLON; |
@@ -3157,15 +3184,15 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base) | |||
3157 | refresh_rates_buf, lcd_refresh_rates[default_refresh_rate]); | 3184 | refresh_rates_buf, lcd_refresh_rates[default_refresh_rate]); |
3158 | par->lcd_refreshrate = lcd_refresh_rates[default_refresh_rate]; | 3185 | par->lcd_refreshrate = lcd_refresh_rates[default_refresh_rate]; |
3159 | /* We now need to determine the crtc parameters for the | 3186 | /* We now need to determine the crtc parameters for the |
3160 | * lcd monitor. This is tricky, because they are not stored | 3187 | * LCD monitor. This is tricky, because they are not stored |
3161 | * individually in the BIOS. Instead, the BIOS contains a | 3188 | * individually in the BIOS. Instead, the BIOS contains a |
3162 | * table of display modes that work for this monitor. | 3189 | * table of display modes that work for this monitor. |
3163 | * | 3190 | * |
3164 | * The idea is that we search for a mode of the same dimensions | 3191 | * The idea is that we search for a mode of the same dimensions |
3165 | * as the dimensions of the lcd monitor. Say our lcd monitor | 3192 | * as the dimensions of the LCD monitor. Say our LCD monitor |
3166 | * is 800x600 pixels, we search for a 800x600 monitor. | 3193 | * is 800x600 pixels, we search for a 800x600 monitor. |
3167 | * The CRTC parameters we find here are the ones that we need | 3194 | * The CRTC parameters we find here are the ones that we need |
3168 | * to use to simulate other resolutions on the lcd screen. | 3195 | * to use to simulate other resolutions on the LCD screen. |
3169 | */ | 3196 | */ |
3170 | lcdmodeptr = (u16 *)(par->lcd_table + 64); | 3197 | lcdmodeptr = (u16 *)(par->lcd_table + 64); |
3171 | while (*lcdmodeptr != 0) { | 3198 | while (*lcdmodeptr != 0) { |
@@ -3472,7 +3499,7 @@ err_release_mem: | |||
3472 | 3499 | ||
3473 | static int __devinit atyfb_atari_probe(void) | 3500 | static int __devinit atyfb_atari_probe(void) |
3474 | { | 3501 | { |
3475 | struct aty_par *par; | 3502 | struct atyfb_par *par; |
3476 | struct fb_info *info; | 3503 | struct fb_info *info; |
3477 | int m64_num; | 3504 | int m64_num; |
3478 | u32 clock_r; | 3505 | u32 clock_r; |
@@ -3692,9 +3719,7 @@ static int __init atyfb_init(void) | |||
3692 | atyfb_setup(option); | 3719 | atyfb_setup(option); |
3693 | #endif | 3720 | #endif |
3694 | 3721 | ||
3695 | #ifdef CONFIG_PCI | ||
3696 | pci_register_driver(&atyfb_driver); | 3722 | pci_register_driver(&atyfb_driver); |
3697 | #endif | ||
3698 | #ifdef CONFIG_ATARI | 3723 | #ifdef CONFIG_ATARI |
3699 | atyfb_atari_probe(); | 3724 | atyfb_atari_probe(); |
3700 | #endif | 3725 | #endif |
@@ -3703,9 +3728,7 @@ static int __init atyfb_init(void) | |||
3703 | 3728 | ||
3704 | static void __exit atyfb_exit(void) | 3729 | static void __exit atyfb_exit(void) |
3705 | { | 3730 | { |
3706 | #ifdef CONFIG_PCI | ||
3707 | pci_unregister_driver(&atyfb_driver); | 3731 | pci_unregister_driver(&atyfb_driver); |
3708 | #endif | ||
3709 | } | 3732 | } |
3710 | 3733 | ||
3711 | module_init(atyfb_init); | 3734 | module_init(atyfb_init); |
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c index 9bdb2aab01aa..e7056934c6a8 100644 --- a/drivers/video/aty/mach64_ct.c +++ b/drivers/video/aty/mach64_ct.c | |||
@@ -206,9 +206,7 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll | |||
206 | { | 206 | { |
207 | u32 q; | 207 | u32 q; |
208 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 208 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
209 | #ifdef DEBUG | ||
210 | int pllvclk; | 209 | int pllvclk; |
211 | #endif | ||
212 | 210 | ||
213 | /* FIXME: use the VTB/GTB /{3,6,12} post dividers if they're better suited */ | 211 | /* FIXME: use the VTB/GTB /{3,6,12} post dividers if they're better suited */ |
214 | q = par->ref_clk_per * pll->pll_ref_div * 4 / vclk_per; | 212 | q = par->ref_clk_per * pll->pll_ref_div * 4 / vclk_per; |
@@ -223,13 +221,26 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll | |||
223 | pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; | 221 | pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; |
224 | // pll->vclk_post_div <<= 6; | 222 | // pll->vclk_post_div <<= 6; |
225 | pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; | 223 | pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; |
226 | #ifdef DEBUG | ||
227 | pllvclk = (1000000 * 2 * pll->vclk_fb_div) / | 224 | pllvclk = (1000000 * 2 * pll->vclk_fb_div) / |
228 | (par->ref_clk_per * pll->pll_ref_div); | 225 | (par->ref_clk_per * pll->pll_ref_div); |
226 | #ifdef DEBUG | ||
229 | printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", | 227 | printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", |
230 | __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real); | 228 | __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real); |
231 | #endif | 229 | #endif |
232 | pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ | 230 | pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ |
231 | |||
232 | /* Set ECP (scaler/overlay clock) divider */ | ||
233 | if (par->pll_limits.ecp_max) { | ||
234 | int ecp = pllvclk / pll->vclk_post_div_real; | ||
235 | int ecp_div = 0; | ||
236 | |||
237 | while (ecp > par->pll_limits.ecp_max && ecp_div < 2) { | ||
238 | ecp >>= 1; | ||
239 | ecp_div++; | ||
240 | } | ||
241 | pll->pll_vclk_cntl |= ecp_div << 4; | ||
242 | } | ||
243 | |||
233 | return 0; | 244 | return 0; |
234 | } | 245 | } |
235 | 246 | ||
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 156db84cb363..c9f0c5a07e6e 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -864,8 +864,8 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, | |||
864 | } | 864 | } |
865 | 865 | ||
866 | 866 | ||
867 | static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int cmd, | 867 | static int radeonfb_ioctl (struct fb_info *info, unsigned int cmd, |
868 | unsigned long arg, struct fb_info *info) | 868 | unsigned long arg) |
869 | { | 869 | { |
870 | struct radeonfb_info *rinfo = info->par; | 870 | struct radeonfb_info *rinfo = info->par; |
871 | unsigned int tmp; | 871 | unsigned int tmp; |
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c index ea7c86306918..7f9838dceab5 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/aty/radeon_monitor.c | |||
@@ -423,7 +423,7 @@ static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo, | |||
423 | /* | 423 | /* |
424 | * Probe display on both primary and secondary card's connector (if any) | 424 | * Probe display on both primary and secondary card's connector (if any) |
425 | * by various available techniques (i2c, OF device tree, BIOS, ...) and | 425 | * by various available techniques (i2c, OF device tree, BIOS, ...) and |
426 | * try to retreive EDID. The algorithm here comes from XFree's radeon | 426 | * try to retrieve EDID. The algorithm here comes from XFree's radeon |
427 | * driver | 427 | * driver |
428 | */ | 428 | */ |
429 | void __devinit radeon_probe_screens(struct radeonfb_info *rinfo, | 429 | void __devinit radeon_probe_screens(struct radeonfb_info *rinfo, |
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 097d668c4fe5..556895e99645 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2734,7 +2734,7 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2734 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that | 2734 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that |
2735 | * reason. --BenH | 2735 | * reason. --BenH |
2736 | */ | 2736 | */ |
2737 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_OF) | 2737 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) |
2738 | if (_machine == _MACH_Pmac && rinfo->of_node) { | 2738 | if (_machine == _MACH_Pmac && rinfo->of_node) { |
2739 | if (rinfo->is_mobility && rinfo->pm_reg && | 2739 | if (rinfo->is_mobility && rinfo->pm_reg && |
2740 | rinfo->family <= CHIP_FAMILY_RV250) | 2740 | rinfo->family <= CHIP_FAMILY_RV250) |
@@ -2778,12 +2778,12 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2778 | OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); | 2778 | OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); |
2779 | #endif | 2779 | #endif |
2780 | } | 2780 | } |
2781 | #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */ | 2781 | #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) */ |
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) | 2784 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) |
2785 | { | 2785 | { |
2786 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_OF) | 2786 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) |
2787 | if (rinfo->pm_mode != radeon_pm_none) | 2787 | if (rinfo->pm_mode != radeon_pm_none) |
2788 | pmac_set_early_video_resume(NULL, NULL); | 2788 | pmac_set_early_video_resume(NULL, NULL); |
2789 | #endif | 2789 | #endif |
diff --git a/drivers/video/aty/xlinit.c b/drivers/video/aty/xlinit.c deleted file mode 100644 index a085cbf74ecb..000000000000 --- a/drivers/video/aty/xlinit.c +++ /dev/null | |||
@@ -1,359 +0,0 @@ | |||
1 | /* | ||
2 | * ATI Rage XL Initialization. Support for Xpert98 and Victoria | ||
3 | * PCI cards. | ||
4 | * | ||
5 | * Copyright (C) 2002 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * stevel@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/errno.h> | ||
33 | #include <linux/string.h> | ||
34 | #include <linux/mm.h> | ||
35 | #include <linux/slab.h> | ||
36 | #include <linux/vmalloc.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/fb.h> | ||
39 | #include <linux/init.h> | ||
40 | #include <linux/pci.h> | ||
41 | #include <asm/io.h> | ||
42 | #include <video/mach64.h> | ||
43 | #include "atyfb.h" | ||
44 | |||
45 | #define MPLL_GAIN 0xad | ||
46 | #define VPLL_GAIN 0xd5 | ||
47 | |||
48 | enum { | ||
49 | VICTORIA = 0, | ||
50 | XPERT98, | ||
51 | NUM_XL_CARDS | ||
52 | }; | ||
53 | |||
54 | extern const struct aty_pll_ops aty_pll_ct; | ||
55 | |||
56 | #define DEFAULT_CARD XPERT98 | ||
57 | static int xl_card = DEFAULT_CARD; | ||
58 | |||
59 | static const struct xl_card_cfg_t { | ||
60 | int ref_crystal; // 10^4 Hz | ||
61 | int mem_type; | ||
62 | int mem_size; | ||
63 | u32 mem_cntl; | ||
64 | u32 ext_mem_cntl; | ||
65 | u32 mem_addr_config; | ||
66 | u32 bus_cntl; | ||
67 | u32 dac_cntl; | ||
68 | u32 hw_debug; | ||
69 | u32 custom_macro_cntl; | ||
70 | u8 dll2_cntl; | ||
71 | u8 pll_yclk_cntl; | ||
72 | } card_cfg[NUM_XL_CARDS] = { | ||
73 | // VICTORIA | ||
74 | { 2700, SDRAM, 0x800000, | ||
75 | 0x10757A3B, 0x64000C81, 0x00110202, 0x7b33A040, | ||
76 | 0x82010102, 0x48803800, 0x005E0179, | ||
77 | 0x50, 0x25 | ||
78 | }, | ||
79 | // XPERT98 | ||
80 | { 1432, WRAM, 0x800000, | ||
81 | 0x00165A2B, 0xE0000CF1, 0x00200213, 0x7333A001, | ||
82 | 0x8000000A, 0x48833800, 0x007F0779, | ||
83 | 0x10, 0x19 | ||
84 | } | ||
85 | }; | ||
86 | |||
87 | typedef struct { | ||
88 | u8 lcd_reg; | ||
89 | u32 val; | ||
90 | } lcd_tbl_t; | ||
91 | |||
92 | static const lcd_tbl_t lcd_tbl[] = { | ||
93 | { 0x01, 0x000520C0 }, | ||
94 | { 0x08, 0x02000408 }, | ||
95 | { 0x03, 0x00000F00 }, | ||
96 | { 0x00, 0x00000000 }, | ||
97 | { 0x02, 0x00000000 }, | ||
98 | { 0x04, 0x00000000 }, | ||
99 | { 0x05, 0x00000000 }, | ||
100 | { 0x06, 0x00000000 }, | ||
101 | { 0x33, 0x00000000 }, | ||
102 | { 0x34, 0x00000000 }, | ||
103 | { 0x35, 0x00000000 }, | ||
104 | { 0x36, 0x00000000 }, | ||
105 | { 0x37, 0x00000000 } | ||
106 | }; | ||
107 | |||
108 | static void reset_gui(struct atyfb_par *par) | ||
109 | { | ||
110 | aty_st_8(GEN_TEST_CNTL+1, 0x01, par); | ||
111 | aty_st_8(GEN_TEST_CNTL+1, 0x00, par); | ||
112 | aty_st_8(GEN_TEST_CNTL+1, 0x02, par); | ||
113 | mdelay(5); | ||
114 | } | ||
115 | |||
116 | static void reset_sdram(struct atyfb_par *par) | ||
117 | { | ||
118 | u8 temp; | ||
119 | |||
120 | temp = aty_ld_8(EXT_MEM_CNTL, par); | ||
121 | temp |= 0x02; | ||
122 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_SDRAM_RESET = 1b | ||
123 | temp |= 0x08; | ||
124 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_CYC_TEST = 10b | ||
125 | temp |= 0x0c; | ||
126 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_CYC_TEST = 11b | ||
127 | mdelay(5); | ||
128 | temp &= 0xf3; | ||
129 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_CYC_TEST = 00b | ||
130 | temp &= 0xfd; | ||
131 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_SDRAM_REST = 0b | ||
132 | mdelay(5); | ||
133 | } | ||
134 | |||
135 | static void init_dll(struct atyfb_par *par) | ||
136 | { | ||
137 | // enable DLL | ||
138 | aty_st_pll_ct(PLL_GEN_CNTL, | ||
139 | aty_ld_pll_ct(PLL_GEN_CNTL, par) & 0x7f, | ||
140 | par); | ||
141 | |||
142 | // reset DLL | ||
143 | aty_st_pll_ct(DLL_CNTL, 0x82, par); | ||
144 | aty_st_pll_ct(DLL_CNTL, 0xE2, par); | ||
145 | mdelay(5); | ||
146 | aty_st_pll_ct(DLL_CNTL, 0x82, par); | ||
147 | mdelay(6); | ||
148 | } | ||
149 | |||
150 | static void reset_clocks(struct atyfb_par *par, struct pll_ct *pll, | ||
151 | int hsync_enb) | ||
152 | { | ||
153 | reset_gui(par); | ||
154 | aty_st_pll_ct(MCLK_FB_DIV, pll->mclk_fb_div, par); | ||
155 | aty_st_pll_ct(SCLK_FB_DIV, pll->sclk_fb_div, par); | ||
156 | |||
157 | mdelay(15); | ||
158 | init_dll(par); | ||
159 | aty_st_8(GEN_TEST_CNTL+1, 0x00, par); | ||
160 | mdelay(5); | ||
161 | aty_st_8(CRTC_GEN_CNTL+3, 0x04, par); | ||
162 | mdelay(6); | ||
163 | reset_sdram(par); | ||
164 | aty_st_8(CRTC_GEN_CNTL+3, | ||
165 | hsync_enb ? 0x00 : 0x04, par); | ||
166 | |||
167 | aty_st_pll_ct(SPLL_CNTL2, pll->spll_cntl2, par); | ||
168 | aty_st_pll_ct(PLL_GEN_CNTL, pll->pll_gen_cntl, par); | ||
169 | aty_st_pll_ct(PLL_VCLK_CNTL, pll->pll_vclk_cntl, par); | ||
170 | } | ||
171 | |||
172 | int atyfb_xl_init(struct fb_info *info) | ||
173 | { | ||
174 | const struct xl_card_cfg_t * card = &card_cfg[xl_card]; | ||
175 | struct atyfb_par *par = (struct atyfb_par *) info->par; | ||
176 | union aty_pll pll; | ||
177 | int err; | ||
178 | u32 temp; | ||
179 | |||
180 | aty_st_8(CONFIG_STAT0, 0x85, par); | ||
181 | mdelay(10); | ||
182 | |||
183 | /* | ||
184 | * The following needs to be set before the call | ||
185 | * to var_to_pll() below. They'll be re-set again | ||
186 | * to the same values in aty_init(). | ||
187 | */ | ||
188 | par->ref_clk_per = 100000000UL/card->ref_crystal; | ||
189 | par->ram_type = card->mem_type; | ||
190 | info->fix.smem_len = card->mem_size; | ||
191 | if (xl_card == VICTORIA) { | ||
192 | // the MCLK, XCLK are 120MHz on victoria card | ||
193 | par->mclk_per = 1000000/120; | ||
194 | par->xclk_per = 1000000/120; | ||
195 | par->features &= ~M64F_MFB_FORCE_4; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * Calculate mclk and xclk dividers, etc. The passed | ||
200 | * pixclock and bpp values don't matter yet, the vclk | ||
201 | * isn't programmed until later. | ||
202 | */ | ||
203 | if ((err = aty_pll_ct.var_to_pll(info, 39726, 8, &pll))) | ||
204 | return err; | ||
205 | |||
206 | aty_st_pll_ct(LVDS_CNTL0, 0x00, par); | ||
207 | aty_st_pll_ct(DLL2_CNTL, card->dll2_cntl, par); | ||
208 | aty_st_pll_ct(V2PLL_CNTL, 0x10, par); | ||
209 | aty_st_pll_ct(MPLL_CNTL, MPLL_GAIN, par); | ||
210 | aty_st_pll_ct(VPLL_CNTL, VPLL_GAIN, par); | ||
211 | aty_st_pll_ct(PLL_VCLK_CNTL, 0x00, par); | ||
212 | aty_st_pll_ct(VFC_CNTL, 0x1B, par); | ||
213 | aty_st_pll_ct(PLL_REF_DIV, pll.ct.pll_ref_div, par); | ||
214 | aty_st_pll_ct(PLL_EXT_CNTL, pll.ct.pll_ext_cntl, par); | ||
215 | aty_st_pll_ct(SPLL_CNTL2, 0x03, par); | ||
216 | aty_st_pll_ct(PLL_GEN_CNTL, 0x44, par); | ||
217 | |||
218 | reset_clocks(par, &pll.ct, 0); | ||
219 | mdelay(10); | ||
220 | |||
221 | aty_st_pll_ct(VCLK_POST_DIV, 0x03, par); | ||
222 | aty_st_pll_ct(VCLK0_FB_DIV, 0xDA, par); | ||
223 | aty_st_pll_ct(VCLK_POST_DIV, 0x0F, par); | ||
224 | aty_st_pll_ct(VCLK1_FB_DIV, 0xF5, par); | ||
225 | aty_st_pll_ct(VCLK_POST_DIV, 0x3F, par); | ||
226 | aty_st_pll_ct(PLL_EXT_CNTL, 0x40 | pll.ct.pll_ext_cntl, par); | ||
227 | aty_st_pll_ct(VCLK2_FB_DIV, 0x00, par); | ||
228 | aty_st_pll_ct(VCLK_POST_DIV, 0xFF, par); | ||
229 | aty_st_pll_ct(PLL_EXT_CNTL, 0xC0 | pll.ct.pll_ext_cntl, par); | ||
230 | aty_st_pll_ct(VCLK3_FB_DIV, 0x00, par); | ||
231 | |||
232 | aty_st_8(BUS_CNTL, 0x01, par); | ||
233 | aty_st_le32(BUS_CNTL, card->bus_cntl | 0x08000000, par); | ||
234 | |||
235 | aty_st_le32(CRTC_GEN_CNTL, 0x04000200, par); | ||
236 | aty_st_le16(CONFIG_STAT0, 0x0020, par); | ||
237 | aty_st_le32(MEM_CNTL, 0x10151A33, par); | ||
238 | aty_st_le32(EXT_MEM_CNTL, 0xE0000C01, par); | ||
239 | aty_st_le16(CRTC_GEN_CNTL+2, 0x0000, par); | ||
240 | aty_st_le32(DAC_CNTL, card->dac_cntl, par); | ||
241 | aty_st_le16(GEN_TEST_CNTL, 0x0100, par); | ||
242 | aty_st_le32(CUSTOM_MACRO_CNTL, 0x003C0171, par); | ||
243 | aty_st_le32(MEM_BUF_CNTL, 0x00382848, par); | ||
244 | |||
245 | aty_st_le32(HW_DEBUG, card->hw_debug, par); | ||
246 | aty_st_le16(MEM_ADDR_CONFIG, 0x0000, par); | ||
247 | aty_st_le16(GP_IO+2, 0x0000, par); | ||
248 | aty_st_le16(GEN_TEST_CNTL, 0x0000, par); | ||
249 | aty_st_le16(EXT_DAC_REGS+2, 0x0000, par); | ||
250 | aty_st_le32(CRTC_INT_CNTL, 0x00000000, par); | ||
251 | aty_st_le32(TIMER_CONFIG, 0x00000000, par); | ||
252 | aty_st_le32(0xEC, 0x00000000, par); | ||
253 | aty_st_le32(0xFC, 0x00000000, par); | ||
254 | |||
255 | #if defined (CONFIG_FB_ATY_GENERIC_LCD) | ||
256 | { | ||
257 | int i; | ||
258 | |||
259 | for (i = 0; i < ARRAY_SIZE(lcd_tbl); i++) | ||
260 | aty_st_lcd(lcd_tbl[i].lcd_reg, lcd_tbl[i].val, par); | ||
261 | } | ||
262 | #endif | ||
263 | |||
264 | aty_st_le16(CONFIG_STAT0, 0x00A4, par); | ||
265 | mdelay(10); | ||
266 | |||
267 | aty_st_8(BUS_CNTL+1, 0xA0, par); | ||
268 | mdelay(10); | ||
269 | |||
270 | reset_clocks(par, &pll.ct, 1); | ||
271 | mdelay(10); | ||
272 | |||
273 | // something about power management | ||
274 | aty_st_8(LCD_INDEX, 0x08, par); | ||
275 | aty_st_8(LCD_DATA, 0x0A, par); | ||
276 | aty_st_8(LCD_INDEX, 0x08, par); | ||
277 | aty_st_8(LCD_DATA+3, 0x02, par); | ||
278 | aty_st_8(LCD_INDEX, 0x08, par); | ||
279 | aty_st_8(LCD_DATA, 0x0B, par); | ||
280 | mdelay(2); | ||
281 | |||
282 | // enable display requests, enable CRTC | ||
283 | aty_st_8(CRTC_GEN_CNTL+3, 0x02, par); | ||
284 | // disable display | ||
285 | aty_st_8(CRTC_GEN_CNTL, 0x40, par); | ||
286 | // disable display requests, disable CRTC | ||
287 | aty_st_8(CRTC_GEN_CNTL+3, 0x04, par); | ||
288 | mdelay(10); | ||
289 | |||
290 | aty_st_pll_ct(PLL_YCLK_CNTL, 0x25, par); | ||
291 | |||
292 | aty_st_le16(CUSTOM_MACRO_CNTL, 0x0179, par); | ||
293 | aty_st_le16(CUSTOM_MACRO_CNTL+2, 0x005E, par); | ||
294 | aty_st_le16(CUSTOM_MACRO_CNTL+2, card->custom_macro_cntl>>16, par); | ||
295 | aty_st_8(CUSTOM_MACRO_CNTL+1, | ||
296 | (card->custom_macro_cntl>>8) & 0xff, par); | ||
297 | |||
298 | aty_st_le32(MEM_ADDR_CONFIG, card->mem_addr_config, par); | ||
299 | aty_st_le32(MEM_CNTL, card->mem_cntl, par); | ||
300 | aty_st_le32(EXT_MEM_CNTL, card->ext_mem_cntl, par); | ||
301 | |||
302 | aty_st_8(CONFIG_STAT0, 0xA0 | card->mem_type, par); | ||
303 | |||
304 | aty_st_pll_ct(PLL_YCLK_CNTL, 0x01, par); | ||
305 | mdelay(15); | ||
306 | aty_st_pll_ct(PLL_YCLK_CNTL, card->pll_yclk_cntl, par); | ||
307 | mdelay(1); | ||
308 | |||
309 | reset_clocks(par, &pll.ct, 0); | ||
310 | mdelay(50); | ||
311 | reset_clocks(par, &pll.ct, 0); | ||
312 | mdelay(50); | ||
313 | |||
314 | // enable extended register block | ||
315 | aty_st_8(BUS_CNTL+3, 0x7B, par); | ||
316 | mdelay(1); | ||
317 | // disable extended register block | ||
318 | aty_st_8(BUS_CNTL+3, 0x73, par); | ||
319 | |||
320 | aty_st_8(CONFIG_STAT0, 0x80 | card->mem_type, par); | ||
321 | |||
322 | // disable display requests, disable CRTC | ||
323 | aty_st_8(CRTC_GEN_CNTL+3, 0x04, par); | ||
324 | // disable mapping registers in VGA aperture | ||
325 | aty_st_8(CONFIG_CNTL, aty_ld_8(CONFIG_CNTL, par) & ~0x04, par); | ||
326 | mdelay(50); | ||
327 | // enable display requests, enable CRTC | ||
328 | aty_st_8(CRTC_GEN_CNTL+3, 0x02, par); | ||
329 | |||
330 | // make GPIO's 14,15,16 all inputs | ||
331 | aty_st_8(LCD_INDEX, 0x07, par); | ||
332 | aty_st_8(LCD_DATA+3, 0x00, par); | ||
333 | |||
334 | // enable the display | ||
335 | aty_st_8(CRTC_GEN_CNTL, 0x00, par); | ||
336 | mdelay(17); | ||
337 | // reset the memory controller | ||
338 | aty_st_8(GEN_TEST_CNTL+1, 0x02, par); | ||
339 | mdelay(15); | ||
340 | aty_st_8(GEN_TEST_CNTL+1, 0x00, par); | ||
341 | mdelay(30); | ||
342 | |||
343 | // enable extended register block | ||
344 | aty_st_8(BUS_CNTL+3, | ||
345 | (u8)(aty_ld_8(BUS_CNTL+3, par) | 0x08), | ||
346 | par); | ||
347 | // set FIFO size to 512 (PIO) | ||
348 | aty_st_le32(GUI_CNTL, | ||
349 | aty_ld_le32(GUI_CNTL, par) & ~0x3, | ||
350 | par); | ||
351 | |||
352 | // enable CRT and disable lcd | ||
353 | aty_st_8(LCD_INDEX, 0x01, par); | ||
354 | temp = aty_ld_le32(LCD_DATA, par); | ||
355 | temp = (temp | 0x01) & ~0x02; | ||
356 | aty_st_le32(LCD_DATA, temp, par); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index a5129806172f..2406899f1207 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -379,7 +379,7 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle) | |||
379 | * Map video memory in user space. We don't use the generic fb_mmap method mainly | 379 | * Map video memory in user space. We don't use the generic fb_mmap method mainly |
380 | * to allow the use of the TLB streaming flag (CCA=6) | 380 | * to allow the use of the TLB streaming flag (CCA=6) |
381 | */ | 381 | */ |
382 | int au1100fb_fb_mmap(struct fb_info *fbi, struct file *file, struct vm_area_struct *vma) | 382 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
383 | { | 383 | { |
384 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 384 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); |
385 | unsigned int len; | 385 | unsigned int len; |
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c index 6a219b2c77e3..d0aaf450e8c7 100644 --- a/drivers/video/backlight/corgi_bl.c +++ b/drivers/video/backlight/corgi_bl.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/backlight.h> | 20 | #include <linux/backlight.h> |
21 | 21 | ||
22 | #include <asm/arch/sharpsl.h> | 22 | #include <asm/arch/sharpsl.h> |
23 | #include <asm/hardware/sharpsl_pm.h> | ||
23 | 24 | ||
24 | #define CORGI_DEFAULT_INTENSITY 0x1f | 25 | #define CORGI_DEFAULT_INTENSITY 0x1f |
25 | #define CORGI_LIMIT_MASK 0x0b | 26 | #define CORGI_LIMIT_MASK 0x0b |
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 9248fe1fbb1a..c029db4646f6 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
@@ -35,9 +35,8 @@ | |||
35 | 35 | ||
36 | static int bw2_blank(int, struct fb_info *); | 36 | static int bw2_blank(int, struct fb_info *); |
37 | 37 | ||
38 | static int bw2_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 38 | static int bw2_mmap(struct fb_info *, struct vm_area_struct *); |
39 | static int bw2_ioctl(struct inode *, struct file *, unsigned int, | 39 | static int bw2_ioctl(struct fb_info *, unsigned int, unsigned long); |
40 | unsigned long, struct fb_info *); | ||
41 | 40 | ||
42 | /* | 41 | /* |
43 | * Frame buffer operations | 42 | * Frame buffer operations |
@@ -169,7 +168,7 @@ static struct sbus_mmap_map bw2_mmap_map[] = { | |||
169 | { .size = 0 } | 168 | { .size = 0 } |
170 | }; | 169 | }; |
171 | 170 | ||
172 | static int bw2_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 171 | static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) |
173 | { | 172 | { |
174 | struct bw2_par *par = (struct bw2_par *)info->par; | 173 | struct bw2_par *par = (struct bw2_par *)info->par; |
175 | 174 | ||
@@ -181,8 +180,7 @@ static int bw2_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
181 | vma); | 180 | vma); |
182 | } | 181 | } |
183 | 182 | ||
184 | static int bw2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 183 | static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
185 | unsigned long arg, struct fb_info *info) | ||
186 | { | 184 | { |
187 | struct bw2_par *par = (struct bw2_par *) info->par; | 185 | struct bw2_par *par = (struct bw2_par *) info->par; |
188 | 186 | ||
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index a56147102abb..63b6c79c8a0a 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
@@ -31,9 +31,8 @@ | |||
31 | static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned, | 31 | static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned, |
32 | unsigned, struct fb_info *); | 32 | unsigned, struct fb_info *); |
33 | 33 | ||
34 | static int cg14_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 34 | static int cg14_mmap(struct fb_info *, struct vm_area_struct *); |
35 | static int cg14_ioctl(struct inode *, struct file *, unsigned int, | 35 | static int cg14_ioctl(struct fb_info *, unsigned int, unsigned long); |
36 | unsigned long, struct fb_info *); | ||
37 | static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 36 | static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
38 | 37 | ||
39 | /* | 38 | /* |
@@ -268,7 +267,7 @@ static int cg14_setcolreg(unsigned regno, | |||
268 | return 0; | 267 | return 0; |
269 | } | 268 | } |
270 | 269 | ||
271 | static int cg14_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 270 | static int cg14_mmap(struct fb_info *info, struct vm_area_struct *vma) |
272 | { | 271 | { |
273 | struct cg14_par *par = (struct cg14_par *) info->par; | 272 | struct cg14_par *par = (struct cg14_par *) info->par; |
274 | 273 | ||
@@ -277,8 +276,7 @@ static int cg14_mmap(struct fb_info *info, struct file *file, struct vm_area_str | |||
277 | par->iospace, vma); | 276 | par->iospace, vma); |
278 | } | 277 | } |
279 | 278 | ||
280 | static int cg14_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 279 | static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
281 | unsigned long arg, struct fb_info *info) | ||
282 | { | 280 | { |
283 | struct cg14_par *par = (struct cg14_par *) info->par; | 281 | struct cg14_par *par = (struct cg14_par *) info->par; |
284 | struct cg14_regs __iomem *regs = par->regs; | 282 | struct cg14_regs __iomem *regs = par->regs; |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 9fcd89608ed7..3de6e1b5ab2f 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
@@ -33,9 +33,8 @@ static int cg3_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
33 | unsigned, struct fb_info *); | 33 | unsigned, struct fb_info *); |
34 | static int cg3_blank(int, struct fb_info *); | 34 | static int cg3_blank(int, struct fb_info *); |
35 | 35 | ||
36 | static int cg3_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 36 | static int cg3_mmap(struct fb_info *, struct vm_area_struct *); |
37 | static int cg3_ioctl(struct inode *, struct file *, unsigned int, | 37 | static int cg3_ioctl(struct fb_info *, unsigned int, unsigned long); |
38 | unsigned long, struct fb_info *); | ||
39 | 38 | ||
40 | /* | 39 | /* |
41 | * Frame buffer operations | 40 | * Frame buffer operations |
@@ -230,7 +229,7 @@ static struct sbus_mmap_map cg3_mmap_map[] = { | |||
230 | { .size = 0 } | 229 | { .size = 0 } |
231 | }; | 230 | }; |
232 | 231 | ||
233 | static int cg3_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 232 | static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) |
234 | { | 233 | { |
235 | struct cg3_par *par = (struct cg3_par *)info->par; | 234 | struct cg3_par *par = (struct cg3_par *)info->par; |
236 | 235 | ||
@@ -240,8 +239,7 @@ static int cg3_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
240 | vma); | 239 | vma); |
241 | } | 240 | } |
242 | 241 | ||
243 | static int cg3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 242 | static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
244 | unsigned long arg, struct fb_info *info) | ||
245 | { | 243 | { |
246 | struct cg3_par *par = (struct cg3_par *) info->par; | 244 | struct cg3_par *par = (struct cg3_par *) info->par; |
247 | 245 | ||
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 050835e39aa3..7aab91ead681 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
@@ -36,9 +36,8 @@ static int cg6_blank(int, struct fb_info *); | |||
36 | static void cg6_imageblit(struct fb_info *, const struct fb_image *); | 36 | static void cg6_imageblit(struct fb_info *, const struct fb_image *); |
37 | static void cg6_fillrect(struct fb_info *, const struct fb_fillrect *); | 37 | static void cg6_fillrect(struct fb_info *, const struct fb_fillrect *); |
38 | static int cg6_sync(struct fb_info *); | 38 | static int cg6_sync(struct fb_info *); |
39 | static int cg6_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 39 | static int cg6_mmap(struct fb_info *, struct vm_area_struct *); |
40 | static int cg6_ioctl(struct inode *, struct file *, unsigned int, | 40 | static int cg6_ioctl(struct fb_info *, unsigned int, unsigned long); |
41 | unsigned long, struct fb_info *); | ||
42 | 41 | ||
43 | /* | 42 | /* |
44 | * Frame buffer operations | 43 | * Frame buffer operations |
@@ -524,7 +523,7 @@ static struct sbus_mmap_map cg6_mmap_map[] = { | |||
524 | { .size = 0 } | 523 | { .size = 0 } |
525 | }; | 524 | }; |
526 | 525 | ||
527 | static int cg6_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 526 | static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) |
528 | { | 527 | { |
529 | struct cg6_par *par = (struct cg6_par *)info->par; | 528 | struct cg6_par *par = (struct cg6_par *)info->par; |
530 | 529 | ||
@@ -534,8 +533,7 @@ static int cg6_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
534 | vma); | 533 | vma); |
535 | } | 534 | } |
536 | 535 | ||
537 | static int cg6_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 536 | static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
538 | unsigned long arg, struct fb_info *info) | ||
539 | { | 537 | { |
540 | struct cg6_par *par = (struct cg6_par *) info->par; | 538 | struct cg6_par *par = (struct cg6_par *) info->par; |
541 | 539 | ||
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index a5d09e159cd1..6ee449858a5c 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
@@ -6,7 +6,7 @@ menu "Console display driver support" | |||
6 | 6 | ||
7 | config VGA_CONSOLE | 7 | config VGA_CONSOLE |
8 | bool "VGA text console" if EMBEDDED || !X86 | 8 | bool "VGA text console" if EMBEDDED || !X86 |
9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !ARCH_VERSATILE | 9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE |
10 | default y | 10 | default y |
11 | help | 11 | help |
12 | Saying Y here will allow you to use Linux in text mode through a | 12 | Saying Y here will allow you to use Linux in text mode through a |
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c index e65fc3ef7630..eea422eb1ab5 100644 --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c | |||
@@ -234,14 +234,14 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | static void bit_cursor(struct vc_data *vc, struct fb_info *info, | 237 | static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
238 | struct display *p, int mode, int softback_lines, int fg, int bg) | 238 | int softback_lines, int fg, int bg) |
239 | { | 239 | { |
240 | struct fb_cursor cursor; | 240 | struct fb_cursor cursor; |
241 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 241 | struct fbcon_ops *ops = info->fbcon_par; |
242 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 242 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
243 | int w = (vc->vc_font.width + 7) >> 3, c; | 243 | int w = (vc->vc_font.width + 7) >> 3, c; |
244 | int y = real_y(p, vc->vc_y); | 244 | int y = real_y(ops->p, vc->vc_y); |
245 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 245 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
246 | int err = 1; | 246 | int err = 1; |
247 | char *src; | 247 | char *src; |
@@ -310,7 +310,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, | |||
310 | } | 310 | } |
311 | 311 | ||
312 | if (cursor.set & FB_CUR_SETSIZE || | 312 | if (cursor.set & FB_CUR_SETSIZE || |
313 | vc->vc_cursor_type != p->cursor_shape || | 313 | vc->vc_cursor_type != ops->p->cursor_shape || |
314 | ops->cursor_state.mask == NULL || | 314 | ops->cursor_state.mask == NULL || |
315 | ops->cursor_reset) { | 315 | ops->cursor_reset) { |
316 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); | 316 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); |
@@ -323,10 +323,10 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, | |||
323 | kfree(ops->cursor_state.mask); | 323 | kfree(ops->cursor_state.mask); |
324 | ops->cursor_state.mask = mask; | 324 | ops->cursor_state.mask = mask; |
325 | 325 | ||
326 | p->cursor_shape = vc->vc_cursor_type; | 326 | ops->p->cursor_shape = vc->vc_cursor_type; |
327 | cursor.set |= FB_CUR_SETSHAPE; | 327 | cursor.set |= FB_CUR_SETSHAPE; |
328 | 328 | ||
329 | switch (p->cursor_shape & CUR_HWMASK) { | 329 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
330 | case CUR_NONE: | 330 | case CUR_NONE: |
331 | cur_height = 0; | 331 | cur_height = 0; |
332 | break; | 332 | break; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 3660e51b2612..041d06987861 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -209,13 +209,13 @@ static irqreturn_t fb_vbl_detect(int irq, void *dummy, struct pt_regs *fp) | |||
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION | 211 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION |
212 | static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) | 212 | static inline void fbcon_set_rotation(struct fb_info *info) |
213 | { | 213 | { |
214 | struct fbcon_ops *ops = info->fbcon_par; | 214 | struct fbcon_ops *ops = info->fbcon_par; |
215 | 215 | ||
216 | if (!(info->flags & FBINFO_MISC_TILEBLITTING) && | 216 | if (!(info->flags & FBINFO_MISC_TILEBLITTING) && |
217 | p->con_rotate < 4) | 217 | ops->p->con_rotate < 4) |
218 | ops->rotate = p->con_rotate; | 218 | ops->rotate = ops->p->con_rotate; |
219 | else | 219 | else |
220 | ops->rotate = 0; | 220 | ops->rotate = 0; |
221 | } | 221 | } |
@@ -265,7 +265,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate) | |||
265 | fbcon_set_all_vcs(info); | 265 | fbcon_set_all_vcs(info); |
266 | } | 266 | } |
267 | #else | 267 | #else |
268 | static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) | 268 | static inline void fbcon_set_rotation(struct fb_info *info) |
269 | { | 269 | { |
270 | struct fbcon_ops *ops = info->fbcon_par; | 270 | struct fbcon_ops *ops = info->fbcon_par; |
271 | 271 | ||
@@ -402,7 +402,7 @@ static void fb_flashcursor(void *private) | |||
402 | c = scr_readw((u16 *) vc->vc_pos); | 402 | c = scr_readw((u16 *) vc->vc_pos); |
403 | mode = (!ops->cursor_flash || ops->cursor_state.enable) ? | 403 | mode = (!ops->cursor_flash || ops->cursor_state.enable) ? |
404 | CM_ERASE : CM_DRAW; | 404 | CM_ERASE : CM_DRAW; |
405 | ops->cursor(vc, info, p, mode, softback_lines, get_color(vc, info, c, 1), | 405 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), |
406 | get_color(vc, info, c, 0)); | 406 | get_color(vc, info, c, 0)); |
407 | release_console_sem(); | 407 | release_console_sem(); |
408 | } | 408 | } |
@@ -647,29 +647,27 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, | |||
647 | } | 647 | } |
648 | 648 | ||
649 | #ifdef CONFIG_FB_TILEBLITTING | 649 | #ifdef CONFIG_FB_TILEBLITTING |
650 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info, | 650 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info) |
651 | struct display *p) | ||
652 | { | 651 | { |
653 | struct fbcon_ops *ops = info->fbcon_par; | 652 | struct fbcon_ops *ops = info->fbcon_par; |
654 | 653 | ||
655 | ops->p = (p) ? p : &fb_display[vc->vc_num]; | 654 | ops->p = &fb_display[vc->vc_num]; |
656 | 655 | ||
657 | if ((info->flags & FBINFO_MISC_TILEBLITTING)) | 656 | if ((info->flags & FBINFO_MISC_TILEBLITTING)) |
658 | fbcon_set_tileops(vc, info, p, ops); | 657 | fbcon_set_tileops(vc, info); |
659 | else { | 658 | else { |
660 | fbcon_set_rotation(info, ops->p); | 659 | fbcon_set_rotation(info); |
661 | fbcon_set_bitops(ops); | 660 | fbcon_set_bitops(ops); |
662 | } | 661 | } |
663 | } | 662 | } |
664 | #else | 663 | #else |
665 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info, | 664 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info) |
666 | struct display *p) | ||
667 | { | 665 | { |
668 | struct fbcon_ops *ops = info->fbcon_par; | 666 | struct fbcon_ops *ops = info->fbcon_par; |
669 | 667 | ||
670 | info->flags &= ~FBINFO_MISC_TILEBLITTING; | 668 | info->flags &= ~FBINFO_MISC_TILEBLITTING; |
671 | ops->p = (p) ? p : &fb_display[vc->vc_num]; | 669 | ops->p = &fb_display[vc->vc_num]; |
672 | fbcon_set_rotation(info, ops->p); | 670 | fbcon_set_rotation(info); |
673 | fbcon_set_bitops(ops); | 671 | fbcon_set_bitops(ops); |
674 | } | 672 | } |
675 | #endif /* CONFIG_MISC_TILEBLITTING */ | 673 | #endif /* CONFIG_MISC_TILEBLITTING */ |
@@ -689,15 +687,14 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, | |||
689 | err = -ENODEV; | 687 | err = -ENODEV; |
690 | 688 | ||
691 | if (!err) { | 689 | if (!err) { |
692 | ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL); | 690 | ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); |
693 | if (!ops) | 691 | if (!ops) |
694 | err = -ENOMEM; | 692 | err = -ENOMEM; |
695 | } | 693 | } |
696 | 694 | ||
697 | if (!err) { | 695 | if (!err) { |
698 | memset(ops, 0, sizeof(struct fbcon_ops)); | ||
699 | info->fbcon_par = ops; | 696 | info->fbcon_par = ops; |
700 | set_blitting_type(vc, info, NULL); | 697 | set_blitting_type(vc, info); |
701 | } | 698 | } |
702 | 699 | ||
703 | if (err) { | 700 | if (err) { |
@@ -921,19 +918,18 @@ static const char *fbcon_startup(void) | |||
921 | return NULL; | 918 | return NULL; |
922 | } | 919 | } |
923 | 920 | ||
924 | ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL); | 921 | ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); |
925 | if (!ops) { | 922 | if (!ops) { |
926 | module_put(owner); | 923 | module_put(owner); |
927 | return NULL; | 924 | return NULL; |
928 | } | 925 | } |
929 | 926 | ||
930 | memset(ops, 0, sizeof(struct fbcon_ops)); | ||
931 | ops->currcon = -1; | 927 | ops->currcon = -1; |
932 | ops->graphics = 1; | 928 | ops->graphics = 1; |
933 | ops->cur_rotate = -1; | 929 | ops->cur_rotate = -1; |
934 | info->fbcon_par = ops; | 930 | info->fbcon_par = ops; |
935 | p->con_rotate = rotate; | 931 | p->con_rotate = rotate; |
936 | set_blitting_type(vc, info, NULL); | 932 | set_blitting_type(vc, info); |
937 | 933 | ||
938 | if (info->fix.type != FB_TYPE_TEXT) { | 934 | if (info->fix.type != FB_TYPE_TEXT) { |
939 | if (fbcon_softback_size) { | 935 | if (fbcon_softback_size) { |
@@ -1093,7 +1089,7 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1093 | 1089 | ||
1094 | ops = info->fbcon_par; | 1090 | ops = info->fbcon_par; |
1095 | p->con_rotate = rotate; | 1091 | p->con_rotate = rotate; |
1096 | set_blitting_type(vc, info, NULL); | 1092 | set_blitting_type(vc, info); |
1097 | 1093 | ||
1098 | cols = vc->vc_cols; | 1094 | cols = vc->vc_cols; |
1099 | rows = vc->vc_rows; | 1095 | rows = vc->vc_rows; |
@@ -1110,7 +1106,7 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1110 | * | 1106 | * |
1111 | * We need to do it in fbcon_init() to prevent screen corruption. | 1107 | * We need to do it in fbcon_init() to prevent screen corruption. |
1112 | */ | 1108 | */ |
1113 | if (CON_IS_VISIBLE(vc)) { | 1109 | if (CON_IS_VISIBLE(vc) && vc->vc_mode == KD_TEXT) { |
1114 | if (info->fbops->fb_set_par && | 1110 | if (info->fbops->fb_set_par && |
1115 | !(ops->flags & FBCON_FLAGS_INIT)) | 1111 | !(ops->flags & FBCON_FLAGS_INIT)) |
1116 | info->fbops->fb_set_par(info); | 1112 | info->fbops->fb_set_par(info); |
@@ -1141,9 +1137,9 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1141 | if (vc == svc && softback_buf) | 1137 | if (vc == svc && softback_buf) |
1142 | fbcon_update_softback(vc); | 1138 | fbcon_update_softback(vc); |
1143 | 1139 | ||
1144 | if (ops->rotate_font && ops->rotate_font(info, vc, p)) { | 1140 | if (ops->rotate_font && ops->rotate_font(info, vc)) { |
1145 | ops->rotate = FB_ROTATE_UR; | 1141 | ops->rotate = FB_ROTATE_UR; |
1146 | set_blitting_type(vc, info, p); | 1142 | set_blitting_type(vc, info); |
1147 | } | 1143 | } |
1148 | 1144 | ||
1149 | } | 1145 | } |
@@ -1243,7 +1239,6 @@ static void fbcon_cursor(struct vc_data *vc, int mode) | |||
1243 | { | 1239 | { |
1244 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | 1240 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1245 | struct fbcon_ops *ops = info->fbcon_par; | 1241 | struct fbcon_ops *ops = info->fbcon_par; |
1246 | struct display *p = &fb_display[vc->vc_num]; | ||
1247 | int y; | 1242 | int y; |
1248 | int c = scr_readw((u16 *) vc->vc_pos); | 1243 | int c = scr_readw((u16 *) vc->vc_pos); |
1249 | 1244 | ||
@@ -1260,7 +1255,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode) | |||
1260 | y = 0; | 1255 | y = 0; |
1261 | } | 1256 | } |
1262 | 1257 | ||
1263 | ops->cursor(vc, info, p, mode, y, get_color(vc, info, c, 1), | 1258 | ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1), |
1264 | get_color(vc, info, c, 0)); | 1259 | get_color(vc, info, c, 0)); |
1265 | vbl_cursor_cnt = CURSOR_DRAW_DELAY; | 1260 | vbl_cursor_cnt = CURSOR_DRAW_DELAY; |
1266 | } | 1261 | } |
@@ -1411,16 +1406,13 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) | |||
1411 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | 1406 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1412 | struct fbcon_ops *ops = info->fbcon_par; | 1407 | struct fbcon_ops *ops = info->fbcon_par; |
1413 | struct display *p = &fb_display[vc->vc_num]; | 1408 | struct display *p = &fb_display[vc->vc_num]; |
1414 | int redraw = 0; | ||
1415 | 1409 | ||
1416 | p->yscroll += count; | 1410 | p->yscroll += count; |
1411 | |||
1417 | if (p->yscroll > p->vrows - vc->vc_rows) { | 1412 | if (p->yscroll > p->vrows - vc->vc_rows) { |
1418 | p->yscroll -= p->vrows - vc->vc_rows; | 1413 | p->yscroll -= p->vrows - vc->vc_rows; |
1419 | redraw = 1; | ||
1420 | } | ||
1421 | |||
1422 | if (redraw) | ||
1423 | fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); | 1414 | fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); |
1415 | } | ||
1424 | 1416 | ||
1425 | ops->var.xoffset = 0; | 1417 | ops->var.xoffset = 0; |
1426 | ops->var.yoffset = p->yscroll * vc->vc_font.height; | 1418 | ops->var.yoffset = p->yscroll * vc->vc_font.height; |
@@ -1462,16 +1454,13 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) | |||
1462 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | 1454 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1463 | struct fbcon_ops *ops = info->fbcon_par; | 1455 | struct fbcon_ops *ops = info->fbcon_par; |
1464 | struct display *p = &fb_display[vc->vc_num]; | 1456 | struct display *p = &fb_display[vc->vc_num]; |
1465 | int redraw = 0; | ||
1466 | 1457 | ||
1467 | p->yscroll -= count; | 1458 | p->yscroll -= count; |
1459 | |||
1468 | if (p->yscroll < 0) { | 1460 | if (p->yscroll < 0) { |
1469 | p->yscroll += p->vrows - vc->vc_rows; | 1461 | p->yscroll += p->vrows - vc->vc_rows; |
1470 | redraw = 1; | ||
1471 | } | ||
1472 | |||
1473 | if (redraw) | ||
1474 | fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); | 1462 | fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); |
1463 | } | ||
1475 | 1464 | ||
1476 | ops->var.xoffset = 0; | 1465 | ops->var.xoffset = 0; |
1477 | ops->var.yoffset = p->yscroll * vc->vc_font.height; | 1466 | ops->var.yoffset = p->yscroll * vc->vc_font.height; |
@@ -1968,7 +1957,8 @@ static __inline__ void updatescrollmode(struct display *p, | |||
1968 | divides(ypan, vc->vc_font.height) && vyres > yres; | 1957 | divides(ypan, vc->vc_font.height) && vyres > yres; |
1969 | int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && | 1958 | int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && |
1970 | divides(ywrap, vc->vc_font.height) && | 1959 | divides(ywrap, vc->vc_font.height) && |
1971 | divides(vc->vc_font.height, vyres); | 1960 | divides(vc->vc_font.height, vyres) && |
1961 | divides(vc->vc_font.height, yres); | ||
1972 | int reading_fast = cap & FBINFO_READS_FAST; | 1962 | int reading_fast = cap & FBINFO_READS_FAST; |
1973 | int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && | 1963 | int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && |
1974 | !(cap & FBINFO_HWACCEL_DISABLED); | 1964 | !(cap & FBINFO_HWACCEL_DISABLED); |
@@ -2107,16 +2097,19 @@ static int fbcon_switch(struct vc_data *vc) | |||
2107 | info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { | 2097 | info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { |
2108 | if (info->fbops->fb_set_par) | 2098 | if (info->fbops->fb_set_par) |
2109 | info->fbops->fb_set_par(info); | 2099 | info->fbops->fb_set_par(info); |
2110 | fbcon_del_cursor_timer(old_info); | 2100 | |
2111 | fbcon_add_cursor_timer(info); | 2101 | if (old_info != info) { |
2102 | fbcon_del_cursor_timer(old_info); | ||
2103 | fbcon_add_cursor_timer(info); | ||
2104 | } | ||
2112 | } | 2105 | } |
2113 | 2106 | ||
2114 | set_blitting_type(vc, info, p); | 2107 | set_blitting_type(vc, info); |
2115 | ops->cursor_reset = 1; | 2108 | ops->cursor_reset = 1; |
2116 | 2109 | ||
2117 | if (ops->rotate_font && ops->rotate_font(info, vc, p)) { | 2110 | if (ops->rotate_font && ops->rotate_font(info, vc)) { |
2118 | ops->rotate = FB_ROTATE_UR; | 2111 | ops->rotate = FB_ROTATE_UR; |
2119 | set_blitting_type(vc, info, p); | 2112 | set_blitting_type(vc, info); |
2120 | } | 2113 | } |
2121 | 2114 | ||
2122 | vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); | 2115 | vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); |
@@ -2739,7 +2732,7 @@ static void fbcon_modechanged(struct fb_info *info) | |||
2739 | return; | 2732 | return; |
2740 | 2733 | ||
2741 | p = &fb_display[vc->vc_num]; | 2734 | p = &fb_display[vc->vc_num]; |
2742 | set_blitting_type(vc, info, p); | 2735 | set_blitting_type(vc, info); |
2743 | 2736 | ||
2744 | if (CON_IS_VISIBLE(vc)) { | 2737 | if (CON_IS_VISIBLE(vc)) { |
2745 | var_to_display(p, &info->var, info); | 2738 | var_to_display(p, &info->var, info); |
@@ -2781,7 +2774,7 @@ static void fbcon_set_all_vcs(struct fb_info *info) | |||
2781 | continue; | 2774 | continue; |
2782 | 2775 | ||
2783 | p = &fb_display[vc->vc_num]; | 2776 | p = &fb_display[vc->vc_num]; |
2784 | set_blitting_type(vc, info, p); | 2777 | set_blitting_type(vc, info); |
2785 | var_to_display(p, &info->var, info); | 2778 | var_to_display(p, &info->var, info); |
2786 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); | 2779 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2787 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); | 2780 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
@@ -2806,6 +2799,8 @@ static void fbcon_set_all_vcs(struct fb_info *info) | |||
2806 | fbcon_update_softback(vc); | 2799 | fbcon_update_softback(vc); |
2807 | } | 2800 | } |
2808 | } | 2801 | } |
2802 | |||
2803 | ops->p = &fb_display[ops->currcon]; | ||
2809 | } | 2804 | } |
2810 | 2805 | ||
2811 | static int fbcon_mode_deleted(struct fb_info *info, | 2806 | static int fbcon_mode_deleted(struct fb_info *info, |
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 6892e7ff34de..c38c3d8e7a74 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h | |||
@@ -62,12 +62,10 @@ struct fbcon_ops { | |||
62 | int fg, int bg); | 62 | int fg, int bg); |
63 | void (*clear_margins)(struct vc_data *vc, struct fb_info *info, | 63 | void (*clear_margins)(struct vc_data *vc, struct fb_info *info, |
64 | int bottom_only); | 64 | int bottom_only); |
65 | void (*cursor)(struct vc_data *vc, struct fb_info *info, | 65 | void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode, |
66 | struct display *p, int mode, int softback_lines, | 66 | int softback_lines, int fg, int bg); |
67 | int fg, int bg); | ||
68 | int (*update_start)(struct fb_info *info); | 67 | int (*update_start)(struct fb_info *info); |
69 | int (*rotate_font)(struct fb_info *info, struct vc_data *vc, | 68 | int (*rotate_font)(struct fb_info *info, struct vc_data *vc); |
70 | struct display *p); | ||
71 | struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ | 69 | struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ |
72 | struct timer_list cursor_timer; /* Cursor timer */ | 70 | struct timer_list cursor_timer; /* Cursor timer */ |
73 | struct fb_cursor cursor_state; | 71 | struct fb_cursor cursor_state; |
@@ -173,8 +171,7 @@ struct fbcon_ops { | |||
173 | #define SCROLL_PAN_REDRAW 0x005 | 171 | #define SCROLL_PAN_REDRAW 0x005 |
174 | 172 | ||
175 | #ifdef CONFIG_FB_TILEBLITTING | 173 | #ifdef CONFIG_FB_TILEBLITTING |
176 | extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | 174 | extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info); |
177 | struct display *p, struct fbcon_ops *ops); | ||
178 | #endif | 175 | #endif |
179 | extern void fbcon_set_bitops(struct fbcon_ops *ops); | 176 | extern void fbcon_set_bitops(struct fbcon_ops *ops); |
180 | extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); | 177 | extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); |
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c index 4952b66ae206..990289a69b78 100644 --- a/drivers/video/console/fbcon_ccw.c +++ b/drivers/video/console/fbcon_ccw.c | |||
@@ -219,19 +219,18 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | static void ccw_cursor(struct vc_data *vc, struct fb_info *info, | 222 | static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
223 | struct display *p, int mode, int softback_lines, | 223 | int softback_lines, int fg, int bg) |
224 | int fg, int bg) | ||
225 | { | 224 | { |
226 | struct fb_cursor cursor; | 225 | struct fb_cursor cursor; |
227 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 226 | struct fbcon_ops *ops = info->fbcon_par; |
228 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 227 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
229 | int w = (vc->vc_font.height + 7) >> 3, c; | 228 | int w = (vc->vc_font.height + 7) >> 3, c; |
230 | int y = real_y(p, vc->vc_y); | 229 | int y = real_y(ops->p, vc->vc_y); |
231 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 230 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
232 | int err = 1, dx, dy; | 231 | int err = 1, dx, dy; |
233 | char *src; | 232 | char *src; |
234 | u32 vyres = GETVYRES(p->scrollmode, info); | 233 | u32 vyres = GETVYRES(ops->p->scrollmode, info); |
235 | 234 | ||
236 | if (!ops->fontbuffer) | 235 | if (!ops->fontbuffer) |
237 | return; | 236 | return; |
@@ -303,7 +302,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, | |||
303 | } | 302 | } |
304 | 303 | ||
305 | if (cursor.set & FB_CUR_SETSIZE || | 304 | if (cursor.set & FB_CUR_SETSIZE || |
306 | vc->vc_cursor_type != p->cursor_shape || | 305 | vc->vc_cursor_type != ops->p->cursor_shape || |
307 | ops->cursor_state.mask == NULL || | 306 | ops->cursor_state.mask == NULL || |
308 | ops->cursor_reset) { | 307 | ops->cursor_reset) { |
309 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); | 308 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); |
@@ -323,10 +322,10 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, | |||
323 | kfree(ops->cursor_state.mask); | 322 | kfree(ops->cursor_state.mask); |
324 | ops->cursor_state.mask = mask; | 323 | ops->cursor_state.mask = mask; |
325 | 324 | ||
326 | p->cursor_shape = vc->vc_cursor_type; | 325 | ops->p->cursor_shape = vc->vc_cursor_type; |
327 | cursor.set |= FB_CUR_SETSHAPE; | 326 | cursor.set |= FB_CUR_SETSHAPE; |
328 | 327 | ||
329 | switch (p->cursor_shape & CUR_HWMASK) { | 328 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
330 | case CUR_NONE: | 329 | case CUR_NONE: |
331 | cur_height = 0; | 330 | cur_height = 0; |
332 | break; | 331 | break; |
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c index 6d92b8456206..d44c5fa515fb 100644 --- a/drivers/video/console/fbcon_cw.c +++ b/drivers/video/console/fbcon_cw.c | |||
@@ -203,19 +203,18 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | static void cw_cursor(struct vc_data *vc, struct fb_info *info, | 206 | static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
207 | struct display *p, int mode, int softback_lines, | 207 | int softback_lines, int fg, int bg) |
208 | int fg, int bg) | ||
209 | { | 208 | { |
210 | struct fb_cursor cursor; | 209 | struct fb_cursor cursor; |
211 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 210 | struct fbcon_ops *ops = info->fbcon_par; |
212 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 211 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
213 | int w = (vc->vc_font.height + 7) >> 3, c; | 212 | int w = (vc->vc_font.height + 7) >> 3, c; |
214 | int y = real_y(p, vc->vc_y); | 213 | int y = real_y(ops->p, vc->vc_y); |
215 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 214 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
216 | int err = 1, dx, dy; | 215 | int err = 1, dx, dy; |
217 | char *src; | 216 | char *src; |
218 | u32 vxres = GETVXRES(p->scrollmode, info); | 217 | u32 vxres = GETVXRES(ops->p->scrollmode, info); |
219 | 218 | ||
220 | if (!ops->fontbuffer) | 219 | if (!ops->fontbuffer) |
221 | return; | 220 | return; |
@@ -287,7 +286,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, | |||
287 | } | 286 | } |
288 | 287 | ||
289 | if (cursor.set & FB_CUR_SETSIZE || | 288 | if (cursor.set & FB_CUR_SETSIZE || |
290 | vc->vc_cursor_type != p->cursor_shape || | 289 | vc->vc_cursor_type != ops->p->cursor_shape || |
291 | ops->cursor_state.mask == NULL || | 290 | ops->cursor_state.mask == NULL || |
292 | ops->cursor_reset) { | 291 | ops->cursor_reset) { |
293 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); | 292 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); |
@@ -307,10 +306,10 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, | |||
307 | kfree(ops->cursor_state.mask); | 306 | kfree(ops->cursor_state.mask); |
308 | ops->cursor_state.mask = mask; | 307 | ops->cursor_state.mask = mask; |
309 | 308 | ||
310 | p->cursor_shape = vc->vc_cursor_type; | 309 | ops->p->cursor_shape = vc->vc_cursor_type; |
311 | cursor.set |= FB_CUR_SETSHAPE; | 310 | cursor.set |= FB_CUR_SETSHAPE; |
312 | 311 | ||
313 | switch (p->cursor_shape & CUR_HWMASK) { | 312 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
314 | case CUR_NONE: | 313 | case CUR_NONE: |
315 | cur_height = 0; | 314 | cur_height = 0; |
316 | break; | 315 | break; |
diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c index ec0dd8fe241c..2dc091fbd5c9 100644 --- a/drivers/video/console/fbcon_rotate.c +++ b/drivers/video/console/fbcon_rotate.c | |||
@@ -18,8 +18,7 @@ | |||
18 | #include "fbcon.h" | 18 | #include "fbcon.h" |
19 | #include "fbcon_rotate.h" | 19 | #include "fbcon_rotate.h" |
20 | 20 | ||
21 | static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc, | 21 | static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc) |
22 | struct display *p) | ||
23 | { | 22 | { |
24 | struct fbcon_ops *ops = info->fbcon_par; | 23 | struct fbcon_ops *ops = info->fbcon_par; |
25 | int len, err = 0; | 24 | int len, err = 0; |
@@ -28,12 +27,12 @@ static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc, | |||
28 | u8 *dst; | 27 | u8 *dst; |
29 | 28 | ||
30 | if (vc->vc_font.data == ops->fontdata && | 29 | if (vc->vc_font.data == ops->fontdata && |
31 | p->con_rotate == ops->cur_rotate) | 30 | ops->p->con_rotate == ops->cur_rotate) |
32 | goto finished; | 31 | goto finished; |
33 | 32 | ||
34 | src = ops->fontdata = vc->vc_font.data; | 33 | src = ops->fontdata = vc->vc_font.data; |
35 | ops->cur_rotate = p->con_rotate; | 34 | ops->cur_rotate = ops->p->con_rotate; |
36 | len = (!p->userfont) ? 256 : FNTCHARCNT(src); | 35 | len = (!ops->p->userfont) ? 256 : FNTCHARCNT(src); |
37 | s_cellsize = ((vc->vc_font.width + 7)/8) * | 36 | s_cellsize = ((vc->vc_font.width + 7)/8) * |
38 | vc->vc_font.height; | 37 | vc->vc_font.height; |
39 | d_cellsize = s_cellsize; | 38 | d_cellsize = s_cellsize; |
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index 1b8f92fdc6a8..75be5ce53dc5 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h | |||
@@ -11,8 +11,6 @@ | |||
11 | #ifndef _FBCON_ROTATE_H | 11 | #ifndef _FBCON_ROTATE_H |
12 | #define _FBCON_ROTATE_H | 12 | #define _FBCON_ROTATE_H |
13 | 13 | ||
14 | #define FNTCHARCNT(fd) (((int *)(fd))[-3]) | ||
15 | |||
16 | #define GETVYRES(s,i) ({ \ | 14 | #define GETVYRES(s,i) ({ \ |
17 | (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ | 15 | (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ |
18 | (i)->var.yres : (i)->var.yres_virtual; }) | 16 | (i)->var.yres : (i)->var.yres_virtual; }) |
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c index 9dd059e8b645..f56ed068a5bc 100644 --- a/drivers/video/console/fbcon_ud.c +++ b/drivers/video/console/fbcon_ud.c | |||
@@ -249,20 +249,19 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | static void ud_cursor(struct vc_data *vc, struct fb_info *info, | 252 | static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
253 | struct display *p, int mode, int softback_lines, | 253 | int softback_lines, int fg, int bg) |
254 | int fg, int bg) | ||
255 | { | 254 | { |
256 | struct fb_cursor cursor; | 255 | struct fb_cursor cursor; |
257 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 256 | struct fbcon_ops *ops = info->fbcon_par; |
258 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 257 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
259 | int w = (vc->vc_font.width + 7) >> 3, c; | 258 | int w = (vc->vc_font.width + 7) >> 3, c; |
260 | int y = real_y(p, vc->vc_y); | 259 | int y = real_y(ops->p, vc->vc_y); |
261 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 260 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
262 | int err = 1, dx, dy; | 261 | int err = 1, dx, dy; |
263 | char *src; | 262 | char *src; |
264 | u32 vyres = GETVYRES(p->scrollmode, info); | 263 | u32 vyres = GETVYRES(ops->p->scrollmode, info); |
265 | u32 vxres = GETVXRES(p->scrollmode, info); | 264 | u32 vxres = GETVXRES(ops->p->scrollmode, info); |
266 | 265 | ||
267 | if (!ops->fontbuffer) | 266 | if (!ops->fontbuffer) |
268 | return; | 267 | return; |
@@ -334,7 +333,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, | |||
334 | } | 333 | } |
335 | 334 | ||
336 | if (cursor.set & FB_CUR_SETSIZE || | 335 | if (cursor.set & FB_CUR_SETSIZE || |
337 | vc->vc_cursor_type != p->cursor_shape || | 336 | vc->vc_cursor_type != ops->p->cursor_shape || |
338 | ops->cursor_state.mask == NULL || | 337 | ops->cursor_state.mask == NULL || |
339 | ops->cursor_reset) { | 338 | ops->cursor_reset) { |
340 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); | 339 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); |
@@ -347,10 +346,10 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, | |||
347 | kfree(ops->cursor_state.mask); | 346 | kfree(ops->cursor_state.mask); |
348 | ops->cursor_state.mask = mask; | 347 | ops->cursor_state.mask = mask; |
349 | 348 | ||
350 | p->cursor_shape = vc->vc_cursor_type; | 349 | ops->p->cursor_shape = vc->vc_cursor_type; |
351 | cursor.set |= FB_CUR_SETSHAPE; | 350 | cursor.set |= FB_CUR_SETSHAPE; |
352 | 351 | ||
353 | switch (p->cursor_shape & CUR_HWMASK) { | 352 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
354 | case CUR_NONE: | 353 | case CUR_NONE: |
355 | cur_height = 0; | 354 | cur_height = 0; |
356 | break; | 355 | break; |
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c index 8529bf08db28..3957fc7523e2 100644 --- a/drivers/video/console/softcursor.c +++ b/drivers/video/console/softcursor.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | 19 | ||
20 | #include "fbcon.h" | ||
21 | |||
20 | int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) | 22 | int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) |
21 | { | 23 | { |
22 | unsigned int scan_align = info->pixmap.scan_align - 1; | 24 | unsigned int scan_align = info->pixmap.scan_align - 1; |
diff --git a/drivers/video/console/tileblit.c b/drivers/video/console/tileblit.c index cb25324a5635..153352ca9461 100644 --- a/drivers/video/console/tileblit.c +++ b/drivers/video/console/tileblit.c | |||
@@ -80,9 +80,8 @@ static void tile_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | static void tile_cursor(struct vc_data *vc, struct fb_info *info, | 83 | static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
84 | struct display *p, int mode, int softback_lines, | 84 | int softback_lines, int fg, int bg) |
85 | int fg, int bg) | ||
86 | { | 85 | { |
87 | struct fb_tilecursor cursor; | 86 | struct fb_tilecursor cursor; |
88 | int use_sw = (vc->vc_cursor_type & 0x01); | 87 | int use_sw = (vc->vc_cursor_type & 0x01); |
@@ -130,10 +129,10 @@ static int tile_update_start(struct fb_info *info) | |||
130 | return err; | 129 | return err; |
131 | } | 130 | } |
132 | 131 | ||
133 | void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | 132 | void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info) |
134 | struct display *p, struct fbcon_ops *ops) | ||
135 | { | 133 | { |
136 | struct fb_tilemap map; | 134 | struct fb_tilemap map; |
135 | struct fbcon_ops *ops = info->fbcon_par; | ||
137 | 136 | ||
138 | ops->bmove = tile_bmove; | 137 | ops->bmove = tile_bmove; |
139 | ops->clear = tile_clear; | 138 | ops->clear = tile_clear; |
@@ -142,13 +141,13 @@ void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | |||
142 | ops->cursor = tile_cursor; | 141 | ops->cursor = tile_cursor; |
143 | ops->update_start = tile_update_start; | 142 | ops->update_start = tile_update_start; |
144 | 143 | ||
145 | if (p) { | 144 | if (ops->p) { |
146 | map.width = vc->vc_font.width; | 145 | map.width = vc->vc_font.width; |
147 | map.height = vc->vc_font.height; | 146 | map.height = vc->vc_font.height; |
148 | map.depth = 1; | 147 | map.depth = 1; |
149 | map.length = (p->userfont) ? | 148 | map.length = (ops->p->userfont) ? |
150 | FNTCHARCNT(p->fontdata) : 256; | 149 | FNTCHARCNT(ops->p->fontdata) : 256; |
151 | map.data = p->fontdata; | 150 | map.data = ops->p->fontdata; |
152 | info->tileops->fb_settile(info, &map); | 151 | info->tileops->fb_settile(info, &map); |
153 | } | 152 | } |
154 | } | 153 | } |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 167de397e4b4..12d9329d1408 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -56,6 +56,8 @@ | |||
56 | static DEFINE_SPINLOCK(vga_lock); | 56 | static DEFINE_SPINLOCK(vga_lock); |
57 | static int cursor_size_lastfrom; | 57 | static int cursor_size_lastfrom; |
58 | static int cursor_size_lastto; | 58 | static int cursor_size_lastto; |
59 | static u32 vgacon_xres; | ||
60 | static u32 vgacon_yres; | ||
59 | static struct vgastate state; | 61 | static struct vgastate state; |
60 | 62 | ||
61 | #define BLANK 0x0020 | 63 | #define BLANK 0x0020 |
@@ -69,7 +71,7 @@ static struct vgastate state; | |||
69 | * appear. | 71 | * appear. |
70 | */ | 72 | */ |
71 | #undef TRIDENT_GLITCH | 73 | #undef TRIDENT_GLITCH |
72 | 74 | #define VGA_FONTWIDTH 8 /* VGA does not support fontwidths != 8 */ | |
73 | /* | 75 | /* |
74 | * Interface used by the world | 76 | * Interface used by the world |
75 | */ | 77 | */ |
@@ -325,6 +327,10 @@ static const char __init *vgacon_startup(void) | |||
325 | vga_scan_lines = | 327 | vga_scan_lines = |
326 | vga_video_font_height * vga_video_num_lines; | 328 | vga_video_font_height * vga_video_num_lines; |
327 | } | 329 | } |
330 | |||
331 | vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH; | ||
332 | vgacon_yres = vga_scan_lines; | ||
333 | |||
328 | return display_desc; | 334 | return display_desc; |
329 | } | 335 | } |
330 | 336 | ||
@@ -503,10 +509,18 @@ static int vgacon_doresize(struct vc_data *c, | |||
503 | { | 509 | { |
504 | unsigned long flags; | 510 | unsigned long flags; |
505 | unsigned int scanlines = height * c->vc_font.height; | 511 | unsigned int scanlines = height * c->vc_font.height; |
506 | u8 scanlines_lo, r7, vsync_end, mode; | 512 | u8 scanlines_lo, r7, vsync_end, mode, max_scan; |
507 | 513 | ||
508 | spin_lock_irqsave(&vga_lock, flags); | 514 | spin_lock_irqsave(&vga_lock, flags); |
509 | 515 | ||
516 | outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); | ||
517 | max_scan = inb_p(vga_video_port_val); | ||
518 | |||
519 | if (max_scan & 0x80) | ||
520 | scanlines <<= 1; | ||
521 | |||
522 | vgacon_xres = width * VGA_FONTWIDTH; | ||
523 | vgacon_yres = height * c->vc_font.height; | ||
510 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); | 524 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); |
511 | mode = inb_p(vga_video_port_val); | 525 | mode = inb_p(vga_video_port_val); |
512 | 526 | ||
@@ -551,6 +565,10 @@ static int vgacon_doresize(struct vc_data *c, | |||
551 | 565 | ||
552 | static int vgacon_switch(struct vc_data *c) | 566 | static int vgacon_switch(struct vc_data *c) |
553 | { | 567 | { |
568 | int x = c->vc_cols * VGA_FONTWIDTH; | ||
569 | int y = c->vc_rows * c->vc_font.height; | ||
570 | int rows = ORIG_VIDEO_LINES * vga_default_font_height/ | ||
571 | c->vc_font.height; | ||
554 | /* | 572 | /* |
555 | * We need to save screen size here as it's the only way | 573 | * We need to save screen size here as it's the only way |
556 | * we can spot the screen has been resized and we need to | 574 | * we can spot the screen has been resized and we need to |
@@ -566,10 +584,11 @@ static int vgacon_switch(struct vc_data *c) | |||
566 | scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, | 584 | scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, |
567 | c->vc_screenbuf_size > vga_vram_size ? | 585 | c->vc_screenbuf_size > vga_vram_size ? |
568 | vga_vram_size : c->vc_screenbuf_size); | 586 | vga_vram_size : c->vc_screenbuf_size); |
569 | if (!(vga_video_num_columns % 2) && | 587 | |
570 | vga_video_num_columns <= ORIG_VIDEO_COLS && | 588 | if ((vgacon_xres != x || vgacon_yres != y) && |
571 | vga_video_num_lines <= (ORIG_VIDEO_LINES * | 589 | (!(vga_video_num_columns % 2) && |
572 | vga_default_font_height) / c->vc_font.height) | 590 | vga_video_num_columns <= ORIG_VIDEO_COLS && |
591 | vga_video_num_lines <= rows)) | ||
573 | vgacon_doresize(c, c->vc_cols, c->vc_rows); | 592 | vgacon_doresize(c, c->vc_cols, c->vc_rows); |
574 | } | 593 | } |
575 | 594 | ||
@@ -993,7 +1012,8 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigne | |||
993 | if (vga_video_type < VIDEO_TYPE_EGAM) | 1012 | if (vga_video_type < VIDEO_TYPE_EGAM) |
994 | return -EINVAL; | 1013 | return -EINVAL; |
995 | 1014 | ||
996 | if (font->width != 8 || (charcount != 256 && charcount != 512)) | 1015 | if (font->width != VGA_FONTWIDTH || |
1016 | (charcount != 256 && charcount != 512)) | ||
997 | return -EINVAL; | 1017 | return -EINVAL; |
998 | 1018 | ||
999 | rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); | 1019 | rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); |
@@ -1010,7 +1030,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font) | |||
1010 | if (vga_video_type < VIDEO_TYPE_EGAM) | 1030 | if (vga_video_type < VIDEO_TYPE_EGAM) |
1011 | return -EINVAL; | 1031 | return -EINVAL; |
1012 | 1032 | ||
1013 | font->width = 8; | 1033 | font->width = VGA_FONTWIDTH; |
1014 | font->height = c->vc_font.height; | 1034 | font->height = c->vc_font.height; |
1015 | font->charcount = vga_512_chars ? 512 : 256; | 1035 | font->charcount = vga_512_chars ? 512 : 256; |
1016 | if (!font->data) | 1036 | if (!font->data) |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 403d17377f8d..655301a8671c 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -128,17 +128,11 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, | |||
128 | static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 128 | static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
129 | u_int transp, struct fb_info *info); | 129 | u_int transp, struct fb_info *info); |
130 | static int controlfb_blank(int blank_mode, struct fb_info *info); | 130 | static int controlfb_blank(int blank_mode, struct fb_info *info); |
131 | static int controlfb_mmap(struct fb_info *info, struct file *file, | 131 | static int controlfb_mmap(struct fb_info *info, |
132 | struct vm_area_struct *vma); | 132 | struct vm_area_struct *vma); |
133 | static int controlfb_set_par (struct fb_info *info); | 133 | static int controlfb_set_par (struct fb_info *info); |
134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); | 134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); |
135 | 135 | ||
136 | /* | ||
137 | * inititialization | ||
138 | */ | ||
139 | int control_init(void); | ||
140 | void control_setup(char *); | ||
141 | |||
142 | /******************** Prototypes for internal functions **********************/ | 136 | /******************** Prototypes for internal functions **********************/ |
143 | 137 | ||
144 | static void set_control_clock(unsigned char *params); | 138 | static void set_control_clock(unsigned char *params); |
@@ -286,7 +280,7 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, | |||
286 | * for controlfb. | 280 | * for controlfb. |
287 | * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. | 281 | * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. |
288 | */ | 282 | */ |
289 | static int controlfb_mmap(struct fb_info *info, struct file *file, | 283 | static int controlfb_mmap(struct fb_info *info, |
290 | struct vm_area_struct *vma) | 284 | struct vm_area_struct *vma) |
291 | { | 285 | { |
292 | unsigned long off, start; | 286 | unsigned long off, start; |
@@ -550,9 +544,46 @@ static void control_set_hardware(struct fb_info_control *p, struct fb_par_contro | |||
550 | 544 | ||
551 | 545 | ||
552 | /* | 546 | /* |
553 | * Called from fbmem.c for probing & initializing | 547 | * Parse user speficied options (`video=controlfb:') |
554 | */ | 548 | */ |
555 | int __init control_init(void) | 549 | static void __init control_setup(char *options) |
550 | { | ||
551 | char *this_opt; | ||
552 | |||
553 | if (!options || !*options) | ||
554 | return; | ||
555 | |||
556 | while ((this_opt = strsep(&options, ",")) != NULL) { | ||
557 | if (!strncmp(this_opt, "vmode:", 6)) { | ||
558 | int vmode = simple_strtoul(this_opt+6, NULL, 0); | ||
559 | if (vmode > 0 && vmode <= VMODE_MAX && | ||
560 | control_mac_modes[vmode - 1].m[1] >= 0) | ||
561 | default_vmode = vmode; | ||
562 | } else if (!strncmp(this_opt, "cmode:", 6)) { | ||
563 | int depth = simple_strtoul(this_opt+6, NULL, 0); | ||
564 | switch (depth) { | ||
565 | case CMODE_8: | ||
566 | case CMODE_16: | ||
567 | case CMODE_32: | ||
568 | default_cmode = depth; | ||
569 | break; | ||
570 | case 8: | ||
571 | default_cmode = CMODE_8; | ||
572 | break; | ||
573 | case 15: | ||
574 | case 16: | ||
575 | default_cmode = CMODE_16; | ||
576 | break; | ||
577 | case 24: | ||
578 | case 32: | ||
579 | default_cmode = CMODE_32; | ||
580 | break; | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | } | ||
585 | |||
586 | static int __init control_init(void) | ||
556 | { | 587 | { |
557 | struct device_node *dp; | 588 | struct device_node *dp; |
558 | char *option = NULL; | 589 | char *option = NULL; |
@@ -651,15 +682,16 @@ static void __init find_vram_size(struct fb_info_control *p) | |||
651 | static int __init control_of_init(struct device_node *dp) | 682 | static int __init control_of_init(struct device_node *dp) |
652 | { | 683 | { |
653 | struct fb_info_control *p; | 684 | struct fb_info_control *p; |
654 | unsigned long addr; | 685 | struct resource fb_res, reg_res; |
655 | int i; | ||
656 | 686 | ||
657 | if (control_fb) { | 687 | if (control_fb) { |
658 | printk(KERN_ERR "controlfb: only one control is supported\n"); | 688 | printk(KERN_ERR "controlfb: only one control is supported\n"); |
659 | return -ENXIO; | 689 | return -ENXIO; |
660 | } | 690 | } |
661 | if(dp->n_addrs != 2) { | 691 | |
662 | printk(KERN_ERR "expecting 2 address for control (got %d)", dp->n_addrs); | 692 | if (of_pci_address_to_resource(dp, 2, &fb_res) || |
693 | of_pci_address_to_resource(dp, 1, ®_res)) { | ||
694 | printk(KERN_ERR "can't get 2 addresses for control\n"); | ||
663 | return -ENXIO; | 695 | return -ENXIO; |
664 | } | 696 | } |
665 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 697 | p = kmalloc(sizeof(*p), GFP_KERNEL); |
@@ -669,18 +701,12 @@ static int __init control_of_init(struct device_node *dp) | |||
669 | memset(p, 0, sizeof(*p)); | 701 | memset(p, 0, sizeof(*p)); |
670 | 702 | ||
671 | /* Map in frame buffer and registers */ | 703 | /* Map in frame buffer and registers */ |
672 | for (i = 0; i < dp->n_addrs; ++i) { | 704 | p->fb_orig_base = fb_res.start; |
673 | addr = dp->addrs[i].address; | 705 | p->fb_orig_size = fb_res.end - fb_res.start + 1; |
674 | if (dp->addrs[i].size >= 0x800000) { | 706 | /* use the big-endian aperture (??) */ |
675 | p->fb_orig_base = addr; | 707 | p->frame_buffer_phys = fb_res.start + 0x800000; |
676 | p->fb_orig_size = dp->addrs[i].size; | 708 | p->control_regs_phys = reg_res.start; |
677 | /* use the big-endian aperture (??) */ | 709 | p->control_regs_size = reg_res.end - reg_res.start + 1; |
678 | p->frame_buffer_phys = addr + 0x800000; | ||
679 | } else { | ||
680 | p->control_regs_phys = addr; | ||
681 | p->control_regs_size = dp->addrs[i].size; | ||
682 | } | ||
683 | } | ||
684 | 710 | ||
685 | if (!p->fb_orig_base || | 711 | if (!p->fb_orig_base || |
686 | !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { | 712 | !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { |
@@ -1059,43 +1085,3 @@ static void control_cleanup(void) | |||
1059 | } | 1085 | } |
1060 | 1086 | ||
1061 | 1087 | ||
1062 | /* | ||
1063 | * Parse user speficied options (`video=controlfb:') | ||
1064 | */ | ||
1065 | void __init control_setup(char *options) | ||
1066 | { | ||
1067 | char *this_opt; | ||
1068 | |||
1069 | if (!options || !*options) | ||
1070 | return; | ||
1071 | |||
1072 | while ((this_opt = strsep(&options, ",")) != NULL) { | ||
1073 | if (!strncmp(this_opt, "vmode:", 6)) { | ||
1074 | int vmode = simple_strtoul(this_opt+6, NULL, 0); | ||
1075 | if (vmode > 0 && vmode <= VMODE_MAX && | ||
1076 | control_mac_modes[vmode - 1].m[1] >= 0) | ||
1077 | default_vmode = vmode; | ||
1078 | } else if (!strncmp(this_opt, "cmode:", 6)) { | ||
1079 | int depth = simple_strtoul(this_opt+6, NULL, 0); | ||
1080 | switch (depth) { | ||
1081 | case CMODE_8: | ||
1082 | case CMODE_16: | ||
1083 | case CMODE_32: | ||
1084 | default_cmode = depth; | ||
1085 | break; | ||
1086 | case 8: | ||
1087 | default_cmode = CMODE_8; | ||
1088 | break; | ||
1089 | case 15: | ||
1090 | case 16: | ||
1091 | default_cmode = CMODE_16; | ||
1092 | break; | ||
1093 | case 24: | ||
1094 | case 32: | ||
1095 | default_cmode = CMODE_32; | ||
1096 | break; | ||
1097 | } | ||
1098 | } | ||
1099 | } | ||
1100 | } | ||
1101 | |||
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index a9300f930ef2..55a3514157ed 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
51 | 51 | ||
52 | #include <asm/io.h> | 52 | #include <asm/io.h> |
53 | #include <asm/irq.h> | ||
54 | #include <asm/pgtable.h> | 53 | #include <asm/pgtable.h> |
55 | #include <asm/system.h> | 54 | #include <asm/system.h> |
56 | #include <asm/uaccess.h> | 55 | #include <asm/uaccess.h> |
diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c index 03fbe83d71a8..2b972461a030 100644 --- a/drivers/video/cyblafb.c +++ b/drivers/video/cyblafb.c | |||
@@ -7,11 +7,12 @@ | |||
7 | * tridentfb.c by Jani Monoses | 7 | * tridentfb.c by Jani Monoses |
8 | * see files above for further credits | 8 | * see files above for further credits |
9 | * | 9 | * |
10 | * TODO: | ||
11 | * | ||
12 | */ | 10 | */ |
13 | 11 | ||
14 | #define CYBLAFB_DEBUG 0 | 12 | #define CYBLAFB_DEBUG 0 |
13 | #define CYBLAFB_KD_GRAPHICS_QUIRK 1 | ||
14 | |||
15 | #define CYBLAFB_PIXMAPSIZE 8192 | ||
15 | 16 | ||
16 | #include <linux/config.h> | 17 | #include <linux/config.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
@@ -22,7 +23,7 @@ | |||
22 | #include <asm/types.h> | 23 | #include <asm/types.h> |
23 | #include <video/cyblafb.h> | 24 | #include <video/cyblafb.h> |
24 | 25 | ||
25 | #define VERSION "0.54" | 26 | #define VERSION "0.62" |
26 | 27 | ||
27 | struct cyblafb_par { | 28 | struct cyblafb_par { |
28 | u32 pseudo_pal[16]; | 29 | u32 pseudo_pal[16]; |
@@ -32,7 +33,9 @@ struct cyblafb_par { | |||
32 | static struct fb_fix_screeninfo cyblafb_fix __devinitdata = { | 33 | static struct fb_fix_screeninfo cyblafb_fix __devinitdata = { |
33 | .id = "CyBla", | 34 | .id = "CyBla", |
34 | .type = FB_TYPE_PACKED_PIXELS, | 35 | .type = FB_TYPE_PACKED_PIXELS, |
36 | .xpanstep = 1, | ||
35 | .ypanstep = 1, | 37 | .ypanstep = 1, |
38 | .ywrapstep = 1, | ||
36 | .visual = FB_VISUAL_PSEUDOCOLOR, | 39 | .visual = FB_VISUAL_PSEUDOCOLOR, |
37 | .accel = FB_ACCEL_NONE, | 40 | .accel = FB_ACCEL_NONE, |
38 | }; | 41 | }; |
@@ -43,8 +46,9 @@ static int ref __devinitdata = 75; | |||
43 | static int fp __devinitdata; | 46 | static int fp __devinitdata; |
44 | static int crt __devinitdata; | 47 | static int crt __devinitdata; |
45 | static int memsize __devinitdata; | 48 | static int memsize __devinitdata; |
46 | static int vesafb __devinitdata; | ||
47 | 49 | ||
50 | static int basestride; | ||
51 | static int vesafb; | ||
48 | static int nativex; | 52 | static int nativex; |
49 | static int center; | 53 | static int center; |
50 | static int stretch; | 54 | static int stretch; |
@@ -52,26 +56,50 @@ static int pciwb = 1; | |||
52 | static int pcirb = 1; | 56 | static int pcirb = 1; |
53 | static int pciwr = 1; | 57 | static int pciwr = 1; |
54 | static int pcirr = 1; | 58 | static int pcirr = 1; |
59 | static int disabled; | ||
55 | static int verbosity; | 60 | static int verbosity; |
56 | static int displaytype; | 61 | static int displaytype; |
57 | 62 | ||
58 | static void __iomem * io_virt; // iospace virtual memory address | 63 | static void __iomem *io_virt; // iospace virtual memory address |
59 | 64 | ||
60 | module_param(mode,charp,0); | 65 | module_param(mode, charp, 0); |
61 | module_param(bpp,int,0); | 66 | module_param(bpp, int, 0); |
62 | module_param(ref,int,0); | 67 | module_param(ref, int, 0); |
63 | module_param(fp,int,0); | 68 | module_param(fp, int, 0); |
64 | module_param(crt,int,0); | 69 | module_param(crt, int, 0); |
65 | module_param(nativex,int,0); | 70 | module_param(nativex, int, 0); |
66 | module_param(center,int,0); | 71 | module_param(center, int, 0); |
67 | module_param(stretch,int,0); | 72 | module_param(stretch, int, 0); |
68 | module_param(pciwb,int,0); | 73 | module_param(pciwb, int, 0); |
69 | module_param(pcirb,int,0); | 74 | module_param(pcirb, int, 0); |
70 | module_param(pciwr,int,0); | 75 | module_param(pciwr, int, 0); |
71 | module_param(pcirr,int,0); | 76 | module_param(pcirr, int, 0); |
72 | module_param(memsize,int,0); | 77 | module_param(memsize, int, 0); |
73 | module_param(verbosity,int,0); | 78 | module_param(verbosity, int, 0); |
74 | module_param(vesafb,int,0); | 79 | |
80 | //========================================= | ||
81 | // | ||
82 | // Well, we have to fix the upper layers. | ||
83 | // Until this has been done, we work around | ||
84 | // the bugs. | ||
85 | // | ||
86 | //========================================= | ||
87 | |||
88 | #if (CYBLAFB_KD_GRAPHICS_QUIRK && CYBLAFB_DEBUG) | ||
89 | if (disabled) { \ | ||
90 | printk("********\n");\ | ||
91 | dump_stack();\ | ||
92 | return val;\ | ||
93 | } | ||
94 | |||
95 | #elif CYBLAFB_KD_GRAPHICS_QUIRK | ||
96 | #define KD_GRAPHICS_RETURN(val)\ | ||
97 | if (disabled) {\ | ||
98 | return val;\ | ||
99 | } | ||
100 | #else | ||
101 | #define KD_GRAPHICS_RETURN(val) | ||
102 | #endif | ||
75 | 103 | ||
76 | //========================================= | 104 | //========================================= |
77 | // | 105 | // |
@@ -79,10 +107,10 @@ module_param(vesafb,int,0); | |||
79 | // | 107 | // |
80 | //========================================= | 108 | //========================================= |
81 | 109 | ||
82 | #define out8(r,v) writeb(v,io_virt+r) | 110 | #define out8(r, v) writeb(v, io_virt + r) |
83 | #define out32(r,v) writel(v,io_virt+r) | 111 | #define out32(r, v) writel(v, io_virt + r) |
84 | #define in8(r) readb(io_virt+r) | 112 | #define in8(r) readb(io_virt + r) |
85 | #define in32(r) readl(io_virt+r) | 113 | #define in32(r) readl(io_virt + r) |
86 | 114 | ||
87 | //====================================== | 115 | //====================================== |
88 | // | 116 | // |
@@ -90,47 +118,47 @@ module_param(vesafb,int,0); | |||
90 | // | 118 | // |
91 | //====================================== | 119 | //====================================== |
92 | 120 | ||
93 | static inline unsigned char read3X4(int reg) | 121 | static inline u8 read3X4(u32 reg) |
94 | { | 122 | { |
95 | out8(0x3D4,reg); | 123 | out8(0x3D4, reg); |
96 | return in8(0x3D5); | 124 | return in8(0x3D5); |
97 | } | 125 | } |
98 | 126 | ||
99 | static inline unsigned char read3C4(int reg) | 127 | static inline u8 read3C4(u32 reg) |
100 | { | 128 | { |
101 | out8(0x3C4,reg); | 129 | out8(0x3C4, reg); |
102 | return in8(0x3C5); | 130 | return in8(0x3C5); |
103 | } | 131 | } |
104 | 132 | ||
105 | static inline unsigned char read3CE(int reg) | 133 | static inline u8 read3CE(u32 reg) |
106 | { | 134 | { |
107 | out8(0x3CE,reg); | 135 | out8(0x3CE, reg); |
108 | return in8(0x3CF); | 136 | return in8(0x3CF); |
109 | } | 137 | } |
110 | 138 | ||
111 | static inline void write3X4(int reg,unsigned char val) | 139 | static inline void write3X4(u32 reg, u8 val) |
112 | { | 140 | { |
113 | out8(0x3D4,reg); | 141 | out8(0x3D4, reg); |
114 | out8(0x3D5,val); | 142 | out8(0x3D5, val); |
115 | } | 143 | } |
116 | 144 | ||
117 | static inline void write3C4(int reg,unsigned char val) | 145 | static inline void write3C4(u32 reg, u8 val) |
118 | { | 146 | { |
119 | out8(0x3C4,reg); | 147 | out8(0x3C4, reg); |
120 | out8(0x3C5,val); | 148 | out8(0x3C5, val); |
121 | } | 149 | } |
122 | 150 | ||
123 | static inline void write3CE(int reg,unsigned char val) | 151 | static inline void write3CE(u32 reg, u8 val) |
124 | { | 152 | { |
125 | out8(0x3CE,reg); | 153 | out8(0x3CE, reg); |
126 | out8(0x3CF,val); | 154 | out8(0x3CF, val); |
127 | } | 155 | } |
128 | 156 | ||
129 | static inline void write3C0(int reg,unsigned char val) | 157 | static inline void write3C0(u32 reg, u8 val) |
130 | { | 158 | { |
131 | in8(0x3DA); // read to reset index | 159 | in8(0x3DA); // read to reset index |
132 | out8(0x3C0,reg); | 160 | out8(0x3C0, reg); |
133 | out8(0x3C0,val); | 161 | out8(0x3C0, val); |
134 | } | 162 | } |
135 | 163 | ||
136 | //================================================= | 164 | //================================================= |
@@ -139,58 +167,62 @@ static inline void write3C0(int reg,unsigned char val) | |||
139 | // | 167 | // |
140 | //================================================= | 168 | //================================================= |
141 | 169 | ||
142 | static inline void enable_mmio(void) | 170 | static void enable_mmio(void) |
143 | { | 171 | { |
144 | int tmp; | 172 | u8 tmp; |
145 | 173 | ||
146 | outb(0x0B,0x3C4); | 174 | outb(0x0B, 0x3C4); |
147 | inb(0x3C5); // Set NEW mode | 175 | inb(0x3C5); // Set NEW mode |
148 | outb(SR0E,0x3C4); // write enable a lot of extended ports | 176 | outb(SR0E, 0x3C4); // write enable a lot of extended ports |
149 | outb(0x80,0x3C5); | 177 | outb(0x80, 0x3C5); |
150 | 178 | ||
151 | outb(SR11,0x3C4); // write enable those extended ports that | 179 | outb(SR11, 0x3C4); // write enable those extended ports that |
152 | outb(0x87,0x3C5); // are not affected by SR0E_New | 180 | outb(0x87, 0x3C5); // are not affected by SR0E_New |
153 | 181 | ||
154 | outb(CR1E,0x3d4); // clear write protect bit for port 0x3c2 | 182 | outb(CR1E, 0x3d4); // clear write protect bit for port 0x3c2 |
155 | tmp=inb(0x3d5) & 0xBF; | 183 | tmp = inb(0x3d5) & 0xBF; |
156 | outb(CR1E,0x3d4); | 184 | outb(CR1E, 0x3d4); |
157 | outb(tmp,0x3d5); | 185 | outb(tmp, 0x3d5); |
158 | 186 | ||
159 | outb(CR39,0x3D4); | 187 | outb(CR39, 0x3D4); |
160 | outb(inb(0x3D5)|0x01,0x3D5); // Enable mmio, everything else untouched | 188 | outb(inb(0x3D5) | 0x01, 0x3D5); // Enable mmio |
161 | } | 189 | } |
162 | 190 | ||
163 | //================================================= | 191 | //================================================= |
164 | // | 192 | // |
165 | // Set pixel clock VCLK1 | 193 | // Set pixel clock VCLK1 |
166 | // - multipliers set elswhere | 194 | // - multipliers set elswhere |
167 | // - freq in units of 0.01 MHz | 195 | // - freq in units of 0.01 MHz |
196 | // | ||
197 | // Hardware bug: SR18 >= 250 is broken for the | ||
198 | // cyberblade/i1 | ||
168 | // | 199 | // |
169 | //================================================= | 200 | //================================================= |
170 | 201 | ||
171 | static void set_vclk(struct cyblafb_par *par, int freq) | 202 | static void set_vclk(struct cyblafb_par *par, int freq) |
172 | { | 203 | { |
173 | u32 m,n,k; | 204 | u32 m, n, k; |
174 | int f,fi,d,di; | 205 | int f, fi, d, di; |
175 | u8 lo=0,hi=0; | 206 | u8 lo = 0, hi = 0; |
176 | 207 | ||
177 | d = 2000; | 208 | d = 2000; |
178 | k = freq >= 10000 ? 0 : freq >= 5000 ? 1 : freq >= 2500 ? 2 : 3; | 209 | k = freq >= 10000 ? 0 : freq >= 5000 ? 1 : freq >= 2500 ? 2 : 3; |
179 | for(m = 0;m<64;m++) | 210 | for (m = 0; m < 64; m++) |
180 | for(n = 0;n<250;n++) { // max 249 is a hardware limit for cybla/i1 ! | 211 | for (n = 0; n < 250; n++) { |
181 | fi = (int)(((5864727*(n+8))/((m+2)*(1<<k)))>>12); | 212 | fi = (int)(((5864727 * (n + 8)) / |
182 | if ((di = abs(fi - freq)) < d) { | 213 | ((m + 2) * (1 << k))) >> 12); |
183 | d = di; | 214 | if ((di = abs(fi - freq)) < d) { |
184 | f = fi; | 215 | d = di; |
185 | lo = (u8) n; | 216 | f = fi; |
186 | hi = (u8) ((k<<6) | m); | 217 | lo = (u8) n; |
218 | hi = (u8) ((k << 6) | m); | ||
219 | } | ||
187 | } | 220 | } |
188 | } | 221 | write3C4(SR19, hi); |
189 | write3C4(SR19,hi); | 222 | write3C4(SR18, lo); |
190 | write3C4(SR18,lo); | 223 | if (verbosity > 0) |
191 | if(verbosity > 1) | ||
192 | output("pixclock = %d.%02d MHz, k/m/n %x %x %x\n", | 224 | output("pixclock = %d.%02d MHz, k/m/n %x %x %x\n", |
193 | freq/100,freq%100,(hi&0xc0)>>6,hi&0x3f,lo); | 225 | freq / 100, freq % 100, (hi & 0xc0) >> 6, hi & 0x3f, lo); |
194 | } | 226 | } |
195 | 227 | ||
196 | //================================================ | 228 | //================================================ |
@@ -199,83 +231,83 @@ static void set_vclk(struct cyblafb_par *par, int freq) | |||
199 | // | 231 | // |
200 | //================================================ | 232 | //================================================ |
201 | 233 | ||
202 | static void cyblafb_setup_GE(int pitch,int bpp) | 234 | static void cyblafb_setup_GE(int pitch, int bpp) |
203 | { | 235 | { |
204 | int base = (pitch>>3)<<20; | 236 | KD_GRAPHICS_RETURN(); |
205 | 237 | ||
206 | switch (bpp) { | 238 | switch (bpp) { |
207 | case 8: base |= (0<<29); break; | 239 | case 8: |
208 | case 15: base |= (5<<29); break; | 240 | basestride = ((pitch >> 3) << 20) | (0 << 29); |
209 | case 16: base |= (1<<29); break; | 241 | break; |
210 | case 24: | 242 | case 15: |
211 | case 32: base |= (2<<29); break; | 243 | basestride = ((pitch >> 3) << 20) | (5 << 29); |
244 | break; | ||
245 | case 16: | ||
246 | basestride = ((pitch >> 3) << 20) | (1 << 29); | ||
247 | break; | ||
248 | case 24: | ||
249 | case 32: | ||
250 | basestride = ((pitch >> 3) << 20) | (2 << 29); | ||
251 | break; | ||
212 | } | 252 | } |
213 | 253 | ||
214 | write3X4(CR36,0x90); // reset GE | 254 | write3X4(CR36, 0x90); // reset GE |
215 | write3X4(CR36,0x80); // enable GE | 255 | write3X4(CR36, 0x80); // enable GE |
216 | 256 | out32(GE24, 1 << 7); // reset all GE pointers by toggling | |
217 | out32(GE24,1<<7); // reset all GE pointers | 257 | out32(GE24, 0); // d7 of GE24 |
218 | out32(GE24,0); | 258 | write3X4(CR2D, 0x00); // GE Timinigs, no delays |
219 | 259 | out32(GE6C, 0); // Pattern and Style, p 129, ok | |
220 | write3X4(CR2D,0x00); // GE Timinigs, no delays | ||
221 | |||
222 | out32(GEB8,base); // Destination Stride / Buffer Base 0, p 133 | ||
223 | out32(GEBC,base); // Destination Stride / Buffer Base 1, p 133 | ||
224 | out32(GEC0,base); // Destination Stride / Buffer Base 2, p 133 | ||
225 | out32(GEC4,base); // Destination Stride / Buffer Base 3, p 133 | ||
226 | out32(GEC8,base); // Source Stride / Buffer Base 0, p 133 | ||
227 | out32(GECC,base); // Source Stride / Buffer Base 1, p 133 | ||
228 | out32(GED0,base); // Source Stride / Buffer Base 2, p 133 | ||
229 | out32(GED4,base); // Source Stride / Buffer Base 3, p 133 | ||
230 | out32(GE6C,0); // Pattern and Style, p 129, ok | ||
231 | } | 260 | } |
232 | 261 | ||
233 | //===================================================================== | 262 | //===================================================================== |
234 | // | 263 | // |
235 | // Although this is a .fb_sync function that could be enabled in | 264 | // Cyberblade specific syncing |
236 | // cyblafb_ops, we do not include it there. We sync immediately before | 265 | // |
237 | // new GE operations to improve performance. | 266 | // A timeout might be caused by disabled mmio. |
267 | // Cause: | ||
268 | // - bit CR39 & 1 == 0 upon return, X trident driver bug | ||
269 | // - kdm bug (KD_GRAPHICS not set on first switch) | ||
270 | // - kernel design flaw (it believes in the correctness | ||
271 | // of kdm/X | ||
272 | // First we try to sync ignoring that problem, as most of the | ||
273 | // time that will succeed immediately and the enable_mmio() | ||
274 | // would only degrade performance. | ||
238 | // | 275 | // |
239 | //===================================================================== | 276 | //===================================================================== |
240 | 277 | ||
241 | static int cyblafb_sync(struct fb_info *info) | 278 | static int cyblafb_sync(struct fb_info *info) |
242 | { | 279 | { |
243 | int status, i=100000; | 280 | u32 status, i = 100000; |
244 | while( ((status=in32(GE20)) & 0xFA800000) && i != 0) | 281 | |
282 | KD_GRAPHICS_RETURN(0); | ||
283 | |||
284 | while (((status = in32(GE20)) & 0xFe800000) && i != 0) | ||
245 | i--; | 285 | i--; |
246 | 286 | ||
247 | if (i == 0) { | 287 | if (i == 0) { |
248 | // The timeout might be caused by disabled mmio. | ||
249 | // Cause: | ||
250 | // - bit CR39 & 1 == 0 upon return, X trident driver bug | ||
251 | // - kdm bug (KD_GRAPHICS not set on first switch) | ||
252 | // - kernel design flaw (it believes in the correctness | ||
253 | // of kdm/X | ||
254 | // So we make sure that mmio is enabled first ... | ||
255 | enable_mmio(); | 288 | enable_mmio(); |
256 | // show_trace(NULL,&status); | 289 | i = 1000000; |
257 | i=1000000; | 290 | while (((status = in32(GE20)) & 0xFA800000) && i != 0) |
258 | while( ((status=in32(GE20)) & 0xFA800000) && i != 0) | ||
259 | i--; | 291 | i--; |
260 | if (i == 0) { | 292 | if (i == 0) { |
261 | output("GE Timeout, status: %x\n",status); | 293 | output("GE Timeout, status: %x\n", status); |
262 | if(status & 0x80000000) | 294 | if (status & 0x80000000) |
263 | output("Bresenham Engine : Busy\n"); | 295 | output("Bresenham Engine : Busy\n"); |
264 | if(status & 0x40000000) | 296 | if (status & 0x40000000) |
265 | output("Setup Engine : Busy\n"); | 297 | output("Setup Engine : Busy\n"); |
266 | if(status & 0x20000000) | 298 | if (status & 0x20000000) |
267 | output("SP / DPE : Busy\n"); | 299 | output("SP / DPE : Busy\n"); |
268 | if(status & 0x10000000) | 300 | if (status & 0x10000000) |
269 | output("Memory Interface : Busy\n"); | 301 | output("Memory Interface : Busy\n"); |
270 | if(status & 0x08000000) | 302 | if (status & 0x08000000) |
271 | output("Com Lst Proc : Busy\n"); | 303 | output("Com Lst Proc : Busy\n"); |
272 | if(status & 0x04000000) | 304 | if (status & 0x04000000) |
273 | output("Block Write : Busy\n"); | 305 | output("Block Write : Busy\n"); |
274 | if(status & 0x02000000) | 306 | if (status & 0x02000000) |
275 | output("Command Buffer : Full\n"); | 307 | output("Command Buffer : Full\n"); |
276 | if(status & 0x01000000) | 308 | if (status & 0x01000000) |
277 | output("RESERVED : Busy\n"); | 309 | output("RESERVED : Busy\n"); |
278 | if(status & 0x00800000) | 310 | if (status & 0x00800000) |
279 | output("PCI Write Buffer : Busy\n"); | 311 | output("PCI Write Buffer : Busy\n"); |
280 | cyblafb_setup_GE(info->var.xres, | 312 | cyblafb_setup_GE(info->var.xres, |
281 | info->var.bits_per_pixel); | 313 | info->var.bits_per_pixel); |
@@ -291,142 +323,193 @@ static int cyblafb_sync(struct fb_info *info) | |||
291 | // | 323 | // |
292 | //============================== | 324 | //============================== |
293 | 325 | ||
294 | static void cyblafb_fillrect(struct fb_info * info, | 326 | static void cyblafb_fillrect(struct fb_info *info, const struct fb_fillrect *fr) |
295 | const struct fb_fillrect *fr) | ||
296 | { | 327 | { |
297 | int bpp = info->var.bits_per_pixel; | 328 | u32 bpp = info->var.bits_per_pixel, col, desty, height; |
298 | int col; | 329 | |
330 | KD_GRAPHICS_RETURN(); | ||
299 | 331 | ||
300 | switch (bpp) { | 332 | switch (bpp) { |
301 | default: | 333 | default: |
302 | case 8: col = fr->color; | 334 | case 8: |
303 | col |= col <<8; | 335 | col = fr->color; |
304 | col |= col <<16; | 336 | col |= col << 8; |
305 | break; | 337 | col |= col << 16; |
306 | case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; | 338 | break; |
307 | col |= col <<16; | 339 | case 16: |
308 | break; | 340 | col = ((u32 *) (info->pseudo_palette))[fr->color]; |
309 | case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; | 341 | col |= col << 16; |
310 | break; | 342 | break; |
343 | case 32: | ||
344 | col = ((u32 *) (info->pseudo_palette))[fr->color]; | ||
345 | break; | ||
311 | } | 346 | } |
312 | 347 | ||
313 | cyblafb_sync(info); | 348 | desty = fr->dy; |
314 | 349 | height = fr->height; | |
315 | out32(GE60,col); | 350 | while (height) { |
316 | out32(GE48,fr->rop ? 0x66:ROP_S); | 351 | out32(GEB8, basestride | ((desty * info->var.xres_virtual * |
317 | out32(GE44,0x20000000|1<<19|1<<4|2<<2); | 352 | bpp) >> 6)); |
318 | out32(GE08,point(fr->dx,fr->dy)); | 353 | out32(GE60, col); |
319 | out32(GE0C,point(fr->dx+fr->width-1,fr->dy+fr->height-1)); | 354 | out32(GE48, fr->rop ? 0x66 : ROP_S); |
320 | 355 | out32(GE44, 0x20000000 | 1 << 19 | 1 << 4 | 2 << 2); | |
356 | out32(GE08, point(fr->dx, 0)); | ||
357 | out32(GE0C, point(fr->dx + fr->width - 1, | ||
358 | height > 4096 ? 4095 : height - 1)); | ||
359 | if (likely(height <= 4096)) | ||
360 | return; | ||
361 | desty += 4096; | ||
362 | height -= 4096; | ||
363 | } | ||
321 | } | 364 | } |
322 | 365 | ||
323 | //============================== | 366 | //================================================ |
324 | // | 367 | // |
325 | // Cyberblade specific copyarea | 368 | // Cyberblade specific copyarea |
326 | // | 369 | // |
327 | //============================== | 370 | // This function silently assumes that it never |
371 | // will be called with width or height exceeding | ||
372 | // 4096. | ||
373 | // | ||
374 | //================================================ | ||
328 | 375 | ||
329 | static void cyblafb_copyarea(struct fb_info *info, | 376 | static void cyblafb_copyarea(struct fb_info *info, const struct fb_copyarea *ca) |
330 | const struct fb_copyarea *ca) | ||
331 | { | 377 | { |
332 | __u32 s1,s2,d1,d2; | 378 | u32 s1, s2, d1, d2, direction; |
333 | int direction; | 379 | |
380 | KD_GRAPHICS_RETURN(); | ||
381 | |||
382 | s1 = point(ca->sx, 0); | ||
383 | s2 = point(ca->sx + ca->width - 1, ca->height - 1); | ||
384 | d1 = point(ca->dx, 0); | ||
385 | d2 = point(ca->dx + ca->width - 1, ca->height - 1); | ||
334 | 386 | ||
335 | s1 = point(ca->sx,ca->sy); | ||
336 | s2 = point(ca->sx+ca->width-1,ca->sy+ca->height-1); | ||
337 | d1 = point(ca->dx,ca->dy); | ||
338 | d2 = point(ca->dx+ca->width-1,ca->dy+ca->height-1); | ||
339 | if ((ca->sy > ca->dy) || ((ca->sy == ca->dy) && (ca->sx > ca->dx))) | 387 | if ((ca->sy > ca->dy) || ((ca->sy == ca->dy) && (ca->sx > ca->dx))) |
340 | direction = 0; | 388 | direction = 0; |
341 | else | 389 | else |
342 | direction = 2; | 390 | direction = 2; |
343 | 391 | ||
344 | cyblafb_sync(info); | 392 | out32(GEB8, basestride | ((ca->dy * info->var.xres_virtual * |
345 | 393 | info->var.bits_per_pixel) >> 6)); | |
346 | out32(GE44,0xa0000000|1<<19|1<<2|direction); | 394 | out32(GEC8, basestride | ((ca->sy * info->var.xres_virtual * |
347 | out32(GE00,direction?s2:s1); | 395 | info->var.bits_per_pixel) >> 6)); |
348 | out32(GE04,direction?s1:s2); | 396 | out32(GE44, 0xa0000000 | 1 << 19 | 1 << 2 | direction); |
349 | out32(GE08,direction?d2:d1); | 397 | out32(GE00, direction ? s2 : s1); |
350 | out32(GE0C,direction?d1:d2); | 398 | out32(GE04, direction ? s1 : s2); |
351 | 399 | out32(GE08, direction ? d2 : d1); | |
400 | out32(GE0C, direction ? d1 : d2); | ||
352 | } | 401 | } |
353 | 402 | ||
354 | //======================================================================= | 403 | //======================================================================= |
355 | // | 404 | // |
356 | // Cyberblade specific imageblit | 405 | // Cyberblade specific imageblit |
357 | // | 406 | // |
358 | // Accelerated for the most usual case, blitting 1-bit deep character | 407 | // Accelerated for the most usual case, blitting 1 - bit deep |
359 | // character images. Everything else is passed to the generic imageblit. | 408 | // character images. Everything else is passed to the generic imageblit |
409 | // unless it is so insane that it is better to printk an alert. | ||
410 | // | ||
411 | // Hardware bug: _Never_ blit across pixel column 2048, that will lock | ||
412 | // the system. We split those blit requests into three blitting | ||
413 | // operations. | ||
360 | // | 414 | // |
361 | //======================================================================= | 415 | //======================================================================= |
362 | 416 | ||
363 | static void cyblafb_imageblit(struct fb_info *info, | 417 | static void cyblafb_imageblit(struct fb_info *info, |
364 | const struct fb_image *image) | 418 | const struct fb_image *image) |
365 | { | 419 | { |
366 | |||
367 | u32 fgcol, bgcol; | 420 | u32 fgcol, bgcol; |
421 | u32 *pd = (u32 *) image->data; | ||
422 | u32 bpp = info->var.bits_per_pixel; | ||
368 | 423 | ||
369 | int i; | 424 | KD_GRAPHICS_RETURN(); |
370 | int bpp = info->var.bits_per_pixel; | 425 | |
371 | int index = 0; | 426 | // Used only for drawing the penguine (image->depth > 1) |
372 | int index_end=image->height * image->width / 8; | 427 | if (image->depth != 1) { |
373 | int width_dds=image->width / 32; | 428 | cfb_imageblit(info, image); |
374 | int width_dbs=image->width % 32; | 429 | return; |
375 | 430 | } | |
376 | if (image->depth != 1 || bpp < 8 || bpp > 32 || bpp % 8 != 0 || | 431 | // That should never happen, but it would be fatal |
377 | image->width % 8 != 0 || image->width == 0 || image->height == 0) { | 432 | if (image->width == 0 || image->height == 0) { |
378 | cfb_imageblit(info,image); | 433 | output("imageblit: width/height 0 detected\n"); |
379 | return; | 434 | return; |
380 | } | 435 | } |
381 | 436 | ||
382 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | 437 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || |
383 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | 438 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
384 | fgcol = ((u32*)(info->pseudo_palette))[image->fg_color]; | 439 | fgcol = ((u32 *) (info->pseudo_palette))[image->fg_color]; |
385 | bgcol = ((u32*)(info->pseudo_palette))[image->bg_color]; | 440 | bgcol = ((u32 *) (info->pseudo_palette))[image->bg_color]; |
386 | } else { | 441 | } else { |
387 | fgcol = image->fg_color; | 442 | fgcol = image->fg_color; |
388 | bgcol = image->bg_color; | 443 | bgcol = image->bg_color; |
389 | } | 444 | } |
390 | 445 | ||
391 | switch (bpp) { | 446 | switch (bpp) { |
392 | case 8: | 447 | case 8: |
393 | fgcol |= fgcol <<8; fgcol |= fgcol <<16; | 448 | fgcol |= fgcol << 8; |
394 | bgcol |= bgcol <<8; bgcol |= bgcol <<16; | 449 | bgcol |= bgcol << 8; |
395 | break; | 450 | case 16: |
396 | case 16: | 451 | fgcol |= fgcol << 16; |
397 | fgcol |= fgcol <<16; | 452 | bgcol |= bgcol << 16; |
398 | bgcol |= bgcol <<16; | 453 | default: |
399 | break; | 454 | break; |
400 | default: | ||
401 | break; | ||
402 | } | 455 | } |
403 | 456 | ||
404 | cyblafb_sync(info); | 457 | out32(GEB8, basestride | ((image->dy * info->var.xres_virtual * |
405 | 458 | bpp) >> 6)); | |
406 | out32(GE60,fgcol); | 459 | out32(GE60, fgcol); |
407 | out32(GE64,bgcol); | 460 | out32(GE64, bgcol); |
408 | out32(GE44,0xa0000000 | 1<<20 | 1<<19); | 461 | |
409 | out32(GE08,point(image->dx,image->dy)); | 462 | if (!(image->dx < 2048 && (image->dx + image->width - 1) >= 2048)) { |
410 | out32(GE0C,point(image->dx+image->width-1,image->dy+image->height-1)); | 463 | u32 dds = ((image->width + 31) >> 5) * image->height; |
464 | out32(GE44, 0xa0000000 | 1 << 20 | 1 << 19); | ||
465 | out32(GE08, point(image->dx, 0)); | ||
466 | out32(GE0C, point(image->dx + image->width - 1, | ||
467 | image->height - 1)); | ||
468 | while (dds--) | ||
469 | out32(GE9C, *pd++); | ||
470 | } else { | ||
471 | int i, j; | ||
472 | u32 ddstotal = (image->width + 31) >> 5; | ||
473 | u32 ddsleft = (2048 - image->dx + 31) >> 5; | ||
474 | u32 skipleft = ddstotal - ddsleft; | ||
475 | |||
476 | out32(GE44, 0xa0000000 | 1 << 20 | 1 << 19); | ||
477 | out32(GE08, point(image->dx, 0)); | ||
478 | out32(GE0C, point(2048 - 1, image->height - 1)); | ||
479 | for (i = 0; i < image->height; i++) { | ||
480 | for (j = 0; j < ddsleft; j++) | ||
481 | out32(GE9C, *pd++); | ||
482 | pd += skipleft; | ||
483 | } | ||
411 | 484 | ||
412 | while(index < index_end) { | 485 | if (image->dx % 32) { |
413 | const char *p = image->data + index; | 486 | out32(GE44, 0xa0000000 | 1 << 20 | 1 << 19); |
414 | for(i=0;i<width_dds;i++) { | 487 | out32(GE08, point(2048, 0)); |
415 | out32(GE9C,*(u32*)p); | 488 | if (image->width > ddsleft << 5) |
416 | p+=4; | 489 | out32(GE0C, point(image->dx + (ddsleft << 5) - |
417 | index+=4; | 490 | 1, image->height - 1)); |
491 | else | ||
492 | out32(GE0C, point(image->dx + image->width - 1, | ||
493 | image->height - 1)); | ||
494 | pd = ((u32 *) image->data) + ddstotal - skipleft - 1; | ||
495 | for (i = 0; i < image->height; i++) { | ||
496 | out32(GE9C, swab32(swab32(*pd) << ((32 - | ||
497 | (image->dx & 31)) & 31))); | ||
498 | pd += ddstotal; | ||
499 | } | ||
418 | } | 500 | } |
419 | switch(width_dbs) { | 501 | |
420 | case 0: break; | 502 | if (skipleft) { |
421 | case 8: out32(GE9C,*(u8*)p); | 503 | out32(GE44, 0xa0000000 | 1 << 20 | 1 << 19); |
422 | index+=1; | 504 | out32(GE08, point(image->dx + (ddsleft << 5), 0)); |
423 | break; | 505 | out32(GE0C, point(image->dx + image->width - 1, |
424 | case 16: out32(GE9C,*(u16*)p); | 506 | image->height - 1)); |
425 | index+=2; | 507 | pd = (u32 *) image->data; |
426 | break; | 508 | for (i = 0; i < image->height; i++) { |
427 | case 24: out32(GE9C,*(u16*)p | *(u8*)(p+2)<<16); | 509 | pd += ddsleft; |
428 | index+=3; | 510 | for (j = 0; j < skipleft; j++) |
429 | break; | 511 | out32(GE9C, *pd++); |
512 | } | ||
430 | } | 513 | } |
431 | } | 514 | } |
432 | } | 515 | } |
@@ -443,7 +526,6 @@ static int cyblafb_check_var(struct fb_var_screeninfo *var, | |||
443 | struct fb_info *info) | 526 | struct fb_info *info) |
444 | { | 527 | { |
445 | int bpp = var->bits_per_pixel; | 528 | int bpp = var->bits_per_pixel; |
446 | int s,t,maxvyres; | ||
447 | 529 | ||
448 | // | 530 | // |
449 | // we try to support 8, 16, 24 and 32 bpp modes, | 531 | // we try to support 8, 16, 24 and 32 bpp modes, |
@@ -453,9 +535,9 @@ static int cyblafb_check_var(struct fb_var_screeninfo *var, | |||
453 | // (This is what tridentfb does ... will be changed in the future) | 535 | // (This is what tridentfb does ... will be changed in the future) |
454 | // | 536 | // |
455 | // | 537 | // |
456 | if ( bpp % 8 != 0 || bpp < 8 || bpp >32) | 538 | if (bpp % 8 != 0 || bpp < 8 || bpp > 32) |
457 | bpp = 8; | 539 | bpp = 8; |
458 | if (bpp == 24 ) | 540 | if (bpp == 24) |
459 | bpp = var->bits_per_pixel = 32; | 541 | bpp = var->bits_per_pixel = 32; |
460 | 542 | ||
461 | // | 543 | // |
@@ -472,65 +554,93 @@ static int cyblafb_check_var(struct fb_var_screeninfo *var, | |||
472 | return -EINVAL; | 554 | return -EINVAL; |
473 | 555 | ||
474 | // | 556 | // |
475 | // xres != xres_virtual is broken, fail if such an | 557 | // we do not allow vclk to exceed 230 MHz. If the requested |
476 | // unusual mode is requested | 558 | // vclk is too high, we default to 200 MHz |
477 | // | 559 | // |
478 | if (var->xres != var->xres_virtual) | 560 | if ((bpp == 32 ? 200000000 : 100000000) / var->pixclock > 23000) |
479 | return -EINVAL; | 561 | var->pixclock = (bpp == 32 ? 200000000 : 100000000) / 20000; |
480 | 562 | ||
481 | // | 563 | // |
482 | // we do not allow vclk to exceed 230 MHz | 564 | // enforce (h|v)sync_len limits |
483 | // | 565 | // |
484 | if ((bpp==32 ? 200000000 : 100000000) / var->pixclock > 23000) | 566 | var->hsync_len &= ~7; |
485 | return -EINVAL; | 567 | if(var->hsync_len > 248) |
568 | var->hsync_len = 248; | ||
569 | |||
570 | var->vsync_len &= 15; | ||
486 | 571 | ||
487 | // | 572 | // |
488 | // calc max yres_virtual that would fit in memory | 573 | // Enforce horizontal and vertical hardware limits. |
489 | // and max yres_virtual that could be used for scrolling | 574 | // 1600x1200 is mentioned as a maximum, but higher resolutions could |
490 | // and use minimum of the results as maxvyres | 575 | // work with slow refresh, small margins and short sync. |
491 | // | ||
492 | // adjust vyres_virtual to maxvyres if necessary | ||
493 | // fail if requested yres is bigger than maxvyres | ||
494 | // | 576 | // |
495 | s = (0x1fffff / (var->xres * bpp/8)) + var->yres; | 577 | var->xres &= ~7; |
496 | t = info->fix.smem_len / (var->xres * bpp/8); | 578 | |
497 | maxvyres = t < s ? t : s; | 579 | if (((var->xres + var->left_margin + var->right_margin + |
498 | if (maxvyres < var->yres_virtual) | 580 | var->hsync_len) > (bpp == 32 ? 2040 : 4088)) || |
499 | var->yres_virtual=maxvyres; | 581 | ((var->yres + var->upper_margin + var->lower_margin + |
500 | if (maxvyres < var->yres) | 582 | var->vsync_len) > 2047)) |
501 | return -EINVAL; | 583 | return -EINVAL; |
502 | 584 | ||
503 | switch (bpp) { | 585 | if ((var->xres > 1600) || (var->yres > 1200)) |
504 | case 8: | 586 | output("Mode %dx%d exceeds documented limits.\n", |
505 | var->red.offset = 0; | 587 | var->xres, var->yres); |
506 | var->green.offset = 0; | 588 | // |
507 | var->blue.offset = 0; | 589 | // try to be smart about (x|y)res_virtual problems. |
508 | var->red.length = 6; | 590 | // |
509 | var->green.length = 6; | 591 | if (var->xres > var->xres_virtual) |
510 | var->blue.length = 6; | 592 | var->xres_virtual = var->xres; |
511 | break; | 593 | if (var->yres > var->yres_virtual) |
512 | case 16: | 594 | var->yres_virtual = var->yres; |
513 | var->red.offset = 11; | 595 | |
514 | var->green.offset = 5; | 596 | if (bpp == 8 || bpp == 16) { |
515 | var->blue.offset = 0; | 597 | if (var->xres_virtual > 4088) |
516 | var->red.length = 5; | 598 | var->xres_virtual = 4088; |
517 | var->green.length = 6; | 599 | } else { |
518 | var->blue.length = 5; | 600 | if (var->xres_virtual > 2040) |
519 | break; | 601 | var->xres_virtual = 2040; |
520 | case 32: | 602 | } |
521 | var->red.offset = 16; | 603 | var->xres_virtual &= ~7; |
522 | var->green.offset = 8; | 604 | while (var->xres_virtual * var->yres_virtual * bpp / 8 > |
523 | var->blue.offset = 0; | 605 | info->fix.smem_len) { |
524 | var->red.length = 8; | 606 | if (var->yres_virtual > var->yres) |
525 | var->green.length = 8; | 607 | var->yres_virtual--; |
526 | var->blue.length = 8; | 608 | else if (var->xres_virtual > var->xres) |
527 | break; | 609 | var->xres_virtual -= 8; |
528 | default: | 610 | else |
529 | return -EINVAL; | 611 | return -EINVAL; |
530 | } | 612 | } |
531 | 613 | ||
532 | return 0; | 614 | switch (bpp) { |
615 | case 8: | ||
616 | var->red.offset = 0; | ||
617 | var->green.offset = 0; | ||
618 | var->blue.offset = 0; | ||
619 | var->red.length = 6; | ||
620 | var->green.length = 6; | ||
621 | var->blue.length = 6; | ||
622 | break; | ||
623 | case 16: | ||
624 | var->red.offset = 11; | ||
625 | var->green.offset = 5; | ||
626 | var->blue.offset = 0; | ||
627 | var->red.length = 5; | ||
628 | var->green.length = 6; | ||
629 | var->blue.length = 5; | ||
630 | break; | ||
631 | case 32: | ||
632 | var->red.offset = 16; | ||
633 | var->green.offset = 8; | ||
634 | var->blue.offset = 0; | ||
635 | var->red.length = 8; | ||
636 | var->green.length = 8; | ||
637 | var->blue.length = 8; | ||
638 | break; | ||
639 | default: | ||
640 | return -EINVAL; | ||
641 | } | ||
533 | 642 | ||
643 | return 0; | ||
534 | } | 644 | } |
535 | 645 | ||
536 | //===================================================================== | 646 | //===================================================================== |
@@ -543,23 +653,25 @@ static int cyblafb_check_var(struct fb_var_screeninfo *var, | |||
543 | // it, so it is also safe to be used here. BTW: datasheet CR0E on page | 653 | // it, so it is also safe to be used here. BTW: datasheet CR0E on page |
544 | // 90 really is CR1E, the real CRE is documented on page 72. | 654 | // 90 really is CR1E, the real CRE is documented on page 72. |
545 | // | 655 | // |
656 | // BUT: | ||
657 | // | ||
658 | // As of internal version 0.60 we do not use vga panning any longer. | ||
659 | // Vga panning did not allow us the use of all available video memory | ||
660 | // and thus prevented ywrap scrolling. We do use the "right view" | ||
661 | // register now. | ||
662 | // | ||
663 | // | ||
546 | //===================================================================== | 664 | //===================================================================== |
547 | 665 | ||
548 | static int cyblafb_pan_display(struct fb_var_screeninfo *var, | 666 | static int cyblafb_pan_display(struct fb_var_screeninfo *var, |
549 | struct fb_info *info) | 667 | struct fb_info *info) |
550 | { | 668 | { |
551 | unsigned int offset; | 669 | KD_GRAPHICS_RETURN(0); |
552 | 670 | ||
553 | offset=(var->xoffset+(var->yoffset*var->xres))*var->bits_per_pixel/32; | ||
554 | info->var.xoffset = var->xoffset; | 671 | info->var.xoffset = var->xoffset; |
555 | info->var.yoffset = var->yoffset; | 672 | info->var.yoffset = var->yoffset; |
556 | 673 | out32(GE10, 0x80000000 | ((var->xoffset + (var->yoffset * | |
557 | write3X4(CR0D,offset & 0xFF); | 674 | var->xres_virtual)) * var->bits_per_pixel / 32)); |
558 | write3X4(CR0C,(offset & 0xFF00) >> 8); | ||
559 | write3X4(CR1E,(read3X4(CR1E) & 0xDF) | ((offset & 0x10000) >> 11)); | ||
560 | write3X4(CR27,(read3X4(CR27) & 0xF8) | ((offset & 0xE0000) >> 17)); | ||
561 | write3X4(CR2B,(read3X4(CR2B) & 0xDF) | ((offset & 0x100000) >> 15)); | ||
562 | |||
563 | return 0; | 675 | return 0; |
564 | } | 676 | } |
565 | 677 | ||
@@ -578,56 +690,96 @@ static void regdump(struct cyblafb_par *par) | |||
578 | return; | 690 | return; |
579 | 691 | ||
580 | printk("\n"); | 692 | printk("\n"); |
581 | for(i=0; i<=0xff; i++) { | 693 | for (i = 0; i <= 0xff; i++) { |
582 | outb(i,0x3d4); | 694 | outb(i, 0x3d4); |
583 | printk("CR%02x=%02x ",i,inb(0x3d5)); | 695 | printk("CR%02x=%02x ", i, inb(0x3d5)); |
584 | if (i%16==15) | 696 | if (i % 16 == 15) |
585 | printk("\n"); | 697 | printk("\n"); |
586 | } | 698 | } |
587 | 699 | ||
588 | outb(0x30,0x3ce); | 700 | outb(0x30, 0x3ce); |
589 | outb(inb(0x3cf) | 0x40,0x3cf); | 701 | outb(inb(0x3cf) | 0x40, 0x3cf); |
590 | for(i=0; i<=0x1f; i++) { | 702 | for (i = 0; i <= 0x1f; i++) { |
591 | if (i==0 || (i>2 && i<8) || i==0x10 || i==0x11 || i==0x16) { | 703 | if (i == 0 || (i > 2 && i < 8) || i == 0x10 || i == 0x11 |
592 | outb(i,0x3d4); | 704 | || i == 0x16) { |
593 | printk("CR%02x=%02x ",i,inb(0x3d5)); | 705 | outb(i, 0x3d4); |
706 | printk("CR%02x=%02x ", i, inb(0x3d5)); | ||
594 | } else | 707 | } else |
595 | printk("------- "); | 708 | printk("------- "); |
596 | if (i%16==15) | 709 | if (i % 16 == 15) |
597 | printk("\n"); | 710 | printk("\n"); |
598 | } | 711 | } |
599 | outb(0x30,0x3ce); | 712 | outb(0x30, 0x3ce); |
600 | outb(inb(0x3cf) & 0xbf,0x3cf); | 713 | outb(inb(0x3cf) & 0xbf, 0x3cf); |
601 | 714 | ||
602 | printk("\n"); | 715 | printk("\n"); |
603 | for(i=0; i<=0x7f; i++) { | 716 | for (i = 0; i <= 0x7f; i++) { |
604 | outb(i,0x3ce); | 717 | outb(i, 0x3ce); |
605 | printk("GR%02x=%02x ",i,inb(0x3cf)); | 718 | printk("GR%02x=%02x ", i, inb(0x3cf)); |
606 | if (i%16==15) | 719 | if (i % 16 == 15) |
607 | printk("\n"); | 720 | printk("\n"); |
608 | } | 721 | } |
609 | 722 | ||
610 | printk("\n"); | 723 | printk("\n"); |
611 | for(i=0; i<=0xff; i++) { | 724 | for (i = 0; i <= 0xff; i++) { |
612 | outb(i,0x3c4); | 725 | outb(i, 0x3c4); |
613 | printk("SR%02x=%02x ",i,inb(0x3c5)); | 726 | printk("SR%02x=%02x ", i, inb(0x3c5)); |
614 | if (i%16==15) | 727 | if (i % 16 == 15) |
615 | printk("\n"); | 728 | printk("\n"); |
616 | } | 729 | } |
617 | 730 | ||
618 | printk("\n"); | 731 | printk("\n"); |
619 | for(i=0; i <= 0x1F; i++) { | 732 | for (i = 0; i <= 0x1F; i++) { |
620 | inb(0x3da); // next access is index! | 733 | inb(0x3da); // next access is index! |
621 | outb(i,0x3c0); | 734 | outb(i, 0x3c0); |
622 | printk("AR%02x=%02x ",i,inb(0x3c1)); | 735 | printk("AR%02x=%02x ", i, inb(0x3c1)); |
623 | if (i%16==15) | 736 | if (i % 16 == 15) |
624 | printk("\n"); | 737 | printk("\n"); |
625 | } | 738 | } |
626 | printk("\n"); | 739 | printk("\n"); |
627 | 740 | ||
628 | inb(0x3DA); // reset internal flag to 3c0 index | 741 | inb(0x3DA); // reset internal flag to 3c0 index |
629 | outb(0x20,0x3C0); // enable attr | 742 | outb(0x20, 0x3C0); // enable attr |
743 | |||
744 | return; | ||
745 | } | ||
746 | |||
747 | //======================================================================= | ||
748 | // | ||
749 | // Save State | ||
750 | // | ||
751 | // This function is called while a switch to KD_TEXT is in progress, | ||
752 | // before any of the other functions are called. | ||
753 | // | ||
754 | //======================================================================= | ||
630 | 755 | ||
756 | static void cyblafb_save_state(struct fb_info *info) | ||
757 | { | ||
758 | struct cyblafb_par *par = info->par; | ||
759 | if (verbosity > 0) | ||
760 | output("Switching to KD_TEXT\n"); | ||
761 | disabled = 0; | ||
762 | regdump(par); | ||
763 | enable_mmio(); | ||
764 | return; | ||
765 | } | ||
766 | |||
767 | //======================================================================= | ||
768 | // | ||
769 | // Restore State | ||
770 | // | ||
771 | // This function is called while a switch to KD_GRAPHICS is in progress, | ||
772 | // We have to turn on vga style panning registers again because the | ||
773 | // trident driver of X does not know about GE10. | ||
774 | // | ||
775 | //======================================================================= | ||
776 | |||
777 | static void cyblafb_restore_state(struct fb_info *info) | ||
778 | { | ||
779 | if (verbosity > 0) | ||
780 | output("Switching to KD_GRAPHICS\n"); | ||
781 | out32(GE10, 0); | ||
782 | disabled = 1; | ||
631 | return; | 783 | return; |
632 | } | 784 | } |
633 | 785 | ||
@@ -640,32 +792,34 @@ static void regdump(struct cyblafb_par *par) | |||
640 | static int cyblafb_set_par(struct fb_info *info) | 792 | static int cyblafb_set_par(struct fb_info *info) |
641 | { | 793 | { |
642 | struct cyblafb_par *par = info->par; | 794 | struct cyblafb_par *par = info->par; |
643 | u32 | 795 | u32 htotal, hdispend, hsyncstart, hsyncend, hblankstart, |
644 | htotal,hdispend,hsyncstart,hsyncend,hblankstart,hblankend,preendfetch, | 796 | hblankend, preendfetch, vtotal, vdispend, vsyncstart, |
645 | vtotal,vdispend,vsyncstart,vsyncend,vblankstart,vblankend; | 797 | vsyncend, vblankstart, vblankend; |
646 | struct fb_var_screeninfo *var = &info->var; | 798 | struct fb_var_screeninfo *var = &info->var; |
647 | int bpp = var->bits_per_pixel; | 799 | int bpp = var->bits_per_pixel; |
648 | int i; | 800 | int i; |
649 | 801 | ||
802 | KD_GRAPHICS_RETURN(0); | ||
803 | |||
650 | if (verbosity > 0) | 804 | if (verbosity > 0) |
651 | output("Switching to new mode: " | 805 | output("Switching to new mode: " |
652 | "fbset -g %d %d %d %d %d -t %d %d %d %d %d %d %d\n", | 806 | "fbset -g %d %d %d %d %d -t %d %d %d %d %d %d %d\n", |
653 | var->xres,var->yres,var->xres_virtual, | 807 | var->xres, var->yres, var->xres_virtual, |
654 | var->yres_virtual,var->bits_per_pixel,var->pixclock, | 808 | var->yres_virtual, var->bits_per_pixel, var->pixclock, |
655 | var->left_margin,var->right_margin,var->upper_margin, | 809 | var->left_margin, var->right_margin, var->upper_margin, |
656 | var->lower_margin,var->hsync_len,var->vsync_len); | 810 | var->lower_margin, var->hsync_len, var->vsync_len); |
657 | 811 | ||
658 | htotal = (var->xres + var->left_margin + var->right_margin + | 812 | htotal = (var->xres + var->left_margin + var->right_margin + |
659 | var->hsync_len) / 8 - 5; | 813 | var->hsync_len) / 8 - 5; |
660 | hdispend = var->xres/8 - 1; | 814 | hdispend = var->xres / 8 - 1; |
661 | hsyncstart = (var->xres + var->right_margin)/8; | 815 | hsyncstart = (var->xres + var->right_margin) / 8; |
662 | hsyncend = var->hsync_len/8; | 816 | hsyncend = var->hsync_len / 8; |
663 | hblankstart = hdispend + 1; | 817 | hblankstart = hdispend + 1; |
664 | hblankend = htotal + 3; // should be htotal + 5, bios does it this way | 818 | hblankend = htotal + 3; // should be htotal + 5, bios does it this way |
665 | preendfetch = ((var->xres >> 3) + 1) * ((bpp+1) >> 3); | 819 | preendfetch = ((var->xres >> 3) + 1) * ((bpp + 1) >> 3); |
666 | 820 | ||
667 | vtotal = var->yres + var->upper_margin + var->lower_margin + | 821 | vtotal = var->yres + var->upper_margin + var->lower_margin + |
668 | var->vsync_len - 2; | 822 | var->vsync_len - 2; |
669 | vdispend = var->yres - 1; | 823 | vdispend = var->yres - 1; |
670 | vsyncstart = var->yres + var->lower_margin; | 824 | vsyncstart = var->yres + var->lower_margin; |
671 | vblankstart = var->yres; | 825 | vblankstart = var->yres; |
@@ -674,101 +828,99 @@ static int cyblafb_set_par(struct fb_info *info) | |||
674 | 828 | ||
675 | enable_mmio(); // necessary! ... check X ... | 829 | enable_mmio(); // necessary! ... check X ... |
676 | 830 | ||
677 | write3X4(CR11,read3X4(CR11) & 0x7F); // unlock cr00 .. cr07 | 831 | write3X4(CR11, read3X4(CR11) & 0x7F); // unlock cr00 .. cr07 |
678 | 832 | ||
679 | write3CE(GR30,8); | 833 | write3CE(GR30, 8); |
680 | 834 | ||
681 | if ((displaytype == DISPLAY_FP) && var->xres < nativex) { | 835 | if ((displaytype == DISPLAY_FP) && var->xres < nativex) { |
682 | 836 | ||
683 | // stretch or center ? | 837 | // stretch or center ? |
684 | 838 | ||
685 | out8(0x3C2,0xEB); | 839 | out8(0x3C2, 0xEB); |
686 | 840 | ||
687 | write3CE(GR30,read3CE(GR30) | 0x81); // shadow mode on | 841 | write3CE(GR30, read3CE(GR30) | 0x81); // shadow mode on |
688 | 842 | ||
689 | if (center) { | 843 | if (center) { |
690 | write3CE(GR52,(read3CE(GR52) & 0x7C) | 0x80); | 844 | write3CE(GR52, (read3CE(GR52) & 0x7C) | 0x80); |
691 | write3CE(GR53,(read3CE(GR53) & 0x7C) | 0x80); | 845 | write3CE(GR53, (read3CE(GR53) & 0x7C) | 0x80); |
692 | } | 846 | } else if (stretch) { |
693 | else if (stretch) { | 847 | write3CE(GR5D, 0); |
694 | write3CE(GR5D,0); | 848 | write3CE(GR52, (read3CE(GR52) & 0x7C) | 1); |
695 | write3CE(GR52,(read3CE(GR52) & 0x7C) | 1); | 849 | write3CE(GR53, (read3CE(GR53) & 0x7C) | 1); |
696 | write3CE(GR53,(read3CE(GR53) & 0x7C) | 1); | ||
697 | } | 850 | } |
698 | 851 | ||
699 | } else { | 852 | } else { |
700 | out8(0x3C2,0x2B); | 853 | out8(0x3C2, 0x2B); |
701 | write3CE(GR30,8); | 854 | write3CE(GR30, 8); |
702 | } | 855 | } |
703 | 856 | ||
704 | // | 857 | // |
705 | // Setup CRxx regs | 858 | // Setup CRxx regs |
706 | // | 859 | // |
707 | 860 | ||
708 | write3X4(CR00,htotal & 0xFF); | 861 | write3X4(CR00, htotal & 0xFF); |
709 | write3X4(CR01,hdispend & 0xFF); | 862 | write3X4(CR01, hdispend & 0xFF); |
710 | write3X4(CR02,hblankstart & 0xFF); | 863 | write3X4(CR02, hblankstart & 0xFF); |
711 | write3X4(CR03,hblankend & 0x1F); | 864 | write3X4(CR03, hblankend & 0x1F); |
712 | write3X4(CR04,hsyncstart & 0xFF); | 865 | write3X4(CR04, hsyncstart & 0xFF); |
713 | write3X4(CR05,(hsyncend & 0x1F) | ((hblankend & 0x20)<<2)); | 866 | write3X4(CR05, (hsyncend & 0x1F) | ((hblankend & 0x20) << 2)); |
714 | write3X4(CR06,vtotal & 0xFF); | 867 | write3X4(CR06, vtotal & 0xFF); |
715 | write3X4(CR07,(vtotal & 0x100) >> 8 | | 868 | write3X4(CR07, (vtotal & 0x100) >> 8 | |
716 | (vdispend & 0x100) >> 7 | | 869 | (vdispend & 0x100) >> 7 | |
717 | (vsyncstart & 0x100) >> 6 | | 870 | (vsyncstart & 0x100) >> 6 | |
718 | (vblankstart & 0x100) >> 5 | | 871 | (vblankstart & 0x100) >> 5 | |
719 | 0x10 | | 872 | 0x10 | |
720 | (vtotal & 0x200) >> 4 | | 873 | (vtotal & 0x200) >> 4 | |
721 | (vdispend & 0x200) >> 3 | | 874 | (vdispend & 0x200) >> 3 | (vsyncstart & 0x200) >> 2); |
722 | (vsyncstart & 0x200) >> 2); | 875 | write3X4(CR08, 0); |
723 | write3X4(CR08,0); | 876 | write3X4(CR09, (vblankstart & 0x200) >> 4 | 0x40 | // FIX !!! |
724 | write3X4(CR09,(vblankstart & 0x200) >> 4 | 0x40 | // FIX !!! | 877 | ((info->var.vmode & FB_VMODE_DOUBLE) ? 0x80 : 0)); |
725 | ((info->var.vmode & FB_VMODE_DOUBLE) ? 0x80 : 0)); | 878 | write3X4(CR0A, 0); // Init to some reasonable default |
726 | write3X4(CR0A,0); // Init to some reasonable default | 879 | write3X4(CR0B, 0); // Init to some reasonable default |
727 | write3X4(CR0B,0); // Init to some reasonable default | 880 | write3X4(CR0C, 0); // Offset 0 |
728 | write3X4(CR0C,0); // Offset 0 | 881 | write3X4(CR0D, 0); // Offset 0 |
729 | write3X4(CR0D,0); // Offset 0 | 882 | write3X4(CR0E, 0); // Init to some reasonable default |
730 | write3X4(CR0E,0); // Init to some reasonable default | 883 | write3X4(CR0F, 0); // Init to some reasonable default |
731 | write3X4(CR0F,0); // Init to some reasonable default | 884 | write3X4(CR10, vsyncstart & 0xFF); |
732 | write3X4(CR10,vsyncstart & 0xFF); | 885 | write3X4(CR11, (vsyncend & 0x0F)); |
733 | write3X4(CR11,(vsyncend & 0x0F)); | 886 | write3X4(CR12, vdispend & 0xFF); |
734 | write3X4(CR12,vdispend & 0xFF); | 887 | write3X4(CR13, ((info->var.xres_virtual * bpp) / (4 * 16)) & 0xFF); |
735 | write3X4(CR13,((info->var.xres * bpp)/(4*16)) & 0xFF); | 888 | write3X4(CR14, 0x40); // double word mode |
736 | write3X4(CR14,0x40); // double word mode | 889 | write3X4(CR15, vblankstart & 0xFF); |
737 | write3X4(CR15,vblankstart & 0xFF); | 890 | write3X4(CR16, vblankend & 0xFF); |
738 | write3X4(CR16,vblankend & 0xFF); | 891 | write3X4(CR17, 0xE3); |
739 | write3X4(CR17,0xC3); | 892 | write3X4(CR18, 0xFF); |
740 | write3X4(CR18,0xFF); | ||
741 | // CR19: needed for interlaced modes ... ignore it for now | 893 | // CR19: needed for interlaced modes ... ignore it for now |
742 | write3X4(CR1A,0x07); // Arbitration Control Counter 1 | 894 | write3X4(CR1A, 0x07); // Arbitration Control Counter 1 |
743 | write3X4(CR1B,0x07); // Arbitration Control Counter 2 | 895 | write3X4(CR1B, 0x07); // Arbitration Control Counter 2 |
744 | write3X4(CR1C,0x07); // Arbitration Control Counter 3 | 896 | write3X4(CR1C, 0x07); // Arbitration Control Counter 3 |
745 | write3X4(CR1D,0x00); // Don't know, doesn't hurt ;-) | 897 | write3X4(CR1D, 0x00); // Don't know, doesn't hurt ; -) |
746 | write3X4(CR1E,(info->var.vmode & FB_VMODE_INTERLACED) ? 0x84 : 0x80); | 898 | write3X4(CR1E, (info->var.vmode & FB_VMODE_INTERLACED) ? 0x84 : 0x80); |
747 | // CR1F: do not set, contains BIOS info about memsize | 899 | // CR1F: do not set, contains BIOS info about memsize |
748 | write3X4(CR20,0x20); // enabe wr buf, disable 16bit planar mode | 900 | write3X4(CR20, 0x20); // enabe wr buf, disable 16bit planar mode |
749 | write3X4(CR21,0x20); // enable linear memory access | 901 | write3X4(CR21, 0x20); // enable linear memory access |
750 | // CR22: RO cpu latch readback | 902 | // CR22: RO cpu latch readback |
751 | // CR23: ??? | 903 | // CR23: ??? |
752 | // CR24: RO AR flag state | 904 | // CR24: RO AR flag state |
753 | // CR25: RAMDAC rw timing, pclk buffer tristate control ???? | 905 | // CR25: RAMDAC rw timing, pclk buffer tristate control ???? |
754 | // CR26: ??? | 906 | // CR26: ??? |
755 | write3X4(CR27,(vdispend & 0x400) >> 6 | | 907 | write3X4(CR27, (vdispend & 0x400) >> 6 | |
756 | (vsyncstart & 0x400) >> 5 | | 908 | (vsyncstart & 0x400) >> 5 | |
757 | (vblankstart & 0x400) >> 4 | | 909 | (vblankstart & 0x400) >> 4 | |
758 | (vtotal & 0x400) >> 3 | | 910 | (vtotal & 0x400) >> 3 | |
759 | 0x8); | 911 | 0x8); |
760 | // CR28: ??? | 912 | // CR28: ??? |
761 | write3X4(CR29,(read3X4(CR29) & 0xCF) | | 913 | write3X4(CR29, (read3X4(CR29) & 0xCF) | ((((info->var.xres_virtual * |
762 | ((((info->var.xres * bpp) / (4*16)) & 0x300) >>4)); | 914 | bpp) / (4 * 16)) & 0x300) >> 4)); |
763 | write3X4(CR2A,read3X4(CR2A) | 0x40); | 915 | write3X4(CR2A, read3X4(CR2A) | 0x40); |
764 | write3X4(CR2B,(htotal & 0x100) >> 8 | | 916 | write3X4(CR2B, (htotal & 0x100) >> 8 | |
765 | (hdispend & 0x100) >> 7 | | 917 | (hdispend & 0x100) >> 7 | |
766 | // (0x00 & 0x100) >> 6 | hinterlace para bit 8 ??? | 918 | // (0x00 & 0x100) >> 6 | hinterlace para bit 8 ??? |
767 | (hsyncstart & 0x100) >> 5 | | 919 | (hsyncstart & 0x100) >> 5 | |
768 | (hblankstart & 0x100) >> 4); | 920 | (hblankstart & 0x100) >> 4); |
769 | // CR2C: ??? | 921 | // CR2C: ??? |
770 | // CR2D: initialized in cyblafb_setup_GE() | 922 | // CR2D: initialized in cyblafb_setup_GE() |
771 | write3X4(CR2F,0x92); // conservative, better signal quality | 923 | write3X4(CR2F, 0x92); // conservative, better signal quality |
772 | // CR30: reserved | 924 | // CR30: reserved |
773 | // CR31: reserved | 925 | // CR31: reserved |
774 | // CR32: reserved | 926 | // CR32: reserved |
@@ -777,96 +929,116 @@ static int cyblafb_set_par(struct fb_info *info) | |||
777 | // CR35: disabled in CR36 | 929 | // CR35: disabled in CR36 |
778 | // CR36: initialized in cyblafb_setup_GE | 930 | // CR36: initialized in cyblafb_setup_GE |
779 | // CR37: i2c, ignore for now | 931 | // CR37: i2c, ignore for now |
780 | write3X4(CR38,(bpp == 8) ? 0x00 : // | 932 | write3X4(CR38, (bpp == 8) ? 0x00 : // |
781 | (bpp == 16) ? 0x05 : // highcolor | 933 | (bpp == 16) ? 0x05 : // highcolor |
782 | (bpp == 24) ? 0x29 : // packed 24bit truecolor | 934 | (bpp == 24) ? 0x29 : // packed 24bit truecolor |
783 | (bpp == 32) ? 0x09 : 0); // truecolor, 16 bit pixelbus | 935 | (bpp == 32) ? 0x09 : 0); // truecolor, 16 bit pixelbus |
784 | write3X4(CR39,0x01 | // MMIO enable | 936 | write3X4(CR39, 0x01 | // MMIO enable |
785 | (pcirb ? 0x02 : 0) | // pci read burst enable | 937 | (pcirb ? 0x02 : 0) | // pci read burst enable |
786 | (pciwb ? 0x04 : 0)); // pci write burst enable | 938 | (pciwb ? 0x04 : 0)); // pci write burst enable |
787 | write3X4(CR55,0x1F | // pci clocks * 2 for STOP# during 1st data phase | 939 | write3X4(CR55, 0x1F | // pci clocks * 2 for STOP# during 1st data phase |
788 | (pcirr ? 0x40 : 0) | // pci read retry enable | 940 | (pcirr ? 0x40 : 0) | // pci read retry enable |
789 | (pciwr ? 0x80 : 0)); // pci write retry enable | 941 | (pciwr ? 0x80 : 0)); // pci write retry enable |
790 | write3X4(CR56,preendfetch >> 8 < 2 ? (preendfetch >> 8 & 0x01)|2 : 0); | 942 | write3X4(CR56, preendfetch >> 8 < 2 ? (preendfetch >> 8 & 0x01) | 2 |
791 | write3X4(CR57,preendfetch >> 8 < 2 ? preendfetch & 0xff : 0); | 943 | : 0); |
792 | write3X4(CR58,0x82); // Bios does this .... don't know more | 944 | write3X4(CR57, preendfetch >> 8 < 2 ? preendfetch & 0xff : 0); |
945 | write3X4(CR58, 0x82); // Bios does this .... don't know more | ||
793 | // | 946 | // |
794 | // Setup SRxx regs | 947 | // Setup SRxx regs |
795 | // | 948 | // |
796 | write3C4(SR00,3); | 949 | write3C4(SR00, 3); |
797 | write3C4(SR01,1); //set char clock 8 dots wide | 950 | write3C4(SR01, 1); //set char clock 8 dots wide |
798 | write3C4(SR02,0x0F); //enable 4 maps needed in chain4 mode | 951 | write3C4(SR02, 0x0F); //enable 4 maps needed in chain4 mode |
799 | write3C4(SR03,0); //no character map select | 952 | write3C4(SR03, 0); //no character map select |
800 | write3C4(SR04,0x0E); //memory mode: ext mem, even, chain4 | 953 | write3C4(SR04, 0x0E); //memory mode: ext mem, even, chain4 |
801 | 954 | ||
802 | out8(0x3C4,0x0b); | 955 | out8(0x3C4, 0x0b); |
803 | in8(0x3C5); // Set NEW mode | 956 | in8(0x3C5); // Set NEW mode |
804 | write3C4(SR0D,0x00); // test ... check | 957 | write3C4(SR0D, 0x00); // test ... check |
805 | 958 | ||
806 | set_vclk(par,(bpp==32 ? 200000000 : 100000000)/ | 959 | set_vclk(par, (bpp == 32 ? 200000000 : 100000000) |
807 | info->var.pixclock); //SR18,SR19 | 960 | / info->var.pixclock); //SR18, SR19 |
808 | 961 | ||
809 | // | 962 | // |
810 | // Setup GRxx regs | 963 | // Setup GRxx regs |
811 | // | 964 | // |
812 | write3CE(GR00,0x00); // test ... check | 965 | write3CE(GR00, 0x00); // test ... check |
813 | write3CE(GR01,0x00); // test ... check | 966 | write3CE(GR01, 0x00); // test ... check |
814 | write3CE(GR02,0x00); // test ... check | 967 | write3CE(GR02, 0x00); // test ... check |
815 | write3CE(GR03,0x00); // test ... check | 968 | write3CE(GR03, 0x00); // test ... check |
816 | write3CE(GR04,0x00); // test ... check | 969 | write3CE(GR04, 0x00); // test ... check |
817 | write3CE(GR05,0x40); // no CGA compat,allow 256 col | 970 | write3CE(GR05, 0x40); // no CGA compat, allow 256 col |
818 | write3CE(GR06,0x05); // graphics mode | 971 | write3CE(GR06, 0x05); // graphics mode |
819 | write3CE(GR07,0x0F); // planes? | 972 | write3CE(GR07, 0x0F); // planes? |
820 | write3CE(GR08,0xFF); // test ... check | 973 | write3CE(GR08, 0xFF); // test ... check |
821 | write3CE(GR0F,(bpp==32)?0x1A:0x12); // div vclk by 2 if 32bpp, chain4 | 974 | write3CE(GR0F, (bpp == 32) ? 0x1A : 0x12); // vclk / 2 if 32bpp, chain4 |
822 | write3CE(GR20,0xC0); // test ... check | 975 | write3CE(GR20, 0xC0); // test ... check |
823 | write3CE(GR2F,0xA0); // PCLK = VCLK, no skew, | 976 | write3CE(GR2F, 0xA0); // PCLK = VCLK, no skew, |
824 | 977 | ||
825 | // | 978 | // |
826 | // Setup ARxx regs | 979 | // Setup ARxx regs |
827 | // | 980 | // |
828 | for(i = 0;i < 0x10;i++) // set AR00 .. AR0f | 981 | for (i = 0; i < 0x10; i++) // set AR00 .. AR0f |
829 | write3C0(i,i); | 982 | write3C0(i, i); |
830 | write3C0(AR10,0x41); // graphics mode and support 256 color modes | 983 | write3C0(AR10, 0x41); // graphics mode and support 256 color modes |
831 | write3C0(AR12,0x0F); // planes | 984 | write3C0(AR12, 0x0F); // planes |
832 | write3C0(AR13,0); // horizontal pel panning | 985 | write3C0(AR13, 0); // horizontal pel panning |
833 | in8(0x3DA); // reset internal flag to 3c0 index | 986 | in8(0x3DA); // reset internal flag to 3c0 index |
834 | out8(0x3C0,0x20); // enable attr | 987 | out8(0x3C0, 0x20); // enable attr |
835 | 988 | ||
836 | // | 989 | // |
837 | // Setup hidden RAMDAC command register | 990 | // Setup hidden RAMDAC command register |
838 | // | 991 | // |
839 | in8(0x3C8); // these reads are | 992 | in8(0x3C8); // these reads are |
840 | in8(0x3C6); // necessary to | 993 | in8(0x3C6); // necessary to |
841 | in8(0x3C6); // unmask the RAMDAC | 994 | in8(0x3C6); // unmask the RAMDAC |
842 | in8(0x3C6); // command reg, otherwise | 995 | in8(0x3C6); // command reg, otherwise |
843 | in8(0x3C6); // we would write the pixelmask reg! | 996 | in8(0x3C6); // we would write the pixelmask reg! |
844 | out8(0x3C6,(bpp == 8) ? 0x00 : // 256 colors | 997 | out8(0x3C6, (bpp == 8) ? 0x00 : // 256 colors |
845 | (bpp == 15) ? 0x10 : // | 998 | (bpp == 15) ? 0x10 : // |
846 | (bpp == 16) ? 0x30 : // hicolor | 999 | (bpp == 16) ? 0x30 : // hicolor |
847 | (bpp == 24) ? 0xD0 : // truecolor | 1000 | (bpp == 24) ? 0xD0 : // truecolor |
848 | (bpp == 32) ? 0xD0 : 0); // truecolor | 1001 | (bpp == 32) ? 0xD0 : 0); // truecolor |
849 | in8(0x3C8); | 1002 | in8(0x3C8); |
850 | 1003 | ||
851 | // | 1004 | // |
852 | // GR31 is not mentioned in the datasheet | 1005 | // GR31 is not mentioned in the datasheet |
853 | // | 1006 | // |
854 | if (displaytype == DISPLAY_FP) | 1007 | if (displaytype == DISPLAY_FP) |
855 | write3CE(GR31,(read3CE(GR31) & 0x8F) | | 1008 | write3CE(GR31, (read3CE(GR31) & 0x8F) | |
856 | ((info->var.yres > 1024) ? 0x50 : | 1009 | ((info->var.yres > 1024) ? 0x50 : |
857 | (info->var.yres > 768) ? 0x30 : | 1010 | (info->var.yres > 768) ? 0x30 : |
858 | (info->var.yres > 600) ? 0x20 : | 1011 | (info->var.yres > 600) ? 0x20 : |
859 | (info->var.yres > 480) ? 0x10 : 0)); | 1012 | (info->var.yres > 480) ? 0x10 : 0)); |
860 | 1013 | ||
861 | info->fix.visual = (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR | 1014 | info->fix.visual = (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR |
862 | : FB_VISUAL_TRUECOLOR; | 1015 | : FB_VISUAL_TRUECOLOR; |
863 | info->fix.line_length = info->var.xres * (bpp >> 3); | 1016 | info->fix.line_length = info->var.xres_virtual * (bpp >> 3); |
864 | info->cmap.len = (bpp == 8) ? 256: 16; | 1017 | info->cmap.len = (bpp == 8) ? 256 : 16; |
865 | 1018 | ||
866 | // | 1019 | // |
867 | // init acceleration engine | 1020 | // init acceleration engine |
868 | // | 1021 | // |
869 | cyblafb_setup_GE(info->var.xres,info->var.bits_per_pixel); | 1022 | cyblafb_setup_GE(info->var.xres_virtual, info->var.bits_per_pixel); |
1023 | |||
1024 | // | ||
1025 | // Set/clear flags to allow proper scroll mode selection. | ||
1026 | // | ||
1027 | if (var->xres == var->xres_virtual) | ||
1028 | info->flags &= ~FBINFO_HWACCEL_XPAN; | ||
1029 | else | ||
1030 | info->flags |= FBINFO_HWACCEL_XPAN; | ||
1031 | |||
1032 | if (var->yres == var->yres_virtual) | ||
1033 | info->flags &= ~FBINFO_HWACCEL_YPAN; | ||
1034 | else | ||
1035 | info->flags |= FBINFO_HWACCEL_YPAN; | ||
1036 | |||
1037 | if (info->fix.smem_len != | ||
1038 | var->xres_virtual * var->yres_virtual * bpp / 8) | ||
1039 | info->flags &= ~FBINFO_HWACCEL_YWRAP; | ||
1040 | else | ||
1041 | info->flags |= FBINFO_HWACCEL_YWRAP; | ||
870 | 1042 | ||
871 | regdump(par); | 1043 | regdump(par); |
872 | 1044 | ||
@@ -885,27 +1057,27 @@ static int cyblafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
885 | { | 1057 | { |
886 | int bpp = info->var.bits_per_pixel; | 1058 | int bpp = info->var.bits_per_pixel; |
887 | 1059 | ||
1060 | KD_GRAPHICS_RETURN(0); | ||
1061 | |||
888 | if (regno >= info->cmap.len) | 1062 | if (regno >= info->cmap.len) |
889 | return 1; | 1063 | return 1; |
890 | 1064 | ||
891 | if (bpp == 8) { | 1065 | if (bpp == 8) { |
892 | out8(0x3C6,0xFF); | 1066 | out8(0x3C6, 0xFF); |
893 | out8(0x3C8,regno); | 1067 | out8(0x3C8, regno); |
894 | out8(0x3C9,red>>10); | 1068 | out8(0x3C9, red >> 10); |
895 | out8(0x3C9,green>>10); | 1069 | out8(0x3C9, green >> 10); |
896 | out8(0x3C9,blue>>10); | 1070 | out8(0x3C9, blue >> 10); |
897 | 1071 | ||
898 | } else if (bpp == 16) // RGB 565 | 1072 | } else if (bpp == 16) // RGB 565 |
899 | ((u32*)info->pseudo_palette)[regno] = | 1073 | ((u32 *) info->pseudo_palette)[regno] = |
900 | (red & 0xF800) | | 1074 | (red & 0xF800) | |
901 | ((green & 0xFC00) >> 5) | | 1075 | ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11); |
902 | ((blue & 0xF800) >> 11); | 1076 | else if (bpp == 32) // ARGB 8888 |
903 | else if (bpp == 32) // ARGB 8888 | 1077 | ((u32 *) info->pseudo_palette)[regno] = |
904 | ((u32*)info->pseudo_palette)[regno] = | 1078 | ((transp & 0xFF00) << 16) | |
905 | ((transp & 0xFF00) <<16) | | 1079 | ((red & 0xFF00) << 8) | |
906 | ((red & 0xFF00) << 8) | | 1080 | ((green & 0xFF00)) | ((blue & 0xFF00) >> 8); |
907 | ((green & 0xFF00)) | | ||
908 | ((blue & 0xFF00)>>8); | ||
909 | 1081 | ||
910 | return 0; | 1082 | return 0; |
911 | } | 1083 | } |
@@ -918,40 +1090,41 @@ static int cyblafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
918 | 1090 | ||
919 | static int cyblafb_blank(int blank_mode, struct fb_info *info) | 1091 | static int cyblafb_blank(int blank_mode, struct fb_info *info) |
920 | { | 1092 | { |
921 | unsigned char PMCont,DPMSCont; | 1093 | unsigned char PMCont, DPMSCont; |
1094 | |||
1095 | KD_GRAPHICS_RETURN(0); | ||
922 | 1096 | ||
923 | if (displaytype == DISPLAY_FP) | 1097 | if (displaytype == DISPLAY_FP) |
924 | return 0; | 1098 | return 0; |
925 | 1099 | ||
926 | out8(0x83C8,0x04); // DPMS Control | 1100 | out8(0x83C8, 0x04); // DPMS Control |
927 | PMCont = in8(0x83C6) & 0xFC; | 1101 | PMCont = in8(0x83C6) & 0xFC; |
928 | 1102 | ||
929 | DPMSCont = read3CE(GR23) & 0xFC; | 1103 | DPMSCont = read3CE(GR23) & 0xFC; |
930 | 1104 | ||
931 | switch (blank_mode) | 1105 | switch (blank_mode) { |
932 | { | 1106 | case FB_BLANK_UNBLANK: // Screen: On, HSync: On, VSync: On |
933 | case FB_BLANK_UNBLANK: // Screen: On, HSync: On, VSync: On | 1107 | case FB_BLANK_NORMAL: // Screen: Off, HSync: On, VSync: On |
934 | case FB_BLANK_NORMAL: // Screen: Off, HSync: On, VSync: On | ||
935 | PMCont |= 0x03; | 1108 | PMCont |= 0x03; |
936 | DPMSCont |= 0x00; | 1109 | DPMSCont |= 0x00; |
937 | break; | 1110 | break; |
938 | case FB_BLANK_HSYNC_SUSPEND: // Screen: Off, HSync: Off, VSync: On | 1111 | case FB_BLANK_HSYNC_SUSPEND: // Screen: Off, HSync: Off, VSync: On |
939 | PMCont |= 0x02; | 1112 | PMCont |= 0x02; |
940 | DPMSCont |= 0x01; | 1113 | DPMSCont |= 0x01; |
941 | break; | 1114 | break; |
942 | case FB_BLANK_VSYNC_SUSPEND: // Screen: Off, HSync: On, VSync: Off | 1115 | case FB_BLANK_VSYNC_SUSPEND: // Screen: Off, HSync: On, VSync: Off |
943 | PMCont |= 0x02; | 1116 | PMCont |= 0x02; |
944 | DPMSCont |= 0x02; | 1117 | DPMSCont |= 0x02; |
945 | break; | 1118 | break; |
946 | case FB_BLANK_POWERDOWN: // Screen: Off, HSync: Off, VSync: Off | 1119 | case FB_BLANK_POWERDOWN: // Screen: Off, HSync: Off, VSync: Off |
947 | PMCont |= 0x00; | 1120 | PMCont |= 0x00; |
948 | DPMSCont |= 0x03; | 1121 | DPMSCont |= 0x03; |
949 | break; | 1122 | break; |
950 | } | 1123 | } |
951 | 1124 | ||
952 | write3CE(GR23,DPMSCont); | 1125 | write3CE(GR23, DPMSCont); |
953 | out8(0x83C8,4); | 1126 | out8(0x83C8, 4); |
954 | out8(0x83C6,PMCont); | 1127 | out8(0x83C6, PMCont); |
955 | // | 1128 | // |
956 | // let fbcon do a softblank for us | 1129 | // let fbcon do a softblank for us |
957 | // | 1130 | // |
@@ -959,15 +1132,18 @@ static int cyblafb_blank(int blank_mode, struct fb_info *info) | |||
959 | } | 1132 | } |
960 | 1133 | ||
961 | static struct fb_ops cyblafb_ops __devinitdata = { | 1134 | static struct fb_ops cyblafb_ops __devinitdata = { |
962 | .owner = THIS_MODULE, | 1135 | .owner = THIS_MODULE, |
963 | .fb_setcolreg = cyblafb_setcolreg, | 1136 | .fb_setcolreg = cyblafb_setcolreg, |
964 | .fb_pan_display = cyblafb_pan_display, | 1137 | .fb_pan_display = cyblafb_pan_display, |
965 | .fb_blank = cyblafb_blank, | 1138 | .fb_blank = cyblafb_blank, |
966 | .fb_check_var = cyblafb_check_var, | 1139 | .fb_check_var = cyblafb_check_var, |
967 | .fb_set_par = cyblafb_set_par, | 1140 | .fb_set_par = cyblafb_set_par, |
968 | .fb_fillrect = cyblafb_fillrect, | 1141 | .fb_fillrect = cyblafb_fillrect, |
969 | .fb_copyarea= cyblafb_copyarea, | 1142 | .fb_copyarea = cyblafb_copyarea, |
970 | .fb_imageblit = cyblafb_imageblit, | 1143 | .fb_imageblit = cyblafb_imageblit, |
1144 | .fb_sync = cyblafb_sync, | ||
1145 | .fb_restore_state = cyblafb_restore_state, | ||
1146 | .fb_save_state = cyblafb_save_state, | ||
971 | }; | 1147 | }; |
972 | 1148 | ||
973 | //========================================================================== | 1149 | //========================================================================== |
@@ -986,74 +1162,89 @@ static struct fb_ops cyblafb_ops __devinitdata = { | |||
986 | 1162 | ||
987 | static int __devinit getstartupmode(struct fb_info *info) | 1163 | static int __devinit getstartupmode(struct fb_info *info) |
988 | { | 1164 | { |
989 | u32 htotal,hdispend,hsyncstart,hsyncend,hblankstart,hblankend, | 1165 | u32 htotal, hdispend, hsyncstart, hsyncend, hblankstart, hblankend, |
990 | vtotal,vdispend,vsyncstart,vsyncend,vblankstart,vblankend, | 1166 | vtotal, vdispend, vsyncstart, vsyncend, vblankstart, vblankend, |
991 | cr00,cr01,cr02,cr03,cr04,cr05,cr2b, | 1167 | cr00, cr01, cr02, cr03, cr04, cr05, cr2b, |
992 | cr06,cr07,cr09,cr10,cr11,cr12,cr15,cr16,cr27, | 1168 | cr06, cr07, cr09, cr10, cr11, cr12, cr15, cr16, cr27, |
993 | cr38, | 1169 | cr38, sr0d, sr18, sr19, gr0f, fi, pxclkdiv, vclkdiv, tmp, i; |
994 | sr0d,sr18,sr19, | ||
995 | gr0f, | ||
996 | fi,pxclkdiv,vclkdiv,tmp,i; | ||
997 | 1170 | ||
998 | struct modus { | 1171 | struct modus { |
999 | int xres; int yres; int vyres; int bpp; int pxclk; | 1172 | int xres; int vxres; int yres; int vyres; |
1000 | int left_margin; int right_margin; int upper_margin; | 1173 | int bpp; int pxclk; |
1001 | int lower_margin; int hsync_len; int vsync_len; | 1174 | int left_margin; int right_margin; |
1002 | } modedb[5] = { | 1175 | int upper_margin; int lower_margin; |
1003 | { 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0}, | 1176 | int hsync_len; int vsync_len; |
1004 | { 640, 480, 3756, 0, 0, -40, 24, 17, 0, 216, 3}, | 1177 | } modedb[5] = { |
1005 | { 800, 600, 3221, 0, 0, 96, 24, 14, 0, 136, 11}, | 1178 | { |
1006 | {1024, 768, 2815, 0, 0, 144, 24, 29, 0, 120, 3}, | 1179 | 0, 2048, 0, 4096, 0, 0, 0, 0, 0, 0, 0, 0}, { |
1007 | {1280, 1024, 2662, 0, 0, 232, 16, 39, 0, 160, 3} | 1180 | 640, 2048, 480, 4096, 0, 0, -40, 24, 17, 0, 216, 3}, { |
1181 | 800, 2048, 600, 4096, 0, 0, 96, 24, 14, 0, 136, 11}, { | ||
1182 | 1024, 2048, 768, 4096, 0, 0, 144, 24, 29, 0, 120, 3}, { | ||
1183 | 1280, 2048, 1024, 4096, 0, 0, 232, 16, 39, 0, 160, 3} | ||
1008 | }; | 1184 | }; |
1009 | 1185 | ||
1010 | outb(0x00,0x3d4); cr00=inb(0x3d5); outb(0x01,0x3d4); cr01=inb(0x3d5); | 1186 | outb(0x00, 0x3d4); cr00 = inb(0x3d5); |
1011 | outb(0x02,0x3d4); cr02=inb(0x3d5); outb(0x03,0x3d4); cr03=inb(0x3d5); | 1187 | outb(0x01, 0x3d4); cr01 = inb(0x3d5); |
1012 | outb(0x04,0x3d4); cr04=inb(0x3d5); outb(0x05,0x3d4); cr05=inb(0x3d5); | 1188 | outb(0x02, 0x3d4); cr02 = inb(0x3d5); |
1013 | outb(0x06,0x3d4); cr06=inb(0x3d5); outb(0x07,0x3d4); cr07=inb(0x3d5); | 1189 | outb(0x03, 0x3d4); cr03 = inb(0x3d5); |
1014 | outb(0x09,0x3d4); cr09=inb(0x3d5); outb(0x10,0x3d4); cr10=inb(0x3d5); | 1190 | outb(0x04, 0x3d4); cr04 = inb(0x3d5); |
1015 | outb(0x11,0x3d4); cr11=inb(0x3d5); outb(0x12,0x3d4); cr12=inb(0x3d5); | 1191 | outb(0x05, 0x3d4); cr05 = inb(0x3d5); |
1016 | outb(0x15,0x3d4); cr15=inb(0x3d5); outb(0x16,0x3d4); cr16=inb(0x3d5); | 1192 | outb(0x06, 0x3d4); cr06 = inb(0x3d5); |
1017 | outb(0x27,0x3d4); cr27=inb(0x3d5); outb(0x2b,0x3d4); cr2b=inb(0x3d5); | 1193 | outb(0x07, 0x3d4); cr07 = inb(0x3d5); |
1018 | outb(0x38,0x3d4); cr38=inb(0x3d5); outb(0x0b,0x3c4); inb(0x3c5); | 1194 | outb(0x09, 0x3d4); cr09 = inb(0x3d5); |
1019 | outb(0x0d,0x3c4); sr0d=inb(0x3c5); outb(0x18,0x3c4); sr18=inb(0x3c5); | 1195 | outb(0x10, 0x3d4); cr10 = inb(0x3d5); |
1020 | outb(0x19,0x3c4); sr19=inb(0x3c5); outb(0x0f,0x3ce); gr0f=inb(0x3cf); | 1196 | outb(0x11, 0x3d4); cr11 = inb(0x3d5); |
1021 | 1197 | outb(0x12, 0x3d4); cr12 = inb(0x3d5); | |
1022 | htotal = cr00 | (cr2b & 0x01) << 8; | 1198 | outb(0x15, 0x3d4); cr15 = inb(0x3d5); |
1023 | hdispend = cr01 | (cr2b & 0x02) << 7; | 1199 | outb(0x16, 0x3d4); cr16 = inb(0x3d5); |
1200 | outb(0x27, 0x3d4); cr27 = inb(0x3d5); | ||
1201 | outb(0x2b, 0x3d4); cr2b = inb(0x3d5); | ||
1202 | outb(0x38, 0x3d4); cr38 = inb(0x3d5); | ||
1203 | |||
1204 | outb(0x0b, 0x3c4); | ||
1205 | inb(0x3c5); | ||
1206 | |||
1207 | outb(0x0d, 0x3c4); sr0d = inb(0x3c5); | ||
1208 | outb(0x18, 0x3c4); sr18 = inb(0x3c5); | ||
1209 | outb(0x19, 0x3c4); sr19 = inb(0x3c5); | ||
1210 | outb(0x0f, 0x3ce); gr0f = inb(0x3cf); | ||
1211 | |||
1212 | htotal = cr00 | (cr2b & 0x01) << 8; | ||
1213 | hdispend = cr01 | (cr2b & 0x02) << 7; | ||
1024 | hblankstart = cr02 | (cr2b & 0x10) << 4; | 1214 | hblankstart = cr02 | (cr2b & 0x10) << 4; |
1025 | hblankend = (cr03 & 0x1f) | (cr05 & 0x80) >> 2; | 1215 | hblankend = (cr03 & 0x1f) | (cr05 & 0x80) >> 2; |
1026 | hsyncstart = cr04 | (cr2b & 0x08) << 5; | 1216 | hsyncstart = cr04 | (cr2b & 0x08) << 5; |
1027 | hsyncend = cr05 & 0x1f; | 1217 | hsyncend = cr05 & 0x1f; |
1028 | 1218 | ||
1029 | modedb[0].xres = hblankstart * 8; | 1219 | modedb[0].xres = hblankstart * 8; |
1030 | modedb[0].hsync_len = hsyncend * 8; | 1220 | modedb[0].hsync_len = hsyncend * 8; |
1031 | modedb[0].right_margin = hsyncstart * 8 - modedb[0].xres; | 1221 | modedb[0].right_margin = hsyncstart * 8 - modedb[0].xres; |
1032 | modedb[0].left_margin = (htotal + 5) * 8 - modedb[0].xres - | 1222 | modedb[0].left_margin = (htotal + 5) * 8 - modedb[0].xres - |
1033 | modedb[0].right_margin - modedb[0].hsync_len; | 1223 | modedb[0].right_margin - modedb[0].hsync_len; |
1034 | 1224 | ||
1035 | vtotal = cr06 | (cr07 & 0x01) << 8 | (cr07 & 0x20) << 4 | 1225 | vtotal = cr06 | (cr07 & 0x01) << 8 | (cr07 & 0x20) << 4 |
1036 | | (cr27 & 0x80) << 3; | 1226 | | (cr27 & 0x80) << 3; |
1037 | vdispend = cr12 | (cr07 & 0x02) << 7 | (cr07 & 0x40) << 3 | 1227 | vdispend = cr12 | (cr07 & 0x02) << 7 | (cr07 & 0x40) << 3 |
1038 | | (cr27 & 0x10) << 6; | 1228 | | (cr27 & 0x10) << 6; |
1039 | vsyncstart = cr10 | (cr07 & 0x04) << 6 | (cr07 & 0x80) << 2 | 1229 | vsyncstart = cr10 | (cr07 & 0x04) << 6 | (cr07 & 0x80) << 2 |
1040 | | (cr27 & 0x20) << 5; | 1230 | | (cr27 & 0x20) << 5; |
1041 | vsyncend = cr11 & 0x0f; | 1231 | vsyncend = cr11 & 0x0f; |
1042 | vblankstart = cr15 | (cr07 & 0x08) << 5 | (cr09 & 0x20) << 4 | 1232 | vblankstart = cr15 | (cr07 & 0x08) << 5 | (cr09 & 0x20) << 4 |
1043 | | (cr27 & 0x40) << 4; | 1233 | | (cr27 & 0x40) << 4; |
1044 | vblankend = cr16; | 1234 | vblankend = cr16; |
1045 | 1235 | ||
1046 | modedb[0].yres = vdispend + 1; | 1236 | modedb[0].yres = vdispend + 1; |
1047 | modedb[0].vsync_len = vsyncend; | 1237 | modedb[0].vsync_len = vsyncend; |
1048 | modedb[0].lower_margin = vsyncstart - modedb[0].yres; | 1238 | modedb[0].lower_margin = vsyncstart - modedb[0].yres; |
1049 | modedb[0].upper_margin = vtotal - modedb[0].yres - | 1239 | modedb[0].upper_margin = vtotal - modedb[0].yres - |
1050 | modedb[0].lower_margin - modedb[0].vsync_len + 2; | 1240 | modedb[0].lower_margin - modedb[0].vsync_len + 2; |
1051 | 1241 | ||
1052 | tmp = cr38 & 0x3c; | 1242 | tmp = cr38 & 0x3c; |
1053 | modedb[0].bpp = tmp == 0 ? 8 : tmp == 4 ? 16 : tmp == 28 ? 24 : | 1243 | modedb[0].bpp = tmp == 0 ? 8 : tmp == 4 ? 16 : tmp == 28 ? 24 : |
1054 | tmp == 8 ? 32 : 8; | 1244 | tmp == 8 ? 32 : 8; |
1055 | 1245 | ||
1056 | fi = ((5864727*(sr18+8))/(((sr19&0x3f)+2)*(1<<((sr19&0xc0)>>6))))>>12; | 1246 | fi = ((5864727 * (sr18 + 8)) / |
1247 | (((sr19 & 0x3f) + 2) * (1 << ((sr19 & 0xc0) >> 6)))) >> 12; | ||
1057 | pxclkdiv = ((gr0f & 0x08) >> 3 | (gr0f & 0x40) >> 5) + 1; | 1248 | pxclkdiv = ((gr0f & 0x08) >> 3 | (gr0f & 0x40) >> 5) + 1; |
1058 | tmp = sr0d & 0x06; | 1249 | tmp = sr0d & 0x06; |
1059 | vclkdiv = tmp == 0 ? 2 : tmp == 2 ? 4 : tmp == 4 ? 8 : 3; // * 2 ! | 1250 | vclkdiv = tmp == 0 ? 2 : tmp == 2 ? 4 : tmp == 4 ? 8 : 3; // * 2 ! |
@@ -1062,10 +1253,10 @@ static int __devinit getstartupmode(struct fb_info *info) | |||
1062 | if (verbosity > 0) | 1253 | if (verbosity > 0) |
1063 | output("detected startup mode: " | 1254 | output("detected startup mode: " |
1064 | "fbset -g %d %d %d ??? %d -t %d %d %d %d %d %d %d\n", | 1255 | "fbset -g %d %d %d ??? %d -t %d %d %d %d %d %d %d\n", |
1065 | modedb[0].xres,modedb[0].yres,modedb[0].xres, | 1256 | modedb[0].xres, modedb[0].yres, modedb[0].xres, |
1066 | modedb[0].bpp,modedb[0].pxclk,modedb[0].left_margin, | 1257 | modedb[0].bpp, modedb[0].pxclk, modedb[0].left_margin, |
1067 | modedb[0].right_margin,modedb[0].upper_margin, | 1258 | modedb[0].right_margin, modedb[0].upper_margin, |
1068 | modedb[0].lower_margin,modedb[0].hsync_len, | 1259 | modedb[0].lower_margin, modedb[0].hsync_len, |
1069 | modedb[0].vsync_len); | 1260 | modedb[0].vsync_len); |
1070 | 1261 | ||
1071 | // | 1262 | // |
@@ -1073,36 +1264,39 @@ static int __devinit getstartupmode(struct fb_info *info) | |||
1073 | // do not want to do it in another way! | 1264 | // do not want to do it in another way! |
1074 | // | 1265 | // |
1075 | 1266 | ||
1076 | tryagain: | 1267 | tryagain: |
1077 | 1268 | ||
1078 | i = (mode == NULL) ? 0 : | 1269 | i = (mode == NULL) ? 0 : |
1079 | !strncmp(mode,"640x480",7) ? 1 : | 1270 | !strncmp(mode, "640x480", 7) ? 1 : |
1080 | !strncmp(mode,"800x600",7) ? 2 : | 1271 | !strncmp(mode, "800x600", 7) ? 2 : |
1081 | !strncmp(mode,"1024x768",8) ? 3 : | 1272 | !strncmp(mode, "1024x768", 8) ? 3 : |
1082 | !strncmp(mode,"1280x1024",9) ? 4 : 0; | 1273 | !strncmp(mode, "1280x1024", 9) ? 4 : 0; |
1083 | 1274 | ||
1084 | ref = (ref < 50) ? 50 : (ref > 85) ? 85 : ref; | 1275 | ref = (ref < 50) ? 50 : (ref > 85) ? 85 : ref; |
1085 | 1276 | ||
1086 | if(i==0) { | 1277 | if (i == 0) { |
1087 | info->var.pixclock = modedb[i].pxclk; | 1278 | info->var.pixclock = modedb[i].pxclk; |
1088 | info->var.bits_per_pixel = modedb[i].bpp; | 1279 | info->var.bits_per_pixel = modedb[i].bpp; |
1089 | } else { | 1280 | } else { |
1090 | info->var.pixclock = (100000000 / | 1281 | info->var.pixclock = (100000000 / |
1091 | ((modedb[i].left_margin + modedb[i].xres + | 1282 | ((modedb[i].left_margin + |
1092 | modedb[i].right_margin + modedb[i].hsync_len | 1283 | modedb[i].xres + |
1093 | ) * ( | 1284 | modedb[i].right_margin + |
1094 | modedb[i].upper_margin + modedb[i].yres + | 1285 | modedb[i].hsync_len) * |
1095 | modedb[i].lower_margin + modedb[i].vsync_len | 1286 | (modedb[i].upper_margin + |
1096 | ) * | 1287 | modedb[i].yres + |
1097 | ref / 10000 | 1288 | modedb[i].lower_margin + |
1098 | )); | 1289 | modedb[i].vsync_len) * ref / 10000)); |
1099 | info->var.bits_per_pixel = bpp; | 1290 | info->var.bits_per_pixel = bpp; |
1100 | } | 1291 | } |
1101 | 1292 | ||
1102 | info->var.left_margin = modedb[i].left_margin; | 1293 | info->var.left_margin = modedb[i].left_margin; |
1103 | info->var.right_margin = modedb[i].right_margin; | 1294 | info->var.right_margin = modedb[i].right_margin; |
1104 | info->var.xres = modedb[i].xres; | 1295 | info->var.xres = modedb[i].xres; |
1105 | info->var.xres_virtual = modedb[i].xres; | 1296 | if (!(modedb[i].yres == 1280 && modedb[i].bpp == 32)) |
1297 | info->var.xres_virtual = modedb[i].vxres; | ||
1298 | else | ||
1299 | info->var.xres_virtual = modedb[i].xres; | ||
1106 | info->var.xoffset = 0; | 1300 | info->var.xoffset = 0; |
1107 | info->var.hsync_len = modedb[i].hsync_len; | 1301 | info->var.hsync_len = modedb[i].hsync_len; |
1108 | info->var.upper_margin = modedb[i].upper_margin; | 1302 | info->var.upper_margin = modedb[i].upper_margin; |
@@ -1114,33 +1308,32 @@ static int __devinit getstartupmode(struct fb_info *info) | |||
1114 | info->var.sync = 0; | 1308 | info->var.sync = 0; |
1115 | info->var.vmode = FB_VMODE_NONINTERLACED; | 1309 | info->var.vmode = FB_VMODE_NONINTERLACED; |
1116 | 1310 | ||
1117 | if(cyblafb_check_var(&info->var,info)) { | 1311 | if (cyblafb_check_var(&info->var, info)) { |
1118 | // 640x480-8@75 should really never fail. One case would | 1312 | // 640x480 - 8@75 should really never fail. One case would |
1119 | // be fp == 1 and nativex < 640 ... give up then | 1313 | // be fp == 1 and nativex < 640 ... give up then |
1120 | if(i==1 && bpp == 8 && ref == 75){ | 1314 | if (i == 1 && bpp == 8 && ref == 75) { |
1121 | output("Can't find a valid mode :-(\n"); | 1315 | output("Can't find a valid mode :-(\n"); |
1122 | return -EINVAL; | 1316 | return -EINVAL; |
1123 | } | 1317 | } |
1124 | // Our detected mode is unlikely to fail. If it does, | 1318 | // Our detected mode is unlikely to fail. If it does, |
1125 | // try 640x480-8@75 ... | 1319 | // try 640x480 - 8@75 ... |
1126 | if(i==0) { | 1320 | if (i == 0) { |
1127 | mode="640x480"; | 1321 | mode = "640x480"; |
1128 | bpp=8; | 1322 | bpp = 8; |
1129 | ref=75; | 1323 | ref = 75; |
1130 | output("Detected mode failed check_var! " | 1324 | output("Detected mode failed check_var! " |
1131 | "Trying 640x480-8@75\n"); | 1325 | "Trying 640x480 - 8@75\n"); |
1132 | goto tryagain; | 1326 | goto tryagain; |
1133 | } | 1327 | } |
1134 | // A specified video mode failed for some reason. | 1328 | // A specified video mode failed for some reason. |
1135 | // Try the startup mode first | 1329 | // Try the startup mode first |
1136 | output("Specified mode '%s' failed check! " | 1330 | output("Specified mode '%s' failed check! " |
1137 | "Falling back to startup mode.\n",mode); | 1331 | "Falling back to startup mode.\n", mode); |
1138 | mode=NULL; | 1332 | mode = NULL; |
1139 | goto tryagain; | 1333 | goto tryagain; |
1140 | } | 1334 | } |
1141 | 1335 | ||
1142 | return 0; | 1336 | return 0; |
1143 | |||
1144 | } | 1337 | } |
1145 | 1338 | ||
1146 | //======================================================== | 1339 | //======================================================== |
@@ -1160,21 +1353,28 @@ static unsigned int __devinit get_memsize(void) | |||
1160 | else { | 1353 | else { |
1161 | tmp = read3X4(CR1F) & 0x0F; | 1354 | tmp = read3X4(CR1F) & 0x0F; |
1162 | switch (tmp) { | 1355 | switch (tmp) { |
1163 | case 0x03: k = 1 * Mb; break; | 1356 | case 0x03: |
1164 | case 0x07: k = 2 * Mb; break; | 1357 | k = 1 * 1024 * 1024; |
1165 | case 0x0F: k = 4 * Mb; break; | 1358 | break; |
1166 | case 0x04: k = 8 * Mb; break; | 1359 | case 0x07: |
1167 | default: | 1360 | k = 2 * 1024 * 1024; |
1168 | k = 1 * Mb; | 1361 | break; |
1169 | output("Unknown memory size code %x in CR1F." | 1362 | case 0x0F: |
1170 | " We default to 1 Mb for now, please" | 1363 | k = 4 * 1024 * 1024; |
1171 | " do provide a memsize parameter!\n", | 1364 | break; |
1172 | tmp); | 1365 | case 0x04: |
1366 | k = 8 * 1024 * 1024; | ||
1367 | break; | ||
1368 | default: | ||
1369 | k = 1 * 1024 * 1024; | ||
1370 | output("Unknown memory size code %x in CR1F." | ||
1371 | " We default to 1 Mb for now, please" | ||
1372 | " do provide a memsize parameter!\n", tmp); | ||
1173 | } | 1373 | } |
1174 | } | 1374 | } |
1175 | 1375 | ||
1176 | if (verbosity > 0) | 1376 | if (verbosity > 0) |
1177 | output("framebuffer size = %d Kb\n",k/Kb); | 1377 | output("framebuffer size = %d Kb\n", k / Kb); |
1178 | return k; | 1378 | return k; |
1179 | } | 1379 | } |
1180 | 1380 | ||
@@ -1192,7 +1392,7 @@ static unsigned int __devinit get_displaytype(void) | |||
1192 | return DISPLAY_FP; | 1392 | return DISPLAY_FP; |
1193 | if (crt) | 1393 | if (crt) |
1194 | return DISPLAY_CRT; | 1394 | return DISPLAY_CRT; |
1195 | return (read3CE(GR33) & 0x10)?DISPLAY_FP:DISPLAY_CRT; | 1395 | return (read3CE(GR33) & 0x10) ? DISPLAY_FP : DISPLAY_CRT; |
1196 | } | 1396 | } |
1197 | 1397 | ||
1198 | //===================================== | 1398 | //===================================== |
@@ -1203,7 +1403,7 @@ static unsigned int __devinit get_displaytype(void) | |||
1203 | 1403 | ||
1204 | static int __devinit get_nativex(void) | 1404 | static int __devinit get_nativex(void) |
1205 | { | 1405 | { |
1206 | int x,y,tmp; | 1406 | int x, y, tmp; |
1207 | 1407 | ||
1208 | if (nativex) | 1408 | if (nativex) |
1209 | return nativex; | 1409 | return nativex; |
@@ -1211,29 +1411,45 @@ static int __devinit get_nativex(void) | |||
1211 | tmp = (read3CE(GR52) >> 4) & 3; | 1411 | tmp = (read3CE(GR52) >> 4) & 3; |
1212 | 1412 | ||
1213 | switch (tmp) { | 1413 | switch (tmp) { |
1214 | case 0: x = 1280; y = 1024; break; | 1414 | case 0: x = 1280; y = 1024; |
1215 | case 2: x = 1024; y = 768; break; | 1415 | break; |
1216 | case 3: x = 800; y = 600; break; | 1416 | case 2: x = 1024; y = 768; |
1217 | case 4: x = 1400; y = 1050; break; | 1417 | break; |
1218 | case 1: | 1418 | case 3: x = 800; y = 600; |
1219 | default: x = 640; y = 480; break; | 1419 | break; |
1420 | case 4: x = 1400; y = 1050; | ||
1421 | break; | ||
1422 | case 1: | ||
1423 | default: | ||
1424 | x = 640; y = 480; | ||
1425 | break; | ||
1220 | } | 1426 | } |
1221 | 1427 | ||
1222 | if (verbosity > 0) | 1428 | if (verbosity > 0) |
1223 | output("%dx%d flat panel found\n",x,y); | 1429 | output("%dx%d flat panel found\n", x, y); |
1224 | return x; | 1430 | return x; |
1225 | } | 1431 | } |
1226 | 1432 | ||
1227 | static int __devinit cybla_pci_probe(struct pci_dev * dev, | 1433 | static int __devinit cybla_pci_probe(struct pci_dev *dev, |
1228 | const struct pci_device_id * id) | 1434 | const struct pci_device_id *id) |
1229 | { | 1435 | { |
1230 | struct fb_info *info; | 1436 | struct fb_info *info; |
1231 | struct cyblafb_par *par; | 1437 | struct cyblafb_par *par; |
1232 | 1438 | ||
1233 | info = framebuffer_alloc(sizeof(struct cyblafb_par),&dev->dev); | 1439 | info = framebuffer_alloc(sizeof(struct cyblafb_par), &dev->dev); |
1234 | |||
1235 | if (!info) | 1440 | if (!info) |
1236 | goto errout_alloc; | 1441 | goto errout_alloc_info; |
1442 | |||
1443 | info->pixmap.addr = kzalloc(CYBLAFB_PIXMAPSIZE, GFP_KERNEL); | ||
1444 | if (!info->pixmap.addr) { | ||
1445 | output("allocation of pixmap buffer failed!\n"); | ||
1446 | goto errout_alloc_pixmap; | ||
1447 | } | ||
1448 | info->pixmap.size = CYBLAFB_PIXMAPSIZE - 4; | ||
1449 | info->pixmap.buf_align = 4; | ||
1450 | info->pixmap.access_align = 32; | ||
1451 | info->pixmap.flags = FB_PIXMAP_SYSTEM; | ||
1452 | info->pixmap.scan_align = 4; | ||
1237 | 1453 | ||
1238 | par = info->par; | 1454 | par = info->par; |
1239 | par->ops = cyblafb_ops; | 1455 | par->ops = cyblafb_ops; |
@@ -1246,26 +1462,31 @@ static int __devinit cybla_pci_probe(struct pci_dev * dev, | |||
1246 | output("could not enable device!\n"); | 1462 | output("could not enable device!\n"); |
1247 | goto errout_enable; | 1463 | goto errout_enable; |
1248 | } | 1464 | } |
1249 | |||
1250 | // might already be requested by vga console or vesafb, | 1465 | // might already be requested by vga console or vesafb, |
1251 | // so we do care about success | 1466 | // so we do care about success |
1252 | request_region(0x3c0,32,"cyblafb"); | 1467 | if (!request_region(0x3c0, 0x20, "cyblafb")) { |
1468 | output("region 0x3c0/0x20 already reserved\n"); | ||
1469 | vesafb |= 1; | ||
1253 | 1470 | ||
1471 | } | ||
1254 | // | 1472 | // |
1255 | // Graphics Engine Registers | 1473 | // Graphics Engine Registers |
1256 | // | 1474 | // |
1257 | request_region(GEBase,0x100,"cyblafb"); | 1475 | if (!request_region(GEBase, 0x100, "cyblafb")) { |
1476 | output("region %#x/0x100 already reserved\n", GEBase); | ||
1477 | vesafb |= 2; | ||
1478 | } | ||
1258 | 1479 | ||
1259 | regdump(par); | 1480 | regdump(par); |
1260 | 1481 | ||
1261 | enable_mmio(); | 1482 | enable_mmio(); |
1262 | 1483 | ||
1263 | // setup MMIO region | 1484 | // setup MMIO region |
1264 | info->fix.mmio_start = pci_resource_start(dev,1); | 1485 | info->fix.mmio_start = pci_resource_start(dev, 1); |
1265 | info->fix.mmio_len = 0x20000; | 1486 | info->fix.mmio_len = 0x20000; |
1266 | 1487 | ||
1267 | if (!request_mem_region(info->fix.mmio_start, | 1488 | if (!request_mem_region(info->fix.mmio_start, |
1268 | info->fix.mmio_len,"cyblafb")) { | 1489 | info->fix.mmio_len, "cyblafb")) { |
1269 | output("request_mem_region failed for mmio region!\n"); | 1490 | output("request_mem_region failed for mmio region!\n"); |
1270 | goto errout_mmio_reqmem; | 1491 | goto errout_mmio_reqmem; |
1271 | } | 1492 | } |
@@ -1276,18 +1497,17 @@ static int __devinit cybla_pci_probe(struct pci_dev * dev, | |||
1276 | output("ioremap failed for mmio region\n"); | 1497 | output("ioremap failed for mmio region\n"); |
1277 | goto errout_mmio_remap; | 1498 | goto errout_mmio_remap; |
1278 | } | 1499 | } |
1279 | |||
1280 | // setup framebuffer memory ... might already be requested | 1500 | // setup framebuffer memory ... might already be requested |
1281 | // by vesafb. Not to fail in case of an unsuccessful request | 1501 | // by vesafb. Not to fail in case of an unsuccessful request |
1282 | // is useful for the development cycle | 1502 | // is useful if both are loaded. |
1283 | info->fix.smem_start = pci_resource_start(dev,0); | 1503 | info->fix.smem_start = pci_resource_start(dev, 0); |
1284 | info->fix.smem_len = get_memsize(); | 1504 | info->fix.smem_len = get_memsize(); |
1285 | 1505 | ||
1286 | if (!request_mem_region(info->fix.smem_start, | 1506 | if (!request_mem_region(info->fix.smem_start, |
1287 | info->fix.smem_len,"cyblafb")) { | 1507 | info->fix.smem_len, "cyblafb")) { |
1288 | output("request_mem_region failed for smem region!\n"); | 1508 | output("region %#lx/%#x already reserved\n", |
1289 | if (!vesafb) | 1509 | info->fix.smem_start, info->fix.smem_len); |
1290 | goto errout_smem_req; | 1510 | vesafb |= 4; |
1291 | } | 1511 | } |
1292 | 1512 | ||
1293 | info->screen_base = ioremap_nocache(info->fix.smem_start, | 1513 | info->screen_base = ioremap_nocache(info->fix.smem_start, |
@@ -1300,31 +1520,30 @@ static int __devinit cybla_pci_probe(struct pci_dev * dev, | |||
1300 | 1520 | ||
1301 | displaytype = get_displaytype(); | 1521 | displaytype = get_displaytype(); |
1302 | 1522 | ||
1303 | if(displaytype == DISPLAY_FP) | 1523 | if (displaytype == DISPLAY_FP) |
1304 | nativex = get_nativex(); | 1524 | nativex = get_nativex(); |
1305 | 1525 | ||
1306 | // | 1526 | info->flags = FBINFO_DEFAULT |
1307 | // FBINFO_HWACCEL_YWRAP .... does not work (could be made to work?) | 1527 | | FBINFO_HWACCEL_COPYAREA |
1308 | // FBINFO_PARTIAL_PAN_OK .... is not ok | 1528 | | FBINFO_HWACCEL_FILLRECT |
1309 | // FBINFO_READS_FAST .... is necessary for optimal scrolling | 1529 | | FBINFO_HWACCEL_IMAGEBLIT |
1310 | // | 1530 | | FBINFO_READS_FAST |
1311 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | 1531 | // | FBINFO_PARTIAL_PAN_OK |
1312 | | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | 1532 | | FBINFO_MISC_ALWAYS_SETPAR; |
1313 | | FBINFO_HWACCEL_IMAGEBLIT | FBINFO_READS_FAST; | ||
1314 | 1533 | ||
1315 | info->pseudo_palette = par->pseudo_pal; | 1534 | info->pseudo_palette = par->pseudo_pal; |
1316 | 1535 | ||
1317 | if(getstartupmode(info)) | 1536 | if (getstartupmode(info)) |
1318 | goto errout_findmode; | 1537 | goto errout_findmode; |
1319 | 1538 | ||
1320 | fb_alloc_cmap(&info->cmap,256,0); | 1539 | fb_alloc_cmap(&info->cmap, 256, 0); |
1321 | 1540 | ||
1322 | if (register_framebuffer(info)) { | 1541 | if (register_framebuffer(info)) { |
1323 | output("Could not register CyBla framebuffer\n"); | 1542 | output("Could not register CyBla framebuffer\n"); |
1324 | goto errout_register; | 1543 | goto errout_register; |
1325 | } | 1544 | } |
1326 | 1545 | ||
1327 | pci_set_drvdata(dev,info); | 1546 | pci_set_drvdata(dev, info); |
1328 | 1547 | ||
1329 | // | 1548 | // |
1330 | // normal exit and error paths | 1549 | // normal exit and error paths |
@@ -1332,23 +1551,24 @@ static int __devinit cybla_pci_probe(struct pci_dev * dev, | |||
1332 | 1551 | ||
1333 | return 0; | 1552 | return 0; |
1334 | 1553 | ||
1335 | errout_register: | 1554 | errout_register: |
1336 | errout_findmode: | 1555 | errout_findmode: |
1337 | iounmap(info->screen_base); | 1556 | iounmap(info->screen_base); |
1338 | errout_smem_remap: | 1557 | errout_smem_remap: |
1339 | release_mem_region(info->fix.smem_start, | 1558 | if (!(vesafb & 4)) |
1340 | info->fix.smem_len); | 1559 | release_mem_region(info->fix.smem_start, info->fix.smem_len); |
1341 | errout_smem_req: | ||
1342 | iounmap(io_virt); | 1560 | iounmap(io_virt); |
1343 | errout_mmio_remap: | 1561 | errout_mmio_remap: |
1344 | release_mem_region(info->fix.mmio_start, | 1562 | release_mem_region(info->fix.mmio_start, info->fix.mmio_len); |
1345 | info->fix.mmio_len); | 1563 | errout_mmio_reqmem: |
1346 | errout_mmio_reqmem: | 1564 | if (!(vesafb & 1)) |
1347 | // release_region(0x3c0,32); | 1565 | release_region(0x3c0, 32); |
1348 | errout_enable: | 1566 | errout_enable: |
1567 | kfree(info->pixmap.addr); | ||
1568 | errout_alloc_pixmap: | ||
1349 | framebuffer_release(info); | 1569 | framebuffer_release(info); |
1350 | errout_alloc: | 1570 | errout_alloc_info: |
1351 | output("CyblaFB version %s aborting init.\n",VERSION); | 1571 | output("CyblaFB version %s aborting init.\n", VERSION); |
1352 | return -ENODEV; | 1572 | return -ENODEV; |
1353 | } | 1573 | } |
1354 | 1574 | ||
@@ -1359,35 +1579,41 @@ static void __devexit cybla_pci_remove(struct pci_dev *dev) | |||
1359 | unregister_framebuffer(info); | 1579 | unregister_framebuffer(info); |
1360 | iounmap(io_virt); | 1580 | iounmap(io_virt); |
1361 | iounmap(info->screen_base); | 1581 | iounmap(info->screen_base); |
1362 | release_mem_region(info->fix.smem_start,info->fix.smem_len); | 1582 | if (!(vesafb & 4)) |
1363 | release_mem_region(info->fix.mmio_start,info->fix.mmio_len); | 1583 | release_mem_region(info->fix.smem_start, info->fix.smem_len); |
1584 | release_mem_region(info->fix.mmio_start, info->fix.mmio_len); | ||
1364 | fb_dealloc_cmap(&info->cmap); | 1585 | fb_dealloc_cmap(&info->cmap); |
1586 | if (!(vesafb & 2)) | ||
1587 | release_region(GEBase, 0x100); | ||
1588 | if (!(vesafb & 1)) | ||
1589 | release_region(0x3c0, 32); | ||
1590 | kfree(info->pixmap.addr); | ||
1365 | framebuffer_release(info); | 1591 | framebuffer_release(info); |
1366 | output("CyblaFB version %s normal exit.\n",VERSION); | 1592 | output("CyblaFB version %s normal exit.\n", VERSION); |
1367 | } | 1593 | } |
1368 | 1594 | ||
1369 | // | 1595 | // |
1370 | // List of boards that we are trying to support | 1596 | // List of boards that we are trying to support |
1371 | // | 1597 | // |
1372 | static struct pci_device_id cybla_devices[] = { | 1598 | static struct pci_device_id cybla_devices[] = { |
1373 | {PCI_VENDOR_ID_TRIDENT,CYBERBLADEi1,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, | 1599 | {PCI_VENDOR_ID_TRIDENT, CYBERBLADEi1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
1374 | {0,} | 1600 | {0,} |
1375 | }; | 1601 | }; |
1376 | 1602 | ||
1377 | MODULE_DEVICE_TABLE(pci,cybla_devices); | 1603 | MODULE_DEVICE_TABLE(pci, cybla_devices); |
1378 | 1604 | ||
1379 | static struct pci_driver cyblafb_pci_driver = { | 1605 | static struct pci_driver cyblafb_pci_driver = { |
1380 | .name = "cyblafb", | 1606 | .name = "cyblafb", |
1381 | .id_table = cybla_devices, | 1607 | .id_table = cybla_devices, |
1382 | .probe = cybla_pci_probe, | 1608 | .probe = cybla_pci_probe, |
1383 | .remove = __devexit_p(cybla_pci_remove) | 1609 | .remove = __devexit_p(cybla_pci_remove) |
1384 | }; | 1610 | }; |
1385 | 1611 | ||
1386 | //============================================================= | 1612 | //============================================================= |
1387 | // | 1613 | // |
1388 | // kernel command line example: | 1614 | // kernel command line example: |
1389 | // | 1615 | // |
1390 | // video=cyblafb:1280x1024,bpp=16,ref=50 ... | 1616 | // video=cyblafb:1280x1024, bpp=16, ref=50 ... |
1391 | // | 1617 | // |
1392 | // modprobe command line example: | 1618 | // modprobe command line example: |
1393 | // | 1619 | // |
@@ -1401,46 +1627,46 @@ static int __devinit cyblafb_init(void) | |||
1401 | char *options = NULL; | 1627 | char *options = NULL; |
1402 | char *opt; | 1628 | char *opt; |
1403 | 1629 | ||
1404 | if (fb_get_options("cyblafb",&options)) | 1630 | if (fb_get_options("cyblafb", &options)) |
1405 | return -ENODEV; | 1631 | return -ENODEV; |
1406 | 1632 | ||
1407 | if (options && *options) | 1633 | if (options && *options) |
1408 | while((opt = strsep(&options,",")) != NULL ) { | 1634 | while ((opt = strsep(&options, ",")) != NULL) { |
1409 | if (!*opt) continue; | 1635 | if (!*opt) |
1410 | else if (!strncmp(opt,"bpp=",4)) | 1636 | continue; |
1411 | bpp = simple_strtoul(opt+4,NULL,0); | 1637 | else if (!strncmp(opt, "bpp=", 4)) |
1412 | else if (!strncmp(opt,"ref=",4)) | 1638 | bpp = simple_strtoul(opt + 4, NULL, 0); |
1413 | ref = simple_strtoul(opt+4,NULL,0); | 1639 | else if (!strncmp(opt, "ref=", 4)) |
1414 | else if (!strncmp(opt,"fp",2)) | 1640 | ref = simple_strtoul(opt + 4, NULL, 0); |
1641 | else if (!strncmp(opt, "fp", 2)) | ||
1415 | displaytype = DISPLAY_FP; | 1642 | displaytype = DISPLAY_FP; |
1416 | else if (!strncmp(opt,"crt",3)) | 1643 | else if (!strncmp(opt, "crt", 3)) |
1417 | displaytype = DISPLAY_CRT; | 1644 | displaytype = DISPLAY_CRT; |
1418 | else if (!strncmp(opt,"nativex=",8)) | 1645 | else if (!strncmp(opt, "nativex=", 8)) |
1419 | nativex = simple_strtoul(opt+8,NULL,0); | 1646 | nativex = simple_strtoul(opt + 8, NULL, 0); |
1420 | else if (!strncmp(opt,"center",6)) | 1647 | else if (!strncmp(opt, "center", 6)) |
1421 | center = 1; | 1648 | center = 1; |
1422 | else if (!strncmp(opt,"stretch",7)) | 1649 | else if (!strncmp(opt, "stretch", 7)) |
1423 | stretch = 1; | 1650 | stretch = 1; |
1424 | else if (!strncmp(opt,"pciwb=",6)) | 1651 | else if (!strncmp(opt, "pciwb=", 6)) |
1425 | pciwb = simple_strtoul(opt+6,NULL,0); | 1652 | pciwb = simple_strtoul(opt + 6, NULL, 0); |
1426 | else if (!strncmp(opt,"pcirb=",6)) | 1653 | else if (!strncmp(opt, "pcirb=", 6)) |
1427 | pcirb = simple_strtoul(opt+6,NULL,0); | 1654 | pcirb = simple_strtoul(opt + 6, NULL, 0); |
1428 | else if (!strncmp(opt,"pciwr=",6)) | 1655 | else if (!strncmp(opt, "pciwr=", 6)) |
1429 | pciwr = simple_strtoul(opt+6,NULL,0); | 1656 | pciwr = simple_strtoul(opt + 6, NULL, 0); |
1430 | else if (!strncmp(opt,"pcirr=",6)) | 1657 | else if (!strncmp(opt, "pcirr=", 6)) |
1431 | pcirr = simple_strtoul(opt+6,NULL,0); | 1658 | pcirr = simple_strtoul(opt + 6, NULL, 0); |
1432 | else if (!strncmp(opt,"memsize=",8)) | 1659 | else if (!strncmp(opt, "memsize=", 8)) |
1433 | memsize = simple_strtoul(opt+8,NULL,0); | 1660 | memsize = simple_strtoul(opt + 8, NULL, 0); |
1434 | else if (!strncmp(opt,"verbosity=",10)) | 1661 | else if (!strncmp(opt, "verbosity=", 10)) |
1435 | verbosity = simple_strtoul(opt+10,NULL,0); | 1662 | verbosity = simple_strtoul(opt + 10, NULL, 0); |
1436 | else if (!strncmp(opt,"vesafb",6)) | ||
1437 | vesafb = 1; | ||
1438 | else | 1663 | else |
1439 | mode = opt; | 1664 | mode = opt; |
1440 | } | 1665 | } |
1441 | #endif | 1666 | #endif |
1442 | output("CyblaFB version %s initializing\n",VERSION); | 1667 | output("CyblaFB version %s initializing\n", VERSION); |
1443 | return pci_module_init(&cyblafb_pci_driver); | 1668 | return pci_module_init(&cyblafb_pci_driver); |
1669 | return pci_register_driver(&cyblafb_pci_driver); | ||
1444 | } | 1670 | } |
1445 | 1671 | ||
1446 | static void __exit cyblafb_exit(void) | 1672 | static void __exit cyblafb_exit(void) |
diff --git a/drivers/video/fbcvt.c b/drivers/video/fbcvt.c index 0b6af00d197e..ac90883dc3aa 100644 --- a/drivers/video/fbcvt.c +++ b/drivers/video/fbcvt.c | |||
@@ -214,12 +214,11 @@ static void fb_cvt_print_name(struct fb_cvt_data *cvt) | |||
214 | { | 214 | { |
215 | u32 pixcount, pixcount_mod; | 215 | u32 pixcount, pixcount_mod; |
216 | int cnt = 255, offset = 0, read = 0; | 216 | int cnt = 255, offset = 0, read = 0; |
217 | u8 *buf = kmalloc(256, GFP_KERNEL); | 217 | u8 *buf = kzalloc(256, GFP_KERNEL); |
218 | 218 | ||
219 | if (!buf) | 219 | if (!buf) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | memset(buf, 0, 256); | ||
223 | pixcount = (cvt->xres * (cvt->yres/cvt->interlace))/1000000; | 222 | pixcount = (cvt->xres * (cvt->yres/cvt->interlace))/1000000; |
224 | pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; | 223 | pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; |
225 | pixcount_mod /= 1000; | 224 | pixcount_mod /= 1000; |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 10dfdf035264..d2dede6ed3e5 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -589,17 +589,19 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
589 | return info->fbops->fb_read(file, buf, count, ppos); | 589 | return info->fbops->fb_read(file, buf, count, ppos); |
590 | 590 | ||
591 | total_size = info->screen_size; | 591 | total_size = info->screen_size; |
592 | |||
592 | if (total_size == 0) | 593 | if (total_size == 0) |
593 | total_size = info->fix.smem_len; | 594 | total_size = info->fix.smem_len; |
594 | 595 | ||
595 | if (p >= total_size) | 596 | if (p >= total_size) |
596 | return 0; | 597 | return 0; |
598 | |||
597 | if (count >= total_size) | 599 | if (count >= total_size) |
598 | count = total_size; | 600 | count = total_size; |
601 | |||
599 | if (count + p > total_size) | 602 | if (count + p > total_size) |
600 | count = total_size - p; | 603 | count = total_size - p; |
601 | 604 | ||
602 | cnt = 0; | ||
603 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, | 605 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, |
604 | GFP_KERNEL); | 606 | GFP_KERNEL); |
605 | if (!buffer) | 607 | if (!buffer) |
@@ -636,6 +638,7 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
636 | } | 638 | } |
637 | 639 | ||
638 | kfree(buffer); | 640 | kfree(buffer); |
641 | |||
639 | return (err) ? err : cnt; | 642 | return (err) ? err : cnt; |
640 | } | 643 | } |
641 | 644 | ||
@@ -648,7 +651,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
648 | struct fb_info *info = registered_fb[fbidx]; | 651 | struct fb_info *info = registered_fb[fbidx]; |
649 | u32 *buffer, *src; | 652 | u32 *buffer, *src; |
650 | u32 __iomem *dst; | 653 | u32 __iomem *dst; |
651 | int c, i, cnt = 0, err; | 654 | int c, i, cnt = 0, err = 0; |
652 | unsigned long total_size; | 655 | unsigned long total_size; |
653 | 656 | ||
654 | if (!info || !info->screen_base) | 657 | if (!info || !info->screen_base) |
@@ -661,19 +664,19 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
661 | return info->fbops->fb_write(file, buf, count, ppos); | 664 | return info->fbops->fb_write(file, buf, count, ppos); |
662 | 665 | ||
663 | total_size = info->screen_size; | 666 | total_size = info->screen_size; |
667 | |||
664 | if (total_size == 0) | 668 | if (total_size == 0) |
665 | total_size = info->fix.smem_len; | 669 | total_size = info->fix.smem_len; |
666 | 670 | ||
667 | if (p > total_size) | 671 | if (p > total_size) |
668 | return -ENOSPC; | 672 | return 0; |
673 | |||
669 | if (count >= total_size) | 674 | if (count >= total_size) |
670 | count = total_size; | 675 | count = total_size; |
671 | err = 0; | 676 | |
672 | if (count + p > total_size) { | 677 | if (count + p > total_size) |
673 | count = total_size - p; | 678 | count = total_size - p; |
674 | err = -ENOSPC; | 679 | |
675 | } | ||
676 | cnt = 0; | ||
677 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, | 680 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, |
678 | GFP_KERNEL); | 681 | GFP_KERNEL); |
679 | if (!buffer) | 682 | if (!buffer) |
@@ -687,12 +690,15 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
687 | while (count) { | 690 | while (count) { |
688 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; | 691 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; |
689 | src = buffer; | 692 | src = buffer; |
693 | |||
690 | if (copy_from_user(src, buf, c)) { | 694 | if (copy_from_user(src, buf, c)) { |
691 | err = -EFAULT; | 695 | err = -EFAULT; |
692 | break; | 696 | break; |
693 | } | 697 | } |
698 | |||
694 | for (i = c >> 2; i--; ) | 699 | for (i = c >> 2; i--; ) |
695 | fb_writel(*src++, dst++); | 700 | fb_writel(*src++, dst++); |
701 | |||
696 | if (c & 3) { | 702 | if (c & 3) { |
697 | u8 *src8 = (u8 *) src; | 703 | u8 *src8 = (u8 *) src; |
698 | u8 __iomem *dst8 = (u8 __iomem *) dst; | 704 | u8 __iomem *dst8 = (u8 __iomem *) dst; |
@@ -702,11 +708,13 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
702 | 708 | ||
703 | dst = (u32 __iomem *) dst8; | 709 | dst = (u32 __iomem *) dst8; |
704 | } | 710 | } |
711 | |||
705 | *ppos += c; | 712 | *ppos += c; |
706 | buf += c; | 713 | buf += c; |
707 | cnt += c; | 714 | cnt += c; |
708 | count -= c; | 715 | count -= c; |
709 | } | 716 | } |
717 | |||
710 | kfree(buffer); | 718 | kfree(buffer); |
711 | 719 | ||
712 | return (err) ? err : cnt; | 720 | return (err) ? err : cnt; |
@@ -949,7 +957,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
949 | default: | 957 | default: |
950 | if (fb->fb_ioctl == NULL) | 958 | if (fb->fb_ioctl == NULL) |
951 | return -EINVAL; | 959 | return -EINVAL; |
952 | return fb->fb_ioctl(inode, file, cmd, arg, info); | 960 | return fb->fb_ioctl(info, cmd, arg); |
953 | } | 961 | } |
954 | } | 962 | } |
955 | 963 | ||
@@ -1099,7 +1107,7 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1099 | 1107 | ||
1100 | default: | 1108 | default: |
1101 | if (fb->fb_compat_ioctl) | 1109 | if (fb->fb_compat_ioctl) |
1102 | ret = fb->fb_compat_ioctl(file, cmd, arg, info); | 1110 | ret = fb->fb_compat_ioctl(info, cmd, arg); |
1103 | break; | 1111 | break; |
1104 | } | 1112 | } |
1105 | unlock_kernel(); | 1113 | unlock_kernel(); |
@@ -1127,7 +1135,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
1127 | if (fb->fb_mmap) { | 1135 | if (fb->fb_mmap) { |
1128 | int res; | 1136 | int res; |
1129 | lock_kernel(); | 1137 | lock_kernel(); |
1130 | res = fb->fb_mmap(info, file, vma); | 1138 | res = fb->fb_mmap(info, vma); |
1131 | unlock_kernel(); | 1139 | unlock_kernel(); |
1132 | return res; | 1140 | return res; |
1133 | } | 1141 | } |
@@ -1226,6 +1234,7 @@ fb_open(struct inode *inode, struct file *file) | |||
1226 | return -ENODEV; | 1234 | return -ENODEV; |
1227 | if (!try_module_get(info->fbops->owner)) | 1235 | if (!try_module_get(info->fbops->owner)) |
1228 | return -ENODEV; | 1236 | return -ENODEV; |
1237 | file->private_data = info; | ||
1229 | if (info->fbops->fb_open) { | 1238 | if (info->fbops->fb_open) { |
1230 | res = info->fbops->fb_open(info,1); | 1239 | res = info->fbops->fb_open(info,1); |
1231 | if (res) | 1240 | if (res) |
@@ -1237,11 +1246,9 @@ fb_open(struct inode *inode, struct file *file) | |||
1237 | static int | 1246 | static int |
1238 | fb_release(struct inode *inode, struct file *file) | 1247 | fb_release(struct inode *inode, struct file *file) |
1239 | { | 1248 | { |
1240 | int fbidx = iminor(inode); | 1249 | struct fb_info * const info = file->private_data; |
1241 | struct fb_info *info; | ||
1242 | 1250 | ||
1243 | lock_kernel(); | 1251 | lock_kernel(); |
1244 | info = registered_fb[fbidx]; | ||
1245 | if (info->fbops->fb_release) | 1252 | if (info->fbops->fb_release) |
1246 | info->fbops->fb_release(info,1); | 1253 | info->fbops->fb_release(info,1); |
1247 | module_put(info->fbops->owner); | 1254 | module_put(info->fbops->owner); |
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index fc7965b66775..7c74e7325d95 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c | |||
@@ -317,26 +317,29 @@ static int edid_is_monitor_block(unsigned char *block) | |||
317 | static void calc_mode_timings(int xres, int yres, int refresh, | 317 | static void calc_mode_timings(int xres, int yres, int refresh, |
318 | struct fb_videomode *mode) | 318 | struct fb_videomode *mode) |
319 | { | 319 | { |
320 | struct fb_var_screeninfo var; | 320 | struct fb_var_screeninfo *var; |
321 | struct fb_info info; | ||
322 | 321 | ||
323 | memset(&var, 0, sizeof(struct fb_var_screeninfo)); | 322 | var = kzalloc(sizeof(struct fb_var_screeninfo), GFP_KERNEL); |
324 | var.xres = xres; | 323 | |
325 | var.yres = yres; | 324 | if (var) { |
326 | fb_get_mode(FB_VSYNCTIMINGS | FB_IGNOREMON, | 325 | var->xres = xres; |
327 | refresh, &var, &info); | 326 | var->yres = yres; |
328 | mode->xres = xres; | 327 | fb_get_mode(FB_VSYNCTIMINGS | FB_IGNOREMON, |
329 | mode->yres = yres; | 328 | refresh, var, NULL); |
330 | mode->pixclock = var.pixclock; | 329 | mode->xres = xres; |
331 | mode->refresh = refresh; | 330 | mode->yres = yres; |
332 | mode->left_margin = var.left_margin; | 331 | mode->pixclock = var->pixclock; |
333 | mode->right_margin = var.right_margin; | 332 | mode->refresh = refresh; |
334 | mode->upper_margin = var.upper_margin; | 333 | mode->left_margin = var->left_margin; |
335 | mode->lower_margin = var.lower_margin; | 334 | mode->right_margin = var->right_margin; |
336 | mode->hsync_len = var.hsync_len; | 335 | mode->upper_margin = var->upper_margin; |
337 | mode->vsync_len = var.vsync_len; | 336 | mode->lower_margin = var->lower_margin; |
338 | mode->vmode = 0; | 337 | mode->hsync_len = var->hsync_len; |
339 | mode->sync = 0; | 338 | mode->vsync_len = var->vsync_len; |
339 | mode->vmode = 0; | ||
340 | mode->sync = 0; | ||
341 | kfree(var); | ||
342 | } | ||
340 | } | 343 | } |
341 | 344 | ||
342 | static int get_est_timing(unsigned char *block, struct fb_videomode *mode) | 345 | static int get_est_timing(unsigned char *block, struct fb_videomode *mode) |
@@ -525,10 +528,9 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize) | |||
525 | unsigned char *block; | 528 | unsigned char *block; |
526 | int num = 0, i; | 529 | int num = 0, i; |
527 | 530 | ||
528 | mode = kmalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); | 531 | mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); |
529 | if (mode == NULL) | 532 | if (mode == NULL) |
530 | return NULL; | 533 | return NULL; |
531 | memset(mode, 0, 50 * sizeof(struct fb_videomode)); | ||
532 | 534 | ||
533 | if (edid == NULL || !edid_checksum(edid) || | 535 | if (edid == NULL || !edid_checksum(edid) || |
534 | !edid_check_header(edid)) { | 536 | !edid_check_header(edid)) { |
@@ -1105,15 +1107,21 @@ static void fb_timings_dclk(struct __fb_timings *timings) | |||
1105 | */ | 1107 | */ |
1106 | int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_info *info) | 1108 | int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_info *info) |
1107 | { | 1109 | { |
1108 | struct __fb_timings timings; | 1110 | struct __fb_timings *timings; |
1109 | u32 interlace = 1, dscan = 1; | 1111 | u32 interlace = 1, dscan = 1; |
1110 | u32 hfmin, hfmax, vfmin, vfmax, dclkmin, dclkmax; | 1112 | u32 hfmin, hfmax, vfmin, vfmax, dclkmin, dclkmax, err = 0; |
1113 | |||
1114 | |||
1115 | timings = kzalloc(sizeof(struct __fb_timings), GFP_KERNEL); | ||
1116 | |||
1117 | if (!timings) | ||
1118 | return -ENOMEM; | ||
1111 | 1119 | ||
1112 | /* | 1120 | /* |
1113 | * If monspecs are invalid, use values that are enough | 1121 | * If monspecs are invalid, use values that are enough |
1114 | * for 640x480@60 | 1122 | * for 640x480@60 |
1115 | */ | 1123 | */ |
1116 | if (!info->monspecs.hfmax || !info->monspecs.vfmax || | 1124 | if (!info || !info->monspecs.hfmax || !info->monspecs.vfmax || |
1117 | !info->monspecs.dclkmax || | 1125 | !info->monspecs.dclkmax || |
1118 | info->monspecs.hfmax < info->monspecs.hfmin || | 1126 | info->monspecs.hfmax < info->monspecs.hfmin || |
1119 | info->monspecs.vfmax < info->monspecs.vfmin || | 1127 | info->monspecs.vfmax < info->monspecs.vfmin || |
@@ -1130,65 +1138,66 @@ int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_inf | |||
1130 | dclkmax = info->monspecs.dclkmax; | 1138 | dclkmax = info->monspecs.dclkmax; |
1131 | } | 1139 | } |
1132 | 1140 | ||
1133 | memset(&timings, 0, sizeof(struct __fb_timings)); | 1141 | timings->hactive = var->xres; |
1134 | timings.hactive = var->xres; | 1142 | timings->vactive = var->yres; |
1135 | timings.vactive = var->yres; | ||
1136 | if (var->vmode & FB_VMODE_INTERLACED) { | 1143 | if (var->vmode & FB_VMODE_INTERLACED) { |
1137 | timings.vactive /= 2; | 1144 | timings->vactive /= 2; |
1138 | interlace = 2; | 1145 | interlace = 2; |
1139 | } | 1146 | } |
1140 | if (var->vmode & FB_VMODE_DOUBLE) { | 1147 | if (var->vmode & FB_VMODE_DOUBLE) { |
1141 | timings.vactive *= 2; | 1148 | timings->vactive *= 2; |
1142 | dscan = 2; | 1149 | dscan = 2; |
1143 | } | 1150 | } |
1144 | 1151 | ||
1145 | switch (flags & ~FB_IGNOREMON) { | 1152 | switch (flags & ~FB_IGNOREMON) { |
1146 | case FB_MAXTIMINGS: /* maximize refresh rate */ | 1153 | case FB_MAXTIMINGS: /* maximize refresh rate */ |
1147 | timings.hfreq = hfmax; | 1154 | timings->hfreq = hfmax; |
1148 | fb_timings_hfreq(&timings); | 1155 | fb_timings_hfreq(timings); |
1149 | if (timings.vfreq > vfmax) { | 1156 | if (timings->vfreq > vfmax) { |
1150 | timings.vfreq = vfmax; | 1157 | timings->vfreq = vfmax; |
1151 | fb_timings_vfreq(&timings); | 1158 | fb_timings_vfreq(timings); |
1152 | } | 1159 | } |
1153 | if (timings.dclk > dclkmax) { | 1160 | if (timings->dclk > dclkmax) { |
1154 | timings.dclk = dclkmax; | 1161 | timings->dclk = dclkmax; |
1155 | fb_timings_dclk(&timings); | 1162 | fb_timings_dclk(timings); |
1156 | } | 1163 | } |
1157 | break; | 1164 | break; |
1158 | case FB_VSYNCTIMINGS: /* vrefresh driven */ | 1165 | case FB_VSYNCTIMINGS: /* vrefresh driven */ |
1159 | timings.vfreq = val; | 1166 | timings->vfreq = val; |
1160 | fb_timings_vfreq(&timings); | 1167 | fb_timings_vfreq(timings); |
1161 | break; | 1168 | break; |
1162 | case FB_HSYNCTIMINGS: /* hsync driven */ | 1169 | case FB_HSYNCTIMINGS: /* hsync driven */ |
1163 | timings.hfreq = val; | 1170 | timings->hfreq = val; |
1164 | fb_timings_hfreq(&timings); | 1171 | fb_timings_hfreq(timings); |
1165 | break; | 1172 | break; |
1166 | case FB_DCLKTIMINGS: /* pixelclock driven */ | 1173 | case FB_DCLKTIMINGS: /* pixelclock driven */ |
1167 | timings.dclk = PICOS2KHZ(val) * 1000; | 1174 | timings->dclk = PICOS2KHZ(val) * 1000; |
1168 | fb_timings_dclk(&timings); | 1175 | fb_timings_dclk(timings); |
1169 | break; | 1176 | break; |
1170 | default: | 1177 | default: |
1171 | return -EINVAL; | 1178 | err = -EINVAL; |
1172 | 1179 | ||
1173 | } | 1180 | } |
1174 | 1181 | ||
1175 | if (!(flags & FB_IGNOREMON) && | 1182 | if (err || (!(flags & FB_IGNOREMON) && |
1176 | (timings.vfreq < vfmin || timings.vfreq > vfmax || | 1183 | (timings->vfreq < vfmin || timings->vfreq > vfmax || |
1177 | timings.hfreq < hfmin || timings.hfreq > hfmax || | 1184 | timings->hfreq < hfmin || timings->hfreq > hfmax || |
1178 | timings.dclk < dclkmin || timings.dclk > dclkmax)) | 1185 | timings->dclk < dclkmin || timings->dclk > dclkmax))) { |
1179 | return -EINVAL; | 1186 | err = -EINVAL; |
1180 | 1187 | } else { | |
1181 | var->pixclock = KHZ2PICOS(timings.dclk/1000); | 1188 | var->pixclock = KHZ2PICOS(timings->dclk/1000); |
1182 | var->hsync_len = (timings.htotal * 8)/100; | 1189 | var->hsync_len = (timings->htotal * 8)/100; |
1183 | var->right_margin = (timings.hblank/2) - var->hsync_len; | 1190 | var->right_margin = (timings->hblank/2) - var->hsync_len; |
1184 | var->left_margin = timings.hblank - var->right_margin - var->hsync_len; | 1191 | var->left_margin = timings->hblank - var->right_margin - |
1185 | 1192 | var->hsync_len; | |
1186 | var->vsync_len = (3 * interlace)/dscan; | 1193 | var->vsync_len = (3 * interlace)/dscan; |
1187 | var->lower_margin = (1 * interlace)/dscan; | 1194 | var->lower_margin = (1 * interlace)/dscan; |
1188 | var->upper_margin = (timings.vblank * interlace)/dscan - | 1195 | var->upper_margin = (timings->vblank * interlace)/dscan - |
1189 | (var->vsync_len + var->lower_margin); | 1196 | (var->vsync_len + var->lower_margin); |
1197 | } | ||
1190 | 1198 | ||
1191 | return 0; | 1199 | kfree(timings); |
1200 | return err; | ||
1192 | } | 1201 | } |
1193 | #else | 1202 | #else |
1194 | int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) | 1203 | int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 08dac9580d15..6d26057337e2 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -43,10 +43,11 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) | |||
43 | if (size) | 43 | if (size) |
44 | fb_info_size += PADDING; | 44 | fb_info_size += PADDING; |
45 | 45 | ||
46 | p = kmalloc(fb_info_size + size, GFP_KERNEL); | 46 | p = kzalloc(fb_info_size + size, GFP_KERNEL); |
47 | |||
47 | if (!p) | 48 | if (!p) |
48 | return NULL; | 49 | return NULL; |
49 | memset(p, 0, fb_info_size + size); | 50 | |
50 | info = (struct fb_info *) p; | 51 | info = (struct fb_info *) p; |
51 | 52 | ||
52 | if (size) | 53 | if (size) |
@@ -106,8 +107,7 @@ static int mode_string(char *buf, unsigned int offset, | |||
106 | static ssize_t store_mode(struct class_device *class_device, const char * buf, | 107 | static ssize_t store_mode(struct class_device *class_device, const char * buf, |
107 | size_t count) | 108 | size_t count) |
108 | { | 109 | { |
109 | struct fb_info *fb_info = | 110 | struct fb_info *fb_info = class_get_devdata(class_device); |
110 | (struct fb_info *)class_get_devdata(class_device); | ||
111 | char mstr[100]; | 111 | char mstr[100]; |
112 | struct fb_var_screeninfo var; | 112 | struct fb_var_screeninfo var; |
113 | struct fb_modelist *modelist; | 113 | struct fb_modelist *modelist; |
@@ -137,8 +137,7 @@ static ssize_t store_mode(struct class_device *class_device, const char * buf, | |||
137 | 137 | ||
138 | static ssize_t show_mode(struct class_device *class_device, char *buf) | 138 | static ssize_t show_mode(struct class_device *class_device, char *buf) |
139 | { | 139 | { |
140 | struct fb_info *fb_info = | 140 | struct fb_info *fb_info = class_get_devdata(class_device); |
141 | (struct fb_info *)class_get_devdata(class_device); | ||
142 | 141 | ||
143 | if (!fb_info->mode) | 142 | if (!fb_info->mode) |
144 | return 0; | 143 | return 0; |
@@ -149,8 +148,7 @@ static ssize_t show_mode(struct class_device *class_device, char *buf) | |||
149 | static ssize_t store_modes(struct class_device *class_device, const char * buf, | 148 | static ssize_t store_modes(struct class_device *class_device, const char * buf, |
150 | size_t count) | 149 | size_t count) |
151 | { | 150 | { |
152 | struct fb_info *fb_info = | 151 | struct fb_info *fb_info = class_get_devdata(class_device); |
153 | (struct fb_info *)class_get_devdata(class_device); | ||
154 | LIST_HEAD(old_list); | 152 | LIST_HEAD(old_list); |
155 | int i = count / sizeof(struct fb_videomode); | 153 | int i = count / sizeof(struct fb_videomode); |
156 | 154 | ||
@@ -174,8 +172,7 @@ static ssize_t store_modes(struct class_device *class_device, const char * buf, | |||
174 | 172 | ||
175 | static ssize_t show_modes(struct class_device *class_device, char *buf) | 173 | static ssize_t show_modes(struct class_device *class_device, char *buf) |
176 | { | 174 | { |
177 | struct fb_info *fb_info = | 175 | struct fb_info *fb_info = class_get_devdata(class_device); |
178 | (struct fb_info *)class_get_devdata(class_device); | ||
179 | unsigned int i; | 176 | unsigned int i; |
180 | struct list_head *pos; | 177 | struct list_head *pos; |
181 | struct fb_modelist *modelist; | 178 | struct fb_modelist *modelist; |
@@ -193,8 +190,7 @@ static ssize_t show_modes(struct class_device *class_device, char *buf) | |||
193 | static ssize_t store_bpp(struct class_device *class_device, const char * buf, | 190 | static ssize_t store_bpp(struct class_device *class_device, const char * buf, |
194 | size_t count) | 191 | size_t count) |
195 | { | 192 | { |
196 | struct fb_info *fb_info = | 193 | struct fb_info *fb_info = class_get_devdata(class_device); |
197 | (struct fb_info *)class_get_devdata(class_device); | ||
198 | struct fb_var_screeninfo var; | 194 | struct fb_var_screeninfo var; |
199 | char ** last = NULL; | 195 | char ** last = NULL; |
200 | int err; | 196 | int err; |
@@ -208,8 +204,7 @@ static ssize_t store_bpp(struct class_device *class_device, const char * buf, | |||
208 | 204 | ||
209 | static ssize_t show_bpp(struct class_device *class_device, char *buf) | 205 | static ssize_t show_bpp(struct class_device *class_device, char *buf) |
210 | { | 206 | { |
211 | struct fb_info *fb_info = | 207 | struct fb_info *fb_info = class_get_devdata(class_device); |
212 | (struct fb_info *)class_get_devdata(class_device); | ||
213 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.bits_per_pixel); | 208 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.bits_per_pixel); |
214 | } | 209 | } |
215 | 210 | ||
@@ -280,8 +275,7 @@ static ssize_t show_con_rotate(struct class_device *class_device, char *buf) | |||
280 | static ssize_t store_virtual(struct class_device *class_device, | 275 | static ssize_t store_virtual(struct class_device *class_device, |
281 | const char * buf, size_t count) | 276 | const char * buf, size_t count) |
282 | { | 277 | { |
283 | struct fb_info *fb_info = | 278 | struct fb_info *fb_info = class_get_devdata(class_device); |
284 | (struct fb_info *)class_get_devdata(class_device); | ||
285 | struct fb_var_screeninfo var; | 279 | struct fb_var_screeninfo var; |
286 | char *last = NULL; | 280 | char *last = NULL; |
287 | int err; | 281 | int err; |
@@ -300,16 +294,14 @@ static ssize_t store_virtual(struct class_device *class_device, | |||
300 | 294 | ||
301 | static ssize_t show_virtual(struct class_device *class_device, char *buf) | 295 | static ssize_t show_virtual(struct class_device *class_device, char *buf) |
302 | { | 296 | { |
303 | struct fb_info *fb_info = | 297 | struct fb_info *fb_info = class_get_devdata(class_device); |
304 | (struct fb_info *)class_get_devdata(class_device); | ||
305 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xres_virtual, | 298 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xres_virtual, |
306 | fb_info->var.yres_virtual); | 299 | fb_info->var.yres_virtual); |
307 | } | 300 | } |
308 | 301 | ||
309 | static ssize_t show_stride(struct class_device *class_device, char *buf) | 302 | static ssize_t show_stride(struct class_device *class_device, char *buf) |
310 | { | 303 | { |
311 | struct fb_info *fb_info = | 304 | struct fb_info *fb_info = class_get_devdata(class_device); |
312 | (struct fb_info *)class_get_devdata(class_device); | ||
313 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); | 305 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); |
314 | } | 306 | } |
315 | 307 | ||
@@ -320,7 +312,7 @@ static ssize_t show_stride(struct class_device *class_device, char *buf) | |||
320 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, | 312 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, |
321 | size_t count) | 313 | size_t count) |
322 | { | 314 | { |
323 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 315 | struct fb_info *fb_info = class_get_devdata(class_device); |
324 | int rc, i, start, length, transp = 0; | 316 | int rc, i, start, length, transp = 0; |
325 | 317 | ||
326 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) | 318 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) |
@@ -380,8 +372,7 @@ static ssize_t store_cmap(struct class_device *class_device, const char *buf, | |||
380 | 372 | ||
381 | static ssize_t show_cmap(struct class_device *class_device, char *buf) | 373 | static ssize_t show_cmap(struct class_device *class_device, char *buf) |
382 | { | 374 | { |
383 | struct fb_info *fb_info = | 375 | struct fb_info *fb_info = class_get_devdata(class_device); |
384 | (struct fb_info *)class_get_devdata(class_device); | ||
385 | unsigned int i; | 376 | unsigned int i; |
386 | 377 | ||
387 | if (!fb_info->cmap.red || !fb_info->cmap.blue || | 378 | if (!fb_info->cmap.red || !fb_info->cmap.blue || |
@@ -405,8 +396,7 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf) | |||
405 | static ssize_t store_blank(struct class_device *class_device, const char * buf, | 396 | static ssize_t store_blank(struct class_device *class_device, const char * buf, |
406 | size_t count) | 397 | size_t count) |
407 | { | 398 | { |
408 | struct fb_info *fb_info = | 399 | struct fb_info *fb_info = class_get_devdata(class_device); |
409 | (struct fb_info *)class_get_devdata(class_device); | ||
410 | char *last = NULL; | 400 | char *last = NULL; |
411 | int err; | 401 | int err; |
412 | 402 | ||
@@ -422,41 +412,40 @@ static ssize_t store_blank(struct class_device *class_device, const char * buf, | |||
422 | 412 | ||
423 | static ssize_t show_blank(struct class_device *class_device, char *buf) | 413 | static ssize_t show_blank(struct class_device *class_device, char *buf) |
424 | { | 414 | { |
425 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 415 | // struct fb_info *fb_info = class_get_devdata(class_device); |
426 | return 0; | 416 | return 0; |
427 | } | 417 | } |
428 | 418 | ||
429 | static ssize_t store_console(struct class_device *class_device, | 419 | static ssize_t store_console(struct class_device *class_device, |
430 | const char * buf, size_t count) | 420 | const char * buf, size_t count) |
431 | { | 421 | { |
432 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 422 | // struct fb_info *fb_info = class_get_devdata(class_device); |
433 | return 0; | 423 | return 0; |
434 | } | 424 | } |
435 | 425 | ||
436 | static ssize_t show_console(struct class_device *class_device, char *buf) | 426 | static ssize_t show_console(struct class_device *class_device, char *buf) |
437 | { | 427 | { |
438 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 428 | // struct fb_info *fb_info = class_get_devdata(class_device); |
439 | return 0; | 429 | return 0; |
440 | } | 430 | } |
441 | 431 | ||
442 | static ssize_t store_cursor(struct class_device *class_device, | 432 | static ssize_t store_cursor(struct class_device *class_device, |
443 | const char * buf, size_t count) | 433 | const char * buf, size_t count) |
444 | { | 434 | { |
445 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 435 | // struct fb_info *fb_info = class_get_devdata(class_device); |
446 | return 0; | 436 | return 0; |
447 | } | 437 | } |
448 | 438 | ||
449 | static ssize_t show_cursor(struct class_device *class_device, char *buf) | 439 | static ssize_t show_cursor(struct class_device *class_device, char *buf) |
450 | { | 440 | { |
451 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 441 | // struct fb_info *fb_info = class_get_devdata(class_device); |
452 | return 0; | 442 | return 0; |
453 | } | 443 | } |
454 | 444 | ||
455 | static ssize_t store_pan(struct class_device *class_device, const char * buf, | 445 | static ssize_t store_pan(struct class_device *class_device, const char * buf, |
456 | size_t count) | 446 | size_t count) |
457 | { | 447 | { |
458 | struct fb_info *fb_info = | 448 | struct fb_info *fb_info = class_get_devdata(class_device); |
459 | (struct fb_info *)class_get_devdata(class_device); | ||
460 | struct fb_var_screeninfo var; | 449 | struct fb_var_screeninfo var; |
461 | char *last = NULL; | 450 | char *last = NULL; |
462 | int err; | 451 | int err; |
@@ -479,19 +468,40 @@ static ssize_t store_pan(struct class_device *class_device, const char * buf, | |||
479 | 468 | ||
480 | static ssize_t show_pan(struct class_device *class_device, char *buf) | 469 | static ssize_t show_pan(struct class_device *class_device, char *buf) |
481 | { | 470 | { |
482 | struct fb_info *fb_info = | 471 | struct fb_info *fb_info = class_get_devdata(class_device); |
483 | (struct fb_info *)class_get_devdata(class_device); | ||
484 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xoffset, | 472 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xoffset, |
485 | fb_info->var.xoffset); | 473 | fb_info->var.xoffset); |
486 | } | 474 | } |
487 | 475 | ||
488 | static ssize_t show_name(struct class_device *class_device, char *buf) | 476 | static ssize_t show_name(struct class_device *class_device, char *buf) |
489 | { | 477 | { |
490 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 478 | struct fb_info *fb_info = class_get_devdata(class_device); |
491 | 479 | ||
492 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); | 480 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); |
493 | } | 481 | } |
494 | 482 | ||
483 | static ssize_t store_fbstate(struct class_device *class_device, | ||
484 | const char *buf, size_t count) | ||
485 | { | ||
486 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
487 | u32 state; | ||
488 | char *last = NULL; | ||
489 | |||
490 | state = simple_strtoul(buf, &last, 0); | ||
491 | |||
492 | acquire_console_sem(); | ||
493 | fb_set_suspend(fb_info, (int)state); | ||
494 | release_console_sem(); | ||
495 | |||
496 | return count; | ||
497 | } | ||
498 | |||
499 | static ssize_t show_fbstate(struct class_device *class_device, char *buf) | ||
500 | { | ||
501 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
502 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->state); | ||
503 | } | ||
504 | |||
495 | static struct class_device_attribute class_device_attrs[] = { | 505 | static struct class_device_attribute class_device_attrs[] = { |
496 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), | 506 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), |
497 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), | 507 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), |
@@ -507,6 +517,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
507 | __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), | 517 | __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), |
508 | __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), | 518 | __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), |
509 | __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), | 519 | __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), |
520 | __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate), | ||
510 | }; | 521 | }; |
511 | 522 | ||
512 | int fb_init_class_device(struct fb_info *fb_info) | 523 | int fb_init_class_device(struct fb_info *fb_info) |
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index c4870d559afc..9c9b21d469a1 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
@@ -37,9 +37,8 @@ static void ffb_imageblit(struct fb_info *, const struct fb_image *); | |||
37 | static void ffb_fillrect(struct fb_info *, const struct fb_fillrect *); | 37 | static void ffb_fillrect(struct fb_info *, const struct fb_fillrect *); |
38 | static void ffb_copyarea(struct fb_info *, const struct fb_copyarea *); | 38 | static void ffb_copyarea(struct fb_info *, const struct fb_copyarea *); |
39 | static int ffb_sync(struct fb_info *); | 39 | static int ffb_sync(struct fb_info *); |
40 | static int ffb_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 40 | static int ffb_mmap(struct fb_info *, struct vm_area_struct *); |
41 | static int ffb_ioctl(struct inode *, struct file *, unsigned int, | 41 | static int ffb_ioctl(struct fb_info *, unsigned int, unsigned long); |
42 | unsigned long, struct fb_info *); | ||
43 | static int ffb_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 42 | static int ffb_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
44 | 43 | ||
45 | /* | 44 | /* |
@@ -839,7 +838,7 @@ static struct sbus_mmap_map ffb_mmap_map[] = { | |||
839 | { .size = 0 } | 838 | { .size = 0 } |
840 | }; | 839 | }; |
841 | 840 | ||
842 | static int ffb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 841 | static int ffb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
843 | { | 842 | { |
844 | struct ffb_par *par = (struct ffb_par *)info->par; | 843 | struct ffb_par *par = (struct ffb_par *)info->par; |
845 | 844 | ||
@@ -848,8 +847,7 @@ static int ffb_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
848 | 0, vma); | 847 | 0, vma); |
849 | } | 848 | } |
850 | 849 | ||
851 | static int ffb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 850 | static int ffb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
852 | unsigned long arg, struct fb_info *info) | ||
853 | { | 851 | { |
854 | struct ffb_par *par = (struct ffb_par *) info->par; | 852 | struct ffb_par *par = (struct ffb_par *) info->par; |
855 | 853 | ||
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index d744c51807b7..38d22729b129 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -979,7 +979,7 @@ static int gbefb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
979 | return 0; | 979 | return 0; |
980 | } | 980 | } |
981 | 981 | ||
982 | static int gbefb_mmap(struct fb_info *info, struct file *file, | 982 | static int gbefb_mmap(struct fb_info *info, |
983 | struct vm_area_struct *vma) | 983 | struct vm_area_struct *vma) |
984 | { | 984 | { |
985 | unsigned long size = vma->vm_end - vma->vm_start; | 985 | unsigned long size = vma->vm_end - vma->vm_start; |
@@ -1000,7 +1000,6 @@ static int gbefb_mmap(struct fb_info *info, struct file *file, | |||
1000 | pgprot_fb(pgprot_val(vma->vm_page_prot)); | 1000 | pgprot_fb(pgprot_val(vma->vm_page_prot)); |
1001 | 1001 | ||
1002 | vma->vm_flags |= VM_IO | VM_RESERVED; | 1002 | vma->vm_flags |= VM_IO | VM_RESERVED; |
1003 | vma->vm_file = file; | ||
1004 | 1003 | ||
1005 | /* look for the starting tile */ | 1004 | /* look for the starting tile */ |
1006 | tile = &gbe_tiles.cpu[offset >> TILE_SHIFT]; | 1005 | tile = &gbe_tiles.cpu[offset >> TILE_SHIFT]; |
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/geode/gx1fb_core.c index 8e8da7433994..20e69156d728 100644 --- a/drivers/video/geode/gx1fb_core.c +++ b/drivers/video/geode/gx1fb_core.c | |||
@@ -215,11 +215,11 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d | |||
215 | if (ret < 0) | 215 | if (ret < 0) |
216 | return ret; | 216 | return ret; |
217 | 217 | ||
218 | ret = pci_request_region(dev, 1, "gx1fb (video)"); | 218 | ret = pci_request_region(dev, 0, "gx1fb (video)"); |
219 | if (ret < 0) | 219 | if (ret < 0) |
220 | return ret; | 220 | return ret; |
221 | par->vid_regs = ioremap(pci_resource_start(dev, 1), | 221 | par->vid_regs = ioremap(pci_resource_start(dev, 0), |
222 | pci_resource_len(dev, 1)); | 222 | pci_resource_len(dev, 0)); |
223 | if (!par->vid_regs) | 223 | if (!par->vid_regs) |
224 | return -ENOMEM; | 224 | return -ENOMEM; |
225 | 225 | ||
@@ -229,12 +229,9 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d | |||
229 | if (!par->dc_regs) | 229 | if (!par->dc_regs) |
230 | return -ENOMEM; | 230 | return -ENOMEM; |
231 | 231 | ||
232 | ret = pci_request_region(dev, 0, "gx1fb (frame buffer)"); | ||
233 | if (ret < 0 ) | ||
234 | return -EBUSY; | ||
235 | if ((fb_len = gx1_frame_buffer_size()) < 0) | 232 | if ((fb_len = gx1_frame_buffer_size()) < 0) |
236 | return -ENOMEM; | 233 | return -ENOMEM; |
237 | info->fix.smem_start = pci_resource_start(dev, 0); | 234 | info->fix.smem_start = gx_base + 0x800000; |
238 | info->fix.smem_len = fb_len; | 235 | info->fix.smem_len = fb_len; |
239 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); | 236 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); |
240 | if (!info->screen_base) | 237 | if (!info->screen_base) |
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index b37cea7d1094..4e39035cf335 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/fb.h> | 42 | #include <linux/fb.h> |
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/ioport.h> | 44 | #include <linux/ioport.h> |
45 | #include <linux/platform_device.h> | ||
45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
46 | #include <asm/vga.h> | 47 | #include <asm/vga.h> |
47 | 48 | ||
@@ -107,7 +108,7 @@ static DEFINE_SPINLOCK(hga_reg_lock); | |||
107 | 108 | ||
108 | /* Framebuffer driver structures */ | 109 | /* Framebuffer driver structures */ |
109 | 110 | ||
110 | static struct fb_var_screeninfo hga_default_var = { | 111 | static struct fb_var_screeninfo __initdata hga_default_var = { |
111 | .xres = 720, | 112 | .xres = 720, |
112 | .yres = 348, | 113 | .yres = 348, |
113 | .xres_virtual = 720, | 114 | .xres_virtual = 720, |
@@ -121,7 +122,7 @@ static struct fb_var_screeninfo hga_default_var = { | |||
121 | .width = -1, | 122 | .width = -1, |
122 | }; | 123 | }; |
123 | 124 | ||
124 | static struct fb_fix_screeninfo hga_fix = { | 125 | static struct fb_fix_screeninfo __initdata hga_fix = { |
125 | .id = "HGA", | 126 | .id = "HGA", |
126 | .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ | 127 | .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ |
127 | .visual = FB_VISUAL_MONO10, | 128 | .visual = FB_VISUAL_MONO10, |
@@ -131,8 +132,6 @@ static struct fb_fix_screeninfo hga_fix = { | |||
131 | .accel = FB_ACCEL_NONE | 132 | .accel = FB_ACCEL_NONE |
132 | }; | 133 | }; |
133 | 134 | ||
134 | static struct fb_info fb_info; | ||
135 | |||
136 | /* Don't assume that tty1 will be the initial current console. */ | 135 | /* Don't assume that tty1 will be the initial current console. */ |
137 | static int release_io_port = 0; | 136 | static int release_io_port = 0; |
138 | static int release_io_ports = 0; | 137 | static int release_io_ports = 0; |
@@ -549,10 +548,9 @@ static struct fb_ops hgafb_ops = { | |||
549 | * Initialization | 548 | * Initialization |
550 | */ | 549 | */ |
551 | 550 | ||
552 | static int __init hgafb_init(void) | 551 | static int __init hgafb_probe(struct device *device) |
553 | { | 552 | { |
554 | if (fb_get_options("hgafb", NULL)) | 553 | struct fb_info *info; |
555 | return -ENODEV; | ||
556 | 554 | ||
557 | if (! hga_card_detect()) { | 555 | if (! hga_card_detect()) { |
558 | printk(KERN_INFO "hgafb: HGA card not detected.\n"); | 556 | printk(KERN_INFO "hgafb: HGA card not detected.\n"); |
@@ -564,41 +562,95 @@ static int __init hgafb_init(void) | |||
564 | printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", | 562 | printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", |
565 | hga_type_name, hga_vram_len/1024); | 563 | hga_type_name, hga_vram_len/1024); |
566 | 564 | ||
565 | info = framebuffer_alloc(0, NULL); | ||
566 | if (!info) { | ||
567 | iounmap(hga_vram); | ||
568 | return -ENOMEM; | ||
569 | } | ||
570 | |||
567 | hga_fix.smem_start = (unsigned long)hga_vram; | 571 | hga_fix.smem_start = (unsigned long)hga_vram; |
568 | hga_fix.smem_len = hga_vram_len; | 572 | hga_fix.smem_len = hga_vram_len; |
569 | 573 | ||
570 | fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 574 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
571 | fb_info.var = hga_default_var; | 575 | info->var = hga_default_var; |
572 | fb_info.fix = hga_fix; | 576 | info->fix = hga_fix; |
573 | fb_info.monspecs.hfmin = 0; | 577 | info->monspecs.hfmin = 0; |
574 | fb_info.monspecs.hfmax = 0; | 578 | info->monspecs.hfmax = 0; |
575 | fb_info.monspecs.vfmin = 10000; | 579 | info->monspecs.vfmin = 10000; |
576 | fb_info.monspecs.vfmax = 10000; | 580 | info->monspecs.vfmax = 10000; |
577 | fb_info.monspecs.dpms = 0; | 581 | info->monspecs.dpms = 0; |
578 | fb_info.fbops = &hgafb_ops; | 582 | info->fbops = &hgafb_ops; |
579 | fb_info.screen_base = hga_vram; | 583 | info->screen_base = hga_vram; |
580 | 584 | ||
581 | if (register_framebuffer(&fb_info) < 0) { | 585 | if (register_framebuffer(info) < 0) { |
586 | framebuffer_release(info); | ||
582 | iounmap(hga_vram); | 587 | iounmap(hga_vram); |
583 | return -EINVAL; | 588 | return -EINVAL; |
584 | } | 589 | } |
585 | 590 | ||
586 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 591 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
587 | fb_info.node, fb_info.fix.id); | 592 | info->node, info->fix.id); |
593 | dev_set_drvdata(device, info); | ||
588 | return 0; | 594 | return 0; |
589 | } | 595 | } |
590 | 596 | ||
591 | #ifdef MODULE | 597 | static int hgafb_remove(struct device *device) |
592 | static void __exit hgafb_exit(void) | ||
593 | { | 598 | { |
599 | struct fb_info *info = dev_get_drvdata(device); | ||
600 | |||
594 | hga_txt_mode(); | 601 | hga_txt_mode(); |
595 | hga_clear_screen(); | 602 | hga_clear_screen(); |
596 | unregister_framebuffer(&fb_info); | 603 | |
604 | if (info) { | ||
605 | unregister_framebuffer(info); | ||
606 | framebuffer_release(info); | ||
607 | } | ||
608 | |||
597 | iounmap(hga_vram); | 609 | iounmap(hga_vram); |
598 | if (release_io_ports) release_region(0x3b0, 12); | 610 | |
599 | if (release_io_port) release_region(0x3bf, 1); | 611 | if (release_io_ports) |
612 | release_region(0x3b0, 12); | ||
613 | |||
614 | if (release_io_port) | ||
615 | release_region(0x3bf, 1); | ||
616 | |||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static struct device_driver hgafb_driver = { | ||
621 | .name = "hgafb", | ||
622 | .bus = &platform_bus_type, | ||
623 | .probe = hgafb_probe, | ||
624 | .remove = hgafb_remove, | ||
625 | }; | ||
626 | |||
627 | static struct platform_device hgafb_device = { | ||
628 | .name = "hgafb", | ||
629 | }; | ||
630 | |||
631 | static int __init hgafb_init(void) | ||
632 | { | ||
633 | int ret; | ||
634 | |||
635 | if (fb_get_options("hgafb", NULL)) | ||
636 | return -ENODEV; | ||
637 | |||
638 | ret = driver_register(&hgafb_driver); | ||
639 | |||
640 | if (!ret) { | ||
641 | ret = platform_device_register(&hgafb_device); | ||
642 | if (ret) | ||
643 | driver_unregister(&hgafb_driver); | ||
644 | } | ||
645 | |||
646 | return ret; | ||
647 | } | ||
648 | |||
649 | static void __exit hgafb_exit(void) | ||
650 | { | ||
651 | platform_device_unregister(&hgafb_device); | ||
652 | driver_unregister(&hgafb_driver); | ||
600 | } | 653 | } |
601 | #endif | ||
602 | 654 | ||
603 | /* ------------------------------------------------------------------------- | 655 | /* ------------------------------------------------------------------------- |
604 | * | 656 | * |
@@ -613,7 +665,4 @@ MODULE_LICENSE("GPL"); | |||
613 | module_param(nologo, bool, 0); | 665 | module_param(nologo, bool, 0); |
614 | MODULE_PARM_DESC(nologo, "Disables startup logo if != 0 (default=0)"); | 666 | MODULE_PARM_DESC(nologo, "Disables startup logo if != 0 (default=0)"); |
615 | module_init(hgafb_init); | 667 | module_init(hgafb_init); |
616 | |||
617 | #ifdef MODULE | ||
618 | module_exit(hgafb_exit); | 668 | module_exit(hgafb_exit); |
619 | #endif | ||
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c index c61bad0da20f..bd410e06db73 100644 --- a/drivers/video/i810/i810-i2c.c +++ b/drivers/video/i810/i810-i2c.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/fb.h> | 17 | #include <linux/fb.h> |
18 | #include "i810.h" | 18 | #include "i810.h" |
19 | #include "i810_regs.h" | 19 | #include "i810_regs.h" |
20 | #include "i810_main.h" | ||
20 | #include "../edid.h" | 21 | #include "../edid.h" |
21 | 22 | ||
22 | #define I810_DDC 0x50 | 23 | #define I810_DDC 0x50 |
@@ -42,7 +43,7 @@ | |||
42 | 43 | ||
43 | static void i810i2c_setscl(void *data, int state) | 44 | static void i810i2c_setscl(void *data, int state) |
44 | { | 45 | { |
45 | struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; | 46 | struct i810fb_i2c_chan *chan = data; |
46 | struct i810fb_par *par = chan->par; | 47 | struct i810fb_par *par = chan->par; |
47 | u8 __iomem *mmio = par->mmio_start_virtual; | 48 | u8 __iomem *mmio = par->mmio_start_virtual; |
48 | 49 | ||
diff --git a/drivers/video/i810/i810_accel.c b/drivers/video/i810/i810_accel.c index 64cd1c827cf0..76764ea3486a 100644 --- a/drivers/video/i810/i810_accel.c +++ b/drivers/video/i810/i810_accel.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include "i810_regs.h" | 15 | #include "i810_regs.h" |
16 | #include "i810.h" | 16 | #include "i810.h" |
17 | #include "i810_main.h" | ||
17 | 18 | ||
18 | static u32 i810fb_rop[] = { | 19 | static u32 i810fb_rop[] = { |
19 | COLOR_COPY_ROP, /* ROP_COPY */ | 20 | COLOR_COPY_ROP, /* ROP_COPY */ |
@@ -57,7 +58,7 @@ static inline void i810_report_error(u8 __iomem *mmio) | |||
57 | */ | 58 | */ |
58 | static inline int wait_for_space(struct fb_info *info, u32 space) | 59 | static inline int wait_for_space(struct fb_info *info, u32 space) |
59 | { | 60 | { |
60 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 61 | struct i810fb_par *par = info->par; |
61 | u32 head, count = WAIT_COUNT, tail; | 62 | u32 head, count = WAIT_COUNT, tail; |
62 | u8 __iomem *mmio = par->mmio_start_virtual; | 63 | u8 __iomem *mmio = par->mmio_start_virtual; |
63 | 64 | ||
@@ -88,7 +89,7 @@ static inline int wait_for_space(struct fb_info *info, u32 space) | |||
88 | */ | 89 | */ |
89 | static inline int wait_for_engine_idle(struct fb_info *info) | 90 | static inline int wait_for_engine_idle(struct fb_info *info) |
90 | { | 91 | { |
91 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 92 | struct i810fb_par *par = info->par; |
92 | u8 __iomem *mmio = par->mmio_start_virtual; | 93 | u8 __iomem *mmio = par->mmio_start_virtual; |
93 | int count = WAIT_COUNT; | 94 | int count = WAIT_COUNT; |
94 | 95 | ||
@@ -116,7 +117,7 @@ static inline int wait_for_engine_idle(struct fb_info *info) | |||
116 | */ | 117 | */ |
117 | static inline u32 begin_iring(struct fb_info *info, u32 space) | 118 | static inline u32 begin_iring(struct fb_info *info, u32 space) |
118 | { | 119 | { |
119 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 120 | struct i810fb_par *par = info->par; |
120 | 121 | ||
121 | if (par->dev_flags & ALWAYS_SYNC) | 122 | if (par->dev_flags & ALWAYS_SYNC) |
122 | wait_for_engine_idle(info); | 123 | wait_for_engine_idle(info); |
@@ -161,7 +162,7 @@ static inline void source_copy_blit(int dwidth, int dheight, int dpitch, | |||
161 | int xdir, int src, int dest, int rop, | 162 | int xdir, int src, int dest, int rop, |
162 | int blit_bpp, struct fb_info *info) | 163 | int blit_bpp, struct fb_info *info) |
163 | { | 164 | { |
164 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 165 | struct i810fb_par *par = info->par; |
165 | 166 | ||
166 | if (begin_iring(info, 24 + IRING_PAD)) return; | 167 | if (begin_iring(info, 24 + IRING_PAD)) return; |
167 | 168 | ||
@@ -195,7 +196,7 @@ static inline void color_blit(int width, int height, int pitch, int dest, | |||
195 | int rop, int what, int blit_bpp, | 196 | int rop, int what, int blit_bpp, |
196 | struct fb_info *info) | 197 | struct fb_info *info) |
197 | { | 198 | { |
198 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 199 | struct i810fb_par *par = info->par; |
199 | 200 | ||
200 | if (begin_iring(info, 24 + IRING_PAD)) return; | 201 | if (begin_iring(info, 24 + IRING_PAD)) return; |
201 | 202 | ||
@@ -236,7 +237,7 @@ static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch, | |||
236 | int dest, const u32 *src, int bg, | 237 | int dest, const u32 *src, int bg, |
237 | int fg, struct fb_info *info) | 238 | int fg, struct fb_info *info) |
238 | { | 239 | { |
239 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 240 | struct i810fb_par *par = info->par; |
240 | 241 | ||
241 | if (begin_iring(info, 24 + (dsize << 2) + IRING_PAD)) return; | 242 | if (begin_iring(info, 24 + (dsize << 2) + IRING_PAD)) return; |
242 | 243 | ||
@@ -254,7 +255,7 @@ static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch, | |||
254 | 255 | ||
255 | static inline void load_front(int offset, struct fb_info *info) | 256 | static inline void load_front(int offset, struct fb_info *info) |
256 | { | 257 | { |
257 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 258 | struct i810fb_par *par = info->par; |
258 | 259 | ||
259 | if (begin_iring(info, 8 + IRING_PAD)) return; | 260 | if (begin_iring(info, 8 + IRING_PAD)) return; |
260 | 261 | ||
@@ -296,7 +297,7 @@ static inline void i810fb_iring_enable(struct i810fb_par *par, u32 mode) | |||
296 | 297 | ||
297 | void i810fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 298 | void i810fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
298 | { | 299 | { |
299 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 300 | struct i810fb_par *par = info->par; |
300 | u32 dx, dy, width, height, dest, rop = 0, color = 0; | 301 | u32 dx, dy, width, height, dest, rop = 0, color = 0; |
301 | 302 | ||
302 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || | 303 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || |
@@ -322,7 +323,7 @@ void i810fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
322 | 323 | ||
323 | void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 324 | void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
324 | { | 325 | { |
325 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 326 | struct i810fb_par *par = info->par; |
326 | u32 sx, sy, dx, dy, pitch, width, height, src, dest, xdir; | 327 | u32 sx, sy, dx, dy, pitch, width, height, src, dest, xdir; |
327 | 328 | ||
328 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || | 329 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || |
@@ -361,7 +362,7 @@ void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
361 | 362 | ||
362 | void i810fb_imageblit(struct fb_info *info, const struct fb_image *image) | 363 | void i810fb_imageblit(struct fb_info *info, const struct fb_image *image) |
363 | { | 364 | { |
364 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 365 | struct i810fb_par *par = info->par; |
365 | u32 fg = 0, bg = 0, size, dst; | 366 | u32 fg = 0, bg = 0, size, dst; |
366 | 367 | ||
367 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || | 368 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || |
@@ -397,7 +398,7 @@ void i810fb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
397 | 398 | ||
398 | int i810fb_sync(struct fb_info *info) | 399 | int i810fb_sync(struct fb_info *info) |
399 | { | 400 | { |
400 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 401 | struct i810fb_par *par = info->par; |
401 | 402 | ||
402 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) | 403 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) |
403 | return 0; | 404 | return 0; |
@@ -407,7 +408,7 @@ int i810fb_sync(struct fb_info *info) | |||
407 | 408 | ||
408 | void i810fb_load_front(u32 offset, struct fb_info *info) | 409 | void i810fb_load_front(u32 offset, struct fb_info *info) |
409 | { | 410 | { |
410 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 411 | struct i810fb_par *par = info->par; |
411 | u8 __iomem *mmio = par->mmio_start_virtual; | 412 | u8 __iomem *mmio = par->mmio_start_virtual; |
412 | 413 | ||
413 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) | 414 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) |
@@ -427,7 +428,7 @@ void i810fb_load_front(u32 offset, struct fb_info *info) | |||
427 | */ | 428 | */ |
428 | void i810fb_init_ringbuffer(struct fb_info *info) | 429 | void i810fb_init_ringbuffer(struct fb_info *info) |
429 | { | 430 | { |
430 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 431 | struct i810fb_par *par = info->par; |
431 | u32 tmp1, tmp2; | 432 | u32 tmp1, tmp2; |
432 | u8 __iomem *mmio = par->mmio_start_virtual; | 433 | u8 __iomem *mmio = par->mmio_start_virtual; |
433 | 434 | ||
diff --git a/drivers/video/i810/i810_gtf.c b/drivers/video/i810/i810_gtf.c index 64f087a4466b..9743d51e7f8c 100644 --- a/drivers/video/i810/i810_gtf.c +++ b/drivers/video/i810/i810_gtf.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include "i810_regs.h" | 15 | #include "i810_regs.h" |
16 | #include "i810.h" | 16 | #include "i810.h" |
17 | #include "i810_main.h" | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * FIFO and Watermark tables - based almost wholly on i810_wmark.c in | 20 | * FIFO and Watermark tables - based almost wholly on i810_wmark.c in |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index c0c974b1afaa..266d0ab92663 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -42,20 +42,62 @@ | |||
42 | #include <linux/pci_ids.h> | 42 | #include <linux/pci_ids.h> |
43 | #include <linux/resource.h> | 43 | #include <linux/resource.h> |
44 | #include <linux/unistd.h> | 44 | #include <linux/unistd.h> |
45 | #include <linux/console.h> | ||
45 | 46 | ||
46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
47 | #include <asm/div64.h> | 48 | #include <asm/div64.h> |
48 | |||
49 | #ifdef CONFIG_MTRR | ||
50 | #include <asm/mtrr.h> | ||
51 | #endif | ||
52 | |||
53 | #include <asm/page.h> | 49 | #include <asm/page.h> |
54 | 50 | ||
55 | #include "i810_regs.h" | 51 | #include "i810_regs.h" |
56 | #include "i810.h" | 52 | #include "i810.h" |
57 | #include "i810_main.h" | 53 | #include "i810_main.h" |
58 | 54 | ||
55 | /* | ||
56 | * voffset - framebuffer offset in MiB from aperture start address. In order for | ||
57 | * the driver to work with X, we must try to use memory holes left untouched by X. The | ||
58 | * following table lists where X's different surfaces start at. | ||
59 | * | ||
60 | * --------------------------------------------- | ||
61 | * : : 64 MiB : 32 MiB : | ||
62 | * ---------------------------------------------- | ||
63 | * : FrontBuffer : 0 : 0 : | ||
64 | * : DepthBuffer : 48 : 16 : | ||
65 | * : BackBuffer : 56 : 24 : | ||
66 | * ---------------------------------------------- | ||
67 | * | ||
68 | * So for chipsets with 64 MiB Aperture sizes, 32 MiB for v_offset is okay, allowing up to | ||
69 | * 15 + 1 MiB of Framebuffer memory. For 32 MiB Aperture sizes, a v_offset of 8 MiB should | ||
70 | * work, allowing 7 + 1 MiB of Framebuffer memory. | ||
71 | * Note, the size of the hole may change depending on how much memory you allocate to X, | ||
72 | * and how the memory is split up between these surfaces. | ||
73 | * | ||
74 | * Note: Anytime the DepthBuffer or FrontBuffer is overlapped, X would still run but with | ||
75 | * DRI disabled. But if the Frontbuffer is overlapped, X will fail to load. | ||
76 | * | ||
77 | * Experiment with v_offset to find out which works best for you. | ||
78 | */ | ||
79 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ | ||
80 | static u32 voffset __initdata = 0; | ||
81 | |||
82 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); | ||
83 | static int __devinit i810fb_init_pci (struct pci_dev *dev, | ||
84 | const struct pci_device_id *entry); | ||
85 | static void __exit i810fb_remove_pci(struct pci_dev *dev); | ||
86 | static int i810fb_resume(struct pci_dev *dev); | ||
87 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state); | ||
88 | |||
89 | /* Chipset Specific Functions */ | ||
90 | static int i810fb_set_par (struct fb_info *info); | ||
91 | static int i810fb_getcolreg (u8 regno, u8 *red, u8 *green, u8 *blue, | ||
92 | u8 *transp, struct fb_info *info); | ||
93 | static int i810fb_setcolreg (unsigned regno, unsigned red, unsigned green, unsigned blue, | ||
94 | unsigned transp, struct fb_info *info); | ||
95 | static int i810fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); | ||
96 | static int i810fb_blank (int blank_mode, struct fb_info *info); | ||
97 | |||
98 | /* Initialization */ | ||
99 | static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par); | ||
100 | |||
59 | /* PCI */ | 101 | /* PCI */ |
60 | static const char *i810_pci_list[] __devinitdata = { | 102 | static const char *i810_pci_list[] __devinitdata = { |
61 | "Intel(R) 810 Framebuffer Device" , | 103 | "Intel(R) 810 Framebuffer Device" , |
@@ -776,7 +818,7 @@ static void i810_load_cursor_image(int width, int height, u8 *data, | |||
776 | 818 | ||
777 | static void i810_load_cursor_colors(int fg, int bg, struct fb_info *info) | 819 | static void i810_load_cursor_colors(int fg, int bg, struct fb_info *info) |
778 | { | 820 | { |
779 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 821 | struct i810fb_par *par = info->par; |
780 | u8 __iomem *mmio = par->mmio_start_virtual; | 822 | u8 __iomem *mmio = par->mmio_start_virtual; |
781 | u8 red, green, blue, trans, temp; | 823 | u8 red, green, blue, trans, temp; |
782 | 824 | ||
@@ -949,7 +991,7 @@ static void set_color_bitfields(struct fb_var_screeninfo *var) | |||
949 | static int i810_check_params(struct fb_var_screeninfo *var, | 991 | static int i810_check_params(struct fb_var_screeninfo *var, |
950 | struct fb_info *info) | 992 | struct fb_info *info) |
951 | { | 993 | { |
952 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 994 | struct i810fb_par *par = info->par; |
953 | int line_length, vidmem, mode_valid = 0, retval = 0; | 995 | int line_length, vidmem, mode_valid = 0, retval = 0; |
954 | u32 vyres = var->yres_virtual, vxres = var->xres_virtual; | 996 | u32 vyres = var->yres_virtual, vxres = var->xres_virtual; |
955 | /* | 997 | /* |
@@ -1043,7 +1085,7 @@ static int i810_check_params(struct fb_var_screeninfo *var, | |||
1043 | */ | 1085 | */ |
1044 | static int encode_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | 1086 | static int encode_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) |
1045 | { | 1087 | { |
1046 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1088 | struct i810fb_par *par = info->par; |
1047 | 1089 | ||
1048 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); | 1090 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); |
1049 | 1091 | ||
@@ -1154,7 +1196,7 @@ static void decode_var(const struct fb_var_screeninfo *var, | |||
1154 | static int i810fb_getcolreg(u8 regno, u8 *red, u8 *green, u8 *blue, | 1196 | static int i810fb_getcolreg(u8 regno, u8 *red, u8 *green, u8 *blue, |
1155 | u8 *transp, struct fb_info *info) | 1197 | u8 *transp, struct fb_info *info) |
1156 | { | 1198 | { |
1157 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1199 | struct i810fb_par *par = info->par; |
1158 | u8 __iomem *mmio = par->mmio_start_virtual; | 1200 | u8 __iomem *mmio = par->mmio_start_virtual; |
1159 | u8 temp; | 1201 | u8 temp; |
1160 | 1202 | ||
@@ -1193,7 +1235,7 @@ static int i810fb_getcolreg(u8 regno, u8 *red, u8 *green, u8 *blue, | |||
1193 | 1235 | ||
1194 | static int i810fb_open(struct fb_info *info, int user) | 1236 | static int i810fb_open(struct fb_info *info, int user) |
1195 | { | 1237 | { |
1196 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1238 | struct i810fb_par *par = info->par; |
1197 | u32 count = atomic_read(&par->use_count); | 1239 | u32 count = atomic_read(&par->use_count); |
1198 | 1240 | ||
1199 | if (count == 0) { | 1241 | if (count == 0) { |
@@ -1212,7 +1254,7 @@ static int i810fb_open(struct fb_info *info, int user) | |||
1212 | 1254 | ||
1213 | static int i810fb_release(struct fb_info *info, int user) | 1255 | static int i810fb_release(struct fb_info *info, int user) |
1214 | { | 1256 | { |
1215 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1257 | struct i810fb_par *par = info->par; |
1216 | u32 count; | 1258 | u32 count; |
1217 | 1259 | ||
1218 | count = atomic_read(&par->use_count); | 1260 | count = atomic_read(&par->use_count); |
@@ -1234,7 +1276,7 @@ static int i810fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1234 | unsigned blue, unsigned transp, | 1276 | unsigned blue, unsigned transp, |
1235 | struct fb_info *info) | 1277 | struct fb_info *info) |
1236 | { | 1278 | { |
1237 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1279 | struct i810fb_par *par = info->par; |
1238 | u8 __iomem *mmio = par->mmio_start_virtual; | 1280 | u8 __iomem *mmio = par->mmio_start_virtual; |
1239 | u8 temp; | 1281 | u8 temp; |
1240 | int i; | 1282 | int i; |
@@ -1328,7 +1370,7 @@ static int i810fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1328 | static int i810fb_pan_display(struct fb_var_screeninfo *var, | 1370 | static int i810fb_pan_display(struct fb_var_screeninfo *var, |
1329 | struct fb_info *info) | 1371 | struct fb_info *info) |
1330 | { | 1372 | { |
1331 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1373 | struct i810fb_par *par = info->par; |
1332 | u32 total; | 1374 | u32 total; |
1333 | 1375 | ||
1334 | total = var->xoffset * par->depth + | 1376 | total = var->xoffset * par->depth + |
@@ -1340,7 +1382,7 @@ static int i810fb_pan_display(struct fb_var_screeninfo *var, | |||
1340 | 1382 | ||
1341 | static int i810fb_blank (int blank_mode, struct fb_info *info) | 1383 | static int i810fb_blank (int blank_mode, struct fb_info *info) |
1342 | { | 1384 | { |
1343 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1385 | struct i810fb_par *par = info->par; |
1344 | u8 __iomem *mmio = par->mmio_start_virtual; | 1386 | u8 __iomem *mmio = par->mmio_start_virtual; |
1345 | int mode = 0, pwr, scr_off = 0; | 1387 | int mode = 0, pwr, scr_off = 0; |
1346 | 1388 | ||
@@ -1385,7 +1427,7 @@ static int i810fb_blank (int blank_mode, struct fb_info *info) | |||
1385 | 1427 | ||
1386 | static int i810fb_set_par(struct fb_info *info) | 1428 | static int i810fb_set_par(struct fb_info *info) |
1387 | { | 1429 | { |
1388 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1430 | struct i810fb_par *par = info->par; |
1389 | 1431 | ||
1390 | decode_var(&info->var, par); | 1432 | decode_var(&info->var, par); |
1391 | i810_load_regs(par); | 1433 | i810_load_regs(par); |
@@ -1429,7 +1471,7 @@ static int i810fb_check_var(struct fb_var_screeninfo *var, | |||
1429 | 1471 | ||
1430 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1472 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1431 | { | 1473 | { |
1432 | struct i810fb_par *par = (struct i810fb_par *)info->par; | 1474 | struct i810fb_par *par = info->par; |
1433 | u8 __iomem *mmio = par->mmio_start_virtual; | 1475 | u8 __iomem *mmio = par->mmio_start_virtual; |
1434 | 1476 | ||
1435 | if (!par->dev_flags & LOCKUP) | 1477 | if (!par->dev_flags & LOCKUP) |
@@ -1516,36 +1558,29 @@ static struct fb_ops i810fb_ops __devinitdata = { | |||
1516 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) | 1558 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) |
1517 | { | 1559 | { |
1518 | struct fb_info *info = pci_get_drvdata(dev); | 1560 | struct fb_info *info = pci_get_drvdata(dev); |
1519 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1561 | struct i810fb_par *par = info->par; |
1520 | int blank = 0, prev_state = par->cur_state; | ||
1521 | |||
1522 | if (state.event == prev_state) | ||
1523 | return 0; | ||
1524 | 1562 | ||
1525 | par->cur_state = state.event; | 1563 | par->cur_state = state.event; |
1526 | 1564 | ||
1527 | switch (state.event) { | 1565 | if (state.event == PM_EVENT_FREEZE) { |
1528 | case 1: | 1566 | dev->dev.power.power_state = state; |
1529 | blank = VESA_VSYNC_SUSPEND; | 1567 | return 0; |
1530 | break; | ||
1531 | case 2: | ||
1532 | blank = VESA_HSYNC_SUSPEND; | ||
1533 | break; | ||
1534 | case 3: | ||
1535 | blank = VESA_POWERDOWN; | ||
1536 | break; | ||
1537 | default: | ||
1538 | return -EINVAL; | ||
1539 | } | 1568 | } |
1540 | info->fbops->fb_blank(blank, info); | ||
1541 | 1569 | ||
1542 | if (!prev_state) { | 1570 | acquire_console_sem(); |
1543 | agp_unbind_memory(par->i810_gtt.i810_fb_memory); | 1571 | fb_set_suspend(info, 1); |
1544 | agp_unbind_memory(par->i810_gtt.i810_cursor_memory); | 1572 | |
1545 | pci_disable_device(dev); | 1573 | if (info->fbops->fb_sync) |
1546 | } | 1574 | info->fbops->fb_sync(info); |
1575 | |||
1576 | i810fb_blank(FB_BLANK_POWERDOWN, info); | ||
1577 | agp_unbind_memory(par->i810_gtt.i810_fb_memory); | ||
1578 | agp_unbind_memory(par->i810_gtt.i810_cursor_memory); | ||
1579 | |||
1547 | pci_save_state(dev); | 1580 | pci_save_state(dev); |
1581 | pci_disable_device(dev); | ||
1548 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1582 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1583 | release_console_sem(); | ||
1549 | 1584 | ||
1550 | return 0; | 1585 | return 0; |
1551 | } | 1586 | } |
@@ -1553,23 +1588,29 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) | |||
1553 | static int i810fb_resume(struct pci_dev *dev) | 1588 | static int i810fb_resume(struct pci_dev *dev) |
1554 | { | 1589 | { |
1555 | struct fb_info *info = pci_get_drvdata(dev); | 1590 | struct fb_info *info = pci_get_drvdata(dev); |
1556 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1591 | struct i810fb_par *par = info->par; |
1592 | int cur_state = par->cur_state; | ||
1593 | |||
1594 | par->cur_state = PM_EVENT_ON; | ||
1557 | 1595 | ||
1558 | if (par->cur_state == 0) | 1596 | if (cur_state == PM_EVENT_FREEZE) { |
1597 | pci_set_power_state(dev, PCI_D0); | ||
1559 | return 0; | 1598 | return 0; |
1599 | } | ||
1560 | 1600 | ||
1561 | pci_restore_state(dev); | 1601 | acquire_console_sem(); |
1562 | pci_set_power_state(dev, PCI_D0); | 1602 | pci_set_power_state(dev, PCI_D0); |
1603 | pci_restore_state(dev); | ||
1563 | pci_enable_device(dev); | 1604 | pci_enable_device(dev); |
1605 | pci_set_master(dev); | ||
1564 | agp_bind_memory(par->i810_gtt.i810_fb_memory, | 1606 | agp_bind_memory(par->i810_gtt.i810_fb_memory, |
1565 | par->fb.offset); | 1607 | par->fb.offset); |
1566 | agp_bind_memory(par->i810_gtt.i810_cursor_memory, | 1608 | agp_bind_memory(par->i810_gtt.i810_cursor_memory, |
1567 | par->cursor_heap.offset); | 1609 | par->cursor_heap.offset); |
1568 | 1610 | i810fb_set_par(info); | |
1611 | fb_set_suspend (info, 0); | ||
1569 | info->fbops->fb_blank(VESA_NO_BLANKING, info); | 1612 | info->fbops->fb_blank(VESA_NO_BLANKING, info); |
1570 | 1613 | release_console_sem(); | |
1571 | par->cur_state = 0; | ||
1572 | |||
1573 | return 0; | 1614 | return 0; |
1574 | } | 1615 | } |
1575 | /*********************************************************************** | 1616 | /*********************************************************************** |
@@ -1610,7 +1651,7 @@ static void __devinit i810_fix_offsets(struct i810fb_par *par) | |||
1610 | 1651 | ||
1611 | static int __devinit i810_alloc_agp_mem(struct fb_info *info) | 1652 | static int __devinit i810_alloc_agp_mem(struct fb_info *info) |
1612 | { | 1653 | { |
1613 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1654 | struct i810fb_par *par = info->par; |
1614 | int size; | 1655 | int size; |
1615 | struct agp_bridge_data *bridge; | 1656 | struct agp_bridge_data *bridge; |
1616 | 1657 | ||
@@ -2074,7 +2115,7 @@ static void i810fb_release_resource(struct fb_info *info, | |||
2074 | static void __exit i810fb_remove_pci(struct pci_dev *dev) | 2115 | static void __exit i810fb_remove_pci(struct pci_dev *dev) |
2075 | { | 2116 | { |
2076 | struct fb_info *info = pci_get_drvdata(dev); | 2117 | struct fb_info *info = pci_get_drvdata(dev); |
2077 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 2118 | struct i810fb_par *par = info->par; |
2078 | 2119 | ||
2079 | unregister_framebuffer(info); | 2120 | unregister_framebuffer(info); |
2080 | i810fb_release_resource(info, par); | 2121 | i810fb_release_resource(info, par); |
diff --git a/drivers/video/i810/i810_main.h b/drivers/video/i810/i810_main.h index 06072a6466f2..51d4f3d4116d 100644 --- a/drivers/video/i810/i810_main.h +++ b/drivers/video/i810/i810_main.h | |||
@@ -14,55 +14,6 @@ | |||
14 | #ifndef __I810_MAIN_H__ | 14 | #ifndef __I810_MAIN_H__ |
15 | #define __I810_MAIN_H__ | 15 | #define __I810_MAIN_H__ |
16 | 16 | ||
17 | static int __devinit i810fb_init_pci (struct pci_dev *dev, | ||
18 | const struct pci_device_id *entry); | ||
19 | static void __exit i810fb_remove_pci(struct pci_dev *dev); | ||
20 | static int i810fb_resume(struct pci_dev *dev); | ||
21 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state); | ||
22 | |||
23 | /* | ||
24 | * voffset - framebuffer offset in MiB from aperture start address. In order for | ||
25 | * the driver to work with X, we must try to use memory holes left untouched by X. The | ||
26 | * following table lists where X's different surfaces start at. | ||
27 | * | ||
28 | * --------------------------------------------- | ||
29 | * : : 64 MiB : 32 MiB : | ||
30 | * ---------------------------------------------- | ||
31 | * : FrontBuffer : 0 : 0 : | ||
32 | * : DepthBuffer : 48 : 16 : | ||
33 | * : BackBuffer : 56 : 24 : | ||
34 | * ---------------------------------------------- | ||
35 | * | ||
36 | * So for chipsets with 64 MiB Aperture sizes, 32 MiB for v_offset is okay, allowing up to | ||
37 | * 15 + 1 MiB of Framebuffer memory. For 32 MiB Aperture sizes, a v_offset of 8 MiB should | ||
38 | * work, allowing 7 + 1 MiB of Framebuffer memory. | ||
39 | * Note, the size of the hole may change depending on how much memory you allocate to X, | ||
40 | * and how the memory is split up between these surfaces. | ||
41 | * | ||
42 | * Note: Anytime the DepthBuffer or FrontBuffer is overlapped, X would still run but with | ||
43 | * DRI disabled. But if the Frontbuffer is overlapped, X will fail to load. | ||
44 | * | ||
45 | * Experiment with v_offset to find out which works best for you. | ||
46 | */ | ||
47 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ | ||
48 | static u32 voffset __initdata = 0; | ||
49 | |||
50 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); | ||
51 | |||
52 | /* Chipset Specific Functions */ | ||
53 | static int i810fb_set_par (struct fb_info *info); | ||
54 | static int i810fb_getcolreg (u8 regno, u8 *red, u8 *green, u8 *blue, | ||
55 | u8 *transp, struct fb_info *info); | ||
56 | static int i810fb_setcolreg (unsigned regno, unsigned red, unsigned green, unsigned blue, | ||
57 | unsigned transp, struct fb_info *info); | ||
58 | static int i810fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); | ||
59 | static int i810fb_blank (int blank_mode, struct fb_info *info); | ||
60 | |||
61 | /* Initialization */ | ||
62 | static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par); | ||
63 | extern int __init agp_intel_init(void); | ||
64 | |||
65 | |||
66 | /* Video Timings */ | 17 | /* Video Timings */ |
67 | extern void round_off_xres (u32 *xres); | 18 | extern void round_off_xres (u32 *xres); |
68 | extern void round_off_yres (u32 *xres, u32 *yres); | 19 | extern void round_off_yres (u32 *xres, u32 *yres); |
@@ -101,7 +52,7 @@ static inline void i810_delete_i2c_busses(struct i810fb_par *par) { } | |||
101 | 52 | ||
102 | /* Conditionals */ | 53 | /* Conditionals */ |
103 | #ifdef CONFIG_X86 | 54 | #ifdef CONFIG_X86 |
104 | inline void flush_cache(void) | 55 | static inline void flush_cache(void) |
105 | { | 56 | { |
106 | asm volatile ("wbinvd":::"memory"); | 57 | asm volatile ("wbinvd":::"memory"); |
107 | } | 58 | } |
@@ -110,7 +61,9 @@ inline void flush_cache(void) | |||
110 | #endif | 61 | #endif |
111 | 62 | ||
112 | #ifdef CONFIG_MTRR | 63 | #ifdef CONFIG_MTRR |
113 | #define KERNEL_HAS_MTRR 1 | 64 | |
65 | #include <asm/mtrr.h> | ||
66 | |||
114 | static inline void __devinit set_mtrr(struct i810fb_par *par) | 67 | static inline void __devinit set_mtrr(struct i810fb_par *par) |
115 | { | 68 | { |
116 | par->mtrr_reg = mtrr_add((u32) par->aperture.physical, | 69 | par->mtrr_reg = mtrr_add((u32) par->aperture.physical, |
@@ -128,7 +81,6 @@ static inline void unset_mtrr(struct i810fb_par *par) | |||
128 | par->aperture.size); | 81 | par->aperture.size); |
129 | } | 82 | } |
130 | #else | 83 | #else |
131 | #define KERNEL_HAS_MTRR 0 | ||
132 | #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n") | 84 | #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n") |
133 | 85 | ||
134 | #define unset_mtrr(x) do { } while (0) | 86 | #define unset_mtrr(x) do { } while (0) |
diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c index e326f44f652d..6b88050d21bf 100644 --- a/drivers/video/igafb.c +++ b/drivers/video/igafb.c | |||
@@ -219,7 +219,7 @@ static void iga_blank_border(struct iga_par *par) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | #ifdef __sparc__ | 221 | #ifdef __sparc__ |
222 | static int igafb_mmap(struct fb_info *info, struct file *file, | 222 | static int igafb_mmap(struct fb_info *info, |
223 | struct vm_area_struct *vma) | 223 | struct vm_area_struct *vma) |
224 | { | 224 | { |
225 | struct iga_par *par = (struct iga_par *)info->par; | 225 | struct iga_par *par = (struct iga_par *)info->par; |
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 7fbe24206b19..ad416ae47596 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -323,6 +323,7 @@ struct imstt_par { | |||
323 | unsigned long cmap_regs_phys; | 323 | unsigned long cmap_regs_phys; |
324 | __u8 *cmap_regs; | 324 | __u8 *cmap_regs; |
325 | __u32 ramdac; | 325 | __u32 ramdac; |
326 | __u32 palette[16]; | ||
326 | }; | 327 | }; |
327 | 328 | ||
328 | enum { | 329 | enum { |
@@ -657,7 +658,7 @@ set_imstt_regvals_tvp (struct imstt_par *par, u_int bpp) | |||
657 | static void | 658 | static void |
658 | set_imstt_regvals (struct fb_info *info, u_int bpp) | 659 | set_imstt_regvals (struct fb_info *info, u_int bpp) |
659 | { | 660 | { |
660 | struct imstt_par *par = (struct imstt_par *) info->par; | 661 | struct imstt_par *par = info->par; |
661 | struct imstt_regvals *init = &par->init; | 662 | struct imstt_regvals *init = &par->init; |
662 | __u32 ctl, pitch, byteswap, scr; | 663 | __u32 ctl, pitch, byteswap, scr; |
663 | 664 | ||
@@ -749,7 +750,7 @@ set_imstt_regvals (struct fb_info *info, u_int bpp) | |||
749 | static inline void | 750 | static inline void |
750 | set_offset (struct fb_var_screeninfo *var, struct fb_info *info) | 751 | set_offset (struct fb_var_screeninfo *var, struct fb_info *info) |
751 | { | 752 | { |
752 | struct imstt_par *par = (struct imstt_par *) info->par; | 753 | struct imstt_par *par = info->par; |
753 | __u32 off = var->yoffset * (info->fix.line_length >> 3) | 754 | __u32 off = var->yoffset * (info->fix.line_length >> 3) |
754 | + ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3); | 755 | + ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3); |
755 | write_reg_le32(par->dc_regs, SSR, off); | 756 | write_reg_le32(par->dc_regs, SSR, off); |
@@ -863,7 +864,7 @@ imsttfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
863 | static int | 864 | static int |
864 | imsttfb_set_par(struct fb_info *info) | 865 | imsttfb_set_par(struct fb_info *info) |
865 | { | 866 | { |
866 | struct imstt_par *par = (struct imstt_par *) info->par; | 867 | struct imstt_par *par = info->par; |
867 | 868 | ||
868 | if (!compute_imstt_regvals(par, info->var.xres, info->var.yres)) | 869 | if (!compute_imstt_regvals(par, info->var.xres, info->var.yres)) |
869 | return -EINVAL; | 870 | return -EINVAL; |
@@ -881,7 +882,7 @@ static int | |||
881 | imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue, | 882 | imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue, |
882 | u_int transp, struct fb_info *info) | 883 | u_int transp, struct fb_info *info) |
883 | { | 884 | { |
884 | struct imstt_par *par = (struct imstt_par *) info->par; | 885 | struct imstt_par *par = info->par; |
885 | u_int bpp = info->var.bits_per_pixel; | 886 | u_int bpp = info->var.bits_per_pixel; |
886 | 887 | ||
887 | if (regno > 255) | 888 | if (regno > 255) |
@@ -905,14 +906,17 @@ imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue, | |||
905 | if (regno < 16) | 906 | if (regno < 16) |
906 | switch (bpp) { | 907 | switch (bpp) { |
907 | case 16: | 908 | case 16: |
908 | ((u16 *)info->pseudo_palette)[regno] = (regno << (info->var.green.length == 5 ? 10 : 11)) | (regno << 5) | regno; | 909 | par->palette[regno] = |
910 | (regno << (info->var.green.length == | ||
911 | 5 ? 10 : 11)) | (regno << 5) | regno; | ||
909 | break; | 912 | break; |
910 | case 24: | 913 | case 24: |
911 | ((u32 *)info->pseudo_palette)[regno] = (regno << 16) | (regno << 8) | regno; | 914 | par->palette[regno] = |
915 | (regno << 16) | (regno << 8) | regno; | ||
912 | break; | 916 | break; |
913 | case 32: { | 917 | case 32: { |
914 | int i = (regno << 8) | regno; | 918 | int i = (regno << 8) | regno; |
915 | ((u32 *)info->pseudo_palette)[regno] = (i << 16) | i; | 919 | par->palette[regno] = (i << 16) |i; |
916 | break; | 920 | break; |
917 | } | 921 | } |
918 | } | 922 | } |
@@ -935,7 +939,7 @@ imsttfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
935 | static int | 939 | static int |
936 | imsttfb_blank(int blank, struct fb_info *info) | 940 | imsttfb_blank(int blank, struct fb_info *info) |
937 | { | 941 | { |
938 | struct imstt_par *par = (struct imstt_par *) info->par; | 942 | struct imstt_par *par = info->par; |
939 | __u32 ctrl; | 943 | __u32 ctrl; |
940 | 944 | ||
941 | ctrl = read_reg_le32(par->dc_regs, STGCTL); | 945 | ctrl = read_reg_le32(par->dc_regs, STGCTL); |
@@ -989,7 +993,7 @@ imsttfb_blank(int blank, struct fb_info *info) | |||
989 | static void | 993 | static void |
990 | imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 994 | imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
991 | { | 995 | { |
992 | struct imstt_par *par = (struct imstt_par *) info->par; | 996 | struct imstt_par *par = info->par; |
993 | __u32 Bpp, line_pitch, bgc, dx, dy, width, height; | 997 | __u32 Bpp, line_pitch, bgc, dx, dy, width, height; |
994 | 998 | ||
995 | bgc = rect->color; | 999 | bgc = rect->color; |
@@ -1033,7 +1037,7 @@ imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
1033 | static void | 1037 | static void |
1034 | imsttfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 1038 | imsttfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
1035 | { | 1039 | { |
1036 | struct imstt_par *par = (struct imstt_par *) info->par; | 1040 | struct imstt_par *par = info->par; |
1037 | __u32 Bpp, line_pitch, fb_offset_old, fb_offset_new, sp, dp_octl; | 1041 | __u32 Bpp, line_pitch, fb_offset_old, fb_offset_new, sp, dp_octl; |
1038 | __u32 cnt, bltctl, sx, sy, dx, dy, height, width; | 1042 | __u32 cnt, bltctl, sx, sy, dx, dy, height, width; |
1039 | 1043 | ||
@@ -1195,7 +1199,7 @@ imstt_set_cursor(struct imstt_par *par, struct fb_image *d, int on) | |||
1195 | static int | 1199 | static int |
1196 | imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1200 | imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1197 | { | 1201 | { |
1198 | struct imstt_par *par = (struct imstt_par *) info->par; | 1202 | struct imstt_par *par = info->par; |
1199 | u32 flags = cursor->set, fg, bg, xx, yy; | 1203 | u32 flags = cursor->set, fg, bg, xx, yy; |
1200 | 1204 | ||
1201 | if (cursor->dest == NULL && cursor->rop == ROP_XOR) | 1205 | if (cursor->dest == NULL && cursor->rop == ROP_XOR) |
@@ -1263,10 +1267,9 @@ imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1263 | #define FBIMSTT_GETIDXREG 0x545406 | 1267 | #define FBIMSTT_GETIDXREG 0x545406 |
1264 | 1268 | ||
1265 | static int | 1269 | static int |
1266 | imsttfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 1270 | imsttfb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
1267 | u_long arg, struct fb_info *info) | ||
1268 | { | 1271 | { |
1269 | struct imstt_par *par = (struct imstt_par *) info->par; | 1272 | struct imstt_par *par = info->par; |
1270 | void __user *argp = (void __user *)arg; | 1273 | void __user *argp = (void __user *)arg; |
1271 | __u32 reg[2]; | 1274 | __u32 reg[2]; |
1272 | __u8 idx[2]; | 1275 | __u8 idx[2]; |
@@ -1350,7 +1353,7 @@ static struct fb_ops imsttfb_ops = { | |||
1350 | static void __devinit | 1353 | static void __devinit |
1351 | init_imstt(struct fb_info *info) | 1354 | init_imstt(struct fb_info *info) |
1352 | { | 1355 | { |
1353 | struct imstt_par *par = (struct imstt_par *) info->par; | 1356 | struct imstt_par *par = info->par; |
1354 | __u32 i, tmp, *ip, *end; | 1357 | __u32 i, tmp, *ip, *end; |
1355 | 1358 | ||
1356 | tmp = read_reg_le32(par->dc_regs, PRC); | 1359 | tmp = read_reg_le32(par->dc_regs, PRC); |
@@ -1413,7 +1416,7 @@ init_imstt(struct fb_info *info) | |||
1413 | if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len | 1416 | if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len |
1414 | || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { | 1417 | || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { |
1415 | printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); | 1418 | printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); |
1416 | kfree(info); | 1419 | framebuffer_release(info); |
1417 | return; | 1420 | return; |
1418 | } | 1421 | } |
1419 | 1422 | ||
@@ -1449,7 +1452,7 @@ init_imstt(struct fb_info *info) | |||
1449 | fb_alloc_cmap(&info->cmap, 0, 0); | 1452 | fb_alloc_cmap(&info->cmap, 0, 0); |
1450 | 1453 | ||
1451 | if (register_framebuffer(info) < 0) { | 1454 | if (register_framebuffer(info) < 0) { |
1452 | kfree(info); | 1455 | framebuffer_release(info); |
1453 | return; | 1456 | return; |
1454 | } | 1457 | } |
1455 | 1458 | ||
@@ -1474,26 +1477,21 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1474 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); | 1477 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); |
1475 | #endif /* CONFIG_PPC_OF */ | 1478 | #endif /* CONFIG_PPC_OF */ |
1476 | 1479 | ||
1477 | size = sizeof(struct fb_info) + sizeof(struct imstt_par) + | 1480 | info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev); |
1478 | sizeof(u32) * 16; | ||
1479 | |||
1480 | info = kmalloc(size, GFP_KERNEL); | ||
1481 | 1481 | ||
1482 | if (!info) { | 1482 | if (!info) { |
1483 | printk(KERN_ERR "imsttfb: Can't allocate memory\n"); | 1483 | printk(KERN_ERR "imsttfb: Can't allocate memory\n"); |
1484 | return -ENOMEM; | 1484 | return -ENOMEM; |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | memset(info, 0, size); | 1487 | par = info->par; |
1488 | |||
1489 | par = (struct imstt_par *) (info + 1); | ||
1490 | 1488 | ||
1491 | addr = pci_resource_start (pdev, 0); | 1489 | addr = pci_resource_start (pdev, 0); |
1492 | size = pci_resource_len (pdev, 0); | 1490 | size = pci_resource_len (pdev, 0); |
1493 | 1491 | ||
1494 | if (!request_mem_region(addr, size, "imsttfb")) { | 1492 | if (!request_mem_region(addr, size, "imsttfb")) { |
1495 | printk(KERN_ERR "imsttfb: Can't reserve memory region\n"); | 1493 | printk(KERN_ERR "imsttfb: Can't reserve memory region\n"); |
1496 | kfree(info); | 1494 | framebuffer_release(info); |
1497 | return -ENODEV; | 1495 | return -ENODEV; |
1498 | } | 1496 | } |
1499 | 1497 | ||
@@ -1516,14 +1514,13 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1516 | } | 1514 | } |
1517 | 1515 | ||
1518 | info->fix.smem_start = addr; | 1516 | info->fix.smem_start = addr; |
1519 | info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? 0x400000 : 0x800000); | 1517 | info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? |
1518 | 0x400000 : 0x800000); | ||
1520 | info->fix.mmio_start = addr + 0x800000; | 1519 | info->fix.mmio_start = addr + 0x800000; |
1521 | par->dc_regs = ioremap(addr + 0x800000, 0x1000); | 1520 | par->dc_regs = ioremap(addr + 0x800000, 0x1000); |
1522 | par->cmap_regs_phys = addr + 0x840000; | 1521 | par->cmap_regs_phys = addr + 0x840000; |
1523 | par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); | 1522 | par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); |
1524 | info->par = par; | 1523 | info->pseudo_palette = par->palette; |
1525 | info->pseudo_palette = (void *) (par + 1); | ||
1526 | info->device = &pdev->dev; | ||
1527 | init_imstt(info); | 1524 | init_imstt(info); |
1528 | 1525 | ||
1529 | pci_set_drvdata(pdev, info); | 1526 | pci_set_drvdata(pdev, info); |
@@ -1534,7 +1531,7 @@ static void __devexit | |||
1534 | imsttfb_remove(struct pci_dev *pdev) | 1531 | imsttfb_remove(struct pci_dev *pdev) |
1535 | { | 1532 | { |
1536 | struct fb_info *info = pci_get_drvdata(pdev); | 1533 | struct fb_info *info = pci_get_drvdata(pdev); |
1537 | struct imstt_par *par = (struct imstt_par *) info->par; | 1534 | struct imstt_par *par = info->par; |
1538 | int size = pci_resource_len(pdev, 0); | 1535 | int size = pci_resource_len(pdev, 0); |
1539 | 1536 | ||
1540 | unregister_framebuffer(info); | 1537 | unregister_framebuffer(info); |
@@ -1542,7 +1539,7 @@ imsttfb_remove(struct pci_dev *pdev) | |||
1542 | iounmap(par->dc_regs); | 1539 | iounmap(par->dc_regs); |
1543 | iounmap(info->screen_base); | 1540 | iounmap(info->screen_base); |
1544 | release_mem_region(info->fix.smem_start, size); | 1541 | release_mem_region(info->fix.smem_start, size); |
1545 | kfree(info); | 1542 | framebuffer_release(info); |
1546 | } | 1543 | } |
1547 | 1544 | ||
1548 | #ifndef MODULE | 1545 | #ifndef MODULE |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 5924cc225c95..1718baaeed2a 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -554,7 +554,7 @@ static int __init imxfb_probe(struct platform_device *pdev) | |||
554 | 554 | ||
555 | inf = pdev->dev.platform_data; | 555 | inf = pdev->dev.platform_data; |
556 | if(!inf) { | 556 | if(!inf) { |
557 | dev_err(dev,"No platform_data available\n"); | 557 | dev_err(&pdev->dev,"No platform_data available\n"); |
558 | return -ENOMEM; | 558 | return -ENOMEM; |
559 | } | 559 | } |
560 | 560 | ||
@@ -579,7 +579,7 @@ static int __init imxfb_probe(struct platform_device *pdev) | |||
579 | if (!inf->fixed_screen_cpu) { | 579 | if (!inf->fixed_screen_cpu) { |
580 | ret = imxfb_map_video_memory(info); | 580 | ret = imxfb_map_video_memory(info); |
581 | if (ret) { | 581 | if (ret) { |
582 | dev_err(dev, "Failed to allocate video RAM: %d\n", ret); | 582 | dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret); |
583 | ret = -ENOMEM; | 583 | ret = -ENOMEM; |
584 | goto failed_map; | 584 | goto failed_map; |
585 | } | 585 | } |
@@ -608,7 +608,7 @@ static int __init imxfb_probe(struct platform_device *pdev) | |||
608 | imxfb_set_par(info); | 608 | imxfb_set_par(info); |
609 | ret = register_framebuffer(info); | 609 | ret = register_framebuffer(info); |
610 | if (ret < 0) { | 610 | if (ret < 0) { |
611 | dev_err(dev, "failed to register framebuffer\n"); | 611 | dev_err(&pdev->dev, "failed to register framebuffer\n"); |
612 | goto failed_register; | 612 | goto failed_register; |
613 | } | 613 | } |
614 | 614 | ||
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 0090544842f5..6b8bd3cdf9c0 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -157,9 +157,8 @@ static int intelfb_cursor(struct fb_info *info, | |||
157 | 157 | ||
158 | static int intelfb_sync(struct fb_info *info); | 158 | static int intelfb_sync(struct fb_info *info); |
159 | 159 | ||
160 | static int intelfb_ioctl(struct inode *inode, struct file *file, | 160 | static int intelfb_ioctl(struct fb_info *info, |
161 | unsigned int cmd, unsigned long arg, | 161 | unsigned int cmd, unsigned long arg); |
162 | struct fb_info *info); | ||
163 | 162 | ||
164 | static int __devinit intelfb_pci_register(struct pci_dev *pdev, | 163 | static int __devinit intelfb_pci_register(struct pci_dev *pdev, |
165 | const struct pci_device_id *ent); | 164 | const struct pci_device_id *ent); |
@@ -1380,8 +1379,7 @@ intelfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1380 | 1379 | ||
1381 | /* When/if we have our own ioctls. */ | 1380 | /* When/if we have our own ioctls. */ |
1382 | static int | 1381 | static int |
1383 | intelfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 1382 | intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
1384 | unsigned long arg, struct fb_info *info) | ||
1385 | { | 1383 | { |
1386 | int retval = 0; | 1384 | int retval = 0; |
1387 | 1385 | ||
diff --git a/drivers/video/kyro/STG4000InitDevice.c b/drivers/video/kyro/STG4000InitDevice.c index 7e33cd307d47..ab5285a7f1d6 100644 --- a/drivers/video/kyro/STG4000InitDevice.c +++ b/drivers/video/kyro/STG4000InitDevice.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | 16 | ||
17 | #include "STG4000Reg.h" | 17 | #include "STG4000Reg.h" |
18 | #include "STG4000Interface.h" | ||
18 | 19 | ||
19 | /* SDRAM fixed settings */ | 20 | /* SDRAM fixed settings */ |
20 | #define SDRAM_CFG_0 0x49A1 | 21 | #define SDRAM_CFG_0 0x49A1 |
diff --git a/drivers/video/kyro/STG4000Interface.h b/drivers/video/kyro/STG4000Interface.h index e75b3b4a4aa1..b7c83d5dfb13 100644 --- a/drivers/video/kyro/STG4000Interface.h +++ b/drivers/video/kyro/STG4000Interface.h | |||
@@ -11,7 +11,8 @@ | |||
11 | #ifndef _STG4000INTERFACE_H | 11 | #ifndef _STG4000INTERFACE_H |
12 | #define _STG4000INTERFACE_H | 12 | #define _STG4000INTERFACE_H |
13 | 13 | ||
14 | struct pci_dev; | 14 | #include <linux/pci.h> |
15 | #include <video/kyro.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Ramdac Setup | 18 | * Ramdac Setup |
diff --git a/drivers/video/kyro/STG4000OverlayDevice.c b/drivers/video/kyro/STG4000OverlayDevice.c index 2ae9bafacdd0..a8c9713413e6 100644 --- a/drivers/video/kyro/STG4000OverlayDevice.c +++ b/drivers/video/kyro/STG4000OverlayDevice.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | 15 | ||
16 | #include "STG4000Reg.h" | 16 | #include "STG4000Reg.h" |
17 | #include "STG4000Interface.h" | ||
17 | 18 | ||
18 | /* HW Defines */ | 19 | /* HW Defines */ |
19 | 20 | ||
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 5eb4d5c177bd..477ad297de4e 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
@@ -73,8 +73,6 @@ static struct fb_var_screeninfo kyro_var __devinitdata = { | |||
73 | .vmode = FB_VMODE_NONINTERLACED, | 73 | .vmode = FB_VMODE_NONINTERLACED, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static struct kyrofb_info *currentpar; | ||
77 | |||
78 | typedef struct { | 76 | typedef struct { |
79 | STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */ | 77 | STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */ |
80 | u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */ | 78 | u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */ |
@@ -309,7 +307,7 @@ enum { | |||
309 | /* Accessors */ | 307 | /* Accessors */ |
310 | static int kyro_dev_video_mode_set(struct fb_info *info) | 308 | static int kyro_dev_video_mode_set(struct fb_info *info) |
311 | { | 309 | { |
312 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 310 | struct kyrofb_info *par = info->par; |
313 | 311 | ||
314 | /* Turn off display */ | 312 | /* Turn off display */ |
315 | StopVTG(deviceInfo.pSTGReg); | 313 | StopVTG(deviceInfo.pSTGReg); |
@@ -402,7 +400,7 @@ static inline unsigned long get_line_length(int x, int bpp) | |||
402 | 400 | ||
403 | static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 401 | static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
404 | { | 402 | { |
405 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 403 | struct kyrofb_info *par = info->par; |
406 | 404 | ||
407 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { | 405 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { |
408 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); | 406 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); |
@@ -478,7 +476,7 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
478 | 476 | ||
479 | static int kyrofb_set_par(struct fb_info *info) | 477 | static int kyrofb_set_par(struct fb_info *info) |
480 | { | 478 | { |
481 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 479 | struct kyrofb_info *par = info->par; |
482 | unsigned long lineclock; | 480 | unsigned long lineclock; |
483 | unsigned long frameclock; | 481 | unsigned long frameclock; |
484 | 482 | ||
@@ -536,20 +534,22 @@ static int kyrofb_set_par(struct fb_info *info) | |||
536 | static int kyrofb_setcolreg(u_int regno, u_int red, u_int green, | 534 | static int kyrofb_setcolreg(u_int regno, u_int red, u_int green, |
537 | u_int blue, u_int transp, struct fb_info *info) | 535 | u_int blue, u_int transp, struct fb_info *info) |
538 | { | 536 | { |
537 | struct kyrofb_info *par = info->par; | ||
538 | |||
539 | if (regno > 255) | 539 | if (regno > 255) |
540 | return 1; /* Invalid register */ | 540 | return 1; /* Invalid register */ |
541 | 541 | ||
542 | if (regno < 16) { | 542 | if (regno < 16) { |
543 | switch (info->var.bits_per_pixel) { | 543 | switch (info->var.bits_per_pixel) { |
544 | case 16: | 544 | case 16: |
545 | ((u16*)(info->pseudo_palette))[regno] = | 545 | par->palette[regno] = |
546 | (red & 0xf800) | | 546 | (red & 0xf800) | |
547 | ((green & 0xfc00) >> 5) | | 547 | ((green & 0xfc00) >> 5) | |
548 | ((blue & 0xf800) >> 11); | 548 | ((blue & 0xf800) >> 11); |
549 | break; | 549 | break; |
550 | case 32: | 550 | case 32: |
551 | red >>= 8; green >>= 8; blue >>= 8; transp >>= 8; | 551 | red >>= 8; green >>= 8; blue >>= 8; transp >>= 8; |
552 | ((u32*)(info->pseudo_palette))[regno] = | 552 | par->palette[regno] = |
553 | (transp << 24) | (red << 16) | (green << 8) | blue; | 553 | (transp << 24) | (red << 16) | (green << 8) | blue; |
554 | break; | 554 | break; |
555 | } | 555 | } |
@@ -586,9 +586,8 @@ static int __init kyrofb_setup(char *options) | |||
586 | } | 586 | } |
587 | #endif | 587 | #endif |
588 | 588 | ||
589 | static int kyrofb_ioctl(struct inode *inode, struct file *file, | 589 | static int kyrofb_ioctl(struct fb_info *info, |
590 | unsigned int cmd, unsigned long arg, | 590 | unsigned int cmd, unsigned long arg) |
591 | struct fb_info *info) | ||
592 | { | 591 | { |
593 | overlay_create ol_create; | 592 | overlay_create ol_create; |
594 | overlay_viewport_set ol_viewport_set; | 593 | overlay_viewport_set ol_viewport_set; |
@@ -675,6 +674,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
675 | const struct pci_device_id *ent) | 674 | const struct pci_device_id *ent) |
676 | { | 675 | { |
677 | struct fb_info *info; | 676 | struct fb_info *info; |
677 | struct kyrofb_info *currentpar; | ||
678 | unsigned long size; | 678 | unsigned long size; |
679 | int err; | 679 | int err; |
680 | 680 | ||
@@ -683,14 +683,11 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
683 | return err; | 683 | return err; |
684 | } | 684 | } |
685 | 685 | ||
686 | size = sizeof(struct fb_info) + sizeof(struct kyrofb_info) + 16 * sizeof(u32); | 686 | info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev); |
687 | info = kmalloc(size, GFP_KERNEL); | ||
688 | if (!info) | 687 | if (!info) |
689 | return -ENOMEM; | 688 | return -ENOMEM; |
690 | 689 | ||
691 | memset(info, 0, size); | 690 | currentpar = info->par; |
692 | |||
693 | currentpar = (struct kyrofb_info *)(info + 1); | ||
694 | 691 | ||
695 | kyro_fix.smem_start = pci_resource_start(pdev, 0); | 692 | kyro_fix.smem_start = pci_resource_start(pdev, 0); |
696 | kyro_fix.smem_len = pci_resource_len(pdev, 0); | 693 | kyro_fix.smem_len = pci_resource_len(pdev, 0); |
@@ -716,8 +713,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
716 | 713 | ||
717 | info->fbops = &kyrofb_ops; | 714 | info->fbops = &kyrofb_ops; |
718 | info->fix = kyro_fix; | 715 | info->fix = kyro_fix; |
719 | info->par = currentpar; | 716 | info->pseudo_palette = currentpar->palette; |
720 | info->pseudo_palette = (void *)(currentpar + 1); | ||
721 | info->flags = FBINFO_DEFAULT; | 717 | info->flags = FBINFO_DEFAULT; |
722 | 718 | ||
723 | SetCoreClockPLL(deviceInfo.pSTGReg, pdev); | 719 | SetCoreClockPLL(deviceInfo.pSTGReg, pdev); |
@@ -741,7 +737,6 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
741 | 737 | ||
742 | fb_memset(info->screen_base, 0, size); | 738 | fb_memset(info->screen_base, 0, size); |
743 | 739 | ||
744 | info->device = &pdev->dev; | ||
745 | if (register_framebuffer(info) < 0) | 740 | if (register_framebuffer(info) < 0) |
746 | goto out_unmap; | 741 | goto out_unmap; |
747 | 742 | ||
@@ -757,7 +752,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
757 | out_unmap: | 752 | out_unmap: |
758 | iounmap(currentpar->regbase); | 753 | iounmap(currentpar->regbase); |
759 | iounmap(info->screen_base); | 754 | iounmap(info->screen_base); |
760 | kfree(info); | 755 | framebuffer_release(info); |
761 | 756 | ||
762 | return -EINVAL; | 757 | return -EINVAL; |
763 | } | 758 | } |
@@ -765,7 +760,7 @@ out_unmap: | |||
765 | static void __devexit kyrofb_remove(struct pci_dev *pdev) | 760 | static void __devexit kyrofb_remove(struct pci_dev *pdev) |
766 | { | 761 | { |
767 | struct fb_info *info = pci_get_drvdata(pdev); | 762 | struct fb_info *info = pci_get_drvdata(pdev); |
768 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 763 | struct kyrofb_info *par = info->par; |
769 | 764 | ||
770 | /* Reset the board */ | 765 | /* Reset the board */ |
771 | StopVTG(deviceInfo.pSTGReg); | 766 | StopVTG(deviceInfo.pSTGReg); |
@@ -789,7 +784,7 @@ static void __devexit kyrofb_remove(struct pci_dev *pdev) | |||
789 | 784 | ||
790 | unregister_framebuffer(info); | 785 | unregister_framebuffer(info); |
791 | pci_set_drvdata(pdev, NULL); | 786 | pci_set_drvdata(pdev, NULL); |
792 | kfree(info); | 787 | framebuffer_release(info); |
793 | } | 788 | } |
794 | 789 | ||
795 | static int __init kyrofb_init(void) | 790 | static int __init kyrofb_init(void) |
diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 494287f8f8bf..a23cfdb9d826 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c | |||
@@ -32,9 +32,8 @@ static int leo_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
32 | unsigned, struct fb_info *); | 32 | unsigned, struct fb_info *); |
33 | static int leo_blank(int, struct fb_info *); | 33 | static int leo_blank(int, struct fb_info *); |
34 | 34 | ||
35 | static int leo_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 35 | static int leo_mmap(struct fb_info *, struct vm_area_struct *); |
36 | static int leo_ioctl(struct inode *, struct file *, unsigned int, | 36 | static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); |
37 | unsigned long, struct fb_info *); | ||
38 | static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 37 | static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
39 | 38 | ||
40 | /* | 39 | /* |
@@ -363,7 +362,7 @@ static struct sbus_mmap_map leo_mmap_map[] = { | |||
363 | { .size = 0 } | 362 | { .size = 0 } |
364 | }; | 363 | }; |
365 | 364 | ||
366 | static int leo_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 365 | static int leo_mmap(struct fb_info *info, struct vm_area_struct *vma) |
367 | { | 366 | { |
368 | struct leo_par *par = (struct leo_par *)info->par; | 367 | struct leo_par *par = (struct leo_par *)info->par; |
369 | 368 | ||
@@ -373,8 +372,7 @@ static int leo_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
373 | vma); | 372 | vma); |
374 | } | 373 | } |
375 | 374 | ||
376 | static int leo_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 375 | static int leo_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
377 | unsigned long arg, struct fb_info *info) | ||
378 | { | 376 | { |
379 | struct leo_par *par = (struct leo_par *) info->par; | 377 | struct leo_par *par = (struct leo_par *) info->par; |
380 | 378 | ||
diff --git a/drivers/video/logo/Makefile b/drivers/video/logo/Makefile index d0244c04af5a..4ef5cd19609d 100644 --- a/drivers/video/logo/Makefile +++ b/drivers/video/logo/Makefile | |||
@@ -16,7 +16,7 @@ obj-$(CONFIG_LOGO_M32R_CLUT224) += logo_m32r_clut224.o | |||
16 | 16 | ||
17 | # How to generate logo's | 17 | # How to generate logo's |
18 | 18 | ||
19 | # Use logo-cfiles to retreive list of .c files to be built | 19 | # Use logo-cfiles to retrieve list of .c files to be built |
20 | logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \ | 20 | logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \ |
21 | $(wildcard $(srctree)/$(src)/*$(1).$(2)))) | 21 | $(wildcard $(srctree)/$(src)/*$(1).$(2)))) |
22 | 22 | ||
diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c index cfc748e94272..e6cbd9de944a 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/macfb.c | |||
@@ -609,18 +609,19 @@ void __init macfb_setup(char *options) | |||
609 | } | 609 | } |
610 | } | 610 | } |
611 | 611 | ||
612 | void __init macfb_init(void) | 612 | static int __init macfb_init(void) |
613 | { | 613 | { |
614 | int video_cmap_len, video_is_nubus = 0; | 614 | int video_cmap_len, video_is_nubus = 0; |
615 | struct nubus_dev* ndev = NULL; | 615 | struct nubus_dev* ndev = NULL; |
616 | char *option = NULL; | 616 | char *option = NULL; |
617 | int err; | ||
617 | 618 | ||
618 | if (fb_get_options("macfb", &option)) | 619 | if (fb_get_options("macfb", &option)) |
619 | return -ENODEV; | 620 | return -ENODEV; |
620 | macfb_setup(option); | 621 | macfb_setup(option); |
621 | 622 | ||
622 | if (!MACH_IS_MAC) | 623 | if (!MACH_IS_MAC) |
623 | return; | 624 | return -ENODEV; |
624 | 625 | ||
625 | /* There can only be one internal video controller anyway so | 626 | /* There can only be one internal video controller anyway so |
626 | we're not too worried about this */ | 627 | we're not too worried about this */ |
@@ -958,11 +959,11 @@ void __init macfb_init(void) | |||
958 | 959 | ||
959 | fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); | 960 | fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); |
960 | 961 | ||
961 | if (register_framebuffer(&fb_info) < 0) | 962 | err = register_framebuffer(&fb_info); |
962 | return; | 963 | if (!err) |
963 | 964 | printk("fb%d: %s frame buffer device\n", | |
964 | printk("fb%d: %s frame buffer device\n", | 965 | fb_info.node, fb_info.fix.id); |
965 | fb_info.node, fb_info.fix.id); | 966 | return err; |
966 | } | 967 | } |
967 | 968 | ||
968 | module_init(macfb_init); | 969 | module_init(macfb_init); |
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 1e74f4cca53b..4055ff6f5a81 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -865,9 +865,8 @@ static struct matrox_altout panellink_output = { | |||
865 | .name = "Panellink output", | 865 | .name = "Panellink output", |
866 | }; | 866 | }; |
867 | 867 | ||
868 | static int matroxfb_ioctl(struct inode *inode, struct file *file, | 868 | static int matroxfb_ioctl(struct fb_info *info, |
869 | unsigned int cmd, unsigned long arg, | 869 | unsigned int cmd, unsigned long arg) |
870 | struct fb_info *info) | ||
871 | { | 870 | { |
872 | void __user *argp = (void __user *)arg; | 871 | void __user *argp = (void __user *)arg; |
873 | MINFO_FROM_INFO(info); | 872 | MINFO_FROM_INFO(info); |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index a8c47ad2cdb6..3a3e1804c56a 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -50,8 +50,6 @@ | |||
50 | #include <asm/mtrr.h> | 50 | #include <asm/mtrr.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include "../console/fbcon.h" | ||
54 | |||
55 | #if defined(CONFIG_PPC_PMAC) | 53 | #if defined(CONFIG_PPC_PMAC) |
56 | #include <asm/prom.h> | 54 | #include <asm/prom.h> |
57 | #include <asm/pci-bridge.h> | 55 | #include <asm/pci-bridge.h> |
@@ -351,8 +349,6 @@ struct matrox_bios { | |||
351 | } output; | 349 | } output; |
352 | }; | 350 | }; |
353 | 351 | ||
354 | extern struct display fb_display[]; | ||
355 | |||
356 | struct matrox_switch; | 352 | struct matrox_switch; |
357 | struct matroxfb_driver; | 353 | struct matroxfb_driver; |
358 | struct matroxfb_dh_fb_info; | 354 | struct matroxfb_dh_fb_info; |
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index d52d7d825c41..27eb4bb4f89f 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c | |||
@@ -419,11 +419,10 @@ static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, stru | |||
419 | return 0; | 419 | return 0; |
420 | } | 420 | } |
421 | 421 | ||
422 | static int matroxfb_dh_ioctl(struct inode* inode, | 422 | static int matroxfb_dh_ioctl(struct fb_info *info, |
423 | struct file* file, | ||
424 | unsigned int cmd, | 423 | unsigned int cmd, |
425 | unsigned long arg, | 424 | unsigned long arg) |
426 | struct fb_info* info) { | 425 | { |
427 | #define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) | 426 | #define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) |
428 | MINFO_FROM(m2info->primary_dev); | 427 | MINFO_FROM(m2info->primary_dev); |
429 | 428 | ||
@@ -457,7 +456,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, | |||
457 | case MATROXFB_GET_OUTPUT_MODE: | 456 | case MATROXFB_GET_OUTPUT_MODE: |
458 | case MATROXFB_GET_ALL_OUTPUTS: | 457 | case MATROXFB_GET_ALL_OUTPUTS: |
459 | { | 458 | { |
460 | return ACCESS_FBINFO(fbcon.fbops)->fb_ioctl(inode, file, cmd, arg, &ACCESS_FBINFO(fbcon)); | 459 | return ACCESS_FBINFO(fbcon.fbops)->fb_ioctl(&ACCESS_FBINFO(fbcon), cmd, arg); |
461 | } | 460 | } |
462 | case MATROXFB_SET_OUTPUT_CONNECTION: | 461 | case MATROXFB_SET_OUTPUT_CONNECTION: |
463 | { | 462 | { |
diff --git a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/matrox/matroxfb_g450.c index 35008af7db75..c122d8743dd2 100644 --- a/drivers/video/matrox/matroxfb_g450.c +++ b/drivers/video/matrox/matroxfb_g450.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | #include <asm/div64.h> | 21 | #include <asm/div64.h> |
22 | 22 | ||
23 | #include "matroxfb_g450.h" | ||
24 | |||
23 | /* Definition of the various controls */ | 25 | /* Definition of the various controls */ |
24 | struct mctl { | 26 | struct mctl { |
25 | struct v4l2_queryctrl desc; | 27 | struct v4l2_queryctrl desc; |
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index a1f2c5e8fc88..6019710dc298 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c | |||
@@ -968,7 +968,7 @@ static inline int maven_compute_timming(struct maven_data* md, | |||
968 | return 0; | 968 | return 0; |
969 | } | 969 | } |
970 | 970 | ||
971 | static inline int maven_program_timming(struct maven_data* md, | 971 | static int maven_program_timming(struct maven_data* md, |
972 | const struct mavenregs* m) { | 972 | const struct mavenregs* m) { |
973 | struct i2c_client* c = md->client; | 973 | struct i2c_client* c = md->client; |
974 | 974 | ||
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index d9d3e9f6c08e..455a46ce840c 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c | |||
@@ -192,11 +192,8 @@ int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) { | |||
192 | unsigned int wd; | 192 | unsigned int wd; |
193 | unsigned int divider; | 193 | unsigned int divider; |
194 | int i; | 194 | int i; |
195 | int fwidth; | ||
196 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); | 195 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); |
197 | 196 | ||
198 | fwidth = 8; | ||
199 | |||
200 | DBG(__FUNCTION__) | 197 | DBG(__FUNCTION__) |
201 | 198 | ||
202 | hw->SEQ[0] = 0x00; | 199 | hw->SEQ[0] = 0x00; |
@@ -235,10 +232,7 @@ int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) { | |||
235 | hw->ATTR[16] = 0x41; | 232 | hw->ATTR[16] = 0x41; |
236 | hw->ATTR[17] = 0xFF; | 233 | hw->ATTR[17] = 0xFF; |
237 | hw->ATTR[18] = 0x0F; | 234 | hw->ATTR[18] = 0x0F; |
238 | if (fwidth == 9) | 235 | hw->ATTR[19] = 0x00; |
239 | hw->ATTR[19] = 0x08; | ||
240 | else | ||
241 | hw->ATTR[19] = 0x00; | ||
242 | hw->ATTR[20] = 0x00; | 236 | hw->ATTR[20] = 0x00; |
243 | 237 | ||
244 | hd = m->HDisplay >> 3; | 238 | hd = m->HDisplay >> 3; |
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 8486e77872dc..747602aa5615 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -485,7 +485,7 @@ static void vgaHWRestore(const struct fb_info *info, | |||
485 | */ | 485 | */ |
486 | static inline int neo2200_sync(struct fb_info *info) | 486 | static inline int neo2200_sync(struct fb_info *info) |
487 | { | 487 | { |
488 | struct neofb_par *par = (struct neofb_par *) info->par; | 488 | struct neofb_par *par = info->par; |
489 | int waitcycles; | 489 | int waitcycles; |
490 | 490 | ||
491 | while (readl(&par->neo2200->bltStat) & 1) | 491 | while (readl(&par->neo2200->bltStat) & 1) |
@@ -525,7 +525,7 @@ static inline void neo2200_wait_fifo(struct fb_info *info, | |||
525 | static inline void neo2200_accel_init(struct fb_info *info, | 525 | static inline void neo2200_accel_init(struct fb_info *info, |
526 | struct fb_var_screeninfo *var) | 526 | struct fb_var_screeninfo *var) |
527 | { | 527 | { |
528 | struct neofb_par *par = (struct neofb_par *) info->par; | 528 | struct neofb_par *par = info->par; |
529 | Neo2200 __iomem *neo2200 = par->neo2200; | 529 | Neo2200 __iomem *neo2200 = par->neo2200; |
530 | u32 bltMod, pitch; | 530 | u32 bltMod, pitch; |
531 | 531 | ||
@@ -560,7 +560,7 @@ static inline void neo2200_accel_init(struct fb_info *info, | |||
560 | static int | 560 | static int |
561 | neofb_open(struct fb_info *info, int user) | 561 | neofb_open(struct fb_info *info, int user) |
562 | { | 562 | { |
563 | struct neofb_par *par = (struct neofb_par *) info->par; | 563 | struct neofb_par *par = info->par; |
564 | int cnt = atomic_read(&par->ref_count); | 564 | int cnt = atomic_read(&par->ref_count); |
565 | 565 | ||
566 | if (!cnt) { | 566 | if (!cnt) { |
@@ -575,7 +575,7 @@ neofb_open(struct fb_info *info, int user) | |||
575 | static int | 575 | static int |
576 | neofb_release(struct fb_info *info, int user) | 576 | neofb_release(struct fb_info *info, int user) |
577 | { | 577 | { |
578 | struct neofb_par *par = (struct neofb_par *) info->par; | 578 | struct neofb_par *par = info->par; |
579 | int cnt = atomic_read(&par->ref_count); | 579 | int cnt = atomic_read(&par->ref_count); |
580 | 580 | ||
581 | if (!cnt) | 581 | if (!cnt) |
@@ -590,7 +590,7 @@ neofb_release(struct fb_info *info, int user) | |||
590 | static int | 590 | static int |
591 | neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 591 | neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
592 | { | 592 | { |
593 | struct neofb_par *par = (struct neofb_par *) info->par; | 593 | struct neofb_par *par = info->par; |
594 | unsigned int pixclock = var->pixclock; | 594 | unsigned int pixclock = var->pixclock; |
595 | struct xtimings timings; | 595 | struct xtimings timings; |
596 | int memlen, vramlen; | 596 | int memlen, vramlen; |
@@ -757,7 +757,7 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
757 | 757 | ||
758 | static int neofb_set_par(struct fb_info *info) | 758 | static int neofb_set_par(struct fb_info *info) |
759 | { | 759 | { |
760 | struct neofb_par *par = (struct neofb_par *) info->par; | 760 | struct neofb_par *par = info->par; |
761 | struct xtimings timings; | 761 | struct xtimings timings; |
762 | unsigned char temp; | 762 | unsigned char temp; |
763 | int i, clock_hi = 0; | 763 | int i, clock_hi = 0; |
@@ -853,7 +853,7 @@ static int neofb_set_par(struct fb_info *info) | |||
853 | /* If the user did not specify any display devices, then... */ | 853 | /* If the user did not specify any display devices, then... */ |
854 | if (par->PanelDispCntlReg1 == 0x00) { | 854 | if (par->PanelDispCntlReg1 == 0x00) { |
855 | /* Default to internal (i.e., LCD) only. */ | 855 | /* Default to internal (i.e., LCD) only. */ |
856 | par->PanelDispCntlReg1 |= 0x02; | 856 | par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03; |
857 | } | 857 | } |
858 | 858 | ||
859 | /* If we are using a fixed mode, then tell the chip we are. */ | 859 | /* If we are using a fixed mode, then tell the chip we are. */ |
@@ -1216,7 +1216,7 @@ static int neofb_set_par(struct fb_info *info) | |||
1216 | static void neofb_update_start(struct fb_info *info, | 1216 | static void neofb_update_start(struct fb_info *info, |
1217 | struct fb_var_screeninfo *var) | 1217 | struct fb_var_screeninfo *var) |
1218 | { | 1218 | { |
1219 | struct neofb_par *par = (struct neofb_par *) info->par; | 1219 | struct neofb_par *par = info->par; |
1220 | struct vgastate *state = &par->state; | 1220 | struct vgastate *state = &par->state; |
1221 | int oldExtCRTDispAddr; | 1221 | int oldExtCRTDispAddr; |
1222 | int Base; | 1222 | int Base; |
@@ -1331,7 +1331,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info) | |||
1331 | * wms...Enable VESA DPMS compatible powerdown mode | 1331 | * wms...Enable VESA DPMS compatible powerdown mode |
1332 | * run "setterm -powersave powerdown" to take advantage | 1332 | * run "setterm -powersave powerdown" to take advantage |
1333 | */ | 1333 | */ |
1334 | struct neofb_par *par = (struct neofb_par *)info->par; | 1334 | struct neofb_par *par = info->par; |
1335 | int seqflags, lcdflags, dpmsflags, reg; | 1335 | int seqflags, lcdflags, dpmsflags, reg; |
1336 | 1336 | ||
1337 | switch (blank_mode) { | 1337 | switch (blank_mode) { |
@@ -1404,7 +1404,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info) | |||
1404 | static void | 1404 | static void |
1405 | neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 1405 | neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
1406 | { | 1406 | { |
1407 | struct neofb_par *par = (struct neofb_par *) info->par; | 1407 | struct neofb_par *par = info->par; |
1408 | u_long dst, rop; | 1408 | u_long dst, rop; |
1409 | 1409 | ||
1410 | dst = rect->dx + rect->dy * info->var.xres_virtual; | 1410 | dst = rect->dx + rect->dy * info->var.xres_virtual; |
@@ -1440,7 +1440,7 @@ static void | |||
1440 | neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 1440 | neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
1441 | { | 1441 | { |
1442 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; | 1442 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; |
1443 | struct neofb_par *par = (struct neofb_par *) info->par; | 1443 | struct neofb_par *par = info->par; |
1444 | u_long src, dst, bltCntl; | 1444 | u_long src, dst, bltCntl; |
1445 | 1445 | ||
1446 | bltCntl = NEO_BC3_FIFO_EN | NEO_BC3_SKIP_MAPPING | 0x0C0000; | 1446 | bltCntl = NEO_BC3_FIFO_EN | NEO_BC3_SKIP_MAPPING | 0x0C0000; |
@@ -1472,7 +1472,7 @@ neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
1472 | static void | 1472 | static void |
1473 | neo2200_imageblit(struct fb_info *info, const struct fb_image *image) | 1473 | neo2200_imageblit(struct fb_info *info, const struct fb_image *image) |
1474 | { | 1474 | { |
1475 | struct neofb_par *par = (struct neofb_par *) info->par; | 1475 | struct neofb_par *par = info->par; |
1476 | int s_pitch = (image->width * image->depth + 7) >> 3; | 1476 | int s_pitch = (image->width * image->depth + 7) >> 3; |
1477 | int scan_align = info->pixmap.scan_align - 1; | 1477 | int scan_align = info->pixmap.scan_align - 1; |
1478 | int buf_align = info->pixmap.buf_align - 1; | 1478 | int buf_align = info->pixmap.buf_align - 1; |
@@ -1686,7 +1686,7 @@ static struct fb_videomode __devinitdata mode800x480 = { | |||
1686 | static int __devinit neo_map_mmio(struct fb_info *info, | 1686 | static int __devinit neo_map_mmio(struct fb_info *info, |
1687 | struct pci_dev *dev) | 1687 | struct pci_dev *dev) |
1688 | { | 1688 | { |
1689 | struct neofb_par *par = (struct neofb_par *) info->par; | 1689 | struct neofb_par *par = info->par; |
1690 | 1690 | ||
1691 | DBG("neo_map_mmio"); | 1691 | DBG("neo_map_mmio"); |
1692 | 1692 | ||
@@ -1733,7 +1733,7 @@ static int __devinit neo_map_mmio(struct fb_info *info, | |||
1733 | 1733 | ||
1734 | static void neo_unmap_mmio(struct fb_info *info) | 1734 | static void neo_unmap_mmio(struct fb_info *info) |
1735 | { | 1735 | { |
1736 | struct neofb_par *par = (struct neofb_par *) info->par; | 1736 | struct neofb_par *par = info->par; |
1737 | 1737 | ||
1738 | DBG("neo_unmap_mmio"); | 1738 | DBG("neo_unmap_mmio"); |
1739 | 1739 | ||
@@ -1796,7 +1796,7 @@ static void neo_unmap_video(struct fb_info *info) | |||
1796 | 1796 | ||
1797 | #ifdef CONFIG_MTRR | 1797 | #ifdef CONFIG_MTRR |
1798 | { | 1798 | { |
1799 | struct neofb_par *par = (struct neofb_par *) info->par; | 1799 | struct neofb_par *par = info->par; |
1800 | 1800 | ||
1801 | mtrr_del(par->mtrr, info->fix.smem_start, | 1801 | mtrr_del(par->mtrr, info->fix.smem_start, |
1802 | info->fix.smem_len); | 1802 | info->fix.smem_len); |
@@ -1811,7 +1811,7 @@ static void neo_unmap_video(struct fb_info *info) | |||
1811 | 1811 | ||
1812 | static int __devinit neo_scan_monitor(struct fb_info *info) | 1812 | static int __devinit neo_scan_monitor(struct fb_info *info) |
1813 | { | 1813 | { |
1814 | struct neofb_par *par = (struct neofb_par *) info->par; | 1814 | struct neofb_par *par = info->par; |
1815 | unsigned char type, display; | 1815 | unsigned char type, display; |
1816 | int w; | 1816 | int w; |
1817 | 1817 | ||
@@ -1890,7 +1890,7 @@ static int __devinit neo_scan_monitor(struct fb_info *info) | |||
1890 | 1890 | ||
1891 | static int __devinit neo_init_hw(struct fb_info *info) | 1891 | static int __devinit neo_init_hw(struct fb_info *info) |
1892 | { | 1892 | { |
1893 | struct neofb_par *par = (struct neofb_par *) info->par; | 1893 | struct neofb_par *par = info->par; |
1894 | int videoRam = 896; | 1894 | int videoRam = 896; |
1895 | int maxClock = 65000; | 1895 | int maxClock = 65000; |
1896 | int CursorMem = 1024; | 1896 | int CursorMem = 1024; |
@@ -2014,7 +2014,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st | |||
2014 | struct fb_info *info; | 2014 | struct fb_info *info; |
2015 | struct neofb_par *par; | 2015 | struct neofb_par *par; |
2016 | 2016 | ||
2017 | info = framebuffer_alloc(sizeof(struct neofb_par) + sizeof(u32) * 256, &dev->dev); | 2017 | info = framebuffer_alloc(sizeof(struct neofb_par), &dev->dev); |
2018 | 2018 | ||
2019 | if (!info) | 2019 | if (!info) |
2020 | return NULL; | 2020 | return NULL; |
@@ -2081,7 +2081,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st | |||
2081 | info->fix.accel = id->driver_data; | 2081 | info->fix.accel = id->driver_data; |
2082 | 2082 | ||
2083 | info->fbops = &neofb_ops; | 2083 | info->fbops = &neofb_ops; |
2084 | info->pseudo_palette = (void *) (par + 1); | 2084 | info->pseudo_palette = par->palette; |
2085 | return info; | 2085 | return info; |
2086 | } | 2086 | } |
2087 | 2087 | ||
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c index b989358437b3..99c3a8e6a237 100644 --- a/drivers/video/nvidia/nv_hw.c +++ b/drivers/video/nvidia/nv_hw.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include "nv_type.h" | 53 | #include "nv_type.h" |
54 | #include "nv_local.h" | 54 | #include "nv_local.h" |
55 | #include "nv_proto.h" | ||
55 | 56 | ||
56 | void NVLockUnlock(struct nvidia_par *par, int Lock) | 57 | void NVLockUnlock(struct nvidia_par *par, int Lock) |
57 | { | 58 | { |
@@ -848,7 +849,7 @@ void NVCalcStateExt(struct nvidia_par *par, | |||
848 | int width, | 849 | int width, |
849 | int hDisplaySize, int height, int dotClock, int flags) | 850 | int hDisplaySize, int height, int dotClock, int flags) |
850 | { | 851 | { |
851 | int pixelDepth, VClk; | 852 | int pixelDepth, VClk = 0; |
852 | /* | 853 | /* |
853 | * Save mode parameters. | 854 | * Save mode parameters. |
854 | */ | 855 | */ |
@@ -938,15 +939,24 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
938 | 939 | ||
939 | if (par->Architecture == NV_ARCH_04) { | 940 | if (par->Architecture == NV_ARCH_04) { |
940 | NV_WR32(par->PFB, 0x0200, state->config); | 941 | NV_WR32(par->PFB, 0x0200, state->config); |
941 | } else if ((par->Chipset & 0xfff0) == 0x0090) { | 942 | } else if ((par->Architecture < NV_ARCH_40) || |
942 | for (i = 0; i < 15; i++) { | 943 | (par->Chipset & 0xfff0) == 0x0040) { |
943 | NV_WR32(par->PFB, 0x0600 + (i * 0x10), 0); | ||
944 | NV_WR32(par->PFB, 0x0604 + (i * 0x10), par->FbMapSize - 1); | ||
945 | } | ||
946 | } else { | ||
947 | for (i = 0; i < 8; i++) { | 944 | for (i = 0; i < 8; i++) { |
948 | NV_WR32(par->PFB, 0x0240 + (i * 0x10), 0); | 945 | NV_WR32(par->PFB, 0x0240 + (i * 0x10), 0); |
949 | NV_WR32(par->PFB, 0x0244 + (i * 0x10), par->FbMapSize - 1); | 946 | NV_WR32(par->PFB, 0x0244 + (i * 0x10), |
947 | par->FbMapSize - 1); | ||
948 | } | ||
949 | } else { | ||
950 | int regions = 12; | ||
951 | |||
952 | if (((par->Chipset & 0xfff0) == 0x0090) || | ||
953 | ((par->Chipset & 0xfff0) == 0x01D0) || | ||
954 | ((par->Chipset & 0xfff0) == 0x0290)) | ||
955 | regions = 15; | ||
956 | for(i = 0; i < regions; i++) { | ||
957 | NV_WR32(par->PFB, 0x0600 + (i * 0x10), 0); | ||
958 | NV_WR32(par->PFB, 0x0604 + (i * 0x10), | ||
959 | par->FbMapSize - 1); | ||
950 | } | 960 | } |
951 | } | 961 | } |
952 | 962 | ||
@@ -1182,11 +1192,17 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1182 | NV_WR32(par->PGRAPH, 0x0608, 0xFFFFFFFF); | 1192 | NV_WR32(par->PGRAPH, 0x0608, 0xFFFFFFFF); |
1183 | } else { | 1193 | } else { |
1184 | if (par->Architecture >= NV_ARCH_40) { | 1194 | if (par->Architecture >= NV_ARCH_40) { |
1195 | u32 tmp; | ||
1196 | |||
1185 | NV_WR32(par->PGRAPH, 0x0084, 0x401287c0); | 1197 | NV_WR32(par->PGRAPH, 0x0084, 0x401287c0); |
1186 | NV_WR32(par->PGRAPH, 0x008C, 0x60de8051); | 1198 | NV_WR32(par->PGRAPH, 0x008C, 0x60de8051); |
1187 | NV_WR32(par->PGRAPH, 0x0090, 0x00008000); | 1199 | NV_WR32(par->PGRAPH, 0x0090, 0x00008000); |
1188 | NV_WR32(par->PGRAPH, 0x0610, 0x00be3c5f); | 1200 | NV_WR32(par->PGRAPH, 0x0610, 0x00be3c5f); |
1189 | 1201 | ||
1202 | tmp = NV_RD32(par->REGS, 0x1540) & 0xff; | ||
1203 | for(i = 0; tmp && !(tmp & 1); tmp >>= 1, i++); | ||
1204 | NV_WR32(par->PGRAPH, 0x5000, i); | ||
1205 | |||
1190 | if ((par->Chipset & 0xfff0) == 0x0040) { | 1206 | if ((par->Chipset & 0xfff0) == 0x0040) { |
1191 | NV_WR32(par->PGRAPH, 0x09b0, | 1207 | NV_WR32(par->PGRAPH, 0x09b0, |
1192 | 0x83280fff); | 1208 | 0x83280fff); |
@@ -1211,6 +1227,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1211 | 0xffff7fff); | 1227 | 0xffff7fff); |
1212 | break; | 1228 | break; |
1213 | case 0x00C0: | 1229 | case 0x00C0: |
1230 | case 0x0120: | ||
1214 | NV_WR32(par->PGRAPH, 0x0828, | 1231 | NV_WR32(par->PGRAPH, 0x0828, |
1215 | 0x007596ff); | 1232 | 0x007596ff); |
1216 | NV_WR32(par->PGRAPH, 0x082C, | 1233 | NV_WR32(par->PGRAPH, 0x082C, |
@@ -1245,6 +1262,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1245 | 0x00100000); | 1262 | 0x00100000); |
1246 | break; | 1263 | break; |
1247 | case 0x0090: | 1264 | case 0x0090: |
1265 | case 0x0290: | ||
1248 | NV_WR32(par->PRAMDAC, 0x0608, | 1266 | NV_WR32(par->PRAMDAC, 0x0608, |
1249 | NV_RD32(par->PRAMDAC, 0x0608) | | 1267 | NV_RD32(par->PRAMDAC, 0x0608) | |
1250 | 0x00100000); | 1268 | 0x00100000); |
@@ -1310,14 +1328,44 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1310 | } | 1328 | } |
1311 | } | 1329 | } |
1312 | 1330 | ||
1313 | if ((par->Chipset & 0xfff0) == 0x0090) { | 1331 | if ((par->Architecture < NV_ARCH_40) || |
1314 | for (i = 0; i < 60; i++) | 1332 | ((par->Chipset & 0xfff0) == 0x0040)) { |
1315 | NV_WR32(par->PGRAPH, 0x0D00 + i, | 1333 | for (i = 0; i < 32; i++) { |
1316 | NV_RD32(par->PFB, 0x0600 + i)); | 1334 | NV_WR32(par->PGRAPH, 0x0900 + i*4, |
1335 | NV_RD32(par->PFB, 0x0240 +i*4)); | ||
1336 | NV_WR32(par->PGRAPH, 0x6900 + i*4, | ||
1337 | NV_RD32(par->PFB, 0x0240 +i*4)); | ||
1338 | } | ||
1317 | } else { | 1339 | } else { |
1318 | for (i = 0; i < 32; i++) | 1340 | if (((par->Chipset & 0xfff0) == 0x0090) || |
1319 | NV_WR32(par->PGRAPH, 0x0900 + i, | 1341 | ((par->Chipset & 0xfff0) == 0x01D0) || |
1320 | NV_RD32(par->PFB, 0x0240 + i)); | 1342 | ((par->Chipset & 0xfff0) == 0x0290)) { |
1343 | for (i = 0; i < 60; i++) { | ||
1344 | NV_WR32(par->PGRAPH, | ||
1345 | 0x0D00 + i*4, | ||
1346 | NV_RD32(par->PFB, | ||
1347 | 0x0600 + i*4)); | ||
1348 | NV_WR32(par->PGRAPH, | ||
1349 | 0x6900 + i*4, | ||
1350 | NV_RD32(par->PFB, | ||
1351 | 0x0600 + i*4)); | ||
1352 | } | ||
1353 | } else { | ||
1354 | for (i = 0; i < 48; i++) { | ||
1355 | NV_WR32(par->PGRAPH, | ||
1356 | 0x0900 + i*4, | ||
1357 | NV_RD32(par->PFB, | ||
1358 | 0x0600 + i*4)); | ||
1359 | if(((par->Chipset & 0xfff0) | ||
1360 | != 0x0160) && | ||
1361 | ((par->Chipset & 0xfff0) | ||
1362 | != 0x0220)) | ||
1363 | NV_WR32(par->PGRAPH, | ||
1364 | 0x6900 + i*4, | ||
1365 | NV_RD32(par->PFB, | ||
1366 | 0x0600 + i*4)); | ||
1367 | } | ||
1368 | } | ||
1321 | } | 1369 | } |
1322 | 1370 | ||
1323 | if (par->Architecture >= NV_ARCH_40) { | 1371 | if (par->Architecture >= NV_ARCH_40) { |
@@ -1338,7 +1386,9 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1338 | NV_WR32(par->PGRAPH, 0x0868, | 1386 | NV_WR32(par->PGRAPH, 0x0868, |
1339 | par->FbMapSize - 1); | 1387 | par->FbMapSize - 1); |
1340 | } else { | 1388 | } else { |
1341 | if((par->Chipset & 0xfff0) == 0x0090) { | 1389 | if ((par->Chipset & 0xfff0) == 0x0090 || |
1390 | (par->Chipset & 0xfff0) == 0x01D0 || | ||
1391 | (par->Chipset & 0xfff0) == 0x0290) { | ||
1342 | NV_WR32(par->PGRAPH, 0x0DF0, | 1392 | NV_WR32(par->PGRAPH, 0x0DF0, |
1343 | NV_RD32(par->PFB, 0x0200)); | 1393 | NV_RD32(par->PFB, 0x0200)); |
1344 | NV_WR32(par->PGRAPH, 0x0DF4, | 1394 | NV_WR32(par->PGRAPH, 0x0DF4, |
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c index 12f2884d3f0b..bd9eca05e146 100644 --- a/drivers/video/nvidia/nv_i2c.c +++ b/drivers/video/nvidia/nv_i2c.c | |||
@@ -46,7 +46,7 @@ static void nvidia_gpio_setscl(void *data, int state) | |||
46 | 46 | ||
47 | static void nvidia_gpio_setsda(void *data, int state) | 47 | static void nvidia_gpio_setsda(void *data, int state) |
48 | { | 48 | { |
49 | struct nvidia_i2c_chan *chan = (struct nvidia_i2c_chan *)data; | 49 | struct nvidia_i2c_chan *chan = data; |
50 | struct nvidia_par *par = chan->par; | 50 | struct nvidia_par *par = chan->par; |
51 | u32 val; | 51 | u32 val; |
52 | 52 | ||
@@ -64,7 +64,7 @@ static void nvidia_gpio_setsda(void *data, int state) | |||
64 | 64 | ||
65 | static int nvidia_gpio_getscl(void *data) | 65 | static int nvidia_gpio_getscl(void *data) |
66 | { | 66 | { |
67 | struct nvidia_i2c_chan *chan = (struct nvidia_i2c_chan *)data; | 67 | struct nvidia_i2c_chan *chan = data; |
68 | struct nvidia_par *par = chan->par; | 68 | struct nvidia_par *par = chan->par; |
69 | u32 val = 0; | 69 | u32 val = 0; |
70 | 70 | ||
@@ -79,7 +79,7 @@ static int nvidia_gpio_getscl(void *data) | |||
79 | 79 | ||
80 | static int nvidia_gpio_getsda(void *data) | 80 | static int nvidia_gpio_getsda(void *data) |
81 | { | 81 | { |
82 | struct nvidia_i2c_chan *chan = (struct nvidia_i2c_chan *)data; | 82 | struct nvidia_i2c_chan *chan = data; |
83 | struct nvidia_par *par = chan->par; | 83 | struct nvidia_par *par = chan->par; |
84 | u32 val = 0; | 84 | u32 val = 0; |
85 | 85 | ||
@@ -136,13 +136,13 @@ void nvidia_create_i2c_busses(struct nvidia_par *par) | |||
136 | par->chan[2].par = par; | 136 | par->chan[2].par = par; |
137 | 137 | ||
138 | par->chan[0].ddc_base = 0x3e; | 138 | par->chan[0].ddc_base = 0x3e; |
139 | nvidia_setup_i2c_bus(&par->chan[0], "BUS1"); | 139 | nvidia_setup_i2c_bus(&par->chan[0], "nvidia #0"); |
140 | 140 | ||
141 | par->chan[1].ddc_base = 0x36; | 141 | par->chan[1].ddc_base = 0x36; |
142 | nvidia_setup_i2c_bus(&par->chan[1], "BUS2"); | 142 | nvidia_setup_i2c_bus(&par->chan[1], "nvidia #1"); |
143 | 143 | ||
144 | par->chan[2].ddc_base = 0x50; | 144 | par->chan[2].ddc_base = 0x50; |
145 | nvidia_setup_i2c_bus(&par->chan[2], "BUS3"); | 145 | nvidia_setup_i2c_bus(&par->chan[2], "nvidia #2"); |
146 | } | 146 | } |
147 | 147 | ||
148 | void nvidia_delete_i2c_busses(struct nvidia_par *par) | 148 | void nvidia_delete_i2c_busses(struct nvidia_par *par) |
diff --git a/drivers/video/nvidia/nv_proto.h b/drivers/video/nvidia/nv_proto.h index 3353103e8b0b..b149a690ee0f 100644 --- a/drivers/video/nvidia/nv_proto.h +++ b/drivers/video/nvidia/nv_proto.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #define __NV_PROTO_H__ | 4 | #define __NV_PROTO_H__ |
5 | 5 | ||
6 | /* in nv_setup.c */ | 6 | /* in nv_setup.c */ |
7 | void NVCommonSetup(struct fb_info *info); | 7 | int NVCommonSetup(struct fb_info *info); |
8 | void NVWriteCrtc(struct nvidia_par *par, u8 index, u8 value); | 8 | void NVWriteCrtc(struct nvidia_par *par, u8 index, u8 value); |
9 | u8 NVReadCrtc(struct nvidia_par *par, u8 index); | 9 | u8 NVReadCrtc(struct nvidia_par *par, u8 index); |
10 | void NVWriteGr(struct nvidia_par *par, u8 index, u8 value); | 10 | void NVWriteGr(struct nvidia_par *par, u8 index, u8 value); |
diff --git a/drivers/video/nvidia/nv_setup.c b/drivers/video/nvidia/nv_setup.c index 1f06a9f1bd0f..a18a9aebf05f 100644 --- a/drivers/video/nvidia/nv_setup.c +++ b/drivers/video/nvidia/nv_setup.c | |||
@@ -285,28 +285,34 @@ static void nv10GetConfig(struct nvidia_par *par) | |||
285 | par->CrystalFreqKHz = 27000; | 285 | par->CrystalFreqKHz = 27000; |
286 | } | 286 | } |
287 | 287 | ||
288 | par->CursorStart = (par->RamAmountKBytes - 96) * 1024; | ||
289 | par->CURSOR = NULL; /* can't set this here */ | 288 | par->CURSOR = NULL; /* can't set this here */ |
290 | par->MinVClockFreqKHz = 12000; | 289 | par->MinVClockFreqKHz = 12000; |
291 | par->MaxVClockFreqKHz = par->twoStagePLL ? 400000 : 350000; | 290 | par->MaxVClockFreqKHz = par->twoStagePLL ? 400000 : 350000; |
292 | } | 291 | } |
293 | 292 | ||
294 | void NVCommonSetup(struct fb_info *info) | 293 | int NVCommonSetup(struct fb_info *info) |
295 | { | 294 | { |
296 | struct nvidia_par *par = info->par; | 295 | struct nvidia_par *par = info->par; |
297 | struct fb_var_screeninfo var; | 296 | struct fb_var_screeninfo *var; |
298 | u16 implementation = par->Chipset & 0x0ff0; | 297 | u16 implementation = par->Chipset & 0x0ff0; |
299 | u8 *edidA = NULL, *edidB = NULL; | 298 | u8 *edidA = NULL, *edidB = NULL; |
300 | struct fb_monspecs monitorA, monitorB; | 299 | struct fb_monspecs *monitorA, *monitorB; |
301 | struct fb_monspecs *monA = NULL, *monB = NULL; | 300 | struct fb_monspecs *monA = NULL, *monB = NULL; |
302 | int mobile = 0; | 301 | int mobile = 0; |
303 | int tvA = 0; | 302 | int tvA = 0; |
304 | int tvB = 0; | 303 | int tvB = 0; |
305 | int FlatPanel = -1; /* really means the CRTC is slaved */ | 304 | int FlatPanel = -1; /* really means the CRTC is slaved */ |
306 | int Television = 0; | 305 | int Television = 0; |
306 | int err = 0; | ||
307 | 307 | ||
308 | memset(&monitorA, 0, sizeof(struct fb_monspecs)); | 308 | var = kzalloc(sizeof(struct fb_var_screeninfo), GFP_KERNEL); |
309 | memset(&monitorB, 0, sizeof(struct fb_monspecs)); | 309 | monitorA = kzalloc(sizeof(struct fb_monspecs), GFP_KERNEL); |
310 | monitorB = kzalloc(sizeof(struct fb_monspecs), GFP_KERNEL); | ||
311 | |||
312 | if (!var || !monitorA || !monitorB) { | ||
313 | err = -ENOMEM; | ||
314 | goto done; | ||
315 | } | ||
310 | 316 | ||
311 | par->PRAMIN = par->REGS + (0x00710000 / 4); | 317 | par->PRAMIN = par->REGS + (0x00710000 / 4); |
312 | par->PCRTC0 = par->REGS + (0x00600000 / 4); | 318 | par->PCRTC0 = par->REGS + (0x00600000 / 4); |
@@ -382,6 +388,8 @@ void NVCommonSetup(struct fb_info *info) | |||
382 | case 0x0146: | 388 | case 0x0146: |
383 | case 0x0147: | 389 | case 0x0147: |
384 | case 0x0148: | 390 | case 0x0148: |
391 | case 0x0098: | ||
392 | case 0x0099: | ||
385 | mobile = 1; | 393 | mobile = 1; |
386 | break; | 394 | break; |
387 | default: | 395 | default: |
@@ -406,9 +414,9 @@ void NVCommonSetup(struct fb_info *info) | |||
406 | par->CRTCnumber = 0; | 414 | par->CRTCnumber = 0; |
407 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) | 415 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) |
408 | nvidia_probe_of_connector(info, 1, &edidA); | 416 | nvidia_probe_of_connector(info, 1, &edidA); |
409 | if (edidA && !fb_parse_edid(edidA, &var)) { | 417 | if (edidA && !fb_parse_edid(edidA, var)) { |
410 | printk("nvidiafb: EDID found from BUS1\n"); | 418 | printk("nvidiafb: EDID found from BUS1\n"); |
411 | monA = &monitorA; | 419 | monA = monitorA; |
412 | fb_edid_to_monspecs(edidA, monA); | 420 | fb_edid_to_monspecs(edidA, monA); |
413 | FlatPanel = (monA->input & FB_DISP_DDI) ? 1 : 0; | 421 | FlatPanel = (monA->input & FB_DISP_DDI) ? 1 : 0; |
414 | 422 | ||
@@ -494,17 +502,17 @@ void NVCommonSetup(struct fb_info *info) | |||
494 | 502 | ||
495 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) | 503 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) |
496 | nvidia_probe_of_connector(info, 1, &edidA); | 504 | nvidia_probe_of_connector(info, 1, &edidA); |
497 | if (edidA && !fb_parse_edid(edidA, &var)) { | 505 | if (edidA && !fb_parse_edid(edidA, var)) { |
498 | printk("nvidiafb: EDID found from BUS1\n"); | 506 | printk("nvidiafb: EDID found from BUS1\n"); |
499 | monA = &monitorA; | 507 | monA = monitorA; |
500 | fb_edid_to_monspecs(edidA, monA); | 508 | fb_edid_to_monspecs(edidA, monA); |
501 | } | 509 | } |
502 | 510 | ||
503 | if (nvidia_probe_i2c_connector(info, 2, &edidB)) | 511 | if (nvidia_probe_i2c_connector(info, 2, &edidB)) |
504 | nvidia_probe_of_connector(info, 2, &edidB); | 512 | nvidia_probe_of_connector(info, 2, &edidB); |
505 | if (edidB && !fb_parse_edid(edidB, &var)) { | 513 | if (edidB && !fb_parse_edid(edidB, var)) { |
506 | printk("nvidiafb: EDID found from BUS2\n"); | 514 | printk("nvidiafb: EDID found from BUS2\n"); |
507 | monB = &monitorB; | 515 | monB = monitorB; |
508 | fb_edid_to_monspecs(edidB, monB); | 516 | fb_edid_to_monspecs(edidB, monB); |
509 | } | 517 | } |
510 | 518 | ||
@@ -639,4 +647,9 @@ void NVCommonSetup(struct fb_info *info) | |||
639 | 647 | ||
640 | kfree(edidA); | 648 | kfree(edidA); |
641 | kfree(edidB); | 649 | kfree(edidB); |
650 | done: | ||
651 | kfree(var); | ||
652 | kfree(monitorA); | ||
653 | kfree(monitorB); | ||
654 | return err; | ||
642 | } | 655 | } |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index bee09c6e48f6..dbcb8962e57d 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -284,6 +284,16 @@ static struct pci_device_id nvidiafb_pci_tbl[] = { | |||
284 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 284 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
285 | {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200, | 285 | {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200, |
286 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 286 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
287 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1, | ||
288 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
289 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1, | ||
290 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
291 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2, | ||
292 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
293 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1, | ||
294 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
295 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT, | ||
296 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
287 | {PCI_VENDOR_ID_NVIDIA, 0x0252, | 297 | {PCI_VENDOR_ID_NVIDIA, 0x0252, |
288 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 298 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
289 | {PCI_VENDOR_ID_NVIDIA, 0x0313, | 299 | {PCI_VENDOR_ID_NVIDIA, 0x0313, |
@@ -418,6 +428,7 @@ static int noaccel __devinitdata = 0; | |||
418 | static int noscale __devinitdata = 0; | 428 | static int noscale __devinitdata = 0; |
419 | static int paneltweak __devinitdata = 0; | 429 | static int paneltweak __devinitdata = 0; |
420 | static int vram __devinitdata = 0; | 430 | static int vram __devinitdata = 0; |
431 | static int bpp __devinitdata = 8; | ||
421 | #ifdef CONFIG_MTRR | 432 | #ifdef CONFIG_MTRR |
422 | static int nomtrr __devinitdata = 0; | 433 | static int nomtrr __devinitdata = 0; |
423 | #endif | 434 | #endif |
@@ -485,7 +496,7 @@ static int nvidia_backlight_levels[] = { | |||
485 | 496 | ||
486 | static int nvidia_set_backlight_enable(int on, int level, void *data) | 497 | static int nvidia_set_backlight_enable(int on, int level, void *data) |
487 | { | 498 | { |
488 | struct nvidia_par *par = (struct nvidia_par *)data; | 499 | struct nvidia_par *par = data; |
489 | u32 tmp_pcrt, tmp_pmc, fpcontrol; | 500 | u32 tmp_pcrt, tmp_pmc, fpcontrol; |
490 | 501 | ||
491 | tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; | 502 | tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; |
@@ -1382,24 +1393,36 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info) | |||
1382 | info->monspecs.modedb_len, &info->modelist); | 1393 | info->monspecs.modedb_len, &info->modelist); |
1383 | fb_var_to_videomode(&modedb, &nvidiafb_default_var); | 1394 | fb_var_to_videomode(&modedb, &nvidiafb_default_var); |
1384 | 1395 | ||
1396 | switch (bpp) { | ||
1397 | case 0 ... 8: | ||
1398 | bpp = 8; | ||
1399 | break; | ||
1400 | case 9 ... 16: | ||
1401 | bpp = 16; | ||
1402 | break; | ||
1403 | default: | ||
1404 | bpp = 32; | ||
1405 | break; | ||
1406 | } | ||
1407 | |||
1385 | if (specs->modedb != NULL) { | 1408 | if (specs->modedb != NULL) { |
1386 | struct fb_videomode *modedb; | 1409 | struct fb_videomode *modedb; |
1387 | 1410 | ||
1388 | modedb = fb_find_best_display(specs, &info->modelist); | 1411 | modedb = fb_find_best_display(specs, &info->modelist); |
1389 | fb_videomode_to_var(&nvidiafb_default_var, modedb); | 1412 | fb_videomode_to_var(&nvidiafb_default_var, modedb); |
1390 | nvidiafb_default_var.bits_per_pixel = 8; | 1413 | nvidiafb_default_var.bits_per_pixel = bpp; |
1391 | } else if (par->fpWidth && par->fpHeight) { | 1414 | } else if (par->fpWidth && par->fpHeight) { |
1392 | char buf[16]; | 1415 | char buf[16]; |
1393 | 1416 | ||
1394 | memset(buf, 0, 16); | 1417 | memset(buf, 0, 16); |
1395 | snprintf(buf, 15, "%dx%dMR", par->fpWidth, par->fpHeight); | 1418 | snprintf(buf, 15, "%dx%dMR", par->fpWidth, par->fpHeight); |
1396 | fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb, | 1419 | fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb, |
1397 | specs->modedb_len, &modedb, 8); | 1420 | specs->modedb_len, &modedb, bpp); |
1398 | } | 1421 | } |
1399 | 1422 | ||
1400 | if (mode_option) | 1423 | if (mode_option) |
1401 | fb_find_mode(&nvidiafb_default_var, info, mode_option, | 1424 | fb_find_mode(&nvidiafb_default_var, info, mode_option, |
1402 | specs->modedb, specs->modedb_len, &modedb, 8); | 1425 | specs->modedb, specs->modedb_len, &modedb, bpp); |
1403 | 1426 | ||
1404 | info->var = nvidiafb_default_var; | 1427 | info->var = nvidiafb_default_var; |
1405 | info->fix.visual = (info->var.bits_per_pixel == 8) ? | 1428 | info->fix.visual = (info->var.bits_per_pixel == 8) ? |
@@ -1448,11 +1471,34 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info) | |||
1448 | return nvidiafb_check_var(&info->var, info); | 1471 | return nvidiafb_check_var(&info->var, info); |
1449 | } | 1472 | } |
1450 | 1473 | ||
1451 | static u32 __devinit nvidia_get_arch(struct pci_dev *pd) | 1474 | static u32 __devinit nvidia_get_chipset(struct fb_info *info) |
1452 | { | 1475 | { |
1476 | struct nvidia_par *par = info->par; | ||
1477 | u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device; | ||
1478 | |||
1479 | printk("nvidiafb: PCI id - %x\n", id); | ||
1480 | if ((id & 0xfff0) == 0x00f0) { | ||
1481 | /* pci-e */ | ||
1482 | printk("nvidiafb: PCI-E card\n"); | ||
1483 | id = NV_RD32(par->REGS, 0x1800); | ||
1484 | |||
1485 | if ((id & 0x0000ffff) == 0x000010DE) | ||
1486 | id = 0x10DE0000 | (id >> 16); | ||
1487 | else if ((id & 0xffff0000) == 0xDE100000) /* wrong endian */ | ||
1488 | id = 0x10DE0000 | ((id << 8) & 0x0000ff00) | | ||
1489 | ((id >> 8) & 0x000000ff); | ||
1490 | } | ||
1491 | |||
1492 | printk("nvidiafb: Actual id - %x\n", id); | ||
1493 | return id; | ||
1494 | } | ||
1495 | |||
1496 | static u32 __devinit nvidia_get_arch(struct fb_info *info) | ||
1497 | { | ||
1498 | struct nvidia_par *par = info->par; | ||
1453 | u32 arch = 0; | 1499 | u32 arch = 0; |
1454 | 1500 | ||
1455 | switch (pd->device & 0x0ff0) { | 1501 | switch (par->Chipset & 0x0ff0) { |
1456 | case 0x0100: /* GeForce 256 */ | 1502 | case 0x0100: /* GeForce 256 */ |
1457 | case 0x0110: /* GeForce2 MX */ | 1503 | case 0x0110: /* GeForce2 MX */ |
1458 | case 0x0150: /* GeForce2 */ | 1504 | case 0x0150: /* GeForce2 */ |
@@ -1485,6 +1531,8 @@ static u32 __devinit nvidia_get_arch(struct pci_dev *pd) | |||
1485 | case 0x0210: | 1531 | case 0x0210: |
1486 | case 0x0220: | 1532 | case 0x0220: |
1487 | case 0x0230: | 1533 | case 0x0230: |
1534 | case 0x0290: | ||
1535 | case 0x0390: | ||
1488 | arch = NV_ARCH_40; | 1536 | arch = NV_ARCH_40; |
1489 | break; | 1537 | break; |
1490 | case 0x0020: /* TNT, TNT2 */ | 1538 | case 0x0020: /* TNT, TNT2 */ |
@@ -1513,7 +1561,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1513 | if (!info) | 1561 | if (!info) |
1514 | goto err_out; | 1562 | goto err_out; |
1515 | 1563 | ||
1516 | par = (struct nvidia_par *)info->par; | 1564 | par = info->par; |
1517 | par->pci_dev = pd; | 1565 | par->pci_dev = pd; |
1518 | 1566 | ||
1519 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); | 1567 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); |
@@ -1533,18 +1581,6 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1533 | goto err_out_request; | 1581 | goto err_out_request; |
1534 | } | 1582 | } |
1535 | 1583 | ||
1536 | par->Architecture = nvidia_get_arch(pd); | ||
1537 | |||
1538 | par->Chipset = (pd->vendor << 16) | pd->device; | ||
1539 | printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset); | ||
1540 | |||
1541 | if (par->Architecture == 0) { | ||
1542 | printk(KERN_ERR PFX "unknown NV_ARCH\n"); | ||
1543 | goto err_out_free_base0; | ||
1544 | } | ||
1545 | |||
1546 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); | ||
1547 | |||
1548 | par->FlatPanel = flatpanel; | 1584 | par->FlatPanel = flatpanel; |
1549 | if (flatpanel == 1) | 1585 | if (flatpanel == 1) |
1550 | printk(KERN_INFO PFX "flatpanel support enabled\n"); | 1586 | printk(KERN_INFO PFX "flatpanel support enabled\n"); |
@@ -1570,7 +1606,19 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1570 | goto err_out_free_base0; | 1606 | goto err_out_free_base0; |
1571 | } | 1607 | } |
1572 | 1608 | ||
1573 | NVCommonSetup(info); | 1609 | par->Chipset = nvidia_get_chipset(info); |
1610 | printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset); | ||
1611 | par->Architecture = nvidia_get_arch(info); | ||
1612 | |||
1613 | if (par->Architecture == 0) { | ||
1614 | printk(KERN_ERR PFX "unknown NV_ARCH\n"); | ||
1615 | goto err_out_arch; | ||
1616 | } | ||
1617 | |||
1618 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); | ||
1619 | |||
1620 | if (NVCommonSetup(info)) | ||
1621 | goto err_out_arch; | ||
1574 | 1622 | ||
1575 | par->FbAddress = nvidiafb_fix.smem_start; | 1623 | par->FbAddress = nvidiafb_fix.smem_start; |
1576 | par->FbMapSize = par->RamAmountKBytes * 1024; | 1624 | par->FbMapSize = par->RamAmountKBytes * 1024; |
@@ -1581,10 +1629,15 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1581 | if (par->FbMapSize > 64 * 1024 * 1024) | 1629 | if (par->FbMapSize > 64 * 1024 * 1024) |
1582 | par->FbMapSize = 64 * 1024 * 1024; | 1630 | par->FbMapSize = 64 * 1024 * 1024; |
1583 | 1631 | ||
1584 | par->FbUsableSize = par->FbMapSize - (128 * 1024); | 1632 | if(par->Architecture >= NV_ARCH_40) |
1633 | par->FbUsableSize = par->FbMapSize - (560 * 1024); | ||
1634 | else | ||
1635 | par->FbUsableSize = par->FbMapSize - (128 * 1024); | ||
1585 | par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 : | 1636 | par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 : |
1586 | 16 * 1024; | 1637 | 16 * 1024; |
1587 | par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize; | 1638 | par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize; |
1639 | par->CursorStart = par->FbUsableSize + (32 * 1024); | ||
1640 | |||
1588 | info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize); | 1641 | info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize); |
1589 | info->screen_size = par->FbUsableSize; | 1642 | info->screen_size = par->FbUsableSize; |
1590 | nvidiafb_fix.smem_len = par->RamAmountKBytes * 1024; | 1643 | nvidiafb_fix.smem_len = par->RamAmountKBytes * 1024; |
@@ -1640,21 +1693,22 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1640 | NVTRACE_LEAVE(); | 1693 | NVTRACE_LEAVE(); |
1641 | return 0; | 1694 | return 0; |
1642 | 1695 | ||
1643 | err_out_iounmap_fb: | 1696 | err_out_iounmap_fb: |
1644 | iounmap(info->screen_base); | 1697 | iounmap(info->screen_base); |
1645 | err_out_free_base1: | 1698 | err_out_free_base1: |
1646 | fb_destroy_modedb(info->monspecs.modedb); | 1699 | fb_destroy_modedb(info->monspecs.modedb); |
1647 | nvidia_delete_i2c_busses(par); | 1700 | nvidia_delete_i2c_busses(par); |
1701 | err_out_arch: | ||
1648 | iounmap(par->REGS); | 1702 | iounmap(par->REGS); |
1649 | err_out_free_base0: | 1703 | err_out_free_base0: |
1650 | pci_release_regions(pd); | 1704 | pci_release_regions(pd); |
1651 | err_out_request: | 1705 | err_out_request: |
1652 | pci_disable_device(pd); | 1706 | pci_disable_device(pd); |
1653 | err_out_enable: | 1707 | err_out_enable: |
1654 | kfree(info->pixmap.addr); | 1708 | kfree(info->pixmap.addr); |
1655 | err_out_kfree: | 1709 | err_out_kfree: |
1656 | framebuffer_release(info); | 1710 | framebuffer_release(info); |
1657 | err_out: | 1711 | err_out: |
1658 | return -ENODEV; | 1712 | return -ENODEV; |
1659 | } | 1713 | } |
1660 | 1714 | ||
@@ -1729,6 +1783,8 @@ static int __devinit nvidiafb_setup(char *options) | |||
1729 | #endif | 1783 | #endif |
1730 | } else if (!strncmp(this_opt, "fpdither:", 9)) { | 1784 | } else if (!strncmp(this_opt, "fpdither:", 9)) { |
1731 | fpdither = simple_strtol(this_opt+9, NULL, 0); | 1785 | fpdither = simple_strtol(this_opt+9, NULL, 0); |
1786 | } else if (!strncmp(this_opt, "bpp:", 4)) { | ||
1787 | bpp = simple_strtoul(this_opt+4, NULL, 0); | ||
1732 | } else | 1788 | } else |
1733 | mode_option = this_opt; | 1789 | mode_option = this_opt; |
1734 | } | 1790 | } |
@@ -1804,6 +1860,11 @@ module_param(vram, int, 0); | |||
1804 | MODULE_PARM_DESC(vram, | 1860 | MODULE_PARM_DESC(vram, |
1805 | "amount of framebuffer memory to remap in MiB" | 1861 | "amount of framebuffer memory to remap in MiB" |
1806 | "(default=0 - remap entire memory)"); | 1862 | "(default=0 - remap entire memory)"); |
1863 | module_param(mode_option, charp, 0); | ||
1864 | MODULE_PARM_DESC(mode_option, "Specify initial video mode"); | ||
1865 | module_param(bpp, int, 0); | ||
1866 | MODULE_PARM_DESC(bpp, "pixel width in bits" | ||
1867 | "(default=8)"); | ||
1807 | #ifdef CONFIG_MTRR | 1868 | #ifdef CONFIG_MTRR |
1808 | module_param(nomtrr, bool, 0); | 1869 | module_param(nomtrr, bool, 0); |
1809 | MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " | 1870 | MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " |
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 00d87f5bb7be..ad1434e3f227 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -223,6 +223,7 @@ static int offb_blank(int blank, struct fb_info *info) | |||
223 | int __init offb_init(void) | 223 | int __init offb_init(void) |
224 | { | 224 | { |
225 | struct device_node *dp = NULL, *boot_disp = NULL; | 225 | struct device_node *dp = NULL, *boot_disp = NULL; |
226 | |||
226 | #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) | 227 | #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) |
227 | struct device_node *macos_display = NULL; | 228 | struct device_node *macos_display = NULL; |
228 | #endif | 229 | #endif |
@@ -234,60 +235,54 @@ int __init offb_init(void) | |||
234 | if (boot_infos != 0) { | 235 | if (boot_infos != 0) { |
235 | unsigned long addr = | 236 | unsigned long addr = |
236 | (unsigned long) boot_infos->dispDeviceBase; | 237 | (unsigned long) boot_infos->dispDeviceBase; |
238 | u32 *addrp; | ||
239 | u64 daddr, dsize; | ||
240 | unsigned int flags; | ||
241 | |||
237 | /* find the device node corresponding to the macos display */ | 242 | /* find the device node corresponding to the macos display */ |
238 | while ((dp = of_find_node_by_type(dp, "display"))) { | 243 | while ((dp = of_find_node_by_type(dp, "display"))) { |
239 | int i; | 244 | int i; |
240 | /* | ||
241 | * Grrr... It looks like the MacOS ATI driver | ||
242 | * munges the assigned-addresses property (but | ||
243 | * the AAPL,address value is OK). | ||
244 | */ | ||
245 | if (strncmp(dp->name, "ATY,", 4) == 0 | ||
246 | && dp->n_addrs == 1) { | ||
247 | unsigned int *ap = | ||
248 | (unsigned int *) get_property(dp, | ||
249 | "AAPL,address", | ||
250 | NULL); | ||
251 | if (ap != NULL) { | ||
252 | dp->addrs[0].address = *ap; | ||
253 | dp->addrs[0].size = 0x01000000; | ||
254 | } | ||
255 | } | ||
256 | 245 | ||
257 | /* | 246 | /* |
258 | * The LTPro on the Lombard powerbook has no addresses | 247 | * Look for an AAPL,address property first. |
259 | * on the display nodes, they are on their parent. | ||
260 | */ | 248 | */ |
261 | if (dp->n_addrs == 0 | 249 | unsigned int na; |
262 | && device_is_compatible(dp, "ATY,264LTPro")) { | 250 | unsigned int *ap = |
263 | int na; | 251 | (unsigned int *)get_property(dp, "AAPL,address", |
264 | unsigned int *ap = (unsigned int *) | 252 | &na); |
265 | get_property(dp, "AAPL,address", &na); | 253 | if (ap != 0) { |
266 | if (ap != 0) | 254 | for (na /= sizeof(unsigned int); na > 0; |
267 | for (na /= sizeof(unsigned int); | 255 | --na, ++ap) |
268 | na > 0; --na, ++ap) | 256 | if (*ap <= addr && |
269 | if (*ap <= addr | 257 | addr < *ap + 0x1000000) { |
270 | && addr < | 258 | macos_display = dp; |
271 | *ap + 0x1000000) | 259 | goto foundit; |
272 | goto foundit; | 260 | } |
273 | } | 261 | } |
274 | 262 | ||
275 | /* | 263 | /* |
276 | * See if the display address is in one of the address | 264 | * See if the display address is in one of the address |
277 | * ranges for this display. | 265 | * ranges for this display. |
278 | */ | 266 | */ |
279 | for (i = 0; i < dp->n_addrs; ++i) { | 267 | i = 0; |
280 | if (dp->addrs[i].address <= addr | 268 | for (;;) { |
281 | && addr < | 269 | addrp = of_get_address(dp, i++, &dsize, &flags); |
282 | dp->addrs[i].address + | 270 | if (addrp == NULL) |
283 | dp->addrs[i].size) | ||
284 | break; | 271 | break; |
272 | if (!(flags & IORESOURCE_MEM)) | ||
273 | continue; | ||
274 | daddr = of_translate_address(dp, addrp); | ||
275 | if (daddr == OF_BAD_ADDR) | ||
276 | continue; | ||
277 | if (daddr <= addr && addr < (daddr + dsize)) { | ||
278 | macos_display = dp; | ||
279 | goto foundit; | ||
280 | } | ||
285 | } | 281 | } |
286 | if (i < dp->n_addrs) { | 282 | foundit: |
287 | foundit: | 283 | if (macos_display) { |
288 | printk(KERN_INFO "MacOS display is %s\n", | 284 | printk(KERN_INFO "MacOS display is %s\n", |
289 | dp->full_name); | 285 | dp->full_name); |
290 | macos_display = dp; | ||
291 | break; | 286 | break; |
292 | } | 287 | } |
293 | } | 288 | } |
@@ -326,8 +321,10 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
326 | int *pp, i; | 321 | int *pp, i; |
327 | unsigned int len; | 322 | unsigned int len; |
328 | int width = 640, height = 480, depth = 8, pitch; | 323 | int width = 640, height = 480, depth = 8, pitch; |
329 | unsigned int rsize, *up; | 324 | unsigned int flags, rsize, *up; |
330 | unsigned long address = 0; | 325 | u64 address = OF_BAD_ADDR; |
326 | u32 *addrp; | ||
327 | u64 asize; | ||
331 | 328 | ||
332 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL | 329 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL |
333 | && len == sizeof(int)) | 330 | && len == sizeof(int)) |
@@ -363,7 +360,7 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
363 | break; | 360 | break; |
364 | } | 361 | } |
365 | if (pdev) { | 362 | if (pdev) { |
366 | for (i = 0; i < 6 && address == 0; i++) { | 363 | for (i = 0; i < 6 && address == OF_BAD_ADDR; i++) { |
367 | if ((pci_resource_flags(pdev, i) & | 364 | if ((pci_resource_flags(pdev, i) & |
368 | IORESOURCE_MEM) && | 365 | IORESOURCE_MEM) && |
369 | (pci_resource_len(pdev, i) >= rsize)) | 366 | (pci_resource_len(pdev, i) >= rsize)) |
@@ -374,27 +371,33 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
374 | } | 371 | } |
375 | #endif /* CONFIG_PCI */ | 372 | #endif /* CONFIG_PCI */ |
376 | 373 | ||
377 | if (address == 0 && | 374 | /* This one is dodgy, we may drop it ... */ |
378 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && | 375 | if (address == OF_BAD_ADDR && |
379 | len == sizeof(unsigned)) | 376 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && |
380 | address = (u_long) * up; | 377 | len == sizeof(unsigned int)) |
381 | if (address == 0) { | 378 | address = (u64) * up; |
382 | for (i = 0; i < dp->n_addrs; ++i) | 379 | |
383 | if (dp->addrs[i].size >= | 380 | if (address == OF_BAD_ADDR) { |
384 | pitch * height * depth / 8) | 381 | for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) |
385 | break; | 382 | != NULL; i++) { |
386 | if (i >= dp->n_addrs) { | 383 | if (!(flags & IORESOURCE_MEM)) |
384 | continue; | ||
385 | if (asize >= pitch * height * depth / 8) | ||
386 | break; | ||
387 | } | ||
388 | if (addrp == NULL) { | ||
387 | printk(KERN_ERR | 389 | printk(KERN_ERR |
388 | "no framebuffer address found for %s\n", | 390 | "no framebuffer address found for %s\n", |
389 | dp->full_name); | 391 | dp->full_name); |
390 | return; | 392 | return; |
391 | } | 393 | } |
392 | 394 | address = of_translate_address(dp, addrp); | |
393 | address = (u_long) dp->addrs[i].address; | 395 | if (address == OF_BAD_ADDR) { |
394 | 396 | printk(KERN_ERR | |
395 | #ifdef CONFIG_PPC64 | 397 | "can't translate framebuffer address for %s\n", |
396 | address += ((struct pci_dn *)dp->data)->phb->pci_mem_offset; | 398 | dp->full_name); |
397 | #endif | 399 | return; |
400 | } | ||
398 | 401 | ||
399 | /* kludge for valkyrie */ | 402 | /* kludge for valkyrie */ |
400 | if (strcmp(dp->name, "valkyrie") == 0) | 403 | if (strcmp(dp->name, "valkyrie") == 0) |
@@ -459,7 +462,9 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
459 | 462 | ||
460 | par->cmap_type = cmap_unknown; | 463 | par->cmap_type = cmap_unknown; |
461 | if (depth == 8) { | 464 | if (depth == 8) { |
462 | /* XXX kludge for ati */ | 465 | |
466 | /* Palette hacks disabled for now */ | ||
467 | #if 0 | ||
463 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { | 468 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { |
464 | unsigned long regbase = dp->addrs[2].address; | 469 | unsigned long regbase = dp->addrs[2].address; |
465 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 470 | par->cmap_adr = ioremap(regbase, 0x1FFF); |
@@ -490,6 +495,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
490 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); | 495 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); |
491 | par->cmap_type = cmap_gxt2000; | 496 | par->cmap_type = cmap_gxt2000; |
492 | } | 497 | } |
498 | #endif | ||
493 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR | 499 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR |
494 | : FB_VISUAL_STATIC_PSEUDOCOLOR; | 500 | : FB_VISUAL_STATIC_PSEUDOCOLOR; |
495 | } else | 501 | } else |
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index b251e754e16c..0d1957505359 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
@@ -31,9 +31,8 @@ static int p9100_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
31 | unsigned, struct fb_info *); | 31 | unsigned, struct fb_info *); |
32 | static int p9100_blank(int, struct fb_info *); | 32 | static int p9100_blank(int, struct fb_info *); |
33 | 33 | ||
34 | static int p9100_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 34 | static int p9100_mmap(struct fb_info *, struct vm_area_struct *); |
35 | static int p9100_ioctl(struct inode *, struct file *, unsigned int, | 35 | static int p9100_ioctl(struct fb_info *, unsigned int, unsigned long); |
36 | unsigned long, struct fb_info *); | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * Frame buffer operations | 38 | * Frame buffer operations |
@@ -222,7 +221,7 @@ static struct sbus_mmap_map p9100_mmap_map[] = { | |||
222 | { 0, 0, 0 } | 221 | { 0, 0, 0 } |
223 | }; | 222 | }; |
224 | 223 | ||
225 | static int p9100_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 224 | static int p9100_mmap(struct fb_info *info, struct vm_area_struct *vma) |
226 | { | 225 | { |
227 | struct p9100_par *par = (struct p9100_par *)info->par; | 226 | struct p9100_par *par = (struct p9100_par *)info->par; |
228 | 227 | ||
@@ -232,8 +231,8 @@ static int p9100_mmap(struct fb_info *info, struct file *file, struct vm_area_st | |||
232 | vma); | 231 | vma); |
233 | } | 232 | } |
234 | 233 | ||
235 | static int p9100_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 234 | static int p9100_ioctl(struct fb_info *info, unsigned int cmd, |
236 | unsigned long arg, struct fb_info *info) | 235 | unsigned long arg) |
237 | { | 236 | { |
238 | struct p9100_par *par = (struct p9100_par *) info->par; | 237 | struct p9100_par *par = (struct p9100_par *) info->par; |
239 | 238 | ||
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index ca4082ae5a18..335e37465559 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -69,6 +69,8 @@ struct fb_info_platinum { | |||
69 | unsigned long total_vram; | 69 | unsigned long total_vram; |
70 | int clktype; | 70 | int clktype; |
71 | int dactype; | 71 | int dactype; |
72 | |||
73 | struct resource rsrc_fb, rsrc_reg; | ||
72 | }; | 74 | }; |
73 | 75 | ||
74 | /* | 76 | /* |
@@ -97,9 +99,6 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
97 | * Interface used by the world | 99 | * Interface used by the world |
98 | */ | 100 | */ |
99 | 101 | ||
100 | int platinumfb_init(void); | ||
101 | int platinumfb_setup(char*); | ||
102 | |||
103 | static struct fb_ops platinumfb_ops = { | 102 | static struct fb_ops platinumfb_ops = { |
104 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
105 | .fb_check_var = platinumfb_check_var, | 104 | .fb_check_var = platinumfb_check_var, |
@@ -138,13 +137,15 @@ static int platinumfb_set_par (struct fb_info *info) | |||
138 | 137 | ||
139 | init = platinum_reg_init[pinfo->vmode-1]; | 138 | init = platinum_reg_init[pinfo->vmode-1]; |
140 | 139 | ||
141 | if (pinfo->vmode == 13 && pinfo->cmode > 0) | 140 | if ((pinfo->vmode == VMODE_832_624_75) && (pinfo->cmode > CMODE_8)) |
142 | offset = 0x10; | 141 | offset = 0x10; |
142 | |||
143 | info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; | 143 | info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; |
144 | info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; | 144 | info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; |
145 | info->fix.visual = (pinfo->cmode == CMODE_8) ? | 145 | info->fix.visual = (pinfo->cmode == CMODE_8) ? |
146 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; | 146 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; |
147 | info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) + offset; | 147 | info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) |
148 | + offset; | ||
148 | printk("line_length: %x\n", info->fix.line_length); | 149 | printk("line_length: %x\n", info->fix.line_length); |
149 | return 0; | 150 | return 0; |
150 | } | 151 | } |
@@ -221,7 +222,9 @@ static int platinumfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
221 | static inline int platinum_vram_reqd(int video_mode, int color_mode) | 222 | static inline int platinum_vram_reqd(int video_mode, int color_mode) |
222 | { | 223 | { |
223 | return vmode_attrs[video_mode-1].vres * | 224 | return vmode_attrs[video_mode-1].vres * |
224 | (vmode_attrs[video_mode-1].hres * (1<<color_mode) + 0x20) +0x1000; | 225 | (vmode_attrs[video_mode-1].hres * (1<<color_mode) + |
226 | ((video_mode == VMODE_832_624_75) && | ||
227 | (color_mode > CMODE_8)) ? 0x10 : 0x20) + 0x1000; | ||
225 | } | 228 | } |
226 | 229 | ||
227 | #define STORE_D2(a, d) { \ | 230 | #define STORE_D2(a, d) { \ |
@@ -481,7 +484,7 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
481 | /* | 484 | /* |
482 | * Parse user speficied options (`video=platinumfb:') | 485 | * Parse user speficied options (`video=platinumfb:') |
483 | */ | 486 | */ |
484 | int __init platinumfb_setup(char *options) | 487 | static int __init platinumfb_setup(char *options) |
485 | { | 488 | { |
486 | char *this_opt; | 489 | char *this_opt; |
487 | 490 | ||
@@ -522,19 +525,15 @@ int __init platinumfb_setup(char *options) | |||
522 | #define invalidate_cache(addr) | 525 | #define invalidate_cache(addr) |
523 | #endif | 526 | #endif |
524 | 527 | ||
525 | static int __devinit platinumfb_probe(struct of_device* odev, const struct of_device_id *match) | 528 | static int __devinit platinumfb_probe(struct of_device* odev, |
529 | const struct of_device_id *match) | ||
526 | { | 530 | { |
527 | struct device_node *dp = odev->node; | 531 | struct device_node *dp = odev->node; |
528 | struct fb_info *info; | 532 | struct fb_info *info; |
529 | struct fb_info_platinum *pinfo; | 533 | struct fb_info_platinum *pinfo; |
530 | unsigned long addr, size; | ||
531 | volatile __u8 *fbuffer; | 534 | volatile __u8 *fbuffer; |
532 | int i, bank0, bank1, bank2, bank3, rc; | 535 | int bank0, bank1, bank2, bank3, rc; |
533 | 536 | ||
534 | if (dp->n_addrs != 2) { | ||
535 | printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs); | ||
536 | return -ENXIO; | ||
537 | } | ||
538 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); | 537 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); |
539 | 538 | ||
540 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); | 539 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); |
@@ -542,26 +541,39 @@ static int __devinit platinumfb_probe(struct of_device* odev, const struct of_de | |||
542 | return -ENOMEM; | 541 | return -ENOMEM; |
543 | pinfo = info->par; | 542 | pinfo = info->par; |
544 | 543 | ||
545 | /* Map in frame buffer and registers */ | 544 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || |
546 | for (i = 0; i < dp->n_addrs; ++i) { | 545 | of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { |
547 | addr = dp->addrs[i].address; | 546 | printk(KERN_ERR "platinumfb: Can't get resources\n"); |
548 | size = dp->addrs[i].size; | 547 | framebuffer_release(info); |
549 | /* Let's assume we can request either all or nothing */ | 548 | return -ENXIO; |
550 | if (!request_mem_region(addr, size, "platinumfb")) { | ||
551 | framebuffer_release(info); | ||
552 | return -ENXIO; | ||
553 | } | ||
554 | if (size >= 0x400000) { | ||
555 | /* frame buffer - map only 4MB */ | ||
556 | pinfo->frame_buffer_phys = addr; | ||
557 | pinfo->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU); | ||
558 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
559 | } else { | ||
560 | /* registers */ | ||
561 | pinfo->platinum_regs_phys = addr; | ||
562 | pinfo->platinum_regs = ioremap(addr, size); | ||
563 | } | ||
564 | } | 549 | } |
550 | if (!request_mem_region(pinfo->rsrc_reg.start, | ||
551 | pinfo->rsrc_reg.start - | ||
552 | pinfo->rsrc_reg.end + 1, | ||
553 | "platinumfb registers")) { | ||
554 | framebuffer_release(info); | ||
555 | return -ENXIO; | ||
556 | } | ||
557 | if (!request_mem_region(pinfo->rsrc_fb.start, | ||
558 | pinfo->rsrc_fb.start | ||
559 | - pinfo->rsrc_fb.end + 1, | ||
560 | "platinumfb framebuffer")) { | ||
561 | release_mem_region(pinfo->rsrc_reg.start, | ||
562 | pinfo->rsrc_reg.end - | ||
563 | pinfo->rsrc_reg.start + 1); | ||
564 | framebuffer_release(info); | ||
565 | return -ENXIO; | ||
566 | } | ||
567 | |||
568 | /* frame buffer - map only 4MB */ | ||
569 | pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; | ||
570 | pinfo->frame_buffer = __ioremap(pinfo->rsrc_fb.start, 0x400000, | ||
571 | _PAGE_WRITETHRU); | ||
572 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
573 | |||
574 | /* registers */ | ||
575 | pinfo->platinum_regs_phys = pinfo->rsrc_reg.start; | ||
576 | pinfo->platinum_regs = ioremap(pinfo->rsrc_reg.start, 0x1000); | ||
565 | 577 | ||
566 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ | 578 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ |
567 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); | 579 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); |
@@ -624,18 +636,16 @@ static int __devexit platinumfb_remove(struct of_device* odev) | |||
624 | { | 636 | { |
625 | struct fb_info *info = dev_get_drvdata(&odev->dev); | 637 | struct fb_info *info = dev_get_drvdata(&odev->dev); |
626 | struct fb_info_platinum *pinfo = info->par; | 638 | struct fb_info_platinum *pinfo = info->par; |
627 | struct device_node *dp = odev->node; | ||
628 | unsigned long addr, size; | ||
629 | int i; | ||
630 | 639 | ||
631 | unregister_framebuffer (info); | 640 | unregister_framebuffer (info); |
632 | 641 | ||
633 | /* Unmap frame buffer and registers */ | 642 | /* Unmap frame buffer and registers */ |
634 | for (i = 0; i < dp->n_addrs; ++i) { | 643 | release_mem_region(pinfo->rsrc_fb.start, |
635 | addr = dp->addrs[i].address; | 644 | pinfo->rsrc_fb.end - |
636 | size = dp->addrs[i].size; | 645 | pinfo->rsrc_fb.start + 1); |
637 | release_mem_region(addr, size); | 646 | release_mem_region(pinfo->rsrc_reg.start, |
638 | } | 647 | pinfo->rsrc_reg.end - |
648 | pinfo->rsrc_reg.start + 1); | ||
639 | iounmap(pinfo->frame_buffer); | 649 | iounmap(pinfo->frame_buffer); |
640 | iounmap(pinfo->platinum_regs); | 650 | iounmap(pinfo->platinum_regs); |
641 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); | 651 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); |
@@ -662,7 +672,7 @@ static struct of_platform_driver platinum_driver = | |||
662 | .remove = platinumfb_remove, | 672 | .remove = platinumfb_remove, |
663 | }; | 673 | }; |
664 | 674 | ||
665 | int __init platinumfb_init(void) | 675 | static int __init platinumfb_init(void) |
666 | { | 676 | { |
667 | #ifndef MODULE | 677 | #ifndef MODULE |
668 | char *option = NULL; | 678 | char *option = NULL; |
@@ -676,7 +686,7 @@ int __init platinumfb_init(void) | |||
676 | return 0; | 686 | return 0; |
677 | } | 687 | } |
678 | 688 | ||
679 | void __exit platinumfb_exit(void) | 689 | static void __exit platinumfb_exit(void) |
680 | { | 690 | { |
681 | of_unregister_driver(&platinum_driver); | 691 | of_unregister_driver(&platinum_driver); |
682 | } | 692 | } |
diff --git a/drivers/video/platinumfb.h b/drivers/video/platinumfb.h index 2834fc1c344b..f6bd77cafd17 100644 --- a/drivers/video/platinumfb.h +++ b/drivers/video/platinumfb.h | |||
@@ -158,7 +158,9 @@ static struct platinum_regvals platinum_reg_init_14 = { | |||
158 | /* 832x624, 75Hz (13) */ | 158 | /* 832x624, 75Hz (13) */ |
159 | static struct platinum_regvals platinum_reg_init_13 = { | 159 | static struct platinum_regvals platinum_reg_init_13 = { |
160 | 0x70, | 160 | 0x70, |
161 | { 864, 1680, 3360 }, /* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB */ | 161 | { 864, 1680, 3344 }, /* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB, |
162 | * and we use 3344 instead of 3360 to fit in 2Mb | ||
163 | */ | ||
162 | { 0xff0, 4, 0, 0, 0, 0, 0x299, 0, | 164 | { 0xff0, 4, 0, 0, 0, 0, 0x299, 0, |
163 | 0, 0x21e, 0x120, 0x10, 0x23f, 0x1f, 0x25, 0x37, | 165 | 0, 0x21e, 0x120, 0x10, 0x23f, 0x1f, 0x25, 0x37, |
164 | 0x8a, 0x22a, 0x23e, 0x536, 0x534, 4, 9, 0x52, | 166 | 0x8a, 0x22a, 0x23e, 0x536, 0x534, 4, 9, 0x52, |
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 0277ce031e5e..5fe197943deb 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
@@ -91,6 +91,7 @@ struct pm2fb_par | |||
91 | u32 mem_config; /* MemConfig reg at probe */ | 91 | u32 mem_config; /* MemConfig reg at probe */ |
92 | u32 mem_control; /* MemControl reg at probe */ | 92 | u32 mem_control; /* MemControl reg at probe */ |
93 | u32 boot_address; /* BootAddress reg at probe */ | 93 | u32 boot_address; /* BootAddress reg at probe */ |
94 | u32 palette[16]; | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | /* | 97 | /* |
@@ -674,7 +675,7 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
674 | */ | 675 | */ |
675 | static int pm2fb_set_par(struct fb_info *info) | 676 | static int pm2fb_set_par(struct fb_info *info) |
676 | { | 677 | { |
677 | struct pm2fb_par *par = (struct pm2fb_par *) info->par; | 678 | struct pm2fb_par *par = info->par; |
678 | u32 pixclock; | 679 | u32 pixclock; |
679 | u32 width, height, depth; | 680 | u32 width, height, depth; |
680 | u32 hsstart, hsend, hbend, htotal; | 681 | u32 hsstart, hsend, hbend, htotal; |
@@ -854,7 +855,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
854 | unsigned blue, unsigned transp, | 855 | unsigned blue, unsigned transp, |
855 | struct fb_info *info) | 856 | struct fb_info *info) |
856 | { | 857 | { |
857 | struct pm2fb_par *par = (struct pm2fb_par *) info->par; | 858 | struct pm2fb_par *par = info->par; |
858 | 859 | ||
859 | if (regno >= info->cmap.len) /* no. of hw registers */ | 860 | if (regno >= info->cmap.len) /* no. of hw registers */ |
860 | return 1; | 861 | return 1; |
@@ -929,7 +930,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
929 | case 16: | 930 | case 16: |
930 | case 24: | 931 | case 24: |
931 | case 32: | 932 | case 32: |
932 | ((u32*)(info->pseudo_palette))[regno] = v; | 933 | par->palette[regno] = v; |
933 | break; | 934 | break; |
934 | } | 935 | } |
935 | return 0; | 936 | return 0; |
@@ -955,7 +956,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
955 | static int pm2fb_pan_display(struct fb_var_screeninfo *var, | 956 | static int pm2fb_pan_display(struct fb_var_screeninfo *var, |
956 | struct fb_info *info) | 957 | struct fb_info *info) |
957 | { | 958 | { |
958 | struct pm2fb_par *p = (struct pm2fb_par *) info->par; | 959 | struct pm2fb_par *p = info->par; |
959 | u32 base; | 960 | u32 base; |
960 | u32 depth; | 961 | u32 depth; |
961 | u32 xres; | 962 | u32 xres; |
@@ -987,7 +988,7 @@ static int pm2fb_pan_display(struct fb_var_screeninfo *var, | |||
987 | */ | 988 | */ |
988 | static int pm2fb_blank(int blank_mode, struct fb_info *info) | 989 | static int pm2fb_blank(int blank_mode, struct fb_info *info) |
989 | { | 990 | { |
990 | struct pm2fb_par *par = (struct pm2fb_par *) info->par; | 991 | struct pm2fb_par *par = info->par; |
991 | u32 video = par->video; | 992 | u32 video = par->video; |
992 | 993 | ||
993 | DPRINTK("blank_mode %d\n", blank_mode); | 994 | DPRINTK("blank_mode %d\n", blank_mode); |
@@ -1054,8 +1055,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1054 | { | 1055 | { |
1055 | struct pm2fb_par *default_par; | 1056 | struct pm2fb_par *default_par; |
1056 | struct fb_info *info; | 1057 | struct fb_info *info; |
1057 | int size, err; | 1058 | int err, err_retval = -ENXIO; |
1058 | int err_retval = -ENXIO; | ||
1059 | 1059 | ||
1060 | err = pci_enable_device(pdev); | 1060 | err = pci_enable_device(pdev); |
1061 | if ( err ) { | 1061 | if ( err ) { |
@@ -1063,11 +1063,10 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1063 | return err; | 1063 | return err; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | size = sizeof(struct pm2fb_par) + 256 * sizeof(u32); | 1066 | info = framebuffer_alloc(sizeof(struct pm2fb_par), &pdev->dev); |
1067 | info = framebuffer_alloc(size, &pdev->dev); | ||
1068 | if ( !info ) | 1067 | if ( !info ) |
1069 | return -ENOMEM; | 1068 | return -ENOMEM; |
1070 | default_par = (struct pm2fb_par *) info->par; | 1069 | default_par = info->par; |
1071 | 1070 | ||
1072 | switch (pdev->device) { | 1071 | switch (pdev->device) { |
1073 | case PCI_DEVICE_ID_TI_TVP4020: | 1072 | case PCI_DEVICE_ID_TI_TVP4020: |
@@ -1171,7 +1170,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1171 | 1170 | ||
1172 | info->fbops = &pm2fb_ops; | 1171 | info->fbops = &pm2fb_ops; |
1173 | info->fix = pm2fb_fix; | 1172 | info->fix = pm2fb_fix; |
1174 | info->pseudo_palette = (void *)(default_par + 1); | 1173 | info->pseudo_palette = default_par->palette; |
1175 | info->flags = FBINFO_DEFAULT | | 1174 | info->flags = FBINFO_DEFAULT | |
1176 | FBINFO_HWACCEL_YPAN; | 1175 | FBINFO_HWACCEL_YPAN; |
1177 | 1176 | ||
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 2e11b601c488..0e78ddc81583 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -657,9 +657,7 @@ static void pm3fb_set_disp(const void *par, struct display *disp, | |||
657 | static void pm3fb_detect(void); | 657 | static void pm3fb_detect(void); |
658 | static int pm3fb_pan_display(const struct fb_var_screeninfo *var, | 658 | static int pm3fb_pan_display(const struct fb_var_screeninfo *var, |
659 | struct fb_info_gen *info); | 659 | struct fb_info_gen *info); |
660 | static int pm3fb_ioctl(struct inode *inode, struct file *file, | 660 | static int pm3fb_ioctl(struct fb_info *info, u_int cmd, u_long arg); |
661 | u_int cmd, u_long arg, int con, | ||
662 | struct fb_info *info); | ||
663 | 661 | ||
664 | 662 | ||
665 | /* the struct that hold them together */ | 663 | /* the struct that hold them together */ |
@@ -3438,9 +3436,7 @@ static int pm3fb_pan_display(const struct fb_var_screeninfo *var, | |||
3438 | return 0; | 3436 | return 0; |
3439 | } | 3437 | } |
3440 | 3438 | ||
3441 | static int pm3fb_ioctl(struct inode *inode, struct file *file, | 3439 | static int pm3fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
3442 | u_int cmd, u_long arg, int con, | ||
3443 | struct fb_info *info) | ||
3444 | { | 3440 | { |
3445 | struct pm3fb_info *l_fb_info = (struct pm3fb_info *) info; | 3441 | struct pm3fb_info *l_fb_info = (struct pm3fb_info *) info; |
3446 | u32 cm, i; | 3442 | u32 cm, i; |
diff --git a/drivers/video/pmag-aa-fb.c b/drivers/video/pmag-aa-fb.c index 28d1fe5fe340..d92f352211ef 100644 --- a/drivers/video/pmag-aa-fb.c +++ b/drivers/video/pmag-aa-fb.c | |||
@@ -299,8 +299,7 @@ static int aafb_set_cmap(struct fb_cmap *cmap, int kspc, int con, | |||
299 | return -EINVAL; | 299 | return -EINVAL; |
300 | } | 300 | } |
301 | 301 | ||
302 | static int aafb_ioctl(struct inode *inode, struct file *file, u32 cmd, | 302 | static int aafb_ioctl(struct fb_info *info, u32 cmd, unsigned long arg) |
303 | unsigned long arg, int con, struct fb_info *info) | ||
304 | { | 303 | { |
305 | /* TODO: Not yet implemented */ | 304 | /* TODO: Not yet implemented */ |
306 | return -ENOIOCTLCMD; | 305 | return -ENOIOCTLCMD; |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 9fc10b9e6f57..53ad61f1038c 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -395,7 +395,7 @@ static int pxafb_blank(int blank, struct fb_info *info) | |||
395 | return 0; | 395 | return 0; |
396 | } | 396 | } |
397 | 397 | ||
398 | static int pxafb_mmap(struct fb_info *info, struct file *file, | 398 | static int pxafb_mmap(struct fb_info *info, |
399 | struct vm_area_struct *vma) | 399 | struct vm_area_struct *vma) |
400 | { | 400 | { |
401 | struct pxafb_info *fbi = (struct pxafb_info *)info; | 401 | struct pxafb_info *fbi = (struct pxafb_info *)info; |
diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c index 600318f708f2..db9fb9074dbc 100644 --- a/drivers/video/radeonfb.c +++ b/drivers/video/radeonfb.c | |||
@@ -1497,8 +1497,8 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, | |||
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | 1499 | ||
1500 | static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int cmd, | 1500 | static int radeonfb_ioctl (struct fb_info *info, unsigned int cmd, |
1501 | unsigned long arg, struct fb_info *info) | 1501 | unsigned long arg) |
1502 | { | 1502 | { |
1503 | struct radeonfb_info *rinfo = (struct radeonfb_info *) info; | 1503 | struct radeonfb_info *rinfo = (struct radeonfb_info *) info; |
1504 | unsigned int tmp; | 1504 | unsigned int tmp; |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 3e9f96e9237d..6c19ab6afb01 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -630,7 +630,7 @@ static void riva_load_video_mode(struct fb_info *info) | |||
630 | int bpp, width, hDisplaySize, hDisplay, hStart, | 630 | int bpp, width, hDisplaySize, hDisplay, hStart, |
631 | hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock; | 631 | hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock; |
632 | int hBlankStart, hBlankEnd, vBlankStart, vBlankEnd; | 632 | int hBlankStart, hBlankEnd, vBlankStart, vBlankEnd; |
633 | struct riva_par *par = (struct riva_par *) info->par; | 633 | struct riva_par *par = info->par; |
634 | struct riva_regs newmode; | 634 | struct riva_regs newmode; |
635 | 635 | ||
636 | NVTRACE_ENTER(); | 636 | NVTRACE_ENTER(); |
@@ -925,7 +925,7 @@ riva_set_rop_solid(struct riva_par *par, int rop) | |||
925 | 925 | ||
926 | static void riva_setup_accel(struct fb_info *info) | 926 | static void riva_setup_accel(struct fb_info *info) |
927 | { | 927 | { |
928 | struct riva_par *par = (struct riva_par *) info->par; | 928 | struct riva_par *par = info->par; |
929 | 929 | ||
930 | RIVA_FIFO_FREE(par->riva, Clip, 2); | 930 | RIVA_FIFO_FREE(par->riva, Clip, 2); |
931 | NV_WR32(&par->riva.Clip->TopLeft, 0, 0x0); | 931 | NV_WR32(&par->riva.Clip->TopLeft, 0, 0x0); |
@@ -979,7 +979,7 @@ static int riva_get_cmap_len(const struct fb_var_screeninfo *var) | |||
979 | #ifdef CONFIG_PMAC_BACKLIGHT | 979 | #ifdef CONFIG_PMAC_BACKLIGHT |
980 | static int riva_set_backlight_enable(int on, int level, void *data) | 980 | static int riva_set_backlight_enable(int on, int level, void *data) |
981 | { | 981 | { |
982 | struct riva_par *par = (struct riva_par *)data; | 982 | struct riva_par *par = data; |
983 | U032 tmp_pcrt, tmp_pmc; | 983 | U032 tmp_pcrt, tmp_pmc; |
984 | 984 | ||
985 | tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; | 985 | tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; |
@@ -1008,7 +1008,7 @@ static int riva_set_backlight_level(int level, void *data) | |||
1008 | 1008 | ||
1009 | static int rivafb_open(struct fb_info *info, int user) | 1009 | static int rivafb_open(struct fb_info *info, int user) |
1010 | { | 1010 | { |
1011 | struct riva_par *par = (struct riva_par *) info->par; | 1011 | struct riva_par *par = info->par; |
1012 | int cnt = atomic_read(&par->ref_count); | 1012 | int cnt = atomic_read(&par->ref_count); |
1013 | 1013 | ||
1014 | NVTRACE_ENTER(); | 1014 | NVTRACE_ENTER(); |
@@ -1034,7 +1034,7 @@ static int rivafb_open(struct fb_info *info, int user) | |||
1034 | 1034 | ||
1035 | static int rivafb_release(struct fb_info *info, int user) | 1035 | static int rivafb_release(struct fb_info *info, int user) |
1036 | { | 1036 | { |
1037 | struct riva_par *par = (struct riva_par *) info->par; | 1037 | struct riva_par *par = info->par; |
1038 | int cnt = atomic_read(&par->ref_count); | 1038 | int cnt = atomic_read(&par->ref_count); |
1039 | 1039 | ||
1040 | NVTRACE_ENTER(); | 1040 | NVTRACE_ENTER(); |
@@ -1057,7 +1057,7 @@ static int rivafb_release(struct fb_info *info, int user) | |||
1057 | static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 1057 | static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
1058 | { | 1058 | { |
1059 | struct fb_videomode *mode; | 1059 | struct fb_videomode *mode; |
1060 | struct riva_par *par = (struct riva_par *) info->par; | 1060 | struct riva_par *par = info->par; |
1061 | int nom, den; /* translating from pixels->bytes */ | 1061 | int nom, den; /* translating from pixels->bytes */ |
1062 | int mode_valid = 0; | 1062 | int mode_valid = 0; |
1063 | 1063 | ||
@@ -1166,7 +1166,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1166 | 1166 | ||
1167 | static int rivafb_set_par(struct fb_info *info) | 1167 | static int rivafb_set_par(struct fb_info *info) |
1168 | { | 1168 | { |
1169 | struct riva_par *par = (struct riva_par *) info->par; | 1169 | struct riva_par *par = info->par; |
1170 | 1170 | ||
1171 | NVTRACE_ENTER(); | 1171 | NVTRACE_ENTER(); |
1172 | /* vgaHWunlock() + riva unlock (0x7F) */ | 1172 | /* vgaHWunlock() + riva unlock (0x7F) */ |
@@ -1205,43 +1205,19 @@ static int rivafb_set_par(struct fb_info *info) | |||
1205 | static int rivafb_pan_display(struct fb_var_screeninfo *var, | 1205 | static int rivafb_pan_display(struct fb_var_screeninfo *var, |
1206 | struct fb_info *info) | 1206 | struct fb_info *info) |
1207 | { | 1207 | { |
1208 | struct riva_par *par = (struct riva_par *)info->par; | 1208 | struct riva_par *par = info->par; |
1209 | unsigned int base; | 1209 | unsigned int base; |
1210 | 1210 | ||
1211 | NVTRACE_ENTER(); | 1211 | NVTRACE_ENTER(); |
1212 | if (var->xoffset > (var->xres_virtual - var->xres)) | ||
1213 | return -EINVAL; | ||
1214 | if (var->yoffset > (var->yres_virtual - var->yres)) | ||
1215 | return -EINVAL; | ||
1216 | |||
1217 | if (var->vmode & FB_VMODE_YWRAP) { | ||
1218 | if (var->yoffset < 0 | ||
1219 | || var->yoffset >= info->var.yres_virtual | ||
1220 | || var->xoffset) return -EINVAL; | ||
1221 | } else { | ||
1222 | if (var->xoffset + info->var.xres > info->var.xres_virtual || | ||
1223 | var->yoffset + info->var.yres > info->var.yres_virtual) | ||
1224 | return -EINVAL; | ||
1225 | } | ||
1226 | |||
1227 | base = var->yoffset * info->fix.line_length + var->xoffset; | 1212 | base = var->yoffset * info->fix.line_length + var->xoffset; |
1228 | |||
1229 | par->riva.SetStartAddress(&par->riva, base); | 1213 | par->riva.SetStartAddress(&par->riva, base); |
1230 | |||
1231 | info->var.xoffset = var->xoffset; | ||
1232 | info->var.yoffset = var->yoffset; | ||
1233 | |||
1234 | if (var->vmode & FB_VMODE_YWRAP) | ||
1235 | info->var.vmode |= FB_VMODE_YWRAP; | ||
1236 | else | ||
1237 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
1238 | NVTRACE_LEAVE(); | 1214 | NVTRACE_LEAVE(); |
1239 | return 0; | 1215 | return 0; |
1240 | } | 1216 | } |
1241 | 1217 | ||
1242 | static int rivafb_blank(int blank, struct fb_info *info) | 1218 | static int rivafb_blank(int blank, struct fb_info *info) |
1243 | { | 1219 | { |
1244 | struct riva_par *par= (struct riva_par *)info->par; | 1220 | struct riva_par *par= info->par; |
1245 | unsigned char tmp, vesa; | 1221 | unsigned char tmp, vesa; |
1246 | 1222 | ||
1247 | tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */ | 1223 | tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */ |
@@ -1304,7 +1280,7 @@ static int rivafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1304 | unsigned blue, unsigned transp, | 1280 | unsigned blue, unsigned transp, |
1305 | struct fb_info *info) | 1281 | struct fb_info *info) |
1306 | { | 1282 | { |
1307 | struct riva_par *par = (struct riva_par *)info->par; | 1283 | struct riva_par *par = info->par; |
1308 | RIVA_HW_INST *chip = &par->riva; | 1284 | RIVA_HW_INST *chip = &par->riva; |
1309 | int i; | 1285 | int i; |
1310 | 1286 | ||
@@ -1393,7 +1369,7 @@ static int rivafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1393 | */ | 1369 | */ |
1394 | static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 1370 | static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
1395 | { | 1371 | { |
1396 | struct riva_par *par = (struct riva_par *) info->par; | 1372 | struct riva_par *par = info->par; |
1397 | u_int color, rop = 0; | 1373 | u_int color, rop = 0; |
1398 | 1374 | ||
1399 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { | 1375 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { |
@@ -1449,7 +1425,7 @@ static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect | |||
1449 | */ | 1425 | */ |
1450 | static void rivafb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 1426 | static void rivafb_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
1451 | { | 1427 | { |
1452 | struct riva_par *par = (struct riva_par *) info->par; | 1428 | struct riva_par *par = info->par; |
1453 | 1429 | ||
1454 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { | 1430 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { |
1455 | cfb_copyarea(info, region); | 1431 | cfb_copyarea(info, region); |
@@ -1495,7 +1471,7 @@ static inline void convert_bgcolor_16(u32 *col) | |||
1495 | static void rivafb_imageblit(struct fb_info *info, | 1471 | static void rivafb_imageblit(struct fb_info *info, |
1496 | const struct fb_image *image) | 1472 | const struct fb_image *image) |
1497 | { | 1473 | { |
1498 | struct riva_par *par = (struct riva_par *) info->par; | 1474 | struct riva_par *par = info->par; |
1499 | u32 fgx = 0, bgx = 0, width, tmp; | 1475 | u32 fgx = 0, bgx = 0, width, tmp; |
1500 | u8 *cdat = (u8 *) image->data; | 1476 | u8 *cdat = (u8 *) image->data; |
1501 | volatile u32 __iomem *d; | 1477 | volatile u32 __iomem *d; |
@@ -1580,7 +1556,7 @@ static void rivafb_imageblit(struct fb_info *info, | |||
1580 | */ | 1556 | */ |
1581 | static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1557 | static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1582 | { | 1558 | { |
1583 | struct riva_par *par = (struct riva_par *) info->par; | 1559 | struct riva_par *par = info->par; |
1584 | u8 data[MAX_CURS * MAX_CURS/8]; | 1560 | u8 data[MAX_CURS * MAX_CURS/8]; |
1585 | int i, set = cursor->set; | 1561 | int i, set = cursor->set; |
1586 | u16 fg, bg; | 1562 | u16 fg, bg; |
@@ -1664,7 +1640,7 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1664 | 1640 | ||
1665 | static int rivafb_sync(struct fb_info *info) | 1641 | static int rivafb_sync(struct fb_info *info) |
1666 | { | 1642 | { |
1667 | struct riva_par *par = (struct riva_par *)info->par; | 1643 | struct riva_par *par = info->par; |
1668 | 1644 | ||
1669 | wait_for_idle(par); | 1645 | wait_for_idle(par); |
1670 | return 0; | 1646 | return 0; |
@@ -1696,7 +1672,7 @@ static struct fb_ops riva_fb_ops = { | |||
1696 | static int __devinit riva_set_fbinfo(struct fb_info *info) | 1672 | static int __devinit riva_set_fbinfo(struct fb_info *info) |
1697 | { | 1673 | { |
1698 | unsigned int cmap_len; | 1674 | unsigned int cmap_len; |
1699 | struct riva_par *par = (struct riva_par *) info->par; | 1675 | struct riva_par *par = info->par; |
1700 | 1676 | ||
1701 | NVTRACE_ENTER(); | 1677 | NVTRACE_ENTER(); |
1702 | info->flags = FBINFO_DEFAULT | 1678 | info->flags = FBINFO_DEFAULT |
@@ -1733,7 +1709,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info) | |||
1733 | #ifdef CONFIG_PPC_OF | 1709 | #ifdef CONFIG_PPC_OF |
1734 | static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) | 1710 | static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) |
1735 | { | 1711 | { |
1736 | struct riva_par *par = (struct riva_par *) info->par; | 1712 | struct riva_par *par = info->par; |
1737 | struct device_node *dp; | 1713 | struct device_node *dp; |
1738 | unsigned char *pedid = NULL; | 1714 | unsigned char *pedid = NULL; |
1739 | unsigned char *disptype = NULL; | 1715 | unsigned char *disptype = NULL; |
@@ -1767,7 +1743,7 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) | |||
1767 | #if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF) | 1743 | #if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF) |
1768 | static int __devinit riva_get_EDID_i2c(struct fb_info *info) | 1744 | static int __devinit riva_get_EDID_i2c(struct fb_info *info) |
1769 | { | 1745 | { |
1770 | struct riva_par *par = (struct riva_par *) info->par; | 1746 | struct riva_par *par = info->par; |
1771 | struct fb_var_screeninfo var; | 1747 | struct fb_var_screeninfo var; |
1772 | int i; | 1748 | int i; |
1773 | 1749 | ||
@@ -1837,7 +1813,7 @@ static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) | |||
1837 | static void __devinit riva_get_edidinfo(struct fb_info *info) | 1813 | static void __devinit riva_get_edidinfo(struct fb_info *info) |
1838 | { | 1814 | { |
1839 | struct fb_var_screeninfo *var = &rivafb_default_var; | 1815 | struct fb_var_screeninfo *var = &rivafb_default_var; |
1840 | struct riva_par *par = (struct riva_par *) info->par; | 1816 | struct riva_par *par = info->par; |
1841 | 1817 | ||
1842 | fb_edid_to_monspecs(par->EDID, &info->monspecs); | 1818 | fb_edid_to_monspecs(par->EDID, &info->monspecs); |
1843 | fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len, | 1819 | fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len, |
@@ -1909,7 +1885,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
1909 | ret = -ENOMEM; | 1885 | ret = -ENOMEM; |
1910 | goto err_ret; | 1886 | goto err_ret; |
1911 | } | 1887 | } |
1912 | default_par = (struct riva_par *) info->par; | 1888 | default_par = info->par; |
1913 | default_par->pdev = pd; | 1889 | default_par->pdev = pd; |
1914 | 1890 | ||
1915 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); | 1891 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); |
@@ -2070,7 +2046,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
2070 | 2046 | ||
2071 | err_iounmap_screen_base: | 2047 | err_iounmap_screen_base: |
2072 | #ifdef CONFIG_FB_RIVA_I2C | 2048 | #ifdef CONFIG_FB_RIVA_I2C |
2073 | riva_delete_i2c_busses((struct riva_par *) info->par); | 2049 | riva_delete_i2c_busses(info->par); |
2074 | #endif | 2050 | #endif |
2075 | iounmap(info->screen_base); | 2051 | iounmap(info->screen_base); |
2076 | err_iounmap_pramin: | 2052 | err_iounmap_pramin: |
@@ -2093,7 +2069,7 @@ err_ret: | |||
2093 | static void __exit rivafb_remove(struct pci_dev *pd) | 2069 | static void __exit rivafb_remove(struct pci_dev *pd) |
2094 | { | 2070 | { |
2095 | struct fb_info *info = pci_get_drvdata(pd); | 2071 | struct fb_info *info = pci_get_drvdata(pd); |
2096 | struct riva_par *par = (struct riva_par *) info->par; | 2072 | struct riva_par *par = info->par; |
2097 | 2073 | ||
2098 | NVTRACE_ENTER(); | 2074 | NVTRACE_ENTER(); |
2099 | if (!info) | 2075 | if (!info) |
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c index 77151d8e0766..8b1967fc116a 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/riva/rivafb-i2c.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | static void riva_gpio_setscl(void* data, int state) | 31 | static void riva_gpio_setscl(void* data, int state) |
32 | { | 32 | { |
33 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 33 | struct riva_i2c_chan *chan = data; |
34 | struct riva_par *par = chan->par; | 34 | struct riva_par *par = chan->par; |
35 | u32 val; | 35 | u32 val; |
36 | 36 | ||
@@ -48,7 +48,7 @@ static void riva_gpio_setscl(void* data, int state) | |||
48 | 48 | ||
49 | static void riva_gpio_setsda(void* data, int state) | 49 | static void riva_gpio_setsda(void* data, int state) |
50 | { | 50 | { |
51 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 51 | struct riva_i2c_chan *chan = data; |
52 | struct riva_par *par = chan->par; | 52 | struct riva_par *par = chan->par; |
53 | u32 val; | 53 | u32 val; |
54 | 54 | ||
@@ -66,7 +66,7 @@ static void riva_gpio_setsda(void* data, int state) | |||
66 | 66 | ||
67 | static int riva_gpio_getscl(void* data) | 67 | static int riva_gpio_getscl(void* data) |
68 | { | 68 | { |
69 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 69 | struct riva_i2c_chan *chan = data; |
70 | struct riva_par *par = chan->par; | 70 | struct riva_par *par = chan->par; |
71 | u32 val = 0; | 71 | u32 val = 0; |
72 | 72 | ||
@@ -81,7 +81,7 @@ static int riva_gpio_getscl(void* data) | |||
81 | 81 | ||
82 | static int riva_gpio_getsda(void* data) | 82 | static int riva_gpio_getsda(void* data) |
83 | { | 83 | { |
84 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 84 | struct riva_i2c_chan *chan = data; |
85 | struct riva_par *par = chan->par; | 85 | struct riva_par *par = chan->par; |
86 | u32 val = 0; | 86 | u32 val = 0; |
87 | 87 | ||
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index ce6e749db3a7..d574dd3c9c8a 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -87,6 +87,7 @@ | |||
87 | #include <linux/workqueue.h> | 87 | #include <linux/workqueue.h> |
88 | #include <linux/wait.h> | 88 | #include <linux/wait.h> |
89 | #include <linux/platform_device.h> | 89 | #include <linux/platform_device.h> |
90 | #include <linux/clk.h> | ||
90 | 91 | ||
91 | #include <asm/io.h> | 92 | #include <asm/io.h> |
92 | #include <asm/uaccess.h> | 93 | #include <asm/uaccess.h> |
@@ -96,7 +97,6 @@ | |||
96 | #include <asm/arch/regs-lcd.h> | 97 | #include <asm/arch/regs-lcd.h> |
97 | #include <asm/arch/regs-gpio.h> | 98 | #include <asm/arch/regs-gpio.h> |
98 | #include <asm/arch/fb.h> | 99 | #include <asm/arch/fb.h> |
99 | #include <asm/hardware/clock.h> | ||
100 | 100 | ||
101 | #ifdef CONFIG_PM | 101 | #ifdef CONFIG_PM |
102 | #include <linux/pm.h> | 102 | #include <linux/pm.h> |
@@ -552,7 +552,7 @@ static inline void modify_gpio(void __iomem *reg, | |||
552 | * s3c2410fb_init_registers - Initialise all LCD-related registers | 552 | * s3c2410fb_init_registers - Initialise all LCD-related registers |
553 | */ | 553 | */ |
554 | 554 | ||
555 | int s3c2410fb_init_registers(struct s3c2410fb_info *fbi) | 555 | static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi) |
556 | { | 556 | { |
557 | unsigned long flags; | 557 | unsigned long flags; |
558 | 558 | ||
@@ -634,7 +634,7 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r) | |||
634 | 634 | ||
635 | static char driver_name[]="s3c2410fb"; | 635 | static char driver_name[]="s3c2410fb"; |
636 | 636 | ||
637 | int __init s3c2410fb_probe(struct platform_device *pdev) | 637 | static int __init s3c2410fb_probe(struct platform_device *pdev) |
638 | { | 638 | { |
639 | struct s3c2410fb_info *info; | 639 | struct s3c2410fb_info *info; |
640 | struct fb_info *fbinfo; | 640 | struct fb_info *fbinfo; |
@@ -667,8 +667,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev) | |||
667 | info->fb = fbinfo; | 667 | info->fb = fbinfo; |
668 | platform_set_drvdata(pdev, fbinfo); | 668 | platform_set_drvdata(pdev, fbinfo); |
669 | 669 | ||
670 | s3c2410fb_init_registers(info); | ||
671 | |||
672 | dprintk("devinit\n"); | 670 | dprintk("devinit\n"); |
673 | 671 | ||
674 | strcpy(fbinfo->fix.id, driver_name); | 672 | strcpy(fbinfo->fix.id, driver_name); |
@@ -701,8 +699,8 @@ int __init s3c2410fb_probe(struct platform_device *pdev) | |||
701 | fbinfo->var.yres_virtual = mach_info->yres.defval; | 699 | fbinfo->var.yres_virtual = mach_info->yres.defval; |
702 | fbinfo->var.bits_per_pixel = mach_info->bpp.defval; | 700 | fbinfo->var.bits_per_pixel = mach_info->bpp.defval; |
703 | 701 | ||
704 | fbinfo->var.upper_margin = S3C2410_LCDCON2_GET_VBPD(mregs->lcdcon2) +1; | 702 | fbinfo->var.upper_margin = S3C2410_LCDCON2_GET_VBPD(mregs->lcdcon2) + 1; |
705 | fbinfo->var.lower_margin = S3C2410_LCDCON2_GET_VFPD(mregs->lcdcon2) +1; | 703 | fbinfo->var.lower_margin = S3C2410_LCDCON2_GET_VFPD(mregs->lcdcon2) + 1; |
706 | fbinfo->var.vsync_len = S3C2410_LCDCON2_GET_VSPW(mregs->lcdcon2) + 1; | 704 | fbinfo->var.vsync_len = S3C2410_LCDCON2_GET_VSPW(mregs->lcdcon2) + 1; |
707 | 705 | ||
708 | fbinfo->var.left_margin = S3C2410_LCDCON3_GET_HFPD(mregs->lcdcon3) + 1; | 706 | fbinfo->var.left_margin = S3C2410_LCDCON3_GET_HFPD(mregs->lcdcon3) + 1; |
@@ -746,7 +744,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev) | |||
746 | goto release_irq; | 744 | goto release_irq; |
747 | } | 745 | } |
748 | 746 | ||
749 | clk_use(info->clk); | ||
750 | clk_enable(info->clk); | 747 | clk_enable(info->clk); |
751 | dprintk("got and enabled clock\n"); | 748 | dprintk("got and enabled clock\n"); |
752 | 749 | ||
@@ -783,7 +780,6 @@ free_video_memory: | |||
783 | s3c2410fb_unmap_video_memory(info); | 780 | s3c2410fb_unmap_video_memory(info); |
784 | release_clock: | 781 | release_clock: |
785 | clk_disable(info->clk); | 782 | clk_disable(info->clk); |
786 | clk_unuse(info->clk); | ||
787 | clk_put(info->clk); | 783 | clk_put(info->clk); |
788 | release_irq: | 784 | release_irq: |
789 | free_irq(irq,info); | 785 | free_irq(irq,info); |
@@ -828,7 +824,6 @@ static int s3c2410fb_remove(struct platform_device *pdev) | |||
828 | 824 | ||
829 | if (info->clk) { | 825 | if (info->clk) { |
830 | clk_disable(info->clk); | 826 | clk_disable(info->clk); |
831 | clk_unuse(info->clk); | ||
832 | clk_put(info->clk); | 827 | clk_put(info->clk); |
833 | info->clk = NULL; | 828 | info->clk = NULL; |
834 | } | 829 | } |
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index 2ea1354e439f..8a893ce7040d 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -178,7 +178,6 @@ | |||
178 | 178 | ||
179 | #include <asm/hardware.h> | 179 | #include <asm/hardware.h> |
180 | #include <asm/io.h> | 180 | #include <asm/io.h> |
181 | #include <asm/irq.h> | ||
182 | #include <asm/mach-types.h> | 181 | #include <asm/mach-types.h> |
183 | #include <asm/uaccess.h> | 182 | #include <asm/uaccess.h> |
184 | #include <asm/arch/assabet.h> | 183 | #include <asm/arch/assabet.h> |
@@ -816,7 +815,7 @@ static int sa1100fb_blank(int blank, struct fb_info *info) | |||
816 | return 0; | 815 | return 0; |
817 | } | 816 | } |
818 | 817 | ||
819 | static int sa1100fb_mmap(struct fb_info *info, struct file *file, | 818 | static int sa1100fb_mmap(struct fb_info *info, |
820 | struct vm_area_struct *vma) | 819 | struct vm_area_struct *vma) |
821 | { | 820 | { |
822 | struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; | 821 | struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; |
@@ -1455,7 +1454,11 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) | |||
1455 | static int __init sa1100fb_probe(struct platform_device *pdev) | 1454 | static int __init sa1100fb_probe(struct platform_device *pdev) |
1456 | { | 1455 | { |
1457 | struct sa1100fb_info *fbi; | 1456 | struct sa1100fb_info *fbi; |
1458 | int ret; | 1457 | int ret, irq; |
1458 | |||
1459 | irq = platform_get_irq(pdev, 0); | ||
1460 | if (irq <= 0) | ||
1461 | return -EINVAL; | ||
1459 | 1462 | ||
1460 | if (!request_mem_region(0xb0100000, 0x10000, "LCD")) | 1463 | if (!request_mem_region(0xb0100000, 0x10000, "LCD")) |
1461 | return -EBUSY; | 1464 | return -EBUSY; |
@@ -1470,7 +1473,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev) | |||
1470 | if (ret) | 1473 | if (ret) |
1471 | goto failed; | 1474 | goto failed; |
1472 | 1475 | ||
1473 | ret = request_irq(IRQ_LCD, sa1100fb_handle_irq, SA_INTERRUPT, | 1476 | ret = request_irq(irq, sa1100fb_handle_irq, SA_INTERRUPT, |
1474 | "LCD", fbi); | 1477 | "LCD", fbi); |
1475 | if (ret) { | 1478 | if (ret) { |
1476 | printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret); | 1479 | printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret); |
@@ -1492,7 +1495,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev) | |||
1492 | 1495 | ||
1493 | ret = register_framebuffer(&fbi->fb); | 1496 | ret = register_framebuffer(&fbi->fb); |
1494 | if (ret < 0) | 1497 | if (ret < 0) |
1495 | goto failed; | 1498 | goto err_free_irq; |
1496 | 1499 | ||
1497 | #ifdef CONFIG_CPU_FREQ | 1500 | #ifdef CONFIG_CPU_FREQ |
1498 | fbi->freq_transition.notifier_call = sa1100fb_freq_transition; | 1501 | fbi->freq_transition.notifier_call = sa1100fb_freq_transition; |
@@ -1504,7 +1507,9 @@ static int __init sa1100fb_probe(struct platform_device *pdev) | |||
1504 | /* This driver cannot be unloaded at the moment */ | 1507 | /* This driver cannot be unloaded at the moment */ |
1505 | return 0; | 1508 | return 0; |
1506 | 1509 | ||
1507 | failed: | 1510 | err_free_irq: |
1511 | free_irq(irq, fbi); | ||
1512 | failed: | ||
1508 | platform_set_drvdata(pdev, NULL); | 1513 | platform_set_drvdata(pdev, NULL); |
1509 | kfree(fbi); | 1514 | kfree(fbi); |
1510 | release_mem_region(0xb0100000, 0x10000); | 1515 | release_mem_region(0xb0100000, 0x10000); |
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c index 3c98457783c4..00719a91479f 100644 --- a/drivers/video/savage/savagefb-i2c.c +++ b/drivers/video/savage/savagefb-i2c.c | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | static void savage4_gpio_setscl(void *data, int val) | 50 | static void savage4_gpio_setscl(void *data, int val) |
51 | { | 51 | { |
52 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 52 | struct savagefb_i2c_chan *chan = data; |
53 | unsigned int r; | 53 | unsigned int r; |
54 | 54 | ||
55 | r = readl(chan->ioaddr + chan->reg); | 55 | r = readl(chan->ioaddr + chan->reg); |
@@ -63,7 +63,7 @@ static void savage4_gpio_setscl(void *data, int val) | |||
63 | 63 | ||
64 | static void savage4_gpio_setsda(void *data, int val) | 64 | static void savage4_gpio_setsda(void *data, int val) |
65 | { | 65 | { |
66 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 66 | struct savagefb_i2c_chan *chan = data; |
67 | 67 | ||
68 | unsigned int r; | 68 | unsigned int r; |
69 | r = readl(chan->ioaddr + chan->reg); | 69 | r = readl(chan->ioaddr + chan->reg); |
@@ -77,21 +77,21 @@ static void savage4_gpio_setsda(void *data, int val) | |||
77 | 77 | ||
78 | static int savage4_gpio_getscl(void *data) | 78 | static int savage4_gpio_getscl(void *data) |
79 | { | 79 | { |
80 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 80 | struct savagefb_i2c_chan *chan = data; |
81 | 81 | ||
82 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN)); | 82 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN)); |
83 | } | 83 | } |
84 | 84 | ||
85 | static int savage4_gpio_getsda(void *data) | 85 | static int savage4_gpio_getsda(void *data) |
86 | { | 86 | { |
87 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 87 | struct savagefb_i2c_chan *chan = data; |
88 | 88 | ||
89 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN)); | 89 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN)); |
90 | } | 90 | } |
91 | 91 | ||
92 | static void prosavage_gpio_setscl(void* data, int val) | 92 | static void prosavage_gpio_setscl(void* data, int val) |
93 | { | 93 | { |
94 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 94 | struct savagefb_i2c_chan *chan = data; |
95 | u32 r; | 95 | u32 r; |
96 | 96 | ||
97 | SET_CR_IX(chan->ioaddr, chan->reg); | 97 | SET_CR_IX(chan->ioaddr, chan->reg); |
@@ -107,7 +107,7 @@ static void prosavage_gpio_setscl(void* data, int val) | |||
107 | 107 | ||
108 | static void prosavage_gpio_setsda(void* data, int val) | 108 | static void prosavage_gpio_setsda(void* data, int val) |
109 | { | 109 | { |
110 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 110 | struct savagefb_i2c_chan *chan = data; |
111 | unsigned int r; | 111 | unsigned int r; |
112 | 112 | ||
113 | SET_CR_IX(chan->ioaddr, chan->reg); | 113 | SET_CR_IX(chan->ioaddr, chan->reg); |
@@ -123,7 +123,7 @@ static void prosavage_gpio_setsda(void* data, int val) | |||
123 | 123 | ||
124 | static int prosavage_gpio_getscl(void* data) | 124 | static int prosavage_gpio_getscl(void* data) |
125 | { | 125 | { |
126 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 126 | struct savagefb_i2c_chan *chan = data; |
127 | 127 | ||
128 | SET_CR_IX(chan->ioaddr, chan->reg); | 128 | SET_CR_IX(chan->ioaddr, chan->reg); |
129 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN)); | 129 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN)); |
@@ -131,7 +131,7 @@ static int prosavage_gpio_getscl(void* data) | |||
131 | 131 | ||
132 | static int prosavage_gpio_getsda(void* data) | 132 | static int prosavage_gpio_getsda(void* data) |
133 | { | 133 | { |
134 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 134 | struct savagefb_i2c_chan *chan = data; |
135 | 135 | ||
136 | SET_CR_IX(chan->ioaddr, chan->reg); | 136 | SET_CR_IX(chan->ioaddr, chan->reg); |
137 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN)); | 137 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN)); |
@@ -140,10 +140,9 @@ static int prosavage_gpio_getsda(void* data) | |||
140 | static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | 140 | static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, |
141 | const char *name) | 141 | const char *name) |
142 | { | 142 | { |
143 | int (*add_bus)(struct i2c_adapter *) = symbol_get(i2c_bit_add_bus); | ||
144 | int rc = 0; | 143 | int rc = 0; |
145 | 144 | ||
146 | if (add_bus && chan->par) { | 145 | if (chan->par) { |
147 | strcpy(chan->adapter.name, name); | 146 | strcpy(chan->adapter.name, name); |
148 | chan->adapter.owner = THIS_MODULE; | 147 | chan->adapter.owner = THIS_MODULE; |
149 | chan->adapter.id = I2C_HW_B_SAVAGE; | 148 | chan->adapter.id = I2C_HW_B_SAVAGE; |
@@ -161,7 +160,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
161 | chan->algo.setscl(chan, 1); | 160 | chan->algo.setscl(chan, 1); |
162 | udelay(20); | 161 | udelay(20); |
163 | 162 | ||
164 | rc = add_bus(&chan->adapter); | 163 | rc = i2c_bit_add_bus(&chan->adapter); |
165 | 164 | ||
166 | if (rc == 0) | 165 | if (rc == 0) |
167 | dev_dbg(&chan->par->pcidev->dev, | 166 | dev_dbg(&chan->par->pcidev->dev, |
@@ -169,8 +168,6 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
169 | else | 168 | else |
170 | dev_warn(&chan->par->pcidev->dev, | 169 | dev_warn(&chan->par->pcidev->dev, |
171 | "Failed to register I2C bus %s.\n", name); | 170 | "Failed to register I2C bus %s.\n", name); |
172 | |||
173 | symbol_put(i2c_bit_add_bus); | ||
174 | } else | 171 | } else |
175 | chan->par = NULL; | 172 | chan->par = NULL; |
176 | 173 | ||
@@ -179,7 +176,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
179 | 176 | ||
180 | void savagefb_create_i2c_busses(struct fb_info *info) | 177 | void savagefb_create_i2c_busses(struct fb_info *info) |
181 | { | 178 | { |
182 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 179 | struct savagefb_par *par = info->par; |
183 | par->chan.par = par; | 180 | par->chan.par = par; |
184 | 181 | ||
185 | switch(info->fix.accel) { | 182 | switch(info->fix.accel) { |
@@ -193,6 +190,7 @@ void savagefb_create_i2c_busses(struct fb_info *info) | |||
193 | par->chan.algo.getscl = prosavage_gpio_getscl; | 190 | par->chan.algo.getscl = prosavage_gpio_getscl; |
194 | break; | 191 | break; |
195 | case FB_ACCEL_SAVAGE4: | 192 | case FB_ACCEL_SAVAGE4: |
193 | case FB_ACCEL_SAVAGE2000: | ||
196 | par->chan.reg = 0xff20; | 194 | par->chan.reg = 0xff20; |
197 | par->chan.ioaddr = par->mmio.vbase; | 195 | par->chan.ioaddr = par->mmio.vbase; |
198 | par->chan.algo.setsda = savage4_gpio_setsda; | 196 | par->chan.algo.setsda = savage4_gpio_setsda; |
@@ -209,14 +207,10 @@ void savagefb_create_i2c_busses(struct fb_info *info) | |||
209 | 207 | ||
210 | void savagefb_delete_i2c_busses(struct fb_info *info) | 208 | void savagefb_delete_i2c_busses(struct fb_info *info) |
211 | { | 209 | { |
212 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 210 | struct savagefb_par *par = info->par; |
213 | int (*del_bus)(struct i2c_adapter *) = | ||
214 | symbol_get(i2c_bit_del_bus); | ||
215 | 211 | ||
216 | if (del_bus && par->chan.par) { | 212 | if (par->chan.par) |
217 | del_bus(&par->chan.adapter); | 213 | i2c_bit_del_bus(&par->chan.adapter); |
218 | symbol_put(i2c_bit_del_bus); | ||
219 | } | ||
220 | 214 | ||
221 | par->chan.par = NULL; | 215 | par->chan.par = NULL; |
222 | } | 216 | } |
@@ -224,8 +218,6 @@ void savagefb_delete_i2c_busses(struct fb_info *info) | |||
224 | static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) | 218 | static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) |
225 | { | 219 | { |
226 | u8 start = 0x0; | 220 | u8 start = 0x0; |
227 | int (*transfer)(struct i2c_adapter *, struct i2c_msg *, int) = | ||
228 | symbol_get(i2c_transfer); | ||
229 | struct i2c_msg msgs[] = { | 221 | struct i2c_msg msgs[] = { |
230 | { | 222 | { |
231 | .addr = SAVAGE_DDC, | 223 | .addr = SAVAGE_DDC, |
@@ -239,21 +231,19 @@ static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) | |||
239 | }; | 231 | }; |
240 | u8 *buf = NULL; | 232 | u8 *buf = NULL; |
241 | 233 | ||
242 | if (transfer && chan->par) { | 234 | if (chan->par) { |
243 | buf = kmalloc(EDID_LENGTH, GFP_KERNEL); | 235 | buf = kmalloc(EDID_LENGTH, GFP_KERNEL); |
244 | 236 | ||
245 | if (buf) { | 237 | if (buf) { |
246 | msgs[1].buf = buf; | 238 | msgs[1].buf = buf; |
247 | 239 | ||
248 | if (transfer(&chan->adapter, msgs, 2) != 2) { | 240 | if (i2c_transfer(&chan->adapter, msgs, 2) != 2) { |
249 | dev_dbg(&chan->par->pcidev->dev, | 241 | dev_dbg(&chan->par->pcidev->dev, |
250 | "Unable to read EDID block.\n"); | 242 | "Unable to read EDID block.\n"); |
251 | kfree(buf); | 243 | kfree(buf); |
252 | buf = NULL; | 244 | buf = NULL; |
253 | } | 245 | } |
254 | } | 246 | } |
255 | |||
256 | symbol_put(i2c_transfer); | ||
257 | } | 247 | } |
258 | 248 | ||
259 | return buf; | 249 | return buf; |
diff --git a/drivers/video/savage/savagefb_accel.c b/drivers/video/savage/savagefb_accel.c index bac8ea3a0108..bbcc055d3bb7 100644 --- a/drivers/video/savage/savagefb_accel.c +++ b/drivers/video/savage/savagefb_accel.c | |||
@@ -21,7 +21,7 @@ static u32 savagefb_rop[] = { | |||
21 | 21 | ||
22 | int savagefb_sync(struct fb_info *info) | 22 | int savagefb_sync(struct fb_info *info) |
23 | { | 23 | { |
24 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 24 | struct savagefb_par *par = info->par; |
25 | 25 | ||
26 | par->SavageWaitIdle(par); | 26 | par->SavageWaitIdle(par); |
27 | return 0; | 27 | return 0; |
@@ -29,7 +29,7 @@ int savagefb_sync(struct fb_info *info) | |||
29 | 29 | ||
30 | void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 30 | void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
31 | { | 31 | { |
32 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 32 | struct savagefb_par *par = info->par; |
33 | int sx = region->sx, dx = region->dx; | 33 | int sx = region->sx, dx = region->dx; |
34 | int sy = region->sy, dy = region->dy; | 34 | int sy = region->sy, dy = region->dy; |
35 | int cmd; | 35 | int cmd; |
@@ -63,7 +63,7 @@ void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
63 | 63 | ||
64 | void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 64 | void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
65 | { | 65 | { |
66 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 66 | struct savagefb_par *par = info->par; |
67 | int cmd, color; | 67 | int cmd, color; |
68 | 68 | ||
69 | if (!rect->width || !rect->height) | 69 | if (!rect->width || !rect->height) |
@@ -90,7 +90,7 @@ void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
90 | 90 | ||
91 | void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) | 91 | void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) |
92 | { | 92 | { |
93 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 93 | struct savagefb_par *par = info->par; |
94 | int fg, bg, size, i, width; | 94 | int fg, bg, size, i, width; |
95 | int cmd; | 95 | int cmd; |
96 | u32 *src = (u32 *) image->data; | 96 | u32 *src = (u32 *) image->data; |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 09e2f2841901..ab727eaa7f43 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -686,7 +686,7 @@ static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode | |||
686 | static int savagefb_check_var (struct fb_var_screeninfo *var, | 686 | static int savagefb_check_var (struct fb_var_screeninfo *var, |
687 | struct fb_info *info) | 687 | struct fb_info *info) |
688 | { | 688 | { |
689 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 689 | struct savagefb_par *par = info->par; |
690 | int memlen, vramlen, mode_valid = 0; | 690 | int memlen, vramlen, mode_valid = 0; |
691 | 691 | ||
692 | DBG("savagefb_check_var"); | 692 | DBG("savagefb_check_var"); |
@@ -1025,7 +1025,7 @@ static int savagefb_setcolreg(unsigned regno, | |||
1025 | unsigned transp, | 1025 | unsigned transp, |
1026 | struct fb_info *info) | 1026 | struct fb_info *info) |
1027 | { | 1027 | { |
1028 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1028 | struct savagefb_par *par = info->par; |
1029 | 1029 | ||
1030 | if (regno >= NR_PALETTE) | 1030 | if (regno >= NR_PALETTE) |
1031 | return -EINVAL; | 1031 | return -EINVAL; |
@@ -1328,7 +1328,7 @@ static void savagefb_set_fix(struct fb_info *info) | |||
1328 | #if defined(CONFIG_FB_SAVAGE_ACCEL) | 1328 | #if defined(CONFIG_FB_SAVAGE_ACCEL) |
1329 | static void savagefb_set_clip(struct fb_info *info) | 1329 | static void savagefb_set_clip(struct fb_info *info) |
1330 | { | 1330 | { |
1331 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1331 | struct savagefb_par *par = info->par; |
1332 | int cmd; | 1332 | int cmd; |
1333 | 1333 | ||
1334 | cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; | 1334 | cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; |
@@ -1342,7 +1342,7 @@ static void savagefb_set_clip(struct fb_info *info) | |||
1342 | 1342 | ||
1343 | static int savagefb_set_par (struct fb_info *info) | 1343 | static int savagefb_set_par (struct fb_info *info) |
1344 | { | 1344 | { |
1345 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1345 | struct savagefb_par *par = info->par; |
1346 | struct fb_var_screeninfo *var = &info->var; | 1346 | struct fb_var_screeninfo *var = &info->var; |
1347 | int err; | 1347 | int err; |
1348 | 1348 | ||
@@ -1381,29 +1381,9 @@ static int savagefb_set_par (struct fb_info *info) | |||
1381 | static int savagefb_pan_display (struct fb_var_screeninfo *var, | 1381 | static int savagefb_pan_display (struct fb_var_screeninfo *var, |
1382 | struct fb_info *info) | 1382 | struct fb_info *info) |
1383 | { | 1383 | { |
1384 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1384 | struct savagefb_par *par = info->par; |
1385 | u_int y_bottom; | ||
1386 | |||
1387 | y_bottom = var->yoffset; | ||
1388 | |||
1389 | if (!(var->vmode & FB_VMODE_YWRAP)) | ||
1390 | y_bottom += var->yres; | ||
1391 | |||
1392 | if (var->xoffset > (var->xres_virtual - var->xres)) | ||
1393 | return -EINVAL; | ||
1394 | if (y_bottom > info->var.yres_virtual) | ||
1395 | return -EINVAL; | ||
1396 | 1385 | ||
1397 | savagefb_update_start (par, var); | 1386 | savagefb_update_start (par, var); |
1398 | |||
1399 | info->var.xoffset = var->xoffset; | ||
1400 | info->var.yoffset = var->yoffset; | ||
1401 | |||
1402 | if (var->vmode & FB_VMODE_YWRAP) | ||
1403 | info->var.vmode |= FB_VMODE_YWRAP; | ||
1404 | else | ||
1405 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
1406 | |||
1407 | return 0; | 1387 | return 0; |
1408 | } | 1388 | } |
1409 | 1389 | ||
@@ -1534,7 +1514,7 @@ static void savage_disable_mmio (struct savagefb_par *par) | |||
1534 | 1514 | ||
1535 | static int __devinit savage_map_mmio (struct fb_info *info) | 1515 | static int __devinit savage_map_mmio (struct fb_info *info) |
1536 | { | 1516 | { |
1537 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1517 | struct savagefb_par *par = info->par; |
1538 | DBG ("savage_map_mmio"); | 1518 | DBG ("savage_map_mmio"); |
1539 | 1519 | ||
1540 | if (S3_SAVAGE3D_SERIES (par->chip)) | 1520 | if (S3_SAVAGE3D_SERIES (par->chip)) |
@@ -1567,7 +1547,7 @@ static int __devinit savage_map_mmio (struct fb_info *info) | |||
1567 | 1547 | ||
1568 | static void __devinit savage_unmap_mmio (struct fb_info *info) | 1548 | static void __devinit savage_unmap_mmio (struct fb_info *info) |
1569 | { | 1549 | { |
1570 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1550 | struct savagefb_par *par = info->par; |
1571 | DBG ("savage_unmap_mmio"); | 1551 | DBG ("savage_unmap_mmio"); |
1572 | 1552 | ||
1573 | savage_disable_mmio(par); | 1553 | savage_disable_mmio(par); |
@@ -1581,7 +1561,7 @@ static void __devinit savage_unmap_mmio (struct fb_info *info) | |||
1581 | static int __devinit savage_map_video (struct fb_info *info, | 1561 | static int __devinit savage_map_video (struct fb_info *info, |
1582 | int video_len) | 1562 | int video_len) |
1583 | { | 1563 | { |
1584 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1564 | struct savagefb_par *par = info->par; |
1585 | int resource; | 1565 | int resource; |
1586 | 1566 | ||
1587 | DBG("savage_map_video"); | 1567 | DBG("savage_map_video"); |
@@ -1619,7 +1599,7 @@ static int __devinit savage_map_video (struct fb_info *info, | |||
1619 | 1599 | ||
1620 | static void __devinit savage_unmap_video (struct fb_info *info) | 1600 | static void __devinit savage_unmap_video (struct fb_info *info) |
1621 | { | 1601 | { |
1622 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1602 | struct savagefb_par *par = info->par; |
1623 | 1603 | ||
1624 | DBG("savage_unmap_video"); | 1604 | DBG("savage_unmap_video"); |
1625 | 1605 | ||
@@ -1869,7 +1849,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info, | |||
1869 | struct pci_dev *dev, | 1849 | struct pci_dev *dev, |
1870 | const struct pci_device_id *id) | 1850 | const struct pci_device_id *id) |
1871 | { | 1851 | { |
1872 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1852 | struct savagefb_par *par = info->par; |
1873 | int err = 0; | 1853 | int err = 0; |
1874 | 1854 | ||
1875 | par->pcidev = dev; | 1855 | par->pcidev = dev; |
@@ -2139,8 +2119,7 @@ static int __devinit savagefb_probe (struct pci_dev* dev, | |||
2139 | 2119 | ||
2140 | static void __devexit savagefb_remove (struct pci_dev *dev) | 2120 | static void __devexit savagefb_remove (struct pci_dev *dev) |
2141 | { | 2121 | { |
2142 | struct fb_info *info = | 2122 | struct fb_info *info = pci_get_drvdata(dev); |
2143 | (struct fb_info *)pci_get_drvdata(dev); | ||
2144 | 2123 | ||
2145 | DBG("savagefb_remove"); | 2124 | DBG("savagefb_remove"); |
2146 | 2125 | ||
@@ -2174,9 +2153,8 @@ static void __devexit savagefb_remove (struct pci_dev *dev) | |||
2174 | 2153 | ||
2175 | static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) | 2154 | static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) |
2176 | { | 2155 | { |
2177 | struct fb_info *info = | 2156 | struct fb_info *info = pci_get_drvdata(dev); |
2178 | (struct fb_info *)pci_get_drvdata(dev); | 2157 | struct savagefb_par *par = info->par; |
2179 | struct savagefb_par *par = (struct savagefb_par *)info->par; | ||
2180 | 2158 | ||
2181 | DBG("savagefb_suspend"); | 2159 | DBG("savagefb_suspend"); |
2182 | 2160 | ||
@@ -2210,9 +2188,8 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) | |||
2210 | 2188 | ||
2211 | static int savagefb_resume (struct pci_dev* dev) | 2189 | static int savagefb_resume (struct pci_dev* dev) |
2212 | { | 2190 | { |
2213 | struct fb_info *info = | 2191 | struct fb_info *info = pci_get_drvdata(dev); |
2214 | (struct fb_info *)pci_get_drvdata(dev); | 2192 | struct savagefb_par *par = info->par; |
2215 | struct savagefb_par *par = (struct savagefb_par *)info->par; | ||
2216 | int cur_state = par->pm_state; | 2193 | int cur_state = par->pm_state; |
2217 | 2194 | ||
2218 | DBG("savage_resume"); | 2195 | DBG("savage_resume"); |
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c index 3a74a63dd4f2..a4d7cc51ce0b 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/sbuslib.c | |||
@@ -199,8 +199,7 @@ struct fbcmap32 { | |||
199 | #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) | 199 | #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) |
200 | #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) | 200 | #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) |
201 | 201 | ||
202 | static int fbiogetputcmap(struct file *file, struct fb_info *info, | 202 | static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long arg) |
203 | unsigned int cmd, unsigned long arg) | ||
204 | { | 203 | { |
205 | struct fbcmap32 __user *argp = (void __user *)arg; | 204 | struct fbcmap32 __user *argp = (void __user *)arg; |
206 | struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p)); | 205 | struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p)); |
@@ -216,10 +215,10 @@ static int fbiogetputcmap(struct file *file, struct fb_info *info, | |||
216 | ret |= put_user(compat_ptr(addr), &p->blue); | 215 | ret |= put_user(compat_ptr(addr), &p->blue); |
217 | if (ret) | 216 | if (ret) |
218 | return -EFAULT; | 217 | return -EFAULT; |
219 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, | 218 | return info->fbops->fb_ioctl(info, |
220 | (cmd == FBIOPUTCMAP32) ? | 219 | (cmd == FBIOPUTCMAP32) ? |
221 | FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, | 220 | FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, |
222 | (unsigned long)p, info); | 221 | (unsigned long)p); |
223 | } | 222 | } |
224 | 223 | ||
225 | struct fbcursor32 { | 224 | struct fbcursor32 { |
@@ -236,8 +235,7 @@ struct fbcursor32 { | |||
236 | #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) | 235 | #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) |
237 | #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) | 236 | #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) |
238 | 237 | ||
239 | static int fbiogscursor(struct file *file, struct fb_info *info, | 238 | static int fbiogscursor(struct fb_info *info, unsigned long arg) |
240 | unsigned long arg) | ||
241 | { | 239 | { |
242 | struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p)); | 240 | struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p)); |
243 | struct fbcursor32 __user *argp = (void __user *)arg; | 241 | struct fbcursor32 __user *argp = (void __user *)arg; |
@@ -260,12 +258,10 @@ static int fbiogscursor(struct file *file, struct fb_info *info, | |||
260 | ret |= put_user(compat_ptr(addr), &p->image); | 258 | ret |= put_user(compat_ptr(addr), &p->image); |
261 | if (ret) | 259 | if (ret) |
262 | return -EFAULT; | 260 | return -EFAULT; |
263 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, | 261 | return info->fbops->fb_ioctl(info, FBIOSCURSOR, (unsigned long)p); |
264 | FBIOSCURSOR, (unsigned long)p, info); | ||
265 | } | 262 | } |
266 | 263 | ||
267 | long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | 264 | int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) |
268 | unsigned long arg, struct fb_info *info) | ||
269 | { | 265 | { |
270 | switch (cmd) { | 266 | switch (cmd) { |
271 | case FBIOGTYPE: | 267 | case FBIOGTYPE: |
@@ -278,14 +274,13 @@ long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | |||
278 | case FBIOSCURPOS: | 274 | case FBIOSCURPOS: |
279 | case FBIOGCURPOS: | 275 | case FBIOGCURPOS: |
280 | case FBIOGCURMAX: | 276 | case FBIOGCURMAX: |
281 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, | 277 | return info->fbops->fb_ioctl(info, cmd, arg); |
282 | file, cmd, arg, info); | ||
283 | case FBIOPUTCMAP32: | 278 | case FBIOPUTCMAP32: |
284 | return fbiogetputcmap(file, info, cmd, arg); | 279 | return fbiogetputcmap(info, cmd, arg); |
285 | case FBIOGETCMAP32: | 280 | case FBIOGETCMAP32: |
286 | return fbiogetputcmap(file, info, cmd, arg); | 281 | return fbiogetputcmap(info, cmd, arg); |
287 | case FBIOSCURSOR32: | 282 | case FBIOSCURSOR32: |
288 | return fbiogscursor(file, info, arg); | 283 | return fbiogscursor(info, arg); |
289 | default: | 284 | default: |
290 | return -ENOIOCTLCMD; | 285 | return -ENOIOCTLCMD; |
291 | } | 286 | } |
diff --git a/drivers/video/sbuslib.h b/drivers/video/sbuslib.h index b470e52ce9e2..492828c3fe8f 100644 --- a/drivers/video/sbuslib.h +++ b/drivers/video/sbuslib.h | |||
@@ -20,7 +20,7 @@ extern int sbusfb_mmap_helper(struct sbus_mmap_map *map, | |||
20 | int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, | 20 | int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, |
21 | struct fb_info *info, | 21 | struct fb_info *info, |
22 | int type, int fb_depth, unsigned long fb_size); | 22 | int type, int fb_depth, unsigned long fb_size); |
23 | long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | 23 | int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, |
24 | unsigned long arg, struct fb_info *info); | 24 | unsigned long arg); |
25 | 25 | ||
26 | #endif /* _SBUSLIB_H */ | 26 | #endif /* _SBUSLIB_H */ |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 7054660767e4..2e6df1fcb2b9 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
@@ -115,7 +115,7 @@ static int sgivwfb_set_par(struct fb_info *info); | |||
115 | static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, | 115 | static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, |
116 | u_int blue, u_int transp, | 116 | u_int blue, u_int transp, |
117 | struct fb_info *info); | 117 | struct fb_info *info); |
118 | static int sgivwfb_mmap(struct fb_info *info, struct file *file, | 118 | static int sgivwfb_mmap(struct fb_info *info, |
119 | struct vm_area_struct *vma); | 119 | struct vm_area_struct *vma); |
120 | 120 | ||
121 | static struct fb_ops sgivwfb_ops = { | 121 | static struct fb_ops sgivwfb_ops = { |
@@ -706,7 +706,7 @@ static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, | |||
706 | return 0; | 706 | return 0; |
707 | } | 707 | } |
708 | 708 | ||
709 | static int sgivwfb_mmap(struct fb_info *info, struct file *file, | 709 | static int sgivwfb_mmap(struct fb_info *info, |
710 | struct vm_area_struct *vma) | 710 | struct vm_area_struct *vma) |
711 | { | 711 | { |
712 | unsigned long size = vma->vm_end - vma->vm_start; | 712 | unsigned long size = vma->vm_end - vma->vm_start; |
@@ -723,7 +723,6 @@ static int sgivwfb_mmap(struct fb_info *info, struct file *file, | |||
723 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, | 723 | if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, |
724 | size, vma->vm_page_prot)) | 724 | size, vma->vm_page_prot)) |
725 | return -EAGAIN; | 725 | return -EAGAIN; |
726 | vma->vm_file = file; | ||
727 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", | 726 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", |
728 | offset, vma->vm_start); | 727 | offset, vma->vm_start); |
729 | return 0; | 728 | return 0; |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index dea1a46c67c4..8adf5bf91eee 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -1743,13 +1743,14 @@ sisfb_blank(int blank, struct fb_info *info) | |||
1743 | 1743 | ||
1744 | /* ----------- FBDev related routines for all series ---------- */ | 1744 | /* ----------- FBDev related routines for all series ---------- */ |
1745 | 1745 | ||
1746 | static int | 1746 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
1747 | sisfb_ioctl(struct inode *inode, struct file *file, | 1747 | static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, |
1748 | unsigned int cmd, unsigned long arg, | 1748 | unsigned long arg) |
1749 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | 1749 | #else |
1750 | int con, | 1750 | static int sisfb_ioctl(struct inode *inode, struct file *file, |
1751 | unsigned int cmd, unsigned long arg, | ||
1752 | struct fb_info *info) | ||
1751 | #endif | 1753 | #endif |
1752 | struct fb_info *info) | ||
1753 | { | 1754 | { |
1754 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; | 1755 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; |
1755 | struct sis_memreq sismemreq; | 1756 | struct sis_memreq sismemreq; |
@@ -1924,19 +1925,6 @@ sisfb_ioctl(struct inode *inode, struct file *file, | |||
1924 | return 0; | 1925 | return 0; |
1925 | } | 1926 | } |
1926 | 1927 | ||
1927 | #ifdef SIS_NEW_CONFIG_COMPAT | ||
1928 | static long | ||
1929 | sisfb_compat_ioctl(struct file *f, unsigned int cmd, unsigned long arg, struct fb_info *info) | ||
1930 | { | ||
1931 | int ret; | ||
1932 | |||
1933 | lock_kernel(); | ||
1934 | ret = sisfb_ioctl(NULL, f, cmd, arg, info); | ||
1935 | unlock_kernel(); | ||
1936 | return ret; | ||
1937 | } | ||
1938 | #endif | ||
1939 | |||
1940 | static int | 1928 | static int |
1941 | sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) | 1929 | sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) |
1942 | { | 1930 | { |
@@ -2007,7 +1995,7 @@ static struct fb_ops sisfb_ops = { | |||
2007 | #endif | 1995 | #endif |
2008 | .fb_sync = fbcon_sis_sync, | 1996 | .fb_sync = fbcon_sis_sync, |
2009 | #ifdef SIS_NEW_CONFIG_COMPAT | 1997 | #ifdef SIS_NEW_CONFIG_COMPAT |
2010 | .fb_compat_ioctl= sisfb_compat_ioctl, | 1998 | .fb_compat_ioctl= sisfb_ioctl, |
2011 | #endif | 1999 | #endif |
2012 | .fb_ioctl = sisfb_ioctl | 2000 | .fb_ioctl = sisfb_ioctl |
2013 | }; | 2001 | }; |
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h index 445bcbba03ae..70b6df371b8e 100644 --- a/drivers/video/sis/sis_main.h +++ b/drivers/video/sis/sis_main.h | |||
@@ -727,9 +727,14 @@ static int sisfb_ioctl(struct inode *inode, struct file *file, | |||
727 | #endif | 727 | #endif |
728 | 728 | ||
729 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | 729 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) |
730 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) | ||
731 | static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, | ||
732 | unsigned long arg); | ||
733 | #else | ||
730 | static int sisfb_ioctl(struct inode *inode, struct file *file, | 734 | static int sisfb_ioctl(struct inode *inode, struct file *file, |
731 | unsigned int cmd, unsigned long arg, | 735 | unsigned int cmd, unsigned long arg, |
732 | struct fb_info *info); | 736 | struct fb_info *info); |
737 | #endif | ||
733 | static int sisfb_set_par(struct fb_info *info); | 738 | static int sisfb_set_par(struct fb_info *info); |
734 | static int sisfb_blank(int blank, | 739 | static int sisfb_blank(int blank, |
735 | struct fb_info *info); | 740 | struct fb_info *info); |
diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index a01e7ecc15ed..9b707771d757 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c | |||
@@ -115,7 +115,8 @@ static struct fb_fix_screeninfo xxxfb_fix __initdata = { | |||
115 | /* | 115 | /* |
116 | * If your driver supports multiple boards or it supports multiple | 116 | * If your driver supports multiple boards or it supports multiple |
117 | * framebuffers, you should make these arrays, or allocate them | 117 | * framebuffers, you should make these arrays, or allocate them |
118 | * dynamically (using kmalloc()). | 118 | * dynamically using framebuffer_alloc() and free them with |
119 | * framebuffer_release(). | ||
119 | */ | 120 | */ |
120 | static struct fb_info info; | 121 | static struct fb_info info; |
121 | 122 | ||
@@ -179,18 +180,31 @@ static int xxxfb_release(const struct fb_info *info, int user) | |||
179 | * intent to only test a mode and not actually set it. The stuff in | 180 | * intent to only test a mode and not actually set it. The stuff in |
180 | * modedb.c is a example of this. If the var passed in is slightly | 181 | * modedb.c is a example of this. If the var passed in is slightly |
181 | * off by what the hardware can support then we alter the var PASSED in | 182 | * off by what the hardware can support then we alter the var PASSED in |
182 | * to what we can do. If the hardware doesn't support mode change | 183 | * to what we can do. |
183 | * a -EINVAL will be returned by the upper layers. You don't need to | 184 | * |
184 | * implement this function then. If you hardware doesn't support | 185 | * For values that are off, this function must round them _up_ to the |
185 | * changing the resolution then this function is not needed. In this | 186 | * next value that is supported by the hardware. If the value is |
186 | * case the driver woudl just provide a var that represents the static | 187 | * greater than the highest value supported by the hardware, then this |
187 | * state the screen is in. | 188 | * function must return -EINVAL. |
189 | * | ||
190 | * Exception to the above rule: Some drivers have a fixed mode, ie, | ||
191 | * the hardware is already set at boot up, and cannot be changed. In | ||
192 | * this case, it is more acceptable that this function just return | ||
193 | * a copy of the currently working var (info->var). Better is to not | ||
194 | * implement this function, as the upper layer will do the copying | ||
195 | * of the current var for you. | ||
196 | * | ||
197 | * Note: This is the only function where the contents of var can be | ||
198 | * freely adjusted after the driver has been registered. If you find | ||
199 | * that you have code outside of this function that alters the content | ||
200 | * of var, then you are doing something wrong. Note also that the | ||
201 | * contents of info->var must be left untouched at all times after | ||
202 | * driver registration. | ||
188 | * | 203 | * |
189 | * Returns negative errno on error, or zero on success. | 204 | * Returns negative errno on error, or zero on success. |
190 | */ | 205 | */ |
191 | static int xxxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 206 | static int xxxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
192 | { | 207 | { |
193 | const struct xxx_par *par = (const struct xxx_par *) info->par; | ||
194 | /* ... */ | 208 | /* ... */ |
195 | return 0; | 209 | return 0; |
196 | } | 210 | } |
@@ -204,14 +218,39 @@ static int xxxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
204 | * fb_fix_screeninfo stored in fb_info. It doesn't not alter var in | 218 | * fb_fix_screeninfo stored in fb_info. It doesn't not alter var in |
205 | * fb_info since we are using that data. This means we depend on the | 219 | * fb_info since we are using that data. This means we depend on the |
206 | * data in var inside fb_info to be supported by the hardware. | 220 | * data in var inside fb_info to be supported by the hardware. |
207 | * xxxfb_check_var is always called before xxxfb_set_par to ensure this. | 221 | * |
222 | * This function is also used to recover/restore the hardware to a | ||
223 | * known working state. | ||
224 | * | ||
225 | * xxxfb_check_var is always called before xxxfb_set_par to ensure that | ||
226 | * the contents of var is always valid. | ||
227 | * | ||
208 | * Again if you can't change the resolution you don't need this function. | 228 | * Again if you can't change the resolution you don't need this function. |
209 | * | 229 | * |
230 | * However, even if your hardware does not support mode changing, | ||
231 | * a set_par might be needed to at least initialize the hardware to | ||
232 | * a known working state, especially if it came back from another | ||
233 | * process that also modifies the same hardware, such as X. | ||
234 | * | ||
235 | * If this is the case, a combination such as the following should work: | ||
236 | * | ||
237 | * static int xxxfb_check_var(struct fb_var_screeninfo *var, | ||
238 | * struct fb_info *info) | ||
239 | * { | ||
240 | * *var = info->var; | ||
241 | * return 0; | ||
242 | * } | ||
243 | * | ||
244 | * static int xxxfb_set_par(struct fb_info *info) | ||
245 | * { | ||
246 | * init your hardware here | ||
247 | * } | ||
248 | * | ||
210 | * Returns negative errno on error, or zero on success. | 249 | * Returns negative errno on error, or zero on success. |
211 | */ | 250 | */ |
212 | static int xxxfb_set_par(struct fb_info *info) | 251 | static int xxxfb_set_par(struct fb_info *info) |
213 | { | 252 | { |
214 | struct xxx_par *par = (struct xxx_par *) info->par; | 253 | struct xxx_par *par = info->par; |
215 | /* ... */ | 254 | /* ... */ |
216 | return 0; | 255 | return 0; |
217 | } | 256 | } |
@@ -258,70 +297,110 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
258 | * var->{color}.offset contains start of bitfield | 297 | * var->{color}.offset contains start of bitfield |
259 | * var->{color}.length contains length of bitfield | 298 | * var->{color}.length contains length of bitfield |
260 | * {hardwarespecific} contains width of DAC | 299 | * {hardwarespecific} contains width of DAC |
261 | * cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset) | 300 | * pseudo_palette[X] is programmed to (X << red.offset) | |
301 | * (X << green.offset) | | ||
302 | * (X << blue.offset) | ||
262 | * RAMDAC[X] is programmed to (red, green, blue) | 303 | * RAMDAC[X] is programmed to (red, green, blue) |
304 | * color depth = SUM(var->{color}.length) | ||
263 | * | 305 | * |
264 | * Pseudocolor: | 306 | * Pseudocolor: |
265 | * uses offset = 0 && length = DAC register width. | ||
266 | * var->{color}.offset is 0 | 307 | * var->{color}.offset is 0 |
267 | * var->{color}.length contains widht of DAC | 308 | * var->{color}.length contains width of DAC or the number of unique |
268 | * cmap is not used | 309 | * colors available (color depth) |
269 | * DAC[X] is programmed to (red, green, blue) | 310 | * pseudo_palette is not used |
311 | * RAMDAC[X] is programmed to (red, green, blue) | ||
312 | * color depth = var->{color}.length | ||
313 | * | ||
314 | * Static pseudocolor: | ||
315 | * same as Pseudocolor, but the RAMDAC is not programmed (read-only) | ||
316 | * | ||
317 | * Mono01/Mono10: | ||
318 | * Has only 2 values, black on white or white on black (fg on bg), | ||
319 | * var->{color}.offset is 0 | ||
320 | * white = (1 << var->{color}.length) - 1, black = 0 | ||
321 | * pseudo_palette is not used | ||
322 | * RAMDAC does not exist | ||
323 | * color depth is always 2 | ||
324 | * | ||
270 | * Truecolor: | 325 | * Truecolor: |
271 | * does not use RAMDAC (usually has 3 of them). | 326 | * does not use RAMDAC (usually has 3 of them). |
272 | * var->{color}.offset contains start of bitfield | 327 | * var->{color}.offset contains start of bitfield |
273 | * var->{color}.length contains length of bitfield | 328 | * var->{color}.length contains length of bitfield |
274 | * cmap is programmed to (red << red.offset) | (green << green.offset) | | 329 | * pseudo_palette is programmed to (red << red.offset) | |
275 | * (blue << blue.offset) | (transp << transp.offset) | 330 | * (green << green.offset) | |
331 | * (blue << blue.offset) | | ||
332 | * (transp << transp.offset) | ||
276 | * RAMDAC does not exist | 333 | * RAMDAC does not exist |
334 | * color depth = SUM(var->{color}.length}) | ||
335 | * | ||
336 | * The color depth is used by fbcon for choosing the logo and also | ||
337 | * for color palette transformation if color depth < 4 | ||
338 | * | ||
339 | * As can be seen from the above, the field bits_per_pixel is _NOT_ | ||
340 | * a criteria for describing the color visual. | ||
341 | * | ||
342 | * A common mistake is assuming that bits_per_pixel <= 8 is pseudocolor, | ||
343 | * and higher than that, true/directcolor. This is incorrect, one needs | ||
344 | * to look at the fix->visual. | ||
345 | * | ||
346 | * Another common mistake is using bits_per_pixel to calculate the color | ||
347 | * depth. The bits_per_pixel field does not directly translate to color | ||
348 | * depth. You have to compute for the color depth (using the color | ||
349 | * bitfields) and fix->visual as seen above. | ||
350 | */ | ||
351 | |||
352 | /* | ||
353 | * This is the point where the color is converted to something that | ||
354 | * is acceptable by the hardware. | ||
277 | */ | 355 | */ |
278 | #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16) | 356 | #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16) |
279 | switch (info->fix.visual) { | 357 | red = CNVT_TOHW(red, info->var.red.length); |
280 | case FB_VISUAL_TRUECOLOR: | 358 | green = CNVT_TOHW(green, info->var.green.length); |
281 | case FB_VISUAL_PSEUDOCOLOR: | 359 | blue = CNVT_TOHW(blue, info->var.blue.length); |
282 | red = CNVT_TOHW(red, info->var.red.length); | 360 | transp = CNVT_TOHW(transp, info->var.transp.length); |
283 | green = CNVT_TOHW(green, info->var.green.length); | ||
284 | blue = CNVT_TOHW(blue, info->var.blue.length); | ||
285 | transp = CNVT_TOHW(transp, info->var.transp.length); | ||
286 | break; | ||
287 | case FB_VISUAL_DIRECTCOLOR: | ||
288 | /* example here assumes 8 bit DAC. Might be different | ||
289 | * for your hardware */ | ||
290 | red = CNVT_TOHW(red, 8); | ||
291 | green = CNVT_TOHW(green, 8); | ||
292 | blue = CNVT_TOHW(blue, 8); | ||
293 | /* hey, there is bug in transp handling... */ | ||
294 | transp = CNVT_TOHW(transp, 8); | ||
295 | break; | ||
296 | } | ||
297 | #undef CNVT_TOHW | 361 | #undef CNVT_TOHW |
298 | /* Truecolor has hardware independent palette */ | 362 | /* |
299 | if (info->fix.visual == FB_VISUAL_TRUECOLOR) { | 363 | * This is the point where the function feeds the color to the hardware |
300 | u32 v; | 364 | * palette after converting the colors to something acceptable by |
301 | 365 | * the hardware. Note, only FB_VISUAL_DIRECTCOLOR and | |
302 | if (regno >= 16) | 366 | * FB_VISUAL_PSEUDOCOLOR visuals need to write to the hardware palette. |
303 | return -EINVAL; | 367 | * If you have code that writes to the hardware CLUT, and it's not |
304 | 368 | * any of the above visuals, then you are doing something wrong. | |
305 | v = (red << info->var.red.offset) | | 369 | */ |
306 | (green << info->var.green.offset) | | 370 | if (info->fix.visual == FB_VISUAL_DIRECTCOLOR || |
307 | (blue << info->var.blue.offset) | | 371 | info->fix.visual == FB_VISUAL_TRUECOLOR) |
308 | (transp << info->var.transp.offset); | 372 | write_{red|green|blue|transp}_to_clut(); |
309 | 373 | ||
310 | switch (info->var.bits_per_pixel) { | 374 | /* This is the point were you need to fill up the contents of |
311 | case 8: | 375 | * info->pseudo_palette. This structure is used _only_ by fbcon, thus |
312 | /* Yes some hand held devices have this. */ | 376 | * it only contains 16 entries to match the number of colors supported |
313 | ((u8*)(info->pseudo_palette))[regno] = v; | 377 | * by the console. The pseudo_palette is used only if the visual is |
314 | break; | 378 | * in directcolor or truecolor mode. With other visuals, the |
315 | case 16: | 379 | * pseudo_palette is not used. (This might change in the future.) |
316 | ((u16*)(info->pseudo_palette))[regno] = v; | 380 | * |
317 | break; | 381 | * The contents of the pseudo_palette is in raw pixel format. Ie, each |
318 | case 24: | 382 | * entry can be written directly to the framebuffer without any conversion. |
319 | case 32: | 383 | * The pseudo_palette is (void *). However, if using the generic |
320 | ((u32*)(info->pseudo_palette))[regno] = v; | 384 | * drawing functions (cfb_imageblit, cfb_fillrect), the pseudo_palette |
321 | break; | 385 | * must be casted to (u32 *) _regardless_ of the bits per pixel. If the |
322 | } | 386 | * driver is using its own drawing functions, then it can use whatever |
323 | return 0; | 387 | * size it wants. |
388 | */ | ||
389 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
390 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | ||
391 | u32 v; | ||
392 | |||
393 | if (regno >= 16) | ||
394 | return -EINVAL; | ||
395 | |||
396 | v = (red << info->var.red.offset) | | ||
397 | (green << info->var.green.offset) | | ||
398 | (blue << info->var.blue.offset) | | ||
399 | (transp << info->var.transp.offset); | ||
400 | |||
401 | ((u32*)(info->pseudo_palette))[regno] = v; | ||
324 | } | 402 | } |
403 | |||
325 | /* ... */ | 404 | /* ... */ |
326 | return 0; | 405 | return 0; |
327 | } | 406 | } |
@@ -340,6 +419,17 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
340 | static int xxxfb_pan_display(struct fb_var_screeninfo *var, | 419 | static int xxxfb_pan_display(struct fb_var_screeninfo *var, |
341 | const struct fb_info *info) | 420 | const struct fb_info *info) |
342 | { | 421 | { |
422 | /* | ||
423 | * If your hardware does not support panning, _do_ _not_ implement this | ||
424 | * function. Creating a dummy function will just confuse user apps. | ||
425 | */ | ||
426 | |||
427 | /* | ||
428 | * Note that even if this function is fully functional, a setting of | ||
429 | * 0 in both xpanstep and ypanstep means that this function will never | ||
430 | * get called. | ||
431 | */ | ||
432 | |||
343 | /* ... */ | 433 | /* ... */ |
344 | return 0; | 434 | return 0; |
345 | } | 435 | } |
@@ -349,15 +439,20 @@ static int xxxfb_pan_display(struct fb_var_screeninfo *var, | |||
349 | * @blank_mode: the blank mode we want. | 439 | * @blank_mode: the blank mode we want. |
350 | * @info: frame buffer structure that represents a single frame buffer | 440 | * @info: frame buffer structure that represents a single frame buffer |
351 | * | 441 | * |
352 | * Blank the screen if blank_mode != 0, else unblank. Return 0 if | 442 | * Blank the screen if blank_mode != FB_BLANK_UNBLANK, else unblank. |
353 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a | 443 | * Return 0 if blanking succeeded, != 0 if un-/blanking failed due to |
354 | * video mode which doesn't support it. Implements VESA suspend | 444 | * e.g. a video mode which doesn't support it. |
355 | * and powerdown modes on hardware that supports disabling hsync/vsync: | ||
356 | * blank_mode == 2: suspend vsync | ||
357 | * blank_mode == 3: suspend hsync | ||
358 | * blank_mode == 4: powerdown | ||
359 | * | 445 | * |
360 | * Returns negative errno on error, or zero on success. | 446 | * Implements VESA suspend and powerdown modes on hardware that supports |
447 | * disabling hsync/vsync: | ||
448 | * | ||
449 | * FB_BLANK_NORMAL = display is blanked, syncs are on. | ||
450 | * FB_BLANK_HSYNC_SUSPEND = hsync off | ||
451 | * FB_BLANK_VSYNC_SUSPEND = vsync off | ||
452 | * FB_BLANK_POWERDOWN = hsync and vsync off | ||
453 | * | ||
454 | * If implementing this function, at least support FB_BLANK_UNBLANK. | ||
455 | * Return !0 for any modes that are unimplemented. | ||
361 | * | 456 | * |
362 | */ | 457 | */ |
363 | static int xxxfb_blank(int blank_mode, const struct fb_info *info) | 458 | static int xxxfb_blank(int blank_mode, const struct fb_info *info) |
@@ -454,6 +549,14 @@ void xxxfb_imageblit(struct fb_info *p, const struct fb_image *image) | |||
454 | * @data: The actual data used to construct the image on the display. | 549 | * @data: The actual data used to construct the image on the display. |
455 | * @cmap: The colormap used for color images. | 550 | * @cmap: The colormap used for color images. |
456 | */ | 551 | */ |
552 | |||
553 | /* | ||
554 | * The generic function, cfb_imageblit, expects that the bitmap scanlines are | ||
555 | * padded to the next byte. Most hardware accelerators may require padding to | ||
556 | * the next u16 or the next u32. If that is the case, the driver can specify | ||
557 | * this by setting info->pixmap.scan_align = 2 or 4. See a more | ||
558 | * comprehensive description of the pixmap below. | ||
559 | */ | ||
457 | } | 560 | } |
458 | 561 | ||
459 | /** | 562 | /** |
@@ -517,6 +620,7 @@ int xxxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
517 | */ | 620 | */ |
518 | void xxxfb_rotate(struct fb_info *info, int angle) | 621 | void xxxfb_rotate(struct fb_info *info, int angle) |
519 | { | 622 | { |
623 | /* Will be deprecated */ | ||
520 | } | 624 | } |
521 | 625 | ||
522 | /** | 626 | /** |
@@ -540,6 +644,9 @@ void xxxfb_poll(struct fb_info *info, poll_table *wait) | |||
540 | * so we can have consistent display output. | 644 | * so we can have consistent display output. |
541 | * | 645 | * |
542 | * @info: frame buffer structure that represents a single frame buffer | 646 | * @info: frame buffer structure that represents a single frame buffer |
647 | * | ||
648 | * If the driver has implemented its own hardware-based drawing function, | ||
649 | * implementing this function is highly recommended. | ||
543 | */ | 650 | */ |
544 | void xxxfb_sync(struct fb_info *info) | 651 | void xxxfb_sync(struct fb_info *info) |
545 | { | 652 | { |
@@ -549,20 +656,25 @@ void xxxfb_sync(struct fb_info *info) | |||
549 | * Initialization | 656 | * Initialization |
550 | */ | 657 | */ |
551 | 658 | ||
552 | int __init xxxfb_init(void) | 659 | /* static int __init xxfb_probe (struct device *device) -- for platform devs */ |
660 | static int __init xxxfb_probe(struct pci_dev *dev, | ||
661 | const_struct pci_device_id *ent) | ||
553 | { | 662 | { |
663 | struct fb_info *info; | ||
664 | struct xxx_par *par; | ||
665 | struct device = &dev->dev; /* for pci drivers */ | ||
554 | int cmap_len, retval; | 666 | int cmap_len, retval; |
555 | 667 | ||
556 | /* | 668 | /* |
557 | * For kernel boot options (in 'video=xxxfb:<options>' format) | 669 | * Dynamically allocate info and par |
558 | */ | 670 | */ |
559 | #ifndef MODULE | 671 | info = framebuffer_alloc(sizeof(struct xxx_par), device); |
560 | char *option = NULL; | ||
561 | 672 | ||
562 | if (fb_get_options("xxxfb", &option)) | 673 | if (!info) { |
563 | return -ENODEV; | 674 | /* goto error path */ |
564 | xxxfb_setup(option); | 675 | } |
565 | #endif | 676 | |
677 | par = info->par; | ||
566 | 678 | ||
567 | /* | 679 | /* |
568 | * Here we set the screen_base to the virtual memory address | 680 | * Here we set the screen_base to the virtual memory address |
@@ -570,18 +682,87 @@ int __init xxxfb_init(void) | |||
570 | * from the bus layer and then translate it to virtual memory | 682 | * from the bus layer and then translate it to virtual memory |
571 | * space via ioremap. Consult ioport.h. | 683 | * space via ioremap. Consult ioport.h. |
572 | */ | 684 | */ |
573 | info.screen_base = framebuffer_virtual_memory; | 685 | info->screen_base = framebuffer_virtual_memory; |
574 | info.fbops = &xxxfb_ops; | 686 | info->fbops = &xxxfb_ops; |
575 | info.fix = xxxfb_fix; | 687 | info->fix = xxxfb_fix; /* this will be the only time xxxfb_fix will be |
576 | info.pseudo_palette = pseudo_palette; | 688 | * used, so mark it as __initdata |
577 | 689 | */ | |
690 | info->pseudo_palette = pseudo_palette; /* The pseudopalette is an | ||
691 | * 16-member array | ||
692 | */ | ||
578 | /* | 693 | /* |
579 | * Set up flags to indicate what sort of acceleration your | 694 | * Set up flags to indicate what sort of acceleration your |
580 | * driver can provide (pan/wrap/copyarea/etc.) and whether it | 695 | * driver can provide (pan/wrap/copyarea/etc.) and whether it |
581 | * is a module -- see FBINFO_* in include/linux/fb.h | 696 | * is a module -- see FBINFO_* in include/linux/fb.h |
697 | * | ||
698 | * If your hardware can support any of the hardware accelerated functions | ||
699 | * fbcon performance will improve if info->flags is set properly. | ||
700 | * | ||
701 | * FBINFO_HWACCEL_COPYAREA - hardware moves | ||
702 | * FBINFO_HWACCEL_FILLRECT - hardware fills | ||
703 | * FBINFO_HWACCEL_IMAGEBLIT - hardware mono->color expansion | ||
704 | * FBINFO_HWACCEL_YPAN - hardware can pan display in y-axis | ||
705 | * FBINFO_HWACCEL_YWRAP - hardware can wrap display in y-axis | ||
706 | * FBINFO_HWACCEL_DISABLED - supports hardware accels, but disabled | ||
707 | * FBINFO_READS_FAST - if set, prefer moves over mono->color expansion | ||
708 | * FBINFO_MISC_TILEBLITTING - hardware can do tile blits | ||
709 | * | ||
710 | * NOTE: These are for fbcon use only. | ||
711 | */ | ||
712 | info->flags = FBINFO_DEFAULT; | ||
713 | |||
714 | /********************* This stage is optional ******************************/ | ||
715 | /* | ||
716 | * The struct pixmap is a scratch pad for the drawing functions. This | ||
717 | * is where the monochrome bitmap is constructed by the higher layers | ||
718 | * and then passed to the accelerator. For drivers that uses | ||
719 | * cfb_imageblit, you can skip this part. For those that have a more | ||
720 | * rigorous requirement, this stage is needed | ||
721 | */ | ||
722 | |||
723 | /* PIXMAP_SIZE should be small enough to optimize drawing, but not | ||
724 | * large enough that memory is wasted. A safe size is | ||
725 | * (max_xres * max_font_height/8). max_xres is driver dependent, | ||
726 | * max_font_height is 32. | ||
727 | */ | ||
728 | info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL); | ||
729 | if (!info->pixmap.addr) { | ||
730 | /* goto error */ | ||
731 | } | ||
732 | |||
733 | info->pixmap.size = PIXMAP_SIZE; | ||
734 | |||
735 | /* | ||
736 | * FB_PIXMAP_SYSTEM - memory is in system ram | ||
737 | * FB_PIXMAP_IO - memory is iomapped | ||
738 | * FB_PIXMAP_SYNC - if set, will call fb_sync() per access to pixmap, | ||
739 | * usually if FB_PIXMAP_IO is set. | ||
740 | * | ||
741 | * Currently, FB_PIXMAP_IO is unimplemented. | ||
742 | */ | ||
743 | info->pixmap.flags = FB_PIXMAP_SYSTEM; | ||
744 | |||
745 | /* | ||
746 | * scan_align is the number of padding for each scanline. It is in bytes. | ||
747 | * Thus for accelerators that need padding to the next u32, put 4 here. | ||
748 | */ | ||
749 | info->pixmap.scan_align = 4; | ||
750 | |||
751 | /* | ||
752 | * buf_align is the amount to be padded for the buffer. For example, | ||
753 | * the i810fb needs a scan_align of 2 but expects it to be fed with | ||
754 | * dwords, so a buf_align = 4 is required. | ||
582 | */ | 755 | */ |
583 | info.flags = FBINFO_DEFAULT; | 756 | info->pixmap.buf_align = 4; |
584 | info.par = current_par; | 757 | |
758 | /* access_align is how many bits can be accessed from the framebuffer | ||
759 | * ie. some epson cards allow 16-bit access only. Most drivers will | ||
760 | * be safe with u32 here. | ||
761 | * | ||
762 | * NOTE: This field is currently unused. | ||
763 | */ | ||
764 | info->pixmap.scan_align = 32 | ||
765 | /***************************** End optional stage ***************************/ | ||
585 | 766 | ||
586 | /* | 767 | /* |
587 | * This should give a reasonable default video mode. The following is | 768 | * This should give a reasonable default video mode. The following is |
@@ -590,42 +771,145 @@ int __init xxxfb_init(void) | |||
590 | if (!mode_option) | 771 | if (!mode_option) |
591 | mode_option = "640x480@60"; | 772 | mode_option = "640x480@60"; |
592 | 773 | ||
593 | retval = fb_find_mode(&info.var, &info, mode_option, NULL, 0, NULL, 8); | 774 | retval = fb_find_mode(info->var, info, mode_option, NULL, 0, NULL, 8); |
594 | 775 | ||
595 | if (!retval || retval == 4) | 776 | if (!retval || retval == 4) |
596 | return -EINVAL; | 777 | return -EINVAL; |
597 | 778 | ||
598 | /* This has to been done !!! */ | 779 | /* This has to been done !!! */ |
599 | fb_alloc_cmap(&info.cmap, cmap_len, 0); | 780 | fb_alloc_cmap(info->cmap, cmap_len, 0); |
600 | 781 | ||
601 | /* | 782 | /* |
602 | * The following is done in the case of having hardware with a static | 783 | * The following is done in the case of having hardware with a static |
603 | * mode. If we are setting the mode ourselves we don't call this. | 784 | * mode. If we are setting the mode ourselves we don't call this. |
604 | */ | 785 | */ |
605 | info.var = xxxfb_var; | 786 | info->var = xxxfb_var; |
606 | 787 | ||
607 | if (register_framebuffer(&info) < 0) | 788 | /* |
789 | * For drivers that can... | ||
790 | */ | ||
791 | xxxfb_check_var(&info->var, info); | ||
792 | |||
793 | /* | ||
794 | * Does a call to fb_set_par() before register_framebuffer needed? This | ||
795 | * will depend on you and the hardware. If you are sure that your driver | ||
796 | * is the only device in the system, a call to fb_set_par() is safe. | ||
797 | * | ||
798 | * Hardware in x86 systems has a VGA core. Calling set_par() at this | ||
799 | * point will corrupt the VGA console, so it might be safer to skip a | ||
800 | * call to set_par here and just allow fbcon to do it for you. | ||
801 | */ | ||
802 | /* xxxfb_set_par(info); */ | ||
803 | |||
804 | if (register_framebuffer(info) < 0) | ||
608 | return -EINVAL; | 805 | return -EINVAL; |
609 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info.node, | 806 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, |
610 | info.fix.id); | 807 | info->fix.id); |
808 | pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ | ||
611 | return 0; | 809 | return 0; |
612 | } | 810 | } |
613 | 811 | ||
614 | /* | 812 | /* |
615 | * Cleanup | 813 | * Cleanup |
616 | */ | 814 | */ |
815 | /* static void __exit xxxfb_remove(struct device *device) */ | ||
816 | static void __exit xxxfb_remove(struct pci_dev *dev) | ||
817 | { | ||
818 | struct fb_info *info = pci_get_drv_data(dev); | ||
819 | /* or dev_get_drv_data(device); */ | ||
820 | |||
821 | if (info) { | ||
822 | unregister_framebuffer(info); | ||
823 | fb_dealloc_cmap(&info.cmap); | ||
824 | /* ... */ | ||
825 | framebuffer_release(info); | ||
826 | } | ||
827 | |||
828 | return 0; | ||
829 | } | ||
617 | 830 | ||
618 | static void __exit xxxfb_cleanup(void) | 831 | #if CONFIG_PCI |
832 | /* For PCI drivers */ | ||
833 | static struct pci_driver xxxfb_driver = { | ||
834 | .name = "xxxfb", | ||
835 | .id_table = xxxfb_devices, | ||
836 | .probe = xxxfb_probe, | ||
837 | .remove = __devexit_p(xxxfb_remove), | ||
838 | .suspend = xxxfb_suspend, /* optional */ | ||
839 | .resume = xxxfb_resume, /* optional */ | ||
840 | }; | ||
841 | |||
842 | static int __init xxxfb_init(void) | ||
619 | { | 843 | { |
620 | /* | 844 | /* |
621 | * If your driver supports multiple boards, you should unregister and | 845 | * For kernel boot options (in 'video=xxxfb:<options>' format) |
622 | * clean up all instances. | 846 | */ |
623 | */ | 847 | #ifndef MODULE |
848 | char *option = NULL; | ||
624 | 849 | ||
625 | unregister_framebuffer(info); | 850 | if (fb_get_options("xxxfb", &option)) |
626 | fb_dealloc_cmap(&info.cmap); | 851 | return -ENODEV; |
627 | /* ... */ | 852 | xxxfb_setup(option); |
853 | #endif | ||
854 | |||
855 | return pci_register_driver(&xxxfb_driver); | ||
856 | } | ||
857 | |||
858 | static void __exit xxxfb_exit(void) | ||
859 | { | ||
860 | pci_unregister_driver(&xxxfb_driver); | ||
628 | } | 861 | } |
862 | #else | ||
863 | #include <linux/platform_device.h> | ||
864 | /* for platform devices */ | ||
865 | static struct device_driver xxxfb_driver = { | ||
866 | .name = "xxxfb", | ||
867 | .bus = &platform_bus_type, | ||
868 | .probe = xxxfb_probe, | ||
869 | .remove = xxxfb_remove, | ||
870 | .suspend = xxxfb_suspend, /* optional */ | ||
871 | .resume = xxxfb_resume, /* optional */ | ||
872 | }; | ||
873 | |||
874 | static struct platform_device xxxfb_device = { | ||
875 | .name = "xxxfb", | ||
876 | }; | ||
877 | |||
878 | static int __init xxxfb_init(void) | ||
879 | { | ||
880 | int ret; | ||
881 | /* | ||
882 | * For kernel boot options (in 'video=xxxfb:<options>' format) | ||
883 | */ | ||
884 | #ifndef MODULE | ||
885 | char *option = NULL; | ||
886 | |||
887 | if (fb_get_options("xxxfb", &option)) | ||
888 | return -ENODEV; | ||
889 | xxxfb_setup(option); | ||
890 | #endif | ||
891 | ret = driver_register(&xxxfb_driver); | ||
892 | |||
893 | if (!ret) { | ||
894 | ret = platform_device_register(&xxxfb_device); | ||
895 | if (ret) | ||
896 | driver_unregister(&xxxfb_driver); | ||
897 | } | ||
898 | |||
899 | return ret; | ||
900 | } | ||
901 | |||
902 | static void __exit xxxfb_exit(void) | ||
903 | { | ||
904 | platform_device_unregister(&xxxfb_device); | ||
905 | driver_unregister(&xxxfb_driver); | ||
906 | } | ||
907 | #endif | ||
908 | |||
909 | MODULE_LICENSE("GPL"); | ||
910 | module_init(xxxfb_init); | ||
911 | module_exit(xxxfb_exit); | ||
912 | |||
629 | 913 | ||
630 | /* | 914 | /* |
631 | * Setup | 915 | * Setup |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index e0f14df840d9..99921df35474 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
@@ -382,7 +382,7 @@ static void sstfb_clear_screen(struct fb_info *info) | |||
382 | static int sstfb_check_var(struct fb_var_screeninfo *var, | 382 | static int sstfb_check_var(struct fb_var_screeninfo *var, |
383 | struct fb_info *info) | 383 | struct fb_info *info) |
384 | { | 384 | { |
385 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 385 | struct sstfb_par *par = info->par; |
386 | int hSyncOff = var->xres + var->right_margin + var->left_margin; | 386 | int hSyncOff = var->xres + var->right_margin + var->left_margin; |
387 | int vSyncOff = var->yres + var->lower_margin + var->upper_margin; | 387 | int vSyncOff = var->yres + var->lower_margin + var->upper_margin; |
388 | int vBackPorch = var->left_margin, yDim = var->yres; | 388 | int vBackPorch = var->left_margin, yDim = var->yres; |
@@ -542,7 +542,7 @@ static int sstfb_check_var(struct fb_var_screeninfo *var, | |||
542 | */ | 542 | */ |
543 | static int sstfb_set_par(struct fb_info *info) | 543 | static int sstfb_set_par(struct fb_info *info) |
544 | { | 544 | { |
545 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 545 | struct sstfb_par *par = info->par; |
546 | u32 lfbmode, fbiinit1, fbiinit2, fbiinit3, fbiinit5, fbiinit6=0; | 546 | u32 lfbmode, fbiinit1, fbiinit2, fbiinit3, fbiinit5, fbiinit6=0; |
547 | struct pci_dev *sst_dev = par->dev; | 547 | struct pci_dev *sst_dev = par->dev; |
548 | unsigned int freq; | 548 | unsigned int freq; |
@@ -748,13 +748,14 @@ static int sstfb_set_par(struct fb_info *info) | |||
748 | static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 748 | static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
749 | u_int transp, struct fb_info *info) | 749 | u_int transp, struct fb_info *info) |
750 | { | 750 | { |
751 | struct sstfb_par *par = info->par; | ||
751 | u32 col; | 752 | u32 col; |
752 | 753 | ||
753 | f_dddprintk("sstfb_setcolreg\n"); | 754 | f_dddprintk("sstfb_setcolreg\n"); |
754 | f_dddprintk("%-2d rgbt: %#x, %#x, %#x, %#x\n", | 755 | f_dddprintk("%-2d rgbt: %#x, %#x, %#x, %#x\n", |
755 | regno, red, green, blue, transp); | 756 | regno, red, green, blue, transp); |
756 | if (regno >= 16) | 757 | if (regno > 15) |
757 | return -EINVAL; | 758 | return 0; |
758 | 759 | ||
759 | red >>= (16 - info->var.red.length); | 760 | red >>= (16 - info->var.red.length); |
760 | green >>= (16 - info->var.green.length); | 761 | green >>= (16 - info->var.green.length); |
@@ -765,15 +766,14 @@ static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
765 | | (blue << info->var.blue.offset) | 766 | | (blue << info->var.blue.offset) |
766 | | (transp << info->var.transp.offset); | 767 | | (transp << info->var.transp.offset); |
767 | 768 | ||
768 | ((u32 *)info->pseudo_palette)[regno] = col; | 769 | par->palette[regno] = col; |
769 | 770 | ||
770 | return 0; | 771 | return 0; |
771 | } | 772 | } |
772 | 773 | ||
773 | static int sstfb_ioctl(struct inode *inode, struct file *file, | 774 | static int sstfb_ioctl(struct fb_info *info, u_int cmd, u_long arg) |
774 | u_int cmd, u_long arg, struct fb_info *info ) | ||
775 | { | 775 | { |
776 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 776 | struct sstfb_par *par = info->par; |
777 | struct pci_dev *sst_dev = par->dev; | 777 | struct pci_dev *sst_dev = par->dev; |
778 | u32 fbiinit0, tmp, val; | 778 | u32 fbiinit0, tmp, val; |
779 | u_long p; | 779 | u_long p; |
@@ -830,7 +830,7 @@ static int sstfb_ioctl(struct inode *inode, struct file *file, | |||
830 | #if 0 | 830 | #if 0 |
831 | static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 831 | static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
832 | { | 832 | { |
833 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 833 | struct sstfb_par *par = info->par; |
834 | u32 stride = info->fix.line_length; | 834 | u32 stride = info->fix.line_length; |
835 | 835 | ||
836 | if (!IS_VOODOO2(par)) | 836 | if (!IS_VOODOO2(par)) |
@@ -855,7 +855,7 @@ static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
855 | */ | 855 | */ |
856 | static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 856 | static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
857 | { | 857 | { |
858 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 858 | struct sstfb_par *par = info->par; |
859 | u32 stride = info->fix.line_length; | 859 | u32 stride = info->fix.line_length; |
860 | 860 | ||
861 | if (!IS_VOODOO2(par)) | 861 | if (!IS_VOODOO2(par)) |
@@ -925,7 +925,7 @@ static int __devinit sst_get_memsize(struct fb_info *info, __u32 *memsize) | |||
925 | 925 | ||
926 | static int __devinit sst_detect_att(struct fb_info *info) | 926 | static int __devinit sst_detect_att(struct fb_info *info) |
927 | { | 927 | { |
928 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 928 | struct sstfb_par *par = info->par; |
929 | int i, mir, dir; | 929 | int i, mir, dir; |
930 | 930 | ||
931 | for (i=0; i<3; i++) { | 931 | for (i=0; i<3; i++) { |
@@ -950,7 +950,7 @@ static int __devinit sst_detect_att(struct fb_info *info) | |||
950 | 950 | ||
951 | static int __devinit sst_detect_ti(struct fb_info *info) | 951 | static int __devinit sst_detect_ti(struct fb_info *info) |
952 | { | 952 | { |
953 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 953 | struct sstfb_par *par = info->par; |
954 | int i, mir, dir; | 954 | int i, mir, dir; |
955 | 955 | ||
956 | for (i = 0; i<3; i++) { | 956 | for (i = 0; i<3; i++) { |
@@ -986,7 +986,7 @@ static int __devinit sst_detect_ti(struct fb_info *info) | |||
986 | */ | 986 | */ |
987 | static int __devinit sst_detect_ics(struct fb_info *info) | 987 | static int __devinit sst_detect_ics(struct fb_info *info) |
988 | { | 988 | { |
989 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 989 | struct sstfb_par *par = info->par; |
990 | int m_clk0_1, m_clk0_7, m_clk1_b; | 990 | int m_clk0_1, m_clk0_7, m_clk1_b; |
991 | int n_clk0_1, n_clk0_7, n_clk1_b; | 991 | int n_clk0_1, n_clk0_7, n_clk1_b; |
992 | int i; | 992 | int i; |
@@ -1023,7 +1023,7 @@ static int __devinit sst_detect_ics(struct fb_info *info) | |||
1023 | static int sst_set_pll_att_ti(struct fb_info *info, | 1023 | static int sst_set_pll_att_ti(struct fb_info *info, |
1024 | const struct pll_timing *t, const int clock) | 1024 | const struct pll_timing *t, const int clock) |
1025 | { | 1025 | { |
1026 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1026 | struct sstfb_par *par = info->par; |
1027 | u8 cr0, cc; | 1027 | u8 cr0, cc; |
1028 | 1028 | ||
1029 | /* enable indexed mode */ | 1029 | /* enable indexed mode */ |
@@ -1077,7 +1077,7 @@ static int sst_set_pll_att_ti(struct fb_info *info, | |||
1077 | static int sst_set_pll_ics(struct fb_info *info, | 1077 | static int sst_set_pll_ics(struct fb_info *info, |
1078 | const struct pll_timing *t, const int clock) | 1078 | const struct pll_timing *t, const int clock) |
1079 | { | 1079 | { |
1080 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1080 | struct sstfb_par *par = info->par; |
1081 | u8 pll_ctrl; | 1081 | u8 pll_ctrl; |
1082 | 1082 | ||
1083 | sst_dac_write(DACREG_ICS_PLLRMA, DACREG_ICS_PLL_CTRL); | 1083 | sst_dac_write(DACREG_ICS_PLLRMA, DACREG_ICS_PLL_CTRL); |
@@ -1114,7 +1114,7 @@ static int sst_set_pll_ics(struct fb_info *info, | |||
1114 | 1114 | ||
1115 | static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) | 1115 | static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) |
1116 | { | 1116 | { |
1117 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1117 | struct sstfb_par *par = info->par; |
1118 | u8 cr0; | 1118 | u8 cr0; |
1119 | 1119 | ||
1120 | sst_dac_write(DACREG_WMA, 0); /* backdoor */ | 1120 | sst_dac_write(DACREG_WMA, 0); /* backdoor */ |
@@ -1149,7 +1149,7 @@ static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) | |||
1149 | 1149 | ||
1150 | static void sst_set_vidmod_ics(struct fb_info *info, const int bpp) | 1150 | static void sst_set_vidmod_ics(struct fb_info *info, const int bpp) |
1151 | { | 1151 | { |
1152 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1152 | struct sstfb_par *par = info->par; |
1153 | 1153 | ||
1154 | switch(bpp) { | 1154 | switch(bpp) { |
1155 | case 16: | 1155 | case 16: |
@@ -1308,7 +1308,7 @@ static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par) | |||
1308 | 1308 | ||
1309 | static void __devexit sst_shutdown(struct fb_info *info) | 1309 | static void __devexit sst_shutdown(struct fb_info *info) |
1310 | { | 1310 | { |
1311 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1311 | struct sstfb_par *par = info->par; |
1312 | struct pci_dev *dev = par->dev; | 1312 | struct pci_dev *dev = par->dev; |
1313 | struct pll_timing gfx_timings; | 1313 | struct pll_timing gfx_timings; |
1314 | int Fout; | 1314 | int Fout; |
@@ -1394,12 +1394,6 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, | |||
1394 | struct sst_spec *spec; | 1394 | struct sst_spec *spec; |
1395 | int err; | 1395 | int err; |
1396 | 1396 | ||
1397 | struct all_info { | ||
1398 | struct fb_info info; | ||
1399 | struct sstfb_par par; | ||
1400 | u32 pseudo_palette[16]; | ||
1401 | } *all; | ||
1402 | |||
1403 | /* Enable device in PCI config. */ | 1397 | /* Enable device in PCI config. */ |
1404 | if ((err=pci_enable_device(pdev))) { | 1398 | if ((err=pci_enable_device(pdev))) { |
1405 | eprintk("cannot enable device\n"); | 1399 | eprintk("cannot enable device\n"); |
@@ -1407,14 +1401,13 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, | |||
1407 | } | 1401 | } |
1408 | 1402 | ||
1409 | /* Allocate the fb and par structures. */ | 1403 | /* Allocate the fb and par structures. */ |
1410 | all = kmalloc(sizeof(*all), GFP_KERNEL); | 1404 | info = framebuffer_alloc(sizeof(struct sstfb_par), &pdev->dev); |
1411 | if (!all) | 1405 | if (!info) |
1412 | return -ENOMEM; | 1406 | return -ENOMEM; |
1413 | memset(all, 0, sizeof(*all)); | 1407 | |
1414 | pci_set_drvdata(pdev, all); | 1408 | pci_set_drvdata(pdev, info); |
1415 | 1409 | ||
1416 | info = &all->info; | 1410 | par = info->par; |
1417 | par = info->par = &all->par; | ||
1418 | fix = &info->fix; | 1411 | fix = &info->fix; |
1419 | 1412 | ||
1420 | par->type = id->driver_data; | 1413 | par->type = id->driver_data; |
@@ -1471,7 +1464,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, | |||
1471 | 1464 | ||
1472 | info->flags = FBINFO_DEFAULT; | 1465 | info->flags = FBINFO_DEFAULT; |
1473 | info->fbops = &sstfb_ops; | 1466 | info->fbops = &sstfb_ops; |
1474 | info->pseudo_palette = &all->pseudo_palette; | 1467 | info->pseudo_palette = par->palette; |
1475 | 1468 | ||
1476 | fix->type = FB_TYPE_PACKED_PIXELS; | 1469 | fix->type = FB_TYPE_PACKED_PIXELS; |
1477 | fix->visual = FB_VISUAL_TRUECOLOR; | 1470 | fix->visual = FB_VISUAL_TRUECOLOR; |
@@ -1527,7 +1520,7 @@ fail_mmio_remap: | |||
1527 | fail_fb_mem: | 1520 | fail_fb_mem: |
1528 | release_mem_region(fix->mmio_start, info->fix.mmio_len); | 1521 | release_mem_region(fix->mmio_start, info->fix.mmio_len); |
1529 | fail_mmio_mem: | 1522 | fail_mmio_mem: |
1530 | kfree(info); | 1523 | framebuffer_release(info); |
1531 | return -ENXIO; /* no voodoo detected */ | 1524 | return -ENXIO; /* no voodoo detected */ |
1532 | } | 1525 | } |
1533 | 1526 | ||
@@ -1537,7 +1530,7 @@ static void __devexit sstfb_remove(struct pci_dev *pdev) | |||
1537 | struct fb_info *info; | 1530 | struct fb_info *info; |
1538 | 1531 | ||
1539 | info = pci_get_drvdata(pdev); | 1532 | info = pci_get_drvdata(pdev); |
1540 | par = (struct sstfb_par *) info->par; | 1533 | par = info->par; |
1541 | 1534 | ||
1542 | sst_shutdown(info); | 1535 | sst_shutdown(info); |
1543 | unregister_framebuffer(info); | 1536 | unregister_framebuffer(info); |
@@ -1545,7 +1538,7 @@ static void __devexit sstfb_remove(struct pci_dev *pdev) | |||
1545 | iounmap(par->mmio_vbase); | 1538 | iounmap(par->mmio_vbase); |
1546 | release_mem_region(info->fix.smem_start, 0x400000); | 1539 | release_mem_region(info->fix.smem_start, 0x400000); |
1547 | release_mem_region(info->fix.mmio_start, info->fix.mmio_len); | 1540 | release_mem_region(info->fix.mmio_start, info->fix.mmio_len); |
1548 | kfree(info); | 1541 | framebuffer_release(info); |
1549 | } | 1542 | } |
1550 | 1543 | ||
1551 | 1544 | ||
@@ -1613,7 +1606,7 @@ static int sstfb_dump_regs(struct fb_info *info) | |||
1613 | 1606 | ||
1614 | const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]); | 1607 | const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]); |
1615 | const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]); | 1608 | const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]); |
1616 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1609 | struct sstfb_par *par = info->par; |
1617 | struct pci_dev *dev = par->dev; | 1610 | struct pci_dev *dev = par->dev; |
1618 | u32 pci_res[pci_s]; | 1611 | u32 pci_res[pci_s]; |
1619 | u32 sst_res[sst_s]; | 1612 | u32 sst_res[sst_s]; |
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index fbb17332afd7..56d71d6e9a72 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Low level Frame buffer driver for HP workstations with | 3 | * Low level Frame buffer driver for HP workstations with |
4 | * STI (standard text interface) video firmware. | 4 | * STI (standard text interface) video firmware. |
5 | * | 5 | * |
6 | * Copyright (C) 2001-2004 Helge Deller <deller@gmx.de> | 6 | * Copyright (C) 2001-2005 Helge Deller <deller@gmx.de> |
7 | * Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 7 | * Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de> |
8 | * | 8 | * |
9 | * Based on: | 9 | * Based on: |
@@ -73,16 +73,13 @@ | |||
73 | #include "sticore.h" | 73 | #include "sticore.h" |
74 | 74 | ||
75 | /* REGION_BASE(fb_info, index) returns the virtual address for region <index> */ | 75 | /* REGION_BASE(fb_info, index) returns the virtual address for region <index> */ |
76 | #ifdef __LP64__ | 76 | #define REGION_BASE(fb_info, index) \ |
77 | #define REGION_BASE(fb_info, index) \ | 77 | F_EXTEND(fb_info->sti->glob_cfg->region_ptrs[index]) |
78 | (fb_info->sti->glob_cfg->region_ptrs[index] | 0xffffffff00000000) | ||
79 | #else | ||
80 | #define REGION_BASE(fb_info, index) \ | ||
81 | fb_info->sti->glob_cfg->region_ptrs[index] | ||
82 | #endif | ||
83 | 78 | ||
84 | #define NGLEDEVDEPROM_CRT_REGION 1 | 79 | #define NGLEDEVDEPROM_CRT_REGION 1 |
85 | 80 | ||
81 | #define NR_PALETTE 256 | ||
82 | |||
86 | typedef struct { | 83 | typedef struct { |
87 | __s32 video_config_reg; | 84 | __s32 video_config_reg; |
88 | __s32 misc_video_start; | 85 | __s32 misc_video_start; |
@@ -112,7 +109,7 @@ struct stifb_info { | |||
112 | ngle_rom_t ngle_rom; | 109 | ngle_rom_t ngle_rom; |
113 | struct sti_struct *sti; | 110 | struct sti_struct *sti; |
114 | int deviceSpecificConfig; | 111 | int deviceSpecificConfig; |
115 | u32 pseudo_palette[256]; | 112 | u32 pseudo_palette[16]; |
116 | }; | 113 | }; |
117 | 114 | ||
118 | static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; | 115 | static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; |
@@ -352,10 +349,10 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable) | |||
352 | #define IS_888_DEVICE(fb) \ | 349 | #define IS_888_DEVICE(fb) \ |
353 | (!(IS_24_DEVICE(fb))) | 350 | (!(IS_24_DEVICE(fb))) |
354 | 351 | ||
355 | #define GET_FIFO_SLOTS(fb, cnt, numslots) \ | 352 | #define GET_FIFO_SLOTS(fb, cnt, numslots) \ |
356 | { while (cnt < numslots) \ | 353 | { while (cnt < numslots) \ |
357 | cnt = READ_WORD(fb, REG_34); \ | 354 | cnt = READ_WORD(fb, REG_34); \ |
358 | cnt -= numslots; \ | 355 | cnt -= numslots; \ |
359 | } | 356 | } |
360 | 357 | ||
361 | #define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ | 358 | #define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ |
@@ -995,7 +992,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, | |||
995 | struct stifb_info *fb = (struct stifb_info *) info; | 992 | struct stifb_info *fb = (struct stifb_info *) info; |
996 | u32 color; | 993 | u32 color; |
997 | 994 | ||
998 | if (regno >= 256) /* no. of hw registers */ | 995 | if (regno >= NR_PALETTE) |
999 | return 1; | 996 | return 1; |
1000 | 997 | ||
1001 | red >>= 8; | 998 | red >>= 8; |
@@ -1005,8 +1002,8 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, | |||
1005 | DEBUG_OFF(); | 1002 | DEBUG_OFF(); |
1006 | 1003 | ||
1007 | START_IMAGE_COLORMAP_ACCESS(fb); | 1004 | START_IMAGE_COLORMAP_ACCESS(fb); |
1008 | 1005 | ||
1009 | if (fb->info.var.grayscale) { | 1006 | if (unlikely(fb->info.var.grayscale)) { |
1010 | /* gray = 0.30*R + 0.59*G + 0.11*B */ | 1007 | /* gray = 0.30*R + 0.59*G + 0.11*B */ |
1011 | color = ((red * 77) + | 1008 | color = ((red * 77) + |
1012 | (green * 151) + | 1009 | (green * 151) + |
@@ -1017,17 +1014,17 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, | |||
1017 | (blue)); | 1014 | (blue)); |
1018 | } | 1015 | } |
1019 | 1016 | ||
1020 | if (info->var.bits_per_pixel == 32) { | 1017 | if (fb->info.fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1021 | ((u32 *)(info->pseudo_palette))[regno] = | 1018 | struct fb_var_screeninfo *var = &fb->info.var; |
1022 | (red << info->var.red.offset) | | 1019 | if (regno < 16) |
1023 | (green << info->var.green.offset) | | 1020 | ((u32 *)fb->info.pseudo_palette)[regno] = |
1024 | (blue << info->var.blue.offset); | 1021 | regno << var->red.offset | |
1025 | } else { | 1022 | regno << var->green.offset | |
1026 | ((u32 *)(info->pseudo_palette))[regno] = regno; | 1023 | regno << var->blue.offset; |
1027 | } | 1024 | } |
1028 | 1025 | ||
1029 | WRITE_IMAGE_COLOR(fb, regno, color); | 1026 | WRITE_IMAGE_COLOR(fb, regno, color); |
1030 | 1027 | ||
1031 | if (fb->id == S9000_ID_HCRX) { | 1028 | if (fb->id == S9000_ID_HCRX) { |
1032 | NgleLutBltCtl lutBltCtl; | 1029 | NgleLutBltCtl lutBltCtl; |
1033 | 1030 | ||
@@ -1066,9 +1063,9 @@ stifb_blank(int blank_mode, struct fb_info *info) | |||
1066 | case S9000_ID_HCRX: | 1063 | case S9000_ID_HCRX: |
1067 | HYPER_ENABLE_DISABLE_DISPLAY(fb, enable); | 1064 | HYPER_ENABLE_DISABLE_DISPLAY(fb, enable); |
1068 | break; | 1065 | break; |
1069 | case S9000_ID_A1659A:; /* fall through */ | 1066 | case S9000_ID_A1659A: /* fall through */ |
1070 | case S9000_ID_TIMBER:; | 1067 | case S9000_ID_TIMBER: |
1071 | case CRX24_OVERLAY_PLANES:; | 1068 | case CRX24_OVERLAY_PLANES: |
1072 | default: | 1069 | default: |
1073 | ENABLE_DISABLE_DISPLAY(fb, enable); | 1070 | ENABLE_DISABLE_DISPLAY(fb, enable); |
1074 | break; | 1071 | break; |
@@ -1250,12 +1247,10 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1250 | memset(&fb->ngle_rom, 0, sizeof(fb->ngle_rom)); | 1247 | memset(&fb->ngle_rom, 0, sizeof(fb->ngle_rom)); |
1251 | if ((fb->sti->regions_phys[0] & 0xfc000000) == | 1248 | if ((fb->sti->regions_phys[0] & 0xfc000000) == |
1252 | (fb->sti->regions_phys[2] & 0xfc000000)) | 1249 | (fb->sti->regions_phys[2] & 0xfc000000)) |
1253 | sti_rom_address = fb->sti->regions_phys[0]; | 1250 | sti_rom_address = F_EXTEND(fb->sti->regions_phys[0]); |
1254 | else | 1251 | else |
1255 | sti_rom_address = fb->sti->regions_phys[1]; | 1252 | sti_rom_address = F_EXTEND(fb->sti->regions_phys[1]); |
1256 | #ifdef __LP64__ | 1253 | |
1257 | sti_rom_address |= 0xffffffff00000000; | ||
1258 | #endif | ||
1259 | fb->deviceSpecificConfig = gsc_readl(sti_rom_address); | 1254 | fb->deviceSpecificConfig = gsc_readl(sti_rom_address); |
1260 | if (IS_24_DEVICE(fb)) { | 1255 | if (IS_24_DEVICE(fb)) { |
1261 | if (bpp_pref == 8 || bpp_pref == 32) | 1256 | if (bpp_pref == 8 || bpp_pref == 32) |
@@ -1315,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1315 | break; | 1310 | break; |
1316 | case 32: | 1311 | case 32: |
1317 | fix->type = FB_TYPE_PACKED_PIXELS; | 1312 | fix->type = FB_TYPE_PACKED_PIXELS; |
1318 | fix->visual = FB_VISUAL_TRUECOLOR; | 1313 | fix->visual = FB_VISUAL_DIRECTCOLOR; |
1319 | var->red.length = var->green.length = var->blue.length = var->transp.length = 8; | 1314 | var->red.length = var->green.length = var->blue.length = var->transp.length = 8; |
1320 | var->blue.offset = 0; | 1315 | var->blue.offset = 0; |
1321 | var->green.offset = 8; | 1316 | var->green.offset = 8; |
@@ -1337,7 +1332,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1337 | info->pseudo_palette = &fb->pseudo_palette; | 1332 | info->pseudo_palette = &fb->pseudo_palette; |
1338 | 1333 | ||
1339 | /* This has to been done !!! */ | 1334 | /* This has to been done !!! */ |
1340 | fb_alloc_cmap(&info->cmap, 256, 0); | 1335 | fb_alloc_cmap(&info->cmap, NR_PALETTE, 0); |
1341 | stifb_init_display(fb); | 1336 | stifb_init_display(fb); |
1342 | 1337 | ||
1343 | if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { | 1338 | if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { |
@@ -1488,7 +1483,3 @@ module_exit(stifb_cleanup); | |||
1488 | MODULE_AUTHOR("Helge Deller <deller@gmx.de>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); | 1483 | MODULE_AUTHOR("Helge Deller <deller@gmx.de>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); |
1489 | MODULE_DESCRIPTION("Framebuffer driver for HP's NGLE series graphics cards in HP PARISC machines"); | 1484 | MODULE_DESCRIPTION("Framebuffer driver for HP's NGLE series graphics cards in HP PARISC machines"); |
1490 | MODULE_LICENSE("GPL v2"); | 1485 | MODULE_LICENSE("GPL v2"); |
1491 | |||
1492 | MODULE_PARM(bpp, "i"); | ||
1493 | MODULE_PARM_DESC(mem, "Bits per pixel (default: 8)"); | ||
1494 | |||
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 2b27b4474001..95b918229d9b 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c | |||
@@ -33,9 +33,8 @@ static int tcx_setcolreg(unsigned, unsigned, unsigned, unsigned, | |||
33 | unsigned, struct fb_info *); | 33 | unsigned, struct fb_info *); |
34 | static int tcx_blank(int, struct fb_info *); | 34 | static int tcx_blank(int, struct fb_info *); |
35 | 35 | ||
36 | static int tcx_mmap(struct fb_info *, struct file *, struct vm_area_struct *); | 36 | static int tcx_mmap(struct fb_info *, struct vm_area_struct *); |
37 | static int tcx_ioctl(struct inode *, struct file *, unsigned int, | 37 | static int tcx_ioctl(struct fb_info *, unsigned int, unsigned long); |
38 | unsigned long, struct fb_info *); | ||
39 | static int tcx_pan_display(struct fb_var_screeninfo *, struct fb_info *); | 38 | static int tcx_pan_display(struct fb_var_screeninfo *, struct fb_info *); |
40 | 39 | ||
41 | /* | 40 | /* |
@@ -302,7 +301,7 @@ static struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = { | |||
302 | { .size = 0 } | 301 | { .size = 0 } |
303 | }; | 302 | }; |
304 | 303 | ||
305 | static int tcx_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma) | 304 | static int tcx_mmap(struct fb_info *info, struct vm_area_struct *vma) |
306 | { | 305 | { |
307 | struct tcx_par *par = (struct tcx_par *)info->par; | 306 | struct tcx_par *par = (struct tcx_par *)info->par; |
308 | 307 | ||
@@ -312,8 +311,8 @@ static int tcx_mmap(struct fb_info *info, struct file *file, struct vm_area_stru | |||
312 | vma); | 311 | vma); |
313 | } | 312 | } |
314 | 313 | ||
315 | static int tcx_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 314 | static int tcx_ioctl(struct fb_info *info, unsigned int cmd, |
316 | unsigned long arg, struct fb_info *info) | 315 | unsigned long arg) |
317 | { | 316 | { |
318 | struct tcx_par *par = (struct tcx_par *) info->par; | 317 | struct tcx_par *par = (struct tcx_par *) info->par; |
319 | 318 | ||
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 9d53387e6a66..3e7baf4c9fa8 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
@@ -291,7 +291,7 @@ static inline void banshee_make_room(struct tdfx_par *par, int size) | |||
291 | 291 | ||
292 | static int banshee_wait_idle(struct fb_info *info) | 292 | static int banshee_wait_idle(struct fb_info *info) |
293 | { | 293 | { |
294 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 294 | struct tdfx_par *par = info->par; |
295 | int i = 0; | 295 | int i = 0; |
296 | 296 | ||
297 | banshee_make_room(par, 1); | 297 | banshee_make_room(par, 1); |
@@ -364,7 +364,7 @@ static u32 do_calc_pll(int freq, int* freq_out) | |||
364 | 364 | ||
365 | static void do_write_regs(struct fb_info *info, struct banshee_reg* reg) | 365 | static void do_write_regs(struct fb_info *info, struct banshee_reg* reg) |
366 | { | 366 | { |
367 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 367 | struct tdfx_par *par = info->par; |
368 | int i; | 368 | int i; |
369 | 369 | ||
370 | banshee_wait_idle(info); | 370 | banshee_wait_idle(info); |
@@ -469,7 +469,7 @@ static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) | |||
469 | 469 | ||
470 | static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info) | 470 | static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info) |
471 | { | 471 | { |
472 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 472 | struct tdfx_par *par = info->par; |
473 | u32 lpitch; | 473 | u32 lpitch; |
474 | 474 | ||
475 | if (var->bits_per_pixel != 8 && var->bits_per_pixel != 16 && | 475 | if (var->bits_per_pixel != 8 && var->bits_per_pixel != 16 && |
@@ -558,7 +558,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info) | |||
558 | 558 | ||
559 | static int tdfxfb_set_par(struct fb_info *info) | 559 | static int tdfxfb_set_par(struct fb_info *info) |
560 | { | 560 | { |
561 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 561 | struct tdfx_par *par = info->par; |
562 | u32 hdispend, hsyncsta, hsyncend, htotal; | 562 | u32 hdispend, hsyncsta, hsyncend, htotal; |
563 | u32 hd, hs, he, ht, hbs, hbe; | 563 | u32 hd, hs, he, ht, hbs, hbe; |
564 | u32 vd, vs, ve, vt, vbs, vbe; | 564 | u32 vd, vs, ve, vt, vbs, vbe; |
@@ -780,7 +780,7 @@ static int tdfxfb_set_par(struct fb_info *info) | |||
780 | static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | 780 | static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, |
781 | unsigned blue,unsigned transp,struct fb_info *info) | 781 | unsigned blue,unsigned transp,struct fb_info *info) |
782 | { | 782 | { |
783 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 783 | struct tdfx_par *par = info->par; |
784 | u32 rgbcol; | 784 | u32 rgbcol; |
785 | 785 | ||
786 | if (regno >= info->cmap.len || regno > 255) return 1; | 786 | if (regno >= info->cmap.len || regno > 255) return 1; |
@@ -794,11 +794,15 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
794 | break; | 794 | break; |
795 | /* Truecolor has no hardware color palettes. */ | 795 | /* Truecolor has no hardware color palettes. */ |
796 | case FB_VISUAL_TRUECOLOR: | 796 | case FB_VISUAL_TRUECOLOR: |
797 | rgbcol = (CNVT_TOHW( red, info->var.red.length) << info->var.red.offset) | | 797 | rgbcol = (CNVT_TOHW( red, info->var.red.length) << |
798 | (CNVT_TOHW( green, info->var.green.length) << info->var.green.offset) | | 798 | info->var.red.offset) | |
799 | (CNVT_TOHW( blue, info->var.blue.length) << info->var.blue.offset) | | 799 | (CNVT_TOHW( green, info->var.green.length) << |
800 | (CNVT_TOHW( transp, info->var.transp.length) << info->var.transp.offset); | 800 | info->var.green.offset) | |
801 | ((u32*)(info->pseudo_palette))[regno] = rgbcol; | 801 | (CNVT_TOHW( blue, info->var.blue.length) << |
802 | info->var.blue.offset) | | ||
803 | (CNVT_TOHW( transp, info->var.transp.length) << | ||
804 | info->var.transp.offset); | ||
805 | par->palette[regno] = rgbcol; | ||
802 | break; | 806 | break; |
803 | default: | 807 | default: |
804 | DPRINTK("bad depth %u\n", info->var.bits_per_pixel); | 808 | DPRINTK("bad depth %u\n", info->var.bits_per_pixel); |
@@ -810,7 +814,7 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
810 | /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ | 814 | /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ |
811 | static int tdfxfb_blank(int blank, struct fb_info *info) | 815 | static int tdfxfb_blank(int blank, struct fb_info *info) |
812 | { | 816 | { |
813 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 817 | struct tdfx_par *par = info->par; |
814 | u32 dacmode, state = 0, vgablank = 0; | 818 | u32 dacmode, state = 0, vgablank = 0; |
815 | 819 | ||
816 | dacmode = tdfx_inl(par, DACMODE); | 820 | dacmode = tdfx_inl(par, DACMODE); |
@@ -855,7 +859,7 @@ static int tdfxfb_blank(int blank, struct fb_info *info) | |||
855 | static int tdfxfb_pan_display(struct fb_var_screeninfo *var, | 859 | static int tdfxfb_pan_display(struct fb_var_screeninfo *var, |
856 | struct fb_info *info) | 860 | struct fb_info *info) |
857 | { | 861 | { |
858 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 862 | struct tdfx_par *par = info->par; |
859 | u32 addr; | 863 | u32 addr; |
860 | 864 | ||
861 | if (nopan || var->xoffset || (var->yoffset > var->yres_virtual)) | 865 | if (nopan || var->xoffset || (var->yoffset > var->yres_virtual)) |
@@ -878,7 +882,7 @@ static int tdfxfb_pan_display(struct fb_var_screeninfo *var, | |||
878 | */ | 882 | */ |
879 | static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 883 | static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
880 | { | 884 | { |
881 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 885 | struct tdfx_par *par = info->par; |
882 | u32 bpp = info->var.bits_per_pixel; | 886 | u32 bpp = info->var.bits_per_pixel; |
883 | u32 stride = info->fix.line_length; | 887 | u32 stride = info->fix.line_length; |
884 | u32 fmt= stride | ((bpp+((bpp==8) ? 0 : 8)) << 13); | 888 | u32 fmt= stride | ((bpp+((bpp==8) ? 0 : 8)) << 13); |
@@ -894,7 +898,7 @@ static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect | |||
894 | if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { | 898 | if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { |
895 | tdfx_outl(par, COLORFORE, rect->color); | 899 | tdfx_outl(par, COLORFORE, rect->color); |
896 | } else { /* FB_VISUAL_TRUECOLOR */ | 900 | } else { /* FB_VISUAL_TRUECOLOR */ |
897 | tdfx_outl(par, COLORFORE, ((u32*)(info->pseudo_palette))[rect->color]); | 901 | tdfx_outl(par, COLORFORE, par->palette[rect->color]); |
898 | } | 902 | } |
899 | tdfx_outl(par, COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); | 903 | tdfx_outl(par, COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); |
900 | tdfx_outl(par, DSTSIZE, rect->width | (rect->height << 16)); | 904 | tdfx_outl(par, DSTSIZE, rect->width | (rect->height << 16)); |
@@ -906,7 +910,7 @@ static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect | |||
906 | */ | 910 | */ |
907 | static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 911 | static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
908 | { | 912 | { |
909 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 913 | struct tdfx_par *par = info->par; |
910 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; | 914 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; |
911 | u32 bpp = info->var.bits_per_pixel; | 915 | u32 bpp = info->var.bits_per_pixel; |
912 | u32 stride = info->fix.line_length; | 916 | u32 stride = info->fix.line_length; |
@@ -938,7 +942,7 @@ static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area | |||
938 | 942 | ||
939 | static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) | 943 | static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) |
940 | { | 944 | { |
941 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 945 | struct tdfx_par *par = info->par; |
942 | int size = image->height * ((image->width * image->depth + 7)>>3); | 946 | int size = image->height * ((image->width * image->depth + 7)>>3); |
943 | int fifo_free; | 947 | int fifo_free; |
944 | int i, stride = info->fix.line_length; | 948 | int i, stride = info->fix.line_length; |
@@ -961,8 +965,10 @@ static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
961 | break; | 965 | break; |
962 | case FB_VISUAL_TRUECOLOR: | 966 | case FB_VISUAL_TRUECOLOR: |
963 | default: | 967 | default: |
964 | tdfx_outl(par, COLORFORE, ((u32*)(info->pseudo_palette))[image->fg_color]); | 968 | tdfx_outl(par, COLORFORE, |
965 | tdfx_outl(par, COLORBACK, ((u32*)(info->pseudo_palette))[image->bg_color]); | 969 | par->palette[image->fg_color]); |
970 | tdfx_outl(par, COLORBACK, | ||
971 | par->palette[image->bg_color]); | ||
966 | } | 972 | } |
967 | #ifdef __BIG_ENDIAN | 973 | #ifdef __BIG_ENDIAN |
968 | srcfmt = 0x400000 | BIT(20); | 974 | srcfmt = 0x400000 | BIT(20); |
@@ -1007,7 +1013,7 @@ static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
1007 | #ifdef TDFX_HARDWARE_CURSOR | 1013 | #ifdef TDFX_HARDWARE_CURSOR |
1008 | static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1014 | static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1009 | { | 1015 | { |
1010 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 1016 | struct tdfx_par *par = info->par; |
1011 | unsigned long flags; | 1017 | unsigned long flags; |
1012 | 1018 | ||
1013 | /* | 1019 | /* |
@@ -1157,18 +1163,17 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, | |||
1157 | { | 1163 | { |
1158 | struct tdfx_par *default_par; | 1164 | struct tdfx_par *default_par; |
1159 | struct fb_info *info; | 1165 | struct fb_info *info; |
1160 | int size, err, lpitch; | 1166 | int err, lpitch; |
1161 | 1167 | ||
1162 | if ((err = pci_enable_device(pdev))) { | 1168 | if ((err = pci_enable_device(pdev))) { |
1163 | printk(KERN_WARNING "tdfxfb: Can't enable pdev: %d\n", err); | 1169 | printk(KERN_WARNING "tdfxfb: Can't enable pdev: %d\n", err); |
1164 | return err; | 1170 | return err; |
1165 | } | 1171 | } |
1166 | 1172 | ||
1167 | size = sizeof(struct tdfx_par)+256*sizeof(u32); | 1173 | info = framebuffer_alloc(sizeof(struct tdfx_par), &pdev->dev); |
1168 | 1174 | ||
1169 | info = framebuffer_alloc(size, &pdev->dev); | 1175 | if (!info) |
1170 | 1176 | return -ENOMEM; | |
1171 | if (!info) return -ENOMEM; | ||
1172 | 1177 | ||
1173 | default_par = info->par; | 1178 | default_par = info->par; |
1174 | 1179 | ||
@@ -1248,7 +1253,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, | |||
1248 | 1253 | ||
1249 | info->fbops = &tdfxfb_ops; | 1254 | info->fbops = &tdfxfb_ops; |
1250 | info->fix = tdfx_fix; | 1255 | info->fix = tdfx_fix; |
1251 | info->pseudo_palette = (void *)(default_par + 1); | 1256 | info->pseudo_palette = default_par->palette; |
1252 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 1257 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
1253 | #ifdef CONFIG_FB_3DFX_ACCEL | 1258 | #ifdef CONFIG_FB_3DFX_ACCEL |
1254 | info->flags |= FBINFO_HWACCEL_FILLRECT | | 1259 | info->flags |= FBINFO_HWACCEL_FILLRECT | |
@@ -1307,7 +1312,7 @@ out_err: | |||
1307 | } | 1312 | } |
1308 | 1313 | ||
1309 | #ifndef MODULE | 1314 | #ifndef MODULE |
1310 | void tdfxfb_setup(char *options) | 1315 | static void tdfxfb_setup(char *options) |
1311 | { | 1316 | { |
1312 | char* this_opt; | 1317 | char* this_opt; |
1313 | 1318 | ||
@@ -1340,7 +1345,7 @@ void tdfxfb_setup(char *options) | |||
1340 | static void __devexit tdfxfb_remove(struct pci_dev *pdev) | 1345 | static void __devexit tdfxfb_remove(struct pci_dev *pdev) |
1341 | { | 1346 | { |
1342 | struct fb_info *info = pci_get_drvdata(pdev); | 1347 | struct fb_info *info = pci_get_drvdata(pdev); |
1343 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 1348 | struct tdfx_par *par = info->par; |
1344 | 1349 | ||
1345 | unregister_framebuffer(info); | 1350 | unregister_framebuffer(info); |
1346 | iounmap(par->regbase_virt); | 1351 | iounmap(par->regbase_virt); |
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index ce97ec8eae97..2bdeb4baa952 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c | |||
@@ -342,19 +342,19 @@ int __init valkyriefb_init(void) | |||
342 | #else /* ppc (!CONFIG_MAC) */ | 342 | #else /* ppc (!CONFIG_MAC) */ |
343 | { | 343 | { |
344 | struct device_node *dp; | 344 | struct device_node *dp; |
345 | struct resource r; | ||
345 | 346 | ||
346 | dp = find_devices("valkyrie"); | 347 | dp = of_find_node_by_name(NULL, "valkyrie"); |
347 | if (dp == 0) | 348 | if (dp == 0) |
348 | return 0; | 349 | return 0; |
349 | 350 | ||
350 | if (dp->n_addrs != 1) { | 351 | if (of_address_to_resource(dp, 0, &r)) { |
351 | printk(KERN_ERR "expecting 1 address for valkyrie (got %d)\n", | 352 | printk(KERN_ERR "can't find address for valkyrie\n"); |
352 | dp->n_addrs); | ||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | frame_buffer_phys = dp->addrs[0].address; | 356 | frame_buffer_phys = r.start; |
357 | cmap_regs_phys = dp->addrs[0].address+0x304000; | 357 | cmap_regs_phys = r.start + 0x304000; |
358 | flags = _PAGE_WRITETHRU; | 358 | flags = _PAGE_WRITETHRU; |
359 | } | 359 | } |
360 | #endif /* ppc (!CONFIG_MAC) */ | 360 | #endif /* ppc (!CONFIG_MAC) */ |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 3e58ddc2bc38..8982e540214c 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -57,7 +57,6 @@ static unsigned short *pmi_base = NULL; | |||
57 | static void (*pmi_start)(void); | 57 | static void (*pmi_start)(void); |
58 | static void (*pmi_pal)(void); | 58 | static void (*pmi_pal)(void); |
59 | static int depth; | 59 | static int depth; |
60 | static int vga_compat; | ||
61 | 60 | ||
62 | /* --------------------------------------------------------------------- */ | 61 | /* --------------------------------------------------------------------- */ |
63 | 62 | ||
@@ -67,15 +66,6 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var, | |||
67 | #ifdef __i386__ | 66 | #ifdef __i386__ |
68 | int offset; | 67 | int offset; |
69 | 68 | ||
70 | if (!ypan) | ||
71 | return -EINVAL; | ||
72 | if (var->xoffset) | ||
73 | return -EINVAL; | ||
74 | if (var->yoffset > var->yres_virtual) | ||
75 | return -EINVAL; | ||
76 | if ((ypan==1) && var->yoffset+var->yres > var->yres_virtual) | ||
77 | return -EINVAL; | ||
78 | |||
79 | offset = (var->yoffset * info->fix.line_length + var->xoffset) / 4; | 69 | offset = (var->yoffset * info->fix.line_length + var->xoffset) / 4; |
80 | 70 | ||
81 | __asm__ __volatile__( | 71 | __asm__ __volatile__( |
@@ -90,37 +80,6 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var, | |||
90 | return 0; | 80 | return 0; |
91 | } | 81 | } |
92 | 82 | ||
93 | static int vesafb_blank(int blank, struct fb_info *info) | ||
94 | { | ||
95 | int err = 1; | ||
96 | |||
97 | if (vga_compat) { | ||
98 | int loop = 10000; | ||
99 | u8 seq = 0, crtc17 = 0; | ||
100 | |||
101 | if (blank == FB_BLANK_POWERDOWN) { | ||
102 | seq = 0x20; | ||
103 | crtc17 = 0x00; | ||
104 | err = 0; | ||
105 | } else { | ||
106 | seq = 0x00; | ||
107 | crtc17 = 0x80; | ||
108 | err = (blank == FB_BLANK_UNBLANK) ? 0 : -EINVAL; | ||
109 | } | ||
110 | |||
111 | vga_wseq(NULL, 0x00, 0x01); | ||
112 | seq |= vga_rseq(NULL, 0x01) & ~0x20; | ||
113 | vga_wseq(NULL, 0x00, seq); | ||
114 | |||
115 | crtc17 |= vga_rcrt(NULL, 0x17) & ~0x80; | ||
116 | while (loop--); | ||
117 | vga_wcrt(NULL, 0x17, crtc17); | ||
118 | vga_wseq(NULL, 0x00, 0x03); | ||
119 | } | ||
120 | |||
121 | return err; | ||
122 | } | ||
123 | |||
124 | static void vesa_setpalette(int regno, unsigned red, unsigned green, | 83 | static void vesa_setpalette(int regno, unsigned red, unsigned green, |
125 | unsigned blue) | 84 | unsigned blue) |
126 | { | 85 | { |
@@ -205,7 +164,6 @@ static struct fb_ops vesafb_ops = { | |||
205 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
206 | .fb_setcolreg = vesafb_setcolreg, | 165 | .fb_setcolreg = vesafb_setcolreg, |
207 | .fb_pan_display = vesafb_pan_display, | 166 | .fb_pan_display = vesafb_pan_display, |
208 | .fb_blank = vesafb_blank, | ||
209 | .fb_fillrect = cfb_fillrect, | 167 | .fb_fillrect = cfb_fillrect, |
210 | .fb_copyarea = cfb_copyarea, | 168 | .fb_copyarea = cfb_copyarea, |
211 | .fb_imageblit = cfb_imageblit, | 169 | .fb_imageblit = cfb_imageblit, |
@@ -459,9 +417,8 @@ static int __init vesafb_probe(struct platform_device *dev) | |||
459 | info->flags = FBINFO_FLAG_DEFAULT | | 417 | info->flags = FBINFO_FLAG_DEFAULT | |
460 | (ypan) ? FBINFO_HWACCEL_YPAN : 0; | 418 | (ypan) ? FBINFO_HWACCEL_YPAN : 0; |
461 | 419 | ||
462 | vga_compat = (screen_info.capabilities & 2) ? 0 : 1; | 420 | if (!ypan) |
463 | printk("vesafb: Mode is %sVGA compatible\n", | 421 | info->fbops->fb_pan_display = NULL; |
464 | (vga_compat) ? "" : "not "); | ||
465 | 422 | ||
466 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 423 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
467 | err = -ENOMEM; | 424 | err = -ENOMEM; |
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index ffa1ad474226..53208cb58396 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
@@ -81,7 +81,7 @@ static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
81 | u_int transp, struct fb_info *info); | 81 | u_int transp, struct fb_info *info); |
82 | static int vfb_pan_display(struct fb_var_screeninfo *var, | 82 | static int vfb_pan_display(struct fb_var_screeninfo *var, |
83 | struct fb_info *info); | 83 | struct fb_info *info); |
84 | static int vfb_mmap(struct fb_info *info, struct file *file, | 84 | static int vfb_mmap(struct fb_info *info, |
85 | struct vm_area_struct *vma); | 85 | struct vm_area_struct *vma); |
86 | 86 | ||
87 | static struct fb_ops vfb_ops = { | 87 | static struct fb_ops vfb_ops = { |
@@ -368,7 +368,7 @@ static int vfb_pan_display(struct fb_var_screeninfo *var, | |||
368 | * Most drivers don't need their own mmap function | 368 | * Most drivers don't need their own mmap function |
369 | */ | 369 | */ |
370 | 370 | ||
371 | static int vfb_mmap(struct fb_info *info, struct file *file, | 371 | static int vfb_mmap(struct fb_info *info, |
372 | struct vm_area_struct *vma) | 372 | struct vm_area_struct *vma) |
373 | { | 373 | { |
374 | return -EINVAL; | 374 | return -EINVAL; |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 226ae8a88482..f3f16fd9f231 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -705,15 +705,7 @@ static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
705 | static int vga16fb_pan_display(struct fb_var_screeninfo *var, | 705 | static int vga16fb_pan_display(struct fb_var_screeninfo *var, |
706 | struct fb_info *info) | 706 | struct fb_info *info) |
707 | { | 707 | { |
708 | if (var->xoffset + info->var.xres > info->var.xres_virtual || | ||
709 | var->yoffset + info->var.yres > info->var.yres_virtual) | ||
710 | return -EINVAL; | ||
711 | |||
712 | vga16fb_pan_var(info, var); | 708 | vga16fb_pan_var(info, var); |
713 | |||
714 | info->var.xoffset = var->xoffset; | ||
715 | info->var.yoffset = var->yoffset; | ||
716 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
717 | return 0; | 709 | return 0; |
718 | } | 710 | } |
719 | 711 | ||
diff --git a/drivers/video/vgastate.c b/drivers/video/vgastate.c index d9e01daee630..15179ec62339 100644 --- a/drivers/video/vgastate.c +++ b/drivers/video/vgastate.c | |||
@@ -356,10 +356,11 @@ int save_vga(struct vgastate *state) | |||
356 | { | 356 | { |
357 | struct regstate *saved; | 357 | struct regstate *saved; |
358 | 358 | ||
359 | saved = kmalloc(sizeof(struct regstate), GFP_KERNEL); | 359 | saved = kzalloc(sizeof(struct regstate), GFP_KERNEL); |
360 | |||
360 | if (saved == NULL) | 361 | if (saved == NULL) |
361 | return 1; | 362 | return 1; |
362 | memset (saved, 0, sizeof(struct regstate)); | 363 | |
363 | state->vidstate = (void *)saved; | 364 | state->vidstate = (void *)saved; |
364 | 365 | ||
365 | if (state->flags & VGA_SAVE_CMAP) { | 366 | if (state->flags & VGA_SAVE_CMAP) { |