aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 14:14:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 14:14:52 -0400
commit59534f7298c5e28aaa64e6ed550e247f64ee72ae (patch)
treeb9fef7756abf897d9e1b10950cdf10bf6dfe5cb7 /drivers/video
parentac3ee84c604502240122c47b52f0542ec8774f15 (diff)
parentb486787ee4797d6e42a9bd3a6f079385ad0f4472 (diff)
Merge branch 'drm-for-2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-for-2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (207 commits) drm/radeon/kms/pm/r600: select the mid clock mode for single head low profile drm/radeon: fix power supply kconfig interaction. drm/radeon/kms: record object that have been list reserved drm/radeon: AGP memory is only I/O if the aperture can be mapped by the CPU. drm/radeon/kms: don't default display priority to high on rs4xx drm/edid: fix typo in 1600x1200@75 mode drm/nouveau: fix i2c-related init table handlers drm/nouveau: support init table i2c device identifier 0x81 drm/nouveau: ensure we've parsed i2c table entry for INIT_*I2C* handlers drm/nouveau: display error message for any failed init table opcode drm/nouveau: fix init table handlers to return proper error codes drm/nv50: support fractional feedback divider on newer chips drm/nv50: fix monitor detection on certain chipsets drm/nv50: store full dcb i2c entry from vbios drm/nv50: fix suspend/resume with DP outputs drm/nv50: output calculated crtc pll when debugging on drm/nouveau: dump pll limits entries when debugging is on drm/nouveau: bios parser fixes for eDP boards drm/nouveau: fix a nouveau_bo dereference after it's been destroyed drm/nv40: remove some completed ctxprog TODOs ...
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/efifb.c11
-rw-r--r--drivers/video/fbmem.c74
-rw-r--r--drivers/video/fbsysfs.c1
-rw-r--r--drivers/video/offb.c28
-rw-r--r--drivers/video/vesafb.c11
-rw-r--r--drivers/video/vga16fb.c26
6 files changed, 109 insertions, 42 deletions
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index ecf405562f5c..4a56f46af40a 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -168,7 +168,7 @@ static void efifb_destroy(struct fb_info *info)
168{ 168{
169 if (info->screen_base) 169 if (info->screen_base)
170 iounmap(info->screen_base); 170 iounmap(info->screen_base);
171 release_mem_region(info->aperture_base, info->aperture_size); 171 release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
172 framebuffer_release(info); 172 framebuffer_release(info);
173} 173}
174 174
@@ -292,8 +292,13 @@ static int __devinit efifb_probe(struct platform_device *dev)
292 info->pseudo_palette = info->par; 292 info->pseudo_palette = info->par;
293 info->par = NULL; 293 info->par = NULL;
294 294
295 info->aperture_base = efifb_fix.smem_start; 295 info->apertures = alloc_apertures(1);
296 info->aperture_size = size_remap; 296 if (!info->apertures) {
297 err = -ENOMEM;
298 goto err_release_fb;
299 }
300 info->apertures->ranges[0].base = efifb_fix.smem_start;
301 info->apertures->ranges[0].size = size_remap;
297 302
298 info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len); 303 info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len);
299 if (!info->screen_base) { 304 if (!info->screen_base) {
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index a15b44e9c003..e08b7b5cb326 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1468,16 +1468,67 @@ static int fb_check_foreignness(struct fb_info *fi)
1468 return 0; 1468 return 0;
1469} 1469}
1470 1470
1471static bool fb_do_apertures_overlap(struct fb_info *gen, struct fb_info *hw) 1471static bool apertures_overlap(struct aperture *gen, struct aperture *hw)
1472{ 1472{
1473 /* is the generic aperture base the same as the HW one */ 1473 /* is the generic aperture base the same as the HW one */
1474 if (gen->aperture_base == hw->aperture_base) 1474 if (gen->base == hw->base)
1475 return true; 1475 return true;
1476 /* is the generic aperture base inside the hw base->hw base+size */ 1476 /* is the generic aperture base inside the hw base->hw base+size */
1477 if (gen->aperture_base > hw->aperture_base && gen->aperture_base <= hw->aperture_base + hw->aperture_size) 1477 if (gen->base > hw->base && gen->base <= hw->base + hw->size)
1478 return true; 1478 return true;
1479 return false; 1479 return false;
1480} 1480}
1481
1482static bool fb_do_apertures_overlap(struct apertures_struct *gena,
1483 struct apertures_struct *hwa)
1484{
1485 int i, j;
1486 if (!hwa || !gena)
1487 return false;
1488
1489 for (i = 0; i < hwa->count; ++i) {
1490 struct aperture *h = &hwa->ranges[i];
1491 for (j = 0; j < gena->count; ++j) {
1492 struct aperture *g = &gena->ranges[j];
1493 printk(KERN_DEBUG "checking generic (%llx %llx) vs hw (%llx %llx)\n",
1494 g->base, g->size, h->base, h->size);
1495 if (apertures_overlap(g, h))
1496 return true;
1497 }
1498 }
1499
1500 return false;
1501}
1502
1503#define VGA_FB_PHYS 0xA0000
1504void remove_conflicting_framebuffers(struct apertures_struct *a,
1505 const char *name, bool primary)
1506{
1507 int i;
1508
1509 /* check all firmware fbs and kick off if the base addr overlaps */
1510 for (i = 0 ; i < FB_MAX; i++) {
1511 struct apertures_struct *gen_aper;
1512 if (!registered_fb[i])
1513 continue;
1514
1515 if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
1516 continue;
1517
1518 gen_aper = registered_fb[i]->apertures;
1519 if (fb_do_apertures_overlap(gen_aper, a) ||
1520 (primary && gen_aper && gen_aper->count &&
1521 gen_aper->ranges[0].base == VGA_FB_PHYS)) {
1522
1523 printk(KERN_ERR "fb: conflicting fb hw usage "
1524 "%s vs %s - removing generic driver\n",
1525 name, registered_fb[i]->fix.id);
1526 unregister_framebuffer(registered_fb[i]);
1527 }
1528 }
1529}
1530EXPORT_SYMBOL(remove_conflicting_framebuffers);
1531
1481/** 1532/**
1482 * register_framebuffer - registers a frame buffer device 1533 * register_framebuffer - registers a frame buffer device
1483 * @fb_info: frame buffer info structure 1534 * @fb_info: frame buffer info structure
@@ -1501,21 +1552,8 @@ register_framebuffer(struct fb_info *fb_info)
1501 if (fb_check_foreignness(fb_info)) 1552 if (fb_check_foreignness(fb_info))
1502 return -ENOSYS; 1553 return -ENOSYS;
1503 1554
1504 /* check all firmware fbs and kick off if the base addr overlaps */ 1555 remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id,
1505 for (i = 0 ; i < FB_MAX; i++) { 1556 fb_is_primary_device(fb_info));
1506 if (!registered_fb[i])
1507 continue;
1508
1509 if (registered_fb[i]->flags & FBINFO_MISC_FIRMWARE) {
1510 if (fb_do_apertures_overlap(registered_fb[i], fb_info)) {
1511 printk(KERN_ERR "fb: conflicting fb hw usage "
1512 "%s vs %s - removing generic driver\n",
1513 fb_info->fix.id,
1514 registered_fb[i]->fix.id);
1515 unregister_framebuffer(registered_fb[i]);
1516 }
1517 }
1518 }
1519 1557
1520 num_registered_fb++; 1558 num_registered_fb++;
1521 for (i = 0 ; i < FB_MAX; i++) 1559 for (i = 0 ; i < FB_MAX; i++)
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 81aa3129c17d..0a08f1341227 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -80,6 +80,7 @@ EXPORT_SYMBOL(framebuffer_alloc);
80 */ 80 */
81void framebuffer_release(struct fb_info *info) 81void framebuffer_release(struct fb_info *info)
82{ 82{
83 kfree(info->apertures);
83 kfree(info); 84 kfree(info);
84} 85}
85EXPORT_SYMBOL(framebuffer_release); 86EXPORT_SYMBOL(framebuffer_release);
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index 61f8b8f919b0..46dda7d8aaee 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -285,7 +285,7 @@ static void offb_destroy(struct fb_info *info)
285{ 285{
286 if (info->screen_base) 286 if (info->screen_base)
287 iounmap(info->screen_base); 287 iounmap(info->screen_base);
288 release_mem_region(info->aperture_base, info->aperture_size); 288 release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
289 framebuffer_release(info); 289 framebuffer_release(info);
290} 290}
291 291
@@ -491,8 +491,11 @@ static void __init offb_init_fb(const char *name, const char *full_name,
491 var->vmode = FB_VMODE_NONINTERLACED; 491 var->vmode = FB_VMODE_NONINTERLACED;
492 492
493 /* set offb aperture size for generic probing */ 493 /* set offb aperture size for generic probing */
494 info->aperture_base = address; 494 info->apertures = alloc_apertures(1);
495 info->aperture_size = fix->smem_len; 495 if (!info->apertures)
496 goto out_aper;
497 info->apertures->ranges[0].base = address;
498 info->apertures->ranges[0].size = fix->smem_len;
496 499
497 info->fbops = &offb_ops; 500 info->fbops = &offb_ops;
498 info->screen_base = ioremap(address, fix->smem_len); 501 info->screen_base = ioremap(address, fix->smem_len);
@@ -501,17 +504,20 @@ static void __init offb_init_fb(const char *name, const char *full_name,
501 504
502 fb_alloc_cmap(&info->cmap, 256, 0); 505 fb_alloc_cmap(&info->cmap, 256, 0);
503 506
504 if (register_framebuffer(info) < 0) { 507 if (register_framebuffer(info) < 0)
505 iounmap(par->cmap_adr); 508 goto out_err;
506 par->cmap_adr = NULL;
507 iounmap(info->screen_base);
508 framebuffer_release(info);
509 release_mem_region(res_start, res_size);
510 return;
511 }
512 509
513 printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n", 510 printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n",
514 info->node, full_name); 511 info->node, full_name);
512 return;
513
514out_err:
515 iounmap(info->screen_base);
516out_aper:
517 iounmap(par->cmap_adr);
518 par->cmap_adr = NULL;
519 framebuffer_release(info);
520 release_mem_region(res_start, res_size);
515} 521}
516 522
517 523
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 0cadf7aee27e..090aa1a9be6e 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -177,7 +177,7 @@ static void vesafb_destroy(struct fb_info *info)
177{ 177{
178 if (info->screen_base) 178 if (info->screen_base)
179 iounmap(info->screen_base); 179 iounmap(info->screen_base);
180 release_mem_region(info->aperture_base, info->aperture_size); 180 release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
181 framebuffer_release(info); 181 framebuffer_release(info);
182} 182}
183 183
@@ -295,8 +295,13 @@ static int __init vesafb_probe(struct platform_device *dev)
295 info->par = NULL; 295 info->par = NULL;
296 296
297 /* set vesafb aperture size for generic probing */ 297 /* set vesafb aperture size for generic probing */
298 info->aperture_base = screen_info.lfb_base; 298 info->apertures = alloc_apertures(1);
299 info->aperture_size = size_total; 299 if (!info->apertures) {
300 err = -ENOMEM;
301 goto err;
302 }
303 info->apertures->ranges[0].base = screen_info.lfb_base;
304 info->apertures->ranges[0].size = size_total;
300 305
301 info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); 306 info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len);
302 if (!info->screen_base) { 307 if (!info->screen_base) {
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index bf638a47a5b3..149c47ac7e93 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -1263,10 +1263,19 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image
1263 vga_imageblit_color(info, image); 1263 vga_imageblit_color(info, image);
1264} 1264}
1265 1265
1266static void vga16fb_destroy(struct fb_info *info)
1267{
1268 iounmap(info->screen_base);
1269 fb_dealloc_cmap(&info->cmap);
1270 /* XXX unshare VGA regions */
1271 framebuffer_release(info);
1272}
1273
1266static struct fb_ops vga16fb_ops = { 1274static struct fb_ops vga16fb_ops = {
1267 .owner = THIS_MODULE, 1275 .owner = THIS_MODULE,
1268 .fb_open = vga16fb_open, 1276 .fb_open = vga16fb_open,
1269 .fb_release = vga16fb_release, 1277 .fb_release = vga16fb_release,
1278 .fb_destroy = vga16fb_destroy,
1270 .fb_check_var = vga16fb_check_var, 1279 .fb_check_var = vga16fb_check_var,
1271 .fb_set_par = vga16fb_set_par, 1280 .fb_set_par = vga16fb_set_par,
1272 .fb_setcolreg = vga16fb_setcolreg, 1281 .fb_setcolreg = vga16fb_setcolreg,
@@ -1306,6 +1315,11 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
1306 ret = -ENOMEM; 1315 ret = -ENOMEM;
1307 goto err_fb_alloc; 1316 goto err_fb_alloc;
1308 } 1317 }
1318 info->apertures = alloc_apertures(1);
1319 if (!info->apertures) {
1320 ret = -ENOMEM;
1321 goto err_ioremap;
1322 }
1309 1323
1310 /* XXX share VGA_FB_PHYS and I/O region with vgacon and others */ 1324 /* XXX share VGA_FB_PHYS and I/O region with vgacon and others */
1311 info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS, 0); 1325 info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS, 0);
@@ -1335,7 +1349,7 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
1335 info->fix = vga16fb_fix; 1349 info->fix = vga16fb_fix;
1336 /* supports rectangles with widths of multiples of 8 */ 1350 /* supports rectangles with widths of multiples of 8 */
1337 info->pixmap.blit_x = 1 << 7 | 1 << 15 | 1 << 23 | 1 << 31; 1351 info->pixmap.blit_x = 1 << 7 | 1 << 15 | 1 << 23 | 1 << 31;
1338 info->flags = FBINFO_FLAG_DEFAULT | 1352 info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE |
1339 FBINFO_HWACCEL_YPAN; 1353 FBINFO_HWACCEL_YPAN;
1340 1354
1341 i = (info->var.bits_per_pixel == 8) ? 256 : 16; 1355 i = (info->var.bits_per_pixel == 8) ? 256 : 16;
@@ -1354,6 +1368,9 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
1354 1368
1355 vga16fb_update_fix(info); 1369 vga16fb_update_fix(info);
1356 1370
1371 info->apertures->ranges[0].base = VGA_FB_PHYS;
1372 info->apertures->ranges[0].size = VGA_FB_PHYS_LEN;
1373
1357 if (register_framebuffer(info) < 0) { 1374 if (register_framebuffer(info) < 0) {
1358 printk(KERN_ERR "vga16fb: unable to register framebuffer\n"); 1375 printk(KERN_ERR "vga16fb: unable to register framebuffer\n");
1359 ret = -EINVAL; 1376 ret = -EINVAL;
@@ -1380,13 +1397,8 @@ static int vga16fb_remove(struct platform_device *dev)
1380{ 1397{
1381 struct fb_info *info = platform_get_drvdata(dev); 1398 struct fb_info *info = platform_get_drvdata(dev);
1382 1399
1383 if (info) { 1400 if (info)
1384 unregister_framebuffer(info); 1401 unregister_framebuffer(info);
1385 iounmap(info->screen_base);
1386 fb_dealloc_cmap(&info->cmap);
1387 /* XXX unshare VGA regions */
1388 framebuffer_release(info);
1389 }
1390 1402
1391 return 0; 1403 return 0;
1392} 1404}