Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67387
b: refs/heads/master
c: 4c2a54b
h: refs/heads/master
i:
  67385: d0649c9
  67383: 4ebce46
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Sep 22, 2007
1 parent fd17287 commit 2e250f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8fd7675c092f79f240246c76728477ec4e7f7f09
refs/heads/master: 4c2a54b09ba35a409afc34bd331a57a994921664
48 changes: 26 additions & 22 deletions trunk/drivers/video/platinumfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* more details.
*/

#undef DEBUG

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
Expand Down Expand Up @@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(struct of_device* odev,
volatile __u8 *fbuffer;
int bank0, bank1, bank2, bank3, rc;

printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n");
dev_info(&odev->dev, "Found Apple Platinum video hardware\n");

info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
if (info == NULL)
if (info == NULL) {
dev_err(&odev->dev, "Failed to allocate fbdev !\n");
return -ENOMEM;
}
pinfo = info->par;

if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) {
printk(KERN_ERR "platinumfb: Can't get resources\n");
framebuffer_release(info);
return -ENXIO;
}
if (!request_mem_region(pinfo->rsrc_reg.start,
pinfo->rsrc_reg.start -
pinfo->rsrc_reg.end + 1,
"platinumfb registers")) {
dev_err(&odev->dev, "Can't get resources\n");
framebuffer_release(info);
return -ENXIO;
}
dev_dbg(&odev->dev, " registers : 0x%llx...0x%llx\n",
(unsigned long long)pinfo->rsrc_reg.start,
(unsigned long long)pinfo->rsrc_reg.end);
dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n",
(unsigned long long)pinfo->rsrc_fb.start,
(unsigned long long)pinfo->rsrc_fb.end);

/* Do not try to request register space, they overlap with the
* northbridge and that can fail. Only request framebuffer
*/
if (!request_mem_region(pinfo->rsrc_fb.start,
pinfo->rsrc_fb.start
- pinfo->rsrc_fb.end + 1,
pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1,
"platinumfb framebuffer")) {
release_mem_region(pinfo->rsrc_reg.start,
pinfo->rsrc_reg.end -
pinfo->rsrc_reg.start + 1);
printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
framebuffer_release(info);
return -ENXIO;
}
Expand Down Expand Up @@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(struct of_device* odev,
bank2 = fbuffer[0x200000] == 0x56;
bank3 = fbuffer[0x300000] == 0x78;
pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", (int) (pinfo->total_vram / 1024 / 1024),
printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n",
(unsigned int) (pinfo->total_vram / 1024 / 1024),
bank3, bank2, bank1, bank0);

/*
Expand Down Expand Up @@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(struct of_device* odev)
unregister_framebuffer (info);

/* Unmap frame buffer and registers */
iounmap(pinfo->frame_buffer);
iounmap(pinfo->platinum_regs);
iounmap(pinfo->cmap_regs);

release_mem_region(pinfo->rsrc_fb.start,
pinfo->rsrc_fb.end -
pinfo->rsrc_fb.start + 1);
release_mem_region(pinfo->rsrc_reg.start,
pinfo->rsrc_reg.end -
pinfo->rsrc_reg.start + 1);
iounmap(pinfo->frame_buffer);
iounmap(pinfo->platinum_regs);

release_mem_region(pinfo->cmap_regs_phys, 0x1000);
iounmap(pinfo->cmap_regs);

framebuffer_release(info);

Expand Down

0 comments on commit 2e250f5

Please sign in to comment.