Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284874
b: refs/heads/master
c: 05342c0
h: refs/heads/master
v: v3
  • Loading branch information
Timur Tabi authored and Florian Tobias Schandinat committed Jan 3, 2012
1 parent e215bd4 commit 311998e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 37 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: e09a8c3a42f4c90d300678b198410e6fcc8eddb6
refs/heads/master: 05342c0bdfd519873462e04ad81be07c9cd3c1e1
47 changes: 11 additions & 36 deletions trunk/drivers/video/fsl-diu-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,37 +461,6 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
return diu_ops.valid_monitor_port(port);
}

/**
* fsl_diu_alloc - allocate memory for the DIU
* @size: number of bytes to allocate
* @param: returned physical address of memory
*
* This function allocates a physically-contiguous block of memory.
*/
static void *fsl_diu_alloc(size_t size, phys_addr_t *phys)
{
void *virt;

virt = alloc_pages_exact(size, GFP_DMA | __GFP_ZERO);
if (virt)
*phys = virt_to_phys(virt);

return virt;
}

/**
* fsl_diu_free - release DIU memory
* @virt: pointer returned by fsl_diu_alloc()
* @size: number of bytes allocated by fsl_diu_alloc()
*
* This function releases memory allocated by fsl_diu_alloc().
*/
static void fsl_diu_free(void *virt, size_t size)
{
if (virt && size)
free_pages_exact(virt, size);
}

/*
* Workaround for failed writing desc register of planes.
* Needed with MPC5121 DIU rev 2.0 silicon.
Expand Down Expand Up @@ -875,16 +844,17 @@ static void update_lcdc(struct fb_info *info)

static int map_video_memory(struct fb_info *info)
{
phys_addr_t phys;
u32 smem_len = info->fix.line_length * info->var.yres_virtual;
void *p;

info->screen_base = fsl_diu_alloc(smem_len, &phys);
if (info->screen_base == NULL) {
p = alloc_pages_exact(smem_len, GFP_DMA | __GFP_ZERO);
if (!p) {
dev_err(info->dev, "unable to allocate fb memory\n");
return -ENOMEM;
}
mutex_lock(&info->mm_lock);
info->fix.smem_start = (unsigned long) phys;
info->screen_base = p;
info->fix.smem_start = virt_to_phys(info->screen_base);
info->fix.smem_len = smem_len;
mutex_unlock(&info->mm_lock);
info->screen_size = info->fix.smem_len;
Expand All @@ -894,12 +864,17 @@ static int map_video_memory(struct fb_info *info)

static void unmap_video_memory(struct fb_info *info)
{
fsl_diu_free(info->screen_base, info->fix.smem_len);
void *p = info->screen_base;
size_t l = info->fix.smem_len;

mutex_lock(&info->mm_lock);
info->screen_base = NULL;
info->fix.smem_start = 0;
info->fix.smem_len = 0;
mutex_unlock(&info->mm_lock);

if (p)
free_pages_exact(p, l);
}

/*
Expand Down

0 comments on commit 311998e

Please sign in to comment.