Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67587
b: refs/heads/master
c: 287e5d6
h: refs/heads/master
i:
  67585: a070449
  67583: 7d723b3
v: v3
  • Loading branch information
Grant Likely authored and Paul Mackerras committed Oct 12, 2007
1 parent b163791 commit 40f5e47
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 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: b4d6a7268fc754eefb196cabc0ccfa2e97022af2
refs/heads/master: 287e5d6fcccfa38b953cebe307e1ddfd32363355
22 changes: 16 additions & 6 deletions trunk/drivers/video/xilinxfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct xilinxfb_drvdata {

void *fb_virt; /* virt. address of the frame buffer */
dma_addr_t fb_phys; /* phys. address of the frame buffer */
int fb_alloced; /* Flag, was the fb memory alloced? */

u32 reg_ctrl_default;

Expand Down Expand Up @@ -235,8 +236,15 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
}

/* Allocate the framebuffer memory */
drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
&drvdata->fb_phys, GFP_KERNEL);
if (pdata->fb_phys) {
drvdata->fb_phys = pdata->fb_phys;
drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize);
} else {
drvdata->fb_alloced = 1;
drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
&drvdata->fb_phys, GFP_KERNEL);
}

if (!drvdata->fb_virt) {
dev_err(dev, "Could not allocate frame buffer memory\n");
rc = -ENOMEM;
Expand Down Expand Up @@ -300,8 +308,9 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
fb_dealloc_cmap(&drvdata->info.cmap);

err_cmap:
dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
drvdata->fb_phys);
if (drvdata->fb_alloced)
dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
drvdata->fb_phys);
/* Turn off the display */
xilinx_fb_out_be32(drvdata, REG_CTRL, 0);

Expand Down Expand Up @@ -330,8 +339,9 @@ static int xilinxfb_release(struct device *dev)

fb_dealloc_cmap(&drvdata->info.cmap);

dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
drvdata->fb_virt, drvdata->fb_phys);
if (drvdata->fb_alloced)
dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
drvdata->fb_virt, drvdata->fb_phys);

/* Turn off the display */
xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/xilinxfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ struct xilinxfb_platform_data {
u32 screen_width_mm;
u32 xres, yres; /* resolution of screen in pixels */
u32 xvirt, yvirt; /* resolution of memory buffer */

/* Physical address of framebuffer memory; If non-zero, driver
* will use provided memory address instead of allocating one from
* the consistent pool. */
u32 fb_phys;
};

#endif /* __XILINXFB_H__ */

0 comments on commit 40f5e47

Please sign in to comment.