aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/pm2fb.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-10-16 04:28:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:14 -0400
commitd5383fcc4c221227b954e028821a697ca7859e0e (patch)
tree36f9bbfb5fd12dd016bfd5f3b17847ef7a6a3aa4 /drivers/video/pm2fb.c
parent0ddf78491ddad301ddcd151de8108146e20398e7 (diff)
pm3fb: mtrr support and noaccel option
This patch adds usage of MTRR registers and two new options: noaccel and nomtrr. [bunk@kernel.org: make pm3fb_init() static again] Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/pm2fb.c')
-rw-r--r--drivers/video/pm2fb.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 10c0cc6e93fc..af615d99d438 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -38,6 +38,9 @@
38#include <linux/fb.h> 38#include <linux/fb.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/pci.h> 40#include <linux/pci.h>
41#ifdef CONFIG_MTRR
42#include <asm/mtrr.h>
43#endif
41 44
42#include <video/permedia2.h> 45#include <video/permedia2.h>
43#include <video/cvisionppc.h> 46#include <video/cvisionppc.h>
@@ -73,6 +76,11 @@ static char *mode __devinitdata = NULL;
73 */ 76 */
74static int lowhsync; 77static int lowhsync;
75static int lowvsync; 78static int lowvsync;
79static int noaccel __devinitdata;
80/* mtrr option */
81#ifdef CONFIG_MTRR
82static int nomtrr __devinitdata;
83#endif
76 84
77/* 85/*
78 * The hardware state of the graphics card that isn't part of the 86 * The hardware state of the graphics card that isn't part of the
@@ -88,6 +96,7 @@ struct pm2fb_par
88 u32 mem_control; /* MemControl reg at probe */ 96 u32 mem_control; /* MemControl reg at probe */
89 u32 boot_address; /* BootAddress reg at probe */ 97 u32 boot_address; /* BootAddress reg at probe */
90 u32 palette[16]; 98 u32 palette[16];
99 int mtrr_handle;
91}; 100};
92 101
93/* 102/*
@@ -1316,6 +1325,15 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1316 goto err_exit_mmio; 1325 goto err_exit_mmio;
1317 } 1326 }
1318 1327
1328#ifdef CONFIG_MTRR
1329 default_par->mtrr_handle = -1;
1330 if (!nomtrr)
1331 default_par->mtrr_handle =
1332 mtrr_add(pm2fb_fix.smem_start,
1333 pm2fb_fix.smem_len,
1334 MTRR_TYPE_WRCOMB, 1);
1335#endif
1336
1319 info->fbops = &pm2fb_ops; 1337 info->fbops = &pm2fb_ops;
1320 info->fix = pm2fb_fix; 1338 info->fix = pm2fb_fix;
1321 info->pseudo_palette = default_par->palette; 1339 info->pseudo_palette = default_par->palette;
@@ -1324,6 +1342,11 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1324 FBINFO_HWACCEL_COPYAREA | 1342 FBINFO_HWACCEL_COPYAREA |
1325 FBINFO_HWACCEL_FILLRECT; 1343 FBINFO_HWACCEL_FILLRECT;
1326 1344
1345 if (noaccel) {
1346 printk(KERN_DEBUG "disabling acceleration\n");
1347 info->flags |= FBINFO_HWACCEL_DISABLED;
1348 }
1349
1327 if (!mode) 1350 if (!mode)
1328 mode = "640x480@60"; 1351 mode = "640x480@60";
1329 1352
@@ -1375,6 +1398,11 @@ static void __devexit pm2fb_remove(struct pci_dev *pdev)
1375 1398
1376 unregister_framebuffer(info); 1399 unregister_framebuffer(info);
1377 1400
1401#ifdef CONFIG_MTRR
1402 if (par->mtrr_handle >= 0)
1403 mtrr_del(par->mtrr_handle, info->fix.smem_start,
1404 info->fix.smem_len);
1405#endif /* CONFIG_MTRR */
1378 iounmap(info->screen_base); 1406 iounmap(info->screen_base);
1379 release_mem_region(fix->smem_start, fix->smem_len); 1407 release_mem_region(fix->smem_start, fix->smem_len);
1380 iounmap(par->v_regs); 1408 iounmap(par->v_regs);
@@ -1430,6 +1458,12 @@ static int __init pm2fb_setup(char *options)
1430 lowhsync = 1; 1458 lowhsync = 1;
1431 } else if(!strcmp(this_opt, "lowvsync")) { 1459 } else if(!strcmp(this_opt, "lowvsync")) {
1432 lowvsync = 1; 1460 lowvsync = 1;
1461#ifdef CONFIG_MTRR
1462 } else if (!strncmp(this_opt, "nomtrr", 6)) {
1463 nomtrr = 1;
1464#endif
1465 } else if (!strncmp(this_opt, "noaccel", 7)) {
1466 noaccel = 1;
1433 } else { 1467 } else {
1434 mode = this_opt; 1468 mode = this_opt;
1435 } 1469 }
@@ -1474,6 +1508,12 @@ module_param(lowhsync, bool, 0);
1474MODULE_PARM_DESC(lowhsync, "Force horizontal sync low regardless of mode"); 1508MODULE_PARM_DESC(lowhsync, "Force horizontal sync low regardless of mode");
1475module_param(lowvsync, bool, 0); 1509module_param(lowvsync, bool, 0);
1476MODULE_PARM_DESC(lowvsync, "Force vertical sync low regardless of mode"); 1510MODULE_PARM_DESC(lowvsync, "Force vertical sync low regardless of mode");
1511module_param(noaccel, bool, 0);
1512MODULE_PARM_DESC(noaccel, "Disable acceleration");
1513#ifdef CONFIG_MTRR
1514module_param(nomtrr, bool, 0);
1515MODULE_PARM_DESC(nomtrr, "Disable MTRR support (0 or 1=disabled) (default=0)");
1516#endif
1477 1517
1478MODULE_AUTHOR("Jim Hague <jim.hague@acm.org>"); 1518MODULE_AUTHOR("Jim Hague <jim.hague@acm.org>");
1479MODULE_DESCRIPTION("Permedia2 framebuffer device driver"); 1519MODULE_DESCRIPTION("Permedia2 framebuffer device driver");