aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/aty/aty128fb.c2
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/aty/radeon_backlight.c2
-rw-r--r--drivers/video/backlight/backlight.c7
-rw-r--r--drivers/video/backlight/corgi_bl.c2
-rw-r--r--drivers/video/backlight/hp680_bl.c2
-rw-r--r--drivers/video/backlight/locomolcd.c2
-rw-r--r--drivers/video/bw2.c18
-rw-r--r--drivers/video/cg14.c28
-rw-r--r--drivers/video/cg3.c22
-rw-r--r--drivers/video/cg6.c33
-rw-r--r--drivers/video/ffb.c25
-rw-r--r--drivers/video/gxt4500.c95
-rw-r--r--drivers/video/leo.c29
-rw-r--r--drivers/video/nvidia/nv_backlight.c2
-rw-r--r--drivers/video/p9100.c25
-rw-r--r--drivers/video/pxafb.c40
-rw-r--r--drivers/video/riva/fbdev.c2
-rw-r--r--drivers/video/sa1100fb.c6
-rw-r--r--drivers/video/tcx.c33
20 files changed, 222 insertions, 155 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 3feddf89d100..2e976ffcde0f 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1834,7 +1834,7 @@ static void aty128_bl_init(struct aty128fb_par *par)
1834 1834
1835 snprintf(name, sizeof(name), "aty128bl%d", info->node); 1835 snprintf(name, sizeof(name), "aty128bl%d", info->node);
1836 1836
1837 bd = backlight_device_register(name, par, &aty128_bl_data); 1837 bd = backlight_device_register(name, info->dev, par, &aty128_bl_data);
1838 if (IS_ERR(bd)) { 1838 if (IS_ERR(bd)) {
1839 info->bl_dev = NULL; 1839 info->bl_dev = NULL;
1840 printk(KERN_WARNING "aty128: Backlight registration failed\n"); 1840 printk(KERN_WARNING "aty128: Backlight registration failed\n");
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 09684d7a7ce9..f2ebdd880085 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2211,7 +2211,7 @@ static void aty_bl_init(struct atyfb_par *par)
2211 2211
2212 snprintf(name, sizeof(name), "atybl%d", info->node); 2212 snprintf(name, sizeof(name), "atybl%d", info->node);
2213 2213
2214 bd = backlight_device_register(name, par, &aty_bl_data); 2214 bd = backlight_device_register(name, info->dev, par, &aty_bl_data);
2215 if (IS_ERR(bd)) { 2215 if (IS_ERR(bd)) {
2216 info->bl_dev = NULL; 2216 info->bl_dev = NULL;
2217 printk(KERN_WARNING "aty: Backlight registration failed\n"); 2217 printk(KERN_WARNING "aty: Backlight registration failed\n");
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 585eb7b9e636..3abfd4a380cc 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -163,7 +163,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
163 163
164 snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); 164 snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node);
165 165
166 bd = backlight_device_register(name, pdata, &radeon_bl_data); 166 bd = backlight_device_register(name, rinfo->info->dev, pdata, &radeon_bl_data);
167 if (IS_ERR(bd)) { 167 if (IS_ERR(bd)) {
168 rinfo->info->bl_dev = NULL; 168 rinfo->info->bl_dev = NULL;
169 printk("radeonfb: Backlight registration failed\n"); 169 printk("radeonfb: Backlight registration failed\n");
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index db8c191b1201..9601bfe309ac 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -216,8 +216,10 @@ static const struct class_device_attribute bl_class_device_attributes[] = {
216 * Creates and registers new backlight class_device. Returns either an 216 * Creates and registers new backlight class_device. Returns either an
217 * ERR_PTR() or a pointer to the newly allocated device. 217 * ERR_PTR() or a pointer to the newly allocated device.
218 */ 218 */
219struct backlight_device *backlight_device_register(const char *name, void *devdata, 219struct backlight_device *backlight_device_register(const char *name,
220 struct backlight_properties *bp) 220 struct device *dev,
221 void *devdata,
222 struct backlight_properties *bp)
221{ 223{
222 int i, rc; 224 int i, rc;
223 struct backlight_device *new_bd; 225 struct backlight_device *new_bd;
@@ -232,6 +234,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda
232 new_bd->props = bp; 234 new_bd->props = bp;
233 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); 235 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
234 new_bd->class_dev.class = &backlight_class; 236 new_bd->class_dev.class = &backlight_class;
237 new_bd->class_dev.dev = dev;
235 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); 238 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
236 class_set_devdata(&new_bd->class_dev, devdata); 239 class_set_devdata(&new_bd->class_dev, devdata);
237 240
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 61587ca2cdbb..fde1d9518123 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -121,7 +121,7 @@ static int corgibl_probe(struct platform_device *pdev)
121 machinfo->limit_mask = -1; 121 machinfo->limit_mask = -1;
122 122
123 corgi_backlight_device = backlight_device_register ("corgi-bl", 123 corgi_backlight_device = backlight_device_register ("corgi-bl",
124 NULL, &corgibl_data); 124 &pdev->dev, NULL, &corgibl_data);
125 if (IS_ERR (corgi_backlight_device)) 125 if (IS_ERR (corgi_backlight_device))
126 return PTR_ERR (corgi_backlight_device); 126 return PTR_ERR (corgi_backlight_device);
127 127
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index 1c569fb543ae..c07d8207fb54 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -105,7 +105,7 @@ static struct backlight_properties hp680bl_data = {
105static int __init hp680bl_probe(struct platform_device *dev) 105static int __init hp680bl_probe(struct platform_device *dev)
106{ 106{
107 hp680_backlight_device = backlight_device_register ("hp680-bl", 107 hp680_backlight_device = backlight_device_register ("hp680-bl",
108 NULL, &hp680bl_data); 108 &dev->dev, NULL, &hp680bl_data);
109 if (IS_ERR (hp680_backlight_device)) 109 if (IS_ERR (hp680_backlight_device))
110 return PTR_ERR (hp680_backlight_device); 110 return PTR_ERR (hp680_backlight_device);
111 111
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index 2d7905410b2a..fc812d96c31d 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -184,7 +184,7 @@ static int locomolcd_probe(struct locomo_dev *ldev)
184 184
185 local_irq_restore(flags); 185 local_irq_restore(flags);
186 186
187 locomolcd_bl_device = backlight_device_register("locomo-bl", NULL, &locomobl_data); 187 locomolcd_bl_device = backlight_device_register("locomo-bl", &ldev->dev, NULL, &locomobl_data);
188 188
189 if (IS_ERR (locomolcd_bl_device)) 189 if (IS_ERR (locomolcd_bl_device))
190 return PTR_ERR (locomolcd_bl_device); 190 return PTR_ERR (locomolcd_bl_device);
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index c66e3d52cbf3..9bb6257d6918 100644
--- a/drivers/video/bw2.c
+++ b/drivers/video/bw2.c
@@ -320,7 +320,7 @@ static int __devinit bw2_init_one(struct of_device *op)
320 all->info.fbops = &bw2_ops; 320 all->info.fbops = &bw2_ops;
321 321
322 all->info.screen_base = 322 all->info.screen_base =
323 sbus_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); 323 of_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram");
324 all->info.par = &all->par; 324 all->info.par = &all->par;
325 325
326 bw2_blank(0, &all->info); 326 bw2_blank(0, &all->info);
@@ -329,8 +329,10 @@ static int __devinit bw2_init_one(struct of_device *op)
329 329
330 err= register_framebuffer(&all->info); 330 err= register_framebuffer(&all->info);
331 if (err < 0) { 331 if (err < 0) {
332 of_iounmap(all->par.regs, sizeof(struct bw2_regs)); 332 of_iounmap(&op->resource[0],
333 of_iounmap(all->info.screen_base, all->par.fbsize); 333 all->par.regs, sizeof(struct bw2_regs));
334 of_iounmap(&op->resource[0],
335 all->info.screen_base, all->par.fbsize);
334 kfree(all); 336 kfree(all);
335 return err; 337 return err;
336 } 338 }
@@ -351,18 +353,18 @@ static int __devinit bw2_probe(struct of_device *dev, const struct of_device_id
351 return bw2_init_one(op); 353 return bw2_init_one(op);
352} 354}
353 355
354static int __devexit bw2_remove(struct of_device *dev) 356static int __devexit bw2_remove(struct of_device *op)
355{ 357{
356 struct all_info *all = dev_get_drvdata(&dev->dev); 358 struct all_info *all = dev_get_drvdata(&op->dev);
357 359
358 unregister_framebuffer(&all->info); 360 unregister_framebuffer(&all->info);
359 361
360 of_iounmap(all->par.regs, sizeof(struct bw2_regs)); 362 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct bw2_regs));
361 of_iounmap(all->info.screen_base, all->par.fbsize); 363 of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
362 364
363 kfree(all); 365 kfree(all);
364 366
365 dev_set_drvdata(&dev->dev, NULL); 367 dev_set_drvdata(&op->dev, NULL);
366 368
367 return 0; 369 return 0;
368} 370}
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 7f926c619b61..ec6a51a5822d 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -452,16 +452,20 @@ struct all_info {
452 struct cg14_par par; 452 struct cg14_par par;
453}; 453};
454 454
455static void cg14_unmap_regs(struct all_info *all) 455static void cg14_unmap_regs(struct of_device *op, struct all_info *all)
456{ 456{
457 if (all->par.regs) 457 if (all->par.regs)
458 of_iounmap(all->par.regs, sizeof(struct cg14_regs)); 458 of_iounmap(&op->resource[0],
459 all->par.regs, sizeof(struct cg14_regs));
459 if (all->par.clut) 460 if (all->par.clut)
460 of_iounmap(all->par.clut, sizeof(struct cg14_clut)); 461 of_iounmap(&op->resource[0],
462 all->par.clut, sizeof(struct cg14_clut));
461 if (all->par.cursor) 463 if (all->par.cursor)
462 of_iounmap(all->par.cursor, sizeof(struct cg14_cursor)); 464 of_iounmap(&op->resource[0],
465 all->par.cursor, sizeof(struct cg14_cursor));
463 if (all->info.screen_base) 466 if (all->info.screen_base)
464 of_iounmap(all->info.screen_base, all->par.fbsize); 467 of_iounmap(&op->resource[1],
468 all->info.screen_base, all->par.fbsize);
465} 469}
466 470
467static int __devinit cg14_init_one(struct of_device *op) 471static int __devinit cg14_init_one(struct of_device *op)
@@ -506,7 +510,7 @@ static int __devinit cg14_init_one(struct of_device *op)
506 510
507 if (!all->par.regs || !all->par.clut || !all->par.cursor || 511 if (!all->par.regs || !all->par.clut || !all->par.cursor ||
508 !all->info.screen_base) 512 !all->info.screen_base)
509 cg14_unmap_regs(all); 513 cg14_unmap_regs(op, all);
510 514
511 is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == 515 is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
512 (8 * 1024 * 1024)); 516 (8 * 1024 * 1024));
@@ -541,7 +545,7 @@ static int __devinit cg14_init_one(struct of_device *op)
541 __cg14_reset(&all->par); 545 __cg14_reset(&all->par);
542 546
543 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 547 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
544 cg14_unmap_regs(all); 548 cg14_unmap_regs(op, all);
545 kfree(all); 549 kfree(all);
546 return -ENOMEM; 550 return -ENOMEM;
547 } 551 }
@@ -552,7 +556,7 @@ static int __devinit cg14_init_one(struct of_device *op)
552 err = register_framebuffer(&all->info); 556 err = register_framebuffer(&all->info);
553 if (err < 0) { 557 if (err < 0) {
554 fb_dealloc_cmap(&all->info.cmap); 558 fb_dealloc_cmap(&all->info.cmap);
555 cg14_unmap_regs(all); 559 cg14_unmap_regs(op, all);
556 kfree(all); 560 kfree(all);
557 return err; 561 return err;
558 } 562 }
@@ -574,18 +578,18 @@ static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id
574 return cg14_init_one(op); 578 return cg14_init_one(op);
575} 579}
576 580
577static int __devexit cg14_remove(struct of_device *dev) 581static int __devexit cg14_remove(struct of_device *op)
578{ 582{
579 struct all_info *all = dev_get_drvdata(&dev->dev); 583 struct all_info *all = dev_get_drvdata(&op->dev);
580 584
581 unregister_framebuffer(&all->info); 585 unregister_framebuffer(&all->info);
582 fb_dealloc_cmap(&all->info.cmap); 586 fb_dealloc_cmap(&all->info.cmap);
583 587
584 cg14_unmap_regs(all); 588 cg14_unmap_regs(op, all);
585 589
586 kfree(all); 590 kfree(all);
587 591
588 dev_set_drvdata(&dev->dev, NULL); 592 dev_set_drvdata(&op->dev, NULL);
589 593
590 return 0; 594 return 0;
591} 595}
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index 9c8c753ef454..ada6f7e3a891 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -403,8 +403,10 @@ static int __devinit cg3_init_one(struct of_device *op)
403 cg3_do_default_mode(&all->par); 403 cg3_do_default_mode(&all->par);
404 404
405 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 405 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
406 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 406 of_iounmap(&op->resource[0],
407 of_iounmap(all->info.screen_base, all->par.fbsize); 407 all->par.regs, sizeof(struct cg3_regs));
408 of_iounmap(&op->resource[0],
409 all->info.screen_base, all->par.fbsize);
408 kfree(all); 410 kfree(all);
409 return -ENOMEM; 411 return -ENOMEM;
410 } 412 }
@@ -415,8 +417,10 @@ static int __devinit cg3_init_one(struct of_device *op)
415 err = register_framebuffer(&all->info); 417 err = register_framebuffer(&all->info);
416 if (err < 0) { 418 if (err < 0) {
417 fb_dealloc_cmap(&all->info.cmap); 419 fb_dealloc_cmap(&all->info.cmap);
418 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 420 of_iounmap(&op->resource[0],
419 of_iounmap(all->info.screen_base, all->par.fbsize); 421 all->par.regs, sizeof(struct cg3_regs));
422 of_iounmap(&op->resource[0],
423 all->info.screen_base, all->par.fbsize);
420 kfree(all); 424 kfree(all);
421 return err; 425 return err;
422 } 426 }
@@ -436,19 +440,19 @@ static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id
436 return cg3_init_one(op); 440 return cg3_init_one(op);
437} 441}
438 442
439static int __devexit cg3_remove(struct of_device *dev) 443static int __devexit cg3_remove(struct of_device *op)
440{ 444{
441 struct all_info *all = dev_get_drvdata(&dev->dev); 445 struct all_info *all = dev_get_drvdata(&op->dev);
442 446
443 unregister_framebuffer(&all->info); 447 unregister_framebuffer(&all->info);
444 fb_dealloc_cmap(&all->info.cmap); 448 fb_dealloc_cmap(&all->info.cmap);
445 449
446 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 450 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct cg3_regs));
447 of_iounmap(all->info.screen_base, all->par.fbsize); 451 of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
448 452
449 kfree(all); 453 kfree(all);
450 454
451 dev_set_drvdata(&dev->dev, NULL); 455 dev_set_drvdata(&op->dev, NULL);
452 456
453 return 0; 457 return 0;
454} 458}
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 64146be2eeb0..4dad23a28f58 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -658,21 +658,26 @@ struct all_info {
658 struct cg6_par par; 658 struct cg6_par par;
659}; 659};
660 660
661static void cg6_unmap_regs(struct all_info *all) 661static void cg6_unmap_regs(struct of_device *op, struct all_info *all)
662{ 662{
663 if (all->par.fbc) 663 if (all->par.fbc)
664 of_iounmap(all->par.fbc, 4096); 664 of_iounmap(&op->resource[0], all->par.fbc, 4096);
665 if (all->par.tec) 665 if (all->par.tec)
666 of_iounmap(all->par.tec, sizeof(struct cg6_tec)); 666 of_iounmap(&op->resource[0],
667 all->par.tec, sizeof(struct cg6_tec));
667 if (all->par.thc) 668 if (all->par.thc)
668 of_iounmap(all->par.thc, sizeof(struct cg6_thc)); 669 of_iounmap(&op->resource[0],
670 all->par.thc, sizeof(struct cg6_thc));
669 if (all->par.bt) 671 if (all->par.bt)
670 of_iounmap(all->par.bt, sizeof(struct bt_regs)); 672 of_iounmap(&op->resource[0],
673 all->par.bt, sizeof(struct bt_regs));
671 if (all->par.fhc) 674 if (all->par.fhc)
672 of_iounmap(all->par.fhc, sizeof(u32)); 675 of_iounmap(&op->resource[0],
676 all->par.fhc, sizeof(u32));
673 677
674 if (all->info.screen_base) 678 if (all->info.screen_base)
675 of_iounmap(all->info.screen_base, all->par.fbsize); 679 of_iounmap(&op->resource[0],
680 all->info.screen_base, all->par.fbsize);
676} 681}
677 682
678static int __devinit cg6_init_one(struct of_device *op) 683static int __devinit cg6_init_one(struct of_device *op)
@@ -720,7 +725,7 @@ static int __devinit cg6_init_one(struct of_device *op)
720 all->par.fbsize, "cgsix ram"); 725 all->par.fbsize, "cgsix ram");
721 if (!all->par.fbc || !all->par.tec || !all->par.thc || 726 if (!all->par.fbc || !all->par.tec || !all->par.thc ||
722 !all->par.bt || !all->par.fhc || !all->info.screen_base) { 727 !all->par.bt || !all->par.fhc || !all->info.screen_base) {
723 cg6_unmap_regs(all); 728 cg6_unmap_regs(op, all);
724 kfree(all); 729 kfree(all);
725 return -ENOMEM; 730 return -ENOMEM;
726 } 731 }
@@ -734,7 +739,7 @@ static int __devinit cg6_init_one(struct of_device *op)
734 cg6_blank(0, &all->info); 739 cg6_blank(0, &all->info);
735 740
736 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 741 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
737 cg6_unmap_regs(all); 742 cg6_unmap_regs(op, all);
738 kfree(all); 743 kfree(all);
739 return -ENOMEM; 744 return -ENOMEM;
740 } 745 }
@@ -744,7 +749,7 @@ static int __devinit cg6_init_one(struct of_device *op)
744 749
745 err = register_framebuffer(&all->info); 750 err = register_framebuffer(&all->info);
746 if (err < 0) { 751 if (err < 0) {
747 cg6_unmap_regs(all); 752 cg6_unmap_regs(op, all);
748 fb_dealloc_cmap(&all->info.cmap); 753 fb_dealloc_cmap(&all->info.cmap);
749 kfree(all); 754 kfree(all);
750 return err; 755 return err;
@@ -767,18 +772,18 @@ static int __devinit cg6_probe(struct of_device *dev, const struct of_device_id
767 return cg6_init_one(op); 772 return cg6_init_one(op);
768} 773}
769 774
770static int __devexit cg6_remove(struct of_device *dev) 775static int __devexit cg6_remove(struct of_device *op)
771{ 776{
772 struct all_info *all = dev_get_drvdata(&dev->dev); 777 struct all_info *all = dev_get_drvdata(&op->dev);
773 778
774 unregister_framebuffer(&all->info); 779 unregister_framebuffer(&all->info);
775 fb_dealloc_cmap(&all->info.cmap); 780 fb_dealloc_cmap(&all->info.cmap);
776 781
777 cg6_unmap_regs(all); 782 cg6_unmap_regs(op, all);
778 783
779 kfree(all); 784 kfree(all);
780 785
781 dev_set_drvdata(&dev->dev, NULL); 786 dev_set_drvdata(&op->dev, NULL);
782 787
783 return 0; 788 return 0;
784} 789}
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 949141bd44d4..15854aec3180 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -910,7 +910,8 @@ static int ffb_init_one(struct of_device *op)
910 all->par.dac = of_ioremap(&op->resource[1], 0, 910 all->par.dac = of_ioremap(&op->resource[1], 0,
911 sizeof(struct ffb_dac), "ffb dac"); 911 sizeof(struct ffb_dac), "ffb dac");
912 if (!all->par.dac) { 912 if (!all->par.dac) {
913 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 913 of_iounmap(&op->resource[2],
914 all->par.fbc, sizeof(struct ffb_fbc));
914 kfree(all); 915 kfree(all);
915 return -ENOMEM; 916 return -ENOMEM;
916 } 917 }
@@ -968,8 +969,10 @@ static int ffb_init_one(struct of_device *op)
968 969
969 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 970 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
970 printk(KERN_ERR "ffb: Could not allocate color map.\n"); 971 printk(KERN_ERR "ffb: Could not allocate color map.\n");
971 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 972 of_iounmap(&op->resource[2],
972 of_iounmap(all->par.dac, sizeof(struct ffb_dac)); 973 all->par.fbc, sizeof(struct ffb_fbc));
974 of_iounmap(&op->resource[1],
975 all->par.dac, sizeof(struct ffb_dac));
973 kfree(all); 976 kfree(all);
974 return -ENOMEM; 977 return -ENOMEM;
975 } 978 }
@@ -980,8 +983,10 @@ static int ffb_init_one(struct of_device *op)
980 if (err < 0) { 983 if (err < 0) {
981 printk(KERN_ERR "ffb: Could not register framebuffer.\n"); 984 printk(KERN_ERR "ffb: Could not register framebuffer.\n");
982 fb_dealloc_cmap(&all->info.cmap); 985 fb_dealloc_cmap(&all->info.cmap);
983 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 986 of_iounmap(&op->resource[2],
984 of_iounmap(all->par.dac, sizeof(struct ffb_dac)); 987 all->par.fbc, sizeof(struct ffb_fbc));
988 of_iounmap(&op->resource[1],
989 all->par.dac, sizeof(struct ffb_dac));
985 kfree(all); 990 kfree(all);
986 return err; 991 return err;
987 } 992 }
@@ -1003,19 +1008,19 @@ static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id
1003 return ffb_init_one(op); 1008 return ffb_init_one(op);
1004} 1009}
1005 1010
1006static int __devexit ffb_remove(struct of_device *dev) 1011static int __devexit ffb_remove(struct of_device *op)
1007{ 1012{
1008 struct all_info *all = dev_get_drvdata(&dev->dev); 1013 struct all_info *all = dev_get_drvdata(&op->dev);
1009 1014
1010 unregister_framebuffer(&all->info); 1015 unregister_framebuffer(&all->info);
1011 fb_dealloc_cmap(&all->info.cmap); 1016 fb_dealloc_cmap(&all->info.cmap);
1012 1017
1013 of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); 1018 of_iounmap(&op->resource[2], all->par.fbc, sizeof(struct ffb_fbc));
1014 of_iounmap(all->par.dac, sizeof(struct ffb_dac)); 1019 of_iounmap(&op->resource[1], all->par.dac, sizeof(struct ffb_dac));
1015 1020
1016 kfree(all); 1021 kfree(all);
1017 1022
1018 dev_set_drvdata(&dev->dev, NULL); 1023 dev_set_drvdata(&op->dev, NULL);
1019 1024
1020 return 0; 1025 return 0;
1021} 1026}
diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c
index 3adf6ab0768f..23a6bcc3e3ce 100644
--- a/drivers/video/gxt4500.c
+++ b/drivers/video/gxt4500.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Frame buffer device for IBM GXT4500P display adaptor 2 * Frame buffer device for IBM GXT4500P and GXT6000P display adaptors
3 * 3 *
4 * Copyright (C) 2006 Paul Mackerras, IBM Corp. <paulus@samba.org> 4 * Copyright (C) 2006 Paul Mackerras, IBM Corp. <paulus@samba.org>
5 */ 5 */
@@ -11,8 +11,10 @@
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/pci_ids.h> 12#include <linux/pci_ids.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/string.h>
14 15
15#define PCI_DEVICE_ID_IBM_GXT4500P 0x21c 16#define PCI_DEVICE_ID_IBM_GXT4500P 0x21c
17#define PCI_DEVICE_ID_IBM_GXT6000P 0x170
16 18
17/* GXT4500P registers */ 19/* GXT4500P registers */
18 20
@@ -94,6 +96,7 @@ static const unsigned char pixsize[] = {
94#define PLL_M 0x4040 96#define PLL_M 0x4040
95#define PLL_N 0x4044 97#define PLL_N 0x4044
96#define PLL_POSTDIV 0x4048 98#define PLL_POSTDIV 0x4048
99#define PLL_C 0x404c
97 100
98/* Hardware cursor */ 101/* Hardware cursor */
99#define CURSOR_X 0x4078 102#define CURSOR_X 0x4078
@@ -140,6 +143,7 @@ struct gxt4500_par {
140 int pixfmt; /* pixel format, see DFA_PIX_* values */ 143 int pixfmt; /* pixel format, see DFA_PIX_* values */
141 144
142 /* PLL parameters */ 145 /* PLL parameters */
146 int refclk_ps; /* ref clock period in picoseconds */
143 int pll_m; /* ref clock divisor */ 147 int pll_m; /* ref clock divisor */
144 int pll_n; /* VCO divisor */ 148 int pll_n; /* VCO divisor */
145 int pll_pd1; /* first post-divisor */ 149 int pll_pd1; /* first post-divisor */
@@ -166,6 +170,21 @@ static const struct fb_videomode defaultmode __devinitdata = {
166 .vmode = FB_VMODE_NONINTERLACED 170 .vmode = FB_VMODE_NONINTERLACED
167}; 171};
168 172
173/* List of supported cards */
174enum gxt_cards {
175 GXT4500P,
176 GXT6000P
177};
178
179/* Card-specific information */
180static const struct cardinfo {
181 int refclk_ps; /* period of PLL reference clock in ps */
182 const char *cardname;
183} cardinfo[] = {
184 [GXT4500P] = { .refclk_ps = 9259, .cardname = "IBM GXT4500P" },
185 [GXT6000P] = { .refclk_ps = 40000, .cardname = "IBM GXT6000P" },
186};
187
169/* 188/*
170 * The refclk and VCO dividers appear to use a linear feedback shift 189 * The refclk and VCO dividers appear to use a linear feedback shift
171 * register, which gets reloaded when it reaches a terminal value, at 190 * register, which gets reloaded when it reaches a terminal value, at
@@ -203,27 +222,16 @@ static const unsigned char ndivtab[] = {
203/* 130 */ 0x9e, 0x4f, 0x27, 0x93, 0xc9, 0xe4, 0x72, 0x39, 0x1c, 0x0e, 222/* 130 */ 0x9e, 0x4f, 0x27, 0x93, 0xc9, 0xe4, 0x72, 0x39, 0x1c, 0x0e,
204/* 140 */ 0x87, 0xc3, 0x61, 0x30, 0x18, 0x8c, 0xc6, 0x63, 0x31, 0x98, 223/* 140 */ 0x87, 0xc3, 0x61, 0x30, 0x18, 0x8c, 0xc6, 0x63, 0x31, 0x98,
205/* 150 */ 0xcc, 0xe6, 0x73, 0xb9, 0x5c, 0x2e, 0x97, 0x4b, 0xa5, 0xd2, 224/* 150 */ 0xcc, 0xe6, 0x73, 0xb9, 0x5c, 0x2e, 0x97, 0x4b, 0xa5, 0xd2,
206/* 160 */ 0x69, 0xb4, 0xda, 0xed, 0x76, 0xbb, 0x5d, 0xae, 0xd7, 0x6b, 225/* 160 */ 0x69,
207/* 170 */ 0xb5, 0x5a, 0xad, 0x56, 0xab, 0xd5, 0x6a, 0x35, 0x1a, 0x8d,
208/* 180 */ 0x46, 0x23, 0x11, 0x88, 0x44, 0x22, 0x91, 0xc8, 0x64, 0x32,
209/* 190 */ 0x19, 0x0c, 0x86, 0x43, 0x21, 0x10, 0x08, 0x04, 0x02, 0x81,
210/* 200 */ 0x40, 0xa0, 0xd0, 0x68, 0x34, 0x9a, 0xcd, 0x66, 0x33, 0x99,
211/* 210 */ 0x4c, 0xa6, 0x53, 0xa9, 0xd4, 0xea, 0x75, 0x3a, 0x9d, 0xce,
212/* 220 */ 0xe7, 0xf3, 0xf9, 0x7c, 0x3e, 0x1f, 0x8f, 0x47, 0xa3, 0x51,
213/* 230 */ 0xa8, 0x54, 0xaa, 0x55, 0x2a, 0x15, 0x0a, 0x05, 0x82, 0xc1,
214/* 240 */ 0x60, 0xb0, 0x58, 0xac, 0xd6, 0xeb, 0xf5, 0x7a, 0xbd, 0xde,
215/* 250 */ 0x6f, 0x37, 0x1b, 0x0d, 0x06, 0x03, 0x01,
216}; 226};
217 227
218#define REF_PERIOD_PS 9259 /* period of reference clock in ps */
219
220static int calc_pll(int period_ps, struct gxt4500_par *par) 228static int calc_pll(int period_ps, struct gxt4500_par *par)
221{ 229{
222 int m, n, pdiv1, pdiv2, postdiv; 230 int m, n, pdiv1, pdiv2, postdiv;
223 int pll_period, best_error, t; 231 int pll_period, best_error, t, intf;
224 232
225 /* only deal with range 1MHz - 400MHz */ 233 /* only deal with range 5MHz - 300MHz */
226 if (period_ps < 2500 || period_ps > 1000000) 234 if (period_ps < 3333 || period_ps > 200000)
227 return -1; 235 return -1;
228 236
229 best_error = 1000000; 237 best_error = 1000000;
@@ -231,14 +239,17 @@ static int calc_pll(int period_ps, struct gxt4500_par *par)
231 for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) { 239 for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) {
232 postdiv = pdiv1 * pdiv2; 240 postdiv = pdiv1 * pdiv2;
233 pll_period = (period_ps + postdiv - 1) / postdiv; 241 pll_period = (period_ps + postdiv - 1) / postdiv;
234 /* keep pll in range 500..1250 MHz */ 242 /* keep pll in range 350..600 MHz */
235 if (pll_period < 800 || pll_period > 2000) 243 if (pll_period < 1666 || pll_period > 2857)
236 continue; 244 continue;
237 for (m = 3; m <= 40; ++m) { 245 for (m = 1; m <= 64; ++m) {
238 n = REF_PERIOD_PS * m * postdiv / period_ps; 246 intf = m * par->refclk_ps;
239 if (n < 5 || n > 256) 247 if (intf > 500000)
248 break;
249 n = intf * postdiv / period_ps;
250 if (n < 3 || n > 160)
240 continue; 251 continue;
241 t = REF_PERIOD_PS * m * postdiv / n; 252 t = par->refclk_ps * m * postdiv / n;
242 t -= period_ps; 253 t -= period_ps;
243 if (t >= 0 && t < best_error) { 254 if (t >= 0 && t < best_error) {
244 par->pll_m = m; 255 par->pll_m = m;
@@ -257,7 +268,7 @@ static int calc_pll(int period_ps, struct gxt4500_par *par)
257 268
258static int calc_pixclock(struct gxt4500_par *par) 269static int calc_pixclock(struct gxt4500_par *par)
259{ 270{
260 return REF_PERIOD_PS * par->pll_m * par->pll_pd1 * par->pll_pd2 271 return par->refclk_ps * par->pll_m * par->pll_pd1 * par->pll_pd2
261 / par->pll_n; 272 / par->pll_n;
262} 273}
263 274
@@ -357,7 +368,7 @@ static int gxt4500_set_par(struct fb_info *info)
357 struct gxt4500_par *par = info->par; 368 struct gxt4500_par *par = info->par;
358 struct fb_var_screeninfo *var = &info->var; 369 struct fb_var_screeninfo *var = &info->var;
359 int err; 370 int err;
360 u32 ctrlreg; 371 u32 ctrlreg, tmp;
361 unsigned int dfa_ctl, pixfmt, stride; 372 unsigned int dfa_ctl, pixfmt, stride;
362 unsigned int wid_tiles, i; 373 unsigned int wid_tiles, i;
363 unsigned int prefetch_pix, htot; 374 unsigned int prefetch_pix, htot;
@@ -376,10 +387,25 @@ static int gxt4500_set_par(struct fb_info *info)
376 writereg(par, DTG_CONTROL, ctrlreg); 387 writereg(par, DTG_CONTROL, ctrlreg);
377 388
378 /* set PLL registers */ 389 /* set PLL registers */
390 tmp = readreg(par, PLL_C) & ~0x7f;
391 if (par->pll_n < 38)
392 tmp |= 0x29;
393 if (par->pll_n < 69)
394 tmp |= 0x35;
395 else if (par->pll_n < 100)
396 tmp |= 0x76;
397 else
398 tmp |= 0x7e;
399 writereg(par, PLL_C, tmp);
379 writereg(par, PLL_M, mdivtab[par->pll_m - 1]); 400 writereg(par, PLL_M, mdivtab[par->pll_m - 1]);
380 writereg(par, PLL_N, ndivtab[par->pll_n - 2]); 401 writereg(par, PLL_N, ndivtab[par->pll_n - 2]);
381 writereg(par, PLL_POSTDIV, 402 tmp = ((8 - par->pll_pd2) << 3) | (8 - par->pll_pd1);
382 ((8 - par->pll_pd1) << 3) | (8 - par->pll_pd2)); 403 if (par->pll_pd1 == 8 || par->pll_pd2 == 8) {
404 /* work around erratum */
405 writereg(par, PLL_POSTDIV, tmp | 0x9);
406 udelay(1);
407 }
408 writereg(par, PLL_POSTDIV, tmp);
383 msleep(20); 409 msleep(20);
384 410
385 /* turn off hardware cursor */ 411 /* turn off hardware cursor */
@@ -483,8 +509,8 @@ static int gxt4500_setcolreg(unsigned int reg, unsigned int red,
483 509
484 if (reg > 1023) 510 if (reg > 1023)
485 return 1; 511 return 1;
486 cmap_entry = ((transp & 0xff00) << 16) | ((blue & 0xff00) << 8) | 512 cmap_entry = ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) |
487 (green & 0xff00) | (red >> 8); 513 (green & 0xff00) | (blue >> 8);
488 writereg(par, CMAP + reg * 4, cmap_entry); 514 writereg(par, CMAP + reg * 4, cmap_entry);
489 515
490 if (reg < 16 && par->pixfmt != DFA_PIX_8BIT) { 516 if (reg < 16 && par->pixfmt != DFA_PIX_8BIT) {
@@ -585,6 +611,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev,
585 struct gxt4500_par *par; 611 struct gxt4500_par *par;
586 struct fb_info *info; 612 struct fb_info *info;
587 struct fb_var_screeninfo var; 613 struct fb_var_screeninfo var;
614 enum gxt_cards cardtype;
588 615
589 err = pci_enable_device(pdev); 616 err = pci_enable_device(pdev);
590 if (err) { 617 if (err) {
@@ -613,7 +640,11 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev,
613 goto err_free_fb; 640 goto err_free_fb;
614 } 641 }
615 par = info->par; 642 par = info->par;
643 cardtype = ent->driver_data;
644 par->refclk_ps = cardinfo[cardtype].refclk_ps;
616 info->fix = gxt4500_fix; 645 info->fix = gxt4500_fix;
646 strlcpy(info->fix.id, cardinfo[cardtype].cardname,
647 sizeof(info->fix.id));
617 info->pseudo_palette = par->pseudo_palette; 648 info->pseudo_palette = par->pseudo_palette;
618 649
619 info->fix.mmio_start = reg_phys; 650 info->fix.mmio_start = reg_phys;
@@ -703,8 +734,10 @@ static void __devexit gxt4500_remove(struct pci_dev *pdev)
703 734
704/* supported chipsets */ 735/* supported chipsets */
705static const struct pci_device_id gxt4500_pci_tbl[] = { 736static const struct pci_device_id gxt4500_pci_tbl[] = {
706 { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT4500P, 737 { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT4500P),
707 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 738 .driver_data = GXT4500P },
739 { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT6000P),
740 .driver_data = GXT6000P },
708 { 0 } 741 { 0 }
709}; 742};
710 743
@@ -735,7 +768,7 @@ static void __exit gxt4500_exit(void)
735module_exit(gxt4500_exit); 768module_exit(gxt4500_exit);
736 769
737MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>"); 770MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
738MODULE_DESCRIPTION("FBDev driver for IBM GXT4500P"); 771MODULE_DESCRIPTION("FBDev driver for IBM GXT4500P/6000P");
739MODULE_LICENSE("GPL"); 772MODULE_LICENSE("GPL");
740module_param(mode_option, charp, 0); 773module_param(mode_option, charp, 0);
741MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\""); 774MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\"");
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index f3a24338d9ac..a038aa5a9e1c 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -530,20 +530,21 @@ struct all_info {
530 struct leo_par par; 530 struct leo_par par;
531}; 531};
532 532
533static void leo_unmap_regs(struct all_info *all) 533static void leo_unmap_regs(struct of_device *op, struct all_info *all)
534{ 534{
535 if (all->par.lc_ss0_usr) 535 if (all->par.lc_ss0_usr)
536 of_iounmap(all->par.lc_ss0_usr, 0x1000); 536 of_iounmap(&op->resource[0], all->par.lc_ss0_usr, 0x1000);
537 if (all->par.ld_ss0) 537 if (all->par.ld_ss0)
538 of_iounmap(all->par.ld_ss0, 0x1000); 538 of_iounmap(&op->resource[0], all->par.ld_ss0, 0x1000);
539 if (all->par.ld_ss1) 539 if (all->par.ld_ss1)
540 of_iounmap(all->par.ld_ss1, 0x1000); 540 of_iounmap(&op->resource[0], all->par.ld_ss1, 0x1000);
541 if (all->par.lx_krn) 541 if (all->par.lx_krn)
542 of_iounmap(all->par.lx_krn, 0x1000); 542 of_iounmap(&op->resource[0], all->par.lx_krn, 0x1000);
543 if (all->par.cursor) 543 if (all->par.cursor)
544 of_iounmap(all->par.cursor, sizeof(struct leo_cursor)); 544 of_iounmap(&op->resource[0],
545 all->par.cursor, sizeof(struct leo_cursor));
545 if (all->info.screen_base) 546 if (all->info.screen_base)
546 of_iounmap(all->info.screen_base, 0x800000); 547 of_iounmap(&op->resource[0], all->info.screen_base, 0x800000);
547} 548}
548 549
549static int __devinit leo_init_one(struct of_device *op) 550static int __devinit leo_init_one(struct of_device *op)
@@ -592,7 +593,7 @@ static int __devinit leo_init_one(struct of_device *op)
592 !all->par.lx_krn || 593 !all->par.lx_krn ||
593 !all->par.cursor || 594 !all->par.cursor ||
594 !all->info.screen_base) { 595 !all->info.screen_base) {
595 leo_unmap_regs(all); 596 leo_unmap_regs(op, all);
596 kfree(all); 597 kfree(all);
597 return -ENOMEM; 598 return -ENOMEM;
598 } 599 }
@@ -607,7 +608,7 @@ static int __devinit leo_init_one(struct of_device *op)
607 leo_blank(0, &all->info); 608 leo_blank(0, &all->info);
608 609
609 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 610 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
610 leo_unmap_regs(all); 611 leo_unmap_regs(op, all);
611 kfree(all); 612 kfree(all);
612 return -ENOMEM;; 613 return -ENOMEM;;
613 } 614 }
@@ -617,7 +618,7 @@ static int __devinit leo_init_one(struct of_device *op)
617 err = register_framebuffer(&all->info); 618 err = register_framebuffer(&all->info);
618 if (err < 0) { 619 if (err < 0) {
619 fb_dealloc_cmap(&all->info.cmap); 620 fb_dealloc_cmap(&all->info.cmap);
620 leo_unmap_regs(all); 621 leo_unmap_regs(op, all);
621 kfree(all); 622 kfree(all);
622 return err; 623 return err;
623 } 624 }
@@ -638,18 +639,18 @@ static int __devinit leo_probe(struct of_device *dev, const struct of_device_id
638 return leo_init_one(op); 639 return leo_init_one(op);
639} 640}
640 641
641static int __devexit leo_remove(struct of_device *dev) 642static int __devexit leo_remove(struct of_device *op)
642{ 643{
643 struct all_info *all = dev_get_drvdata(&dev->dev); 644 struct all_info *all = dev_get_drvdata(&op->dev);
644 645
645 unregister_framebuffer(&all->info); 646 unregister_framebuffer(&all->info);
646 fb_dealloc_cmap(&all->info.cmap); 647 fb_dealloc_cmap(&all->info.cmap);
647 648
648 leo_unmap_regs(all); 649 leo_unmap_regs(op, all);
649 650
650 kfree(all); 651 kfree(all);
651 652
652 dev_set_drvdata(&dev->dev, NULL); 653 dev_set_drvdata(&op->dev, NULL);
653 654
654 return 0; 655 return 0;
655} 656}
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c
index 5b75ae4e9457..df934bd21899 100644
--- a/drivers/video/nvidia/nv_backlight.c
+++ b/drivers/video/nvidia/nv_backlight.c
@@ -141,7 +141,7 @@ void nvidia_bl_init(struct nvidia_par *par)
141 141
142 snprintf(name, sizeof(name), "nvidiabl%d", info->node); 142 snprintf(name, sizeof(name), "nvidiabl%d", info->node);
143 143
144 bd = backlight_device_register(name, par, &nvidia_bl_data); 144 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data);
145 if (IS_ERR(bd)) { 145 if (IS_ERR(bd)) {
146 info->bl_dev = NULL; 146 info->bl_dev = NULL;
147 printk(KERN_WARNING "nvidia: Backlight registration failed\n"); 147 printk(KERN_WARNING "nvidia: Backlight registration failed\n");
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index 56ac51d6a7f3..637b78bb4bf7 100644
--- a/drivers/video/p9100.c
+++ b/drivers/video/p9100.c
@@ -297,7 +297,8 @@ static int __devinit p9100_init_one(struct of_device *op)
297 all->info.screen_base = of_ioremap(&op->resource[2], 0, 297 all->info.screen_base = of_ioremap(&op->resource[2], 0,
298 all->par.fbsize, "p9100 ram"); 298 all->par.fbsize, "p9100 ram");
299 if (!all->info.screen_base) { 299 if (!all->info.screen_base) {
300 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 300 of_iounmap(&op->resource[0],
301 all->par.regs, sizeof(struct p9100_regs));
301 kfree(all); 302 kfree(all);
302 return -ENOMEM; 303 return -ENOMEM;
303 } 304 }
@@ -306,8 +307,10 @@ static int __devinit p9100_init_one(struct of_device *op)
306 p9100_blank(0, &all->info); 307 p9100_blank(0, &all->info);
307 308
308 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 309 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
309 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 310 of_iounmap(&op->resource[0],
310 of_iounmap(all->info.screen_base, all->par.fbsize); 311 all->par.regs, sizeof(struct p9100_regs));
312 of_iounmap(&op->resource[2],
313 all->info.screen_base, all->par.fbsize);
311 kfree(all); 314 kfree(all);
312 return -ENOMEM; 315 return -ENOMEM;
313 } 316 }
@@ -317,8 +320,10 @@ static int __devinit p9100_init_one(struct of_device *op)
317 err = register_framebuffer(&all->info); 320 err = register_framebuffer(&all->info);
318 if (err < 0) { 321 if (err < 0) {
319 fb_dealloc_cmap(&all->info.cmap); 322 fb_dealloc_cmap(&all->info.cmap);
320 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 323 of_iounmap(&op->resource[0],
321 of_iounmap(all->info.screen_base, all->par.fbsize); 324 all->par.regs, sizeof(struct p9100_regs));
325 of_iounmap(&op->resource[2],
326 all->info.screen_base, all->par.fbsize);
322 kfree(all); 327 kfree(all);
323 return err; 328 return err;
324 } 329 }
@@ -340,19 +345,19 @@ static int __devinit p9100_probe(struct of_device *dev, const struct of_device_i
340 return p9100_init_one(op); 345 return p9100_init_one(op);
341} 346}
342 347
343static int __devexit p9100_remove(struct of_device *dev) 348static int __devexit p9100_remove(struct of_device *op)
344{ 349{
345 struct all_info *all = dev_get_drvdata(&dev->dev); 350 struct all_info *all = dev_get_drvdata(&op->dev);
346 351
347 unregister_framebuffer(&all->info); 352 unregister_framebuffer(&all->info);
348 fb_dealloc_cmap(&all->info.cmap); 353 fb_dealloc_cmap(&all->info.cmap);
349 354
350 of_iounmap(all->par.regs, sizeof(struct p9100_regs)); 355 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct p9100_regs));
351 of_iounmap(all->info.screen_base, all->par.fbsize); 356 of_iounmap(&op->resource[2], all->info.screen_base, all->par.fbsize);
352 357
353 kfree(all); 358 kfree(all);
354 359
355 dev_set_drvdata(&dev->dev, NULL); 360 dev_set_drvdata(&op->dev, NULL);
356 361
357 return 0; 362 return 0;
358} 363}
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 38eb0b69c2d7..b4947c810706 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1216,7 +1216,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1216 done: 1216 done:
1217 if (res_specified) { 1217 if (res_specified) {
1218 dev_info(dev, "overriding resolution: %dx%d\n", xres, yres); 1218 dev_info(dev, "overriding resolution: %dx%d\n", xres, yres);
1219 inf->xres = xres; inf->yres = yres; 1219 inf->modes[0].xres = xres; inf->modes[0].yres = yres;
1220 } 1220 }
1221 if (bpp_specified) 1221 if (bpp_specified)
1222 switch (bpp) { 1222 switch (bpp) {
@@ -1225,48 +1225,48 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1225 case 4: 1225 case 4:
1226 case 8: 1226 case 8:
1227 case 16: 1227 case 16:
1228 inf->bpp = bpp; 1228 inf->modes[0].bpp = bpp;
1229 dev_info(dev, "overriding bit depth: %d\n", bpp); 1229 dev_info(dev, "overriding bit depth: %d\n", bpp);
1230 break; 1230 break;
1231 default: 1231 default:
1232 dev_err(dev, "Depth %d is not valid\n", bpp); 1232 dev_err(dev, "Depth %d is not valid\n", bpp);
1233 } 1233 }
1234 } else if (!strncmp(this_opt, "pixclock:", 9)) { 1234 } else if (!strncmp(this_opt, "pixclock:", 9)) {
1235 inf->pixclock = simple_strtoul(this_opt+9, NULL, 0); 1235 inf->modes[0].pixclock = simple_strtoul(this_opt+9, NULL, 0);
1236 dev_info(dev, "override pixclock: %ld\n", inf->pixclock); 1236 dev_info(dev, "override pixclock: %ld\n", inf->modes[0].pixclock);
1237 } else if (!strncmp(this_opt, "left:", 5)) { 1237 } else if (!strncmp(this_opt, "left:", 5)) {
1238 inf->left_margin = simple_strtoul(this_opt+5, NULL, 0); 1238 inf->modes[0].left_margin = simple_strtoul(this_opt+5, NULL, 0);
1239 dev_info(dev, "override left: %u\n", inf->left_margin); 1239 dev_info(dev, "override left: %u\n", inf->modes[0].left_margin);
1240 } else if (!strncmp(this_opt, "right:", 6)) { 1240 } else if (!strncmp(this_opt, "right:", 6)) {
1241 inf->right_margin = simple_strtoul(this_opt+6, NULL, 0); 1241 inf->modes[0].right_margin = simple_strtoul(this_opt+6, NULL, 0);
1242 dev_info(dev, "override right: %u\n", inf->right_margin); 1242 dev_info(dev, "override right: %u\n", inf->modes[0].right_margin);
1243 } else if (!strncmp(this_opt, "upper:", 6)) { 1243 } else if (!strncmp(this_opt, "upper:", 6)) {
1244 inf->upper_margin = simple_strtoul(this_opt+6, NULL, 0); 1244 inf->modes[0].upper_margin = simple_strtoul(this_opt+6, NULL, 0);
1245 dev_info(dev, "override upper: %u\n", inf->upper_margin); 1245 dev_info(dev, "override upper: %u\n", inf->modes[0].upper_margin);
1246 } else if (!strncmp(this_opt, "lower:", 6)) { 1246 } else if (!strncmp(this_opt, "lower:", 6)) {
1247 inf->lower_margin = simple_strtoul(this_opt+6, NULL, 0); 1247 inf->modes[0].lower_margin = simple_strtoul(this_opt+6, NULL, 0);
1248 dev_info(dev, "override lower: %u\n", inf->lower_margin); 1248 dev_info(dev, "override lower: %u\n", inf->modes[0].lower_margin);
1249 } else if (!strncmp(this_opt, "hsynclen:", 9)) { 1249 } else if (!strncmp(this_opt, "hsynclen:", 9)) {
1250 inf->hsync_len = simple_strtoul(this_opt+9, NULL, 0); 1250 inf->modes[0].hsync_len = simple_strtoul(this_opt+9, NULL, 0);
1251 dev_info(dev, "override hsynclen: %u\n", inf->hsync_len); 1251 dev_info(dev, "override hsynclen: %u\n", inf->modes[0].hsync_len);
1252 } else if (!strncmp(this_opt, "vsynclen:", 9)) { 1252 } else if (!strncmp(this_opt, "vsynclen:", 9)) {
1253 inf->vsync_len = simple_strtoul(this_opt+9, NULL, 0); 1253 inf->modes[0].vsync_len = simple_strtoul(this_opt+9, NULL, 0);
1254 dev_info(dev, "override vsynclen: %u\n", inf->vsync_len); 1254 dev_info(dev, "override vsynclen: %u\n", inf->modes[0].vsync_len);
1255 } else if (!strncmp(this_opt, "hsync:", 6)) { 1255 } else if (!strncmp(this_opt, "hsync:", 6)) {
1256 if (simple_strtoul(this_opt+6, NULL, 0) == 0) { 1256 if (simple_strtoul(this_opt+6, NULL, 0) == 0) {
1257 dev_info(dev, "override hsync: Active Low\n"); 1257 dev_info(dev, "override hsync: Active Low\n");
1258 inf->sync &= ~FB_SYNC_HOR_HIGH_ACT; 1258 inf->modes[0].sync &= ~FB_SYNC_HOR_HIGH_ACT;
1259 } else { 1259 } else {
1260 dev_info(dev, "override hsync: Active High\n"); 1260 dev_info(dev, "override hsync: Active High\n");
1261 inf->sync |= FB_SYNC_HOR_HIGH_ACT; 1261 inf->modes[0].sync |= FB_SYNC_HOR_HIGH_ACT;
1262 } 1262 }
1263 } else if (!strncmp(this_opt, "vsync:", 6)) { 1263 } else if (!strncmp(this_opt, "vsync:", 6)) {
1264 if (simple_strtoul(this_opt+6, NULL, 0) == 0) { 1264 if (simple_strtoul(this_opt+6, NULL, 0) == 0) {
1265 dev_info(dev, "override vsync: Active Low\n"); 1265 dev_info(dev, "override vsync: Active Low\n");
1266 inf->sync &= ~FB_SYNC_VERT_HIGH_ACT; 1266 inf->modes[0].sync &= ~FB_SYNC_VERT_HIGH_ACT;
1267 } else { 1267 } else {
1268 dev_info(dev, "override vsync: Active High\n"); 1268 dev_info(dev, "override vsync: Active High\n");
1269 inf->sync |= FB_SYNC_VERT_HIGH_ACT; 1269 inf->modes[0].sync |= FB_SYNC_VERT_HIGH_ACT;
1270 } 1270 }
1271 } else if (!strncmp(this_opt, "dpc:", 4)) { 1271 } else if (!strncmp(this_opt, "dpc:", 4)) {
1272 if (simple_strtoul(this_opt+4, NULL, 0) == 0) { 1272 if (simple_strtoul(this_opt+4, NULL, 0) == 0) {
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 345e8b1c1af8..1a13966b7d5b 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -384,7 +384,7 @@ static void riva_bl_init(struct riva_par *par)
384 384
385 snprintf(name, sizeof(name), "rivabl%d", info->node); 385 snprintf(name, sizeof(name), "rivabl%d", info->node);
386 386
387 bd = backlight_device_register(name, par, &riva_bl_data); 387 bd = backlight_device_register(name, info->dev, par, &riva_bl_data);
388 if (IS_ERR(bd)) { 388 if (IS_ERR(bd)) {
389 info->bl_dev = NULL; 389 info->bl_dev = NULL;
390 printk(KERN_WARNING "riva: Backlight registration failed\n"); 390 printk(KERN_WARNING "riva: Backlight registration failed\n");
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index cd10b18150b8..5d2a4a4b731c 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -1200,9 +1200,9 @@ static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state)
1200 * Our LCD controller task (which is called when we blank or unblank) 1200 * Our LCD controller task (which is called when we blank or unblank)
1201 * via keventd. 1201 * via keventd.
1202 */ 1202 */
1203static void sa1100fb_task(void *dummy) 1203static void sa1100fb_task(struct work_struct *w)
1204{ 1204{
1205 struct sa1100fb_info *fbi = dummy; 1205 struct sa1100fb_info *fbi = container_of(w, struct sa1100fb_info, task);
1206 u_int state = xchg(&fbi->task_state, -1); 1206 u_int state = xchg(&fbi->task_state, -1);
1207 1207
1208 set_ctrlr_state(fbi, state); 1208 set_ctrlr_state(fbi, state);
@@ -1444,7 +1444,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
1444 fbi->max_bpp / 8; 1444 fbi->max_bpp / 8;
1445 1445
1446 init_waitqueue_head(&fbi->ctrlr_wait); 1446 init_waitqueue_head(&fbi->ctrlr_wait);
1447 INIT_WORK(&fbi->task, sa1100fb_task, fbi); 1447 INIT_WORK(&fbi->task, sa1100fb_task);
1448 init_MUTEX(&fbi->ctrlr_sem); 1448 init_MUTEX(&fbi->ctrlr_sem);
1449 1449
1450 return fbi; 1450 return fbi;
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index 6990ab11cd06..5a99669232ce 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -350,18 +350,23 @@ struct all_info {
350 struct tcx_par par; 350 struct tcx_par par;
351}; 351};
352 352
353static void tcx_unmap_regs(struct all_info *all) 353static void tcx_unmap_regs(struct of_device *op, struct all_info *all)
354{ 354{
355 if (all->par.tec) 355 if (all->par.tec)
356 of_iounmap(all->par.tec, sizeof(struct tcx_tec)); 356 of_iounmap(&op->resource[7],
357 all->par.tec, sizeof(struct tcx_tec));
357 if (all->par.thc) 358 if (all->par.thc)
358 of_iounmap(all->par.thc, sizeof(struct tcx_thc)); 359 of_iounmap(&op->resource[9],
360 all->par.thc, sizeof(struct tcx_thc));
359 if (all->par.bt) 361 if (all->par.bt)
360 of_iounmap(all->par.bt, sizeof(struct bt_regs)); 362 of_iounmap(&op->resource[8],
363 all->par.bt, sizeof(struct bt_regs));
361 if (all->par.cplane) 364 if (all->par.cplane)
362 of_iounmap(all->par.cplane, all->par.fbsize * sizeof(u32)); 365 of_iounmap(&op->resource[4],
366 all->par.cplane, all->par.fbsize * sizeof(u32));
363 if (all->info.screen_base) 367 if (all->info.screen_base)
364 of_iounmap(all->info.screen_base, all->par.fbsize); 368 of_iounmap(&op->resource[0],
369 all->info.screen_base, all->par.fbsize);
365} 370}
366 371
367static int __devinit tcx_init_one(struct of_device *op) 372static int __devinit tcx_init_one(struct of_device *op)
@@ -398,7 +403,7 @@ static int __devinit tcx_init_one(struct of_device *op)
398 all->par.fbsize, "tcx ram"); 403 all->par.fbsize, "tcx ram");
399 if (!all->par.tec || !all->par.thc || 404 if (!all->par.tec || !all->par.thc ||
400 !all->par.bt || !all->info.screen_base) { 405 !all->par.bt || !all->info.screen_base) {
401 tcx_unmap_regs(all); 406 tcx_unmap_regs(op, all);
402 kfree(all); 407 kfree(all);
403 return -ENOMEM; 408 return -ENOMEM;
404 } 409 }
@@ -409,7 +414,7 @@ static int __devinit tcx_init_one(struct of_device *op)
409 all->par.fbsize * sizeof(u32), 414 all->par.fbsize * sizeof(u32),
410 "tcx cplane"); 415 "tcx cplane");
411 if (!all->par.cplane) { 416 if (!all->par.cplane) {
412 tcx_unmap_regs(all); 417 tcx_unmap_regs(op, all);
413 kfree(all); 418 kfree(all);
414 return -ENOMEM; 419 return -ENOMEM;
415 } 420 }
@@ -461,7 +466,7 @@ static int __devinit tcx_init_one(struct of_device *op)
461 tcx_blank(FB_BLANK_UNBLANK, &all->info); 466 tcx_blank(FB_BLANK_UNBLANK, &all->info);
462 467
463 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 468 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
464 tcx_unmap_regs(all); 469 tcx_unmap_regs(op, all);
465 kfree(all); 470 kfree(all);
466 return -ENOMEM; 471 return -ENOMEM;
467 } 472 }
@@ -472,7 +477,7 @@ static int __devinit tcx_init_one(struct of_device *op)
472 err = register_framebuffer(&all->info); 477 err = register_framebuffer(&all->info);
473 if (err < 0) { 478 if (err < 0) {
474 fb_dealloc_cmap(&all->info.cmap); 479 fb_dealloc_cmap(&all->info.cmap);
475 tcx_unmap_regs(all); 480 tcx_unmap_regs(op, all);
476 kfree(all); 481 kfree(all);
477 return err; 482 return err;
478 } 483 }
@@ -495,18 +500,18 @@ static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id
495 return tcx_init_one(op); 500 return tcx_init_one(op);
496} 501}
497 502
498static int __devexit tcx_remove(struct of_device *dev) 503static int __devexit tcx_remove(struct of_device *op)
499{ 504{
500 struct all_info *all = dev_get_drvdata(&dev->dev); 505 struct all_info *all = dev_get_drvdata(&op->dev);
501 506
502 unregister_framebuffer(&all->info); 507 unregister_framebuffer(&all->info);
503 fb_dealloc_cmap(&all->info.cmap); 508 fb_dealloc_cmap(&all->info.cmap);
504 509
505 tcx_unmap_regs(all); 510 tcx_unmap_regs(op, all);
506 511
507 kfree(all); 512 kfree(all);
508 513
509 dev_set_drvdata(&dev->dev, NULL); 514 dev_set_drvdata(&op->dev, NULL);
510 515
511 return 0; 516 return 0;
512} 517}