Commit b0c8809e authored by Russell King's avatar Russell King

[ARM] Add DMA mmap support for SA1100/PXA framebuffer drivers.

Since the framebuffers are allocated via dma_alloc_writecombine() we
should use the DMA mmap interface to map these buffers.
Signed-off-by: default avatarRussell King <rmk@arm.linux.org.uk>
parent b4bbc134
...@@ -394,6 +394,20 @@ static int pxafb_blank(int blank, struct fb_info *info) ...@@ -394,6 +394,20 @@ static int pxafb_blank(int blank, struct fb_info *info)
return 0; return 0;
} }
static int pxafb_mmap(struct fb_info *info, struct file *file,
struct vm_area_struct *vma)
{
struct pxafb_info *fbi = (struct pxafb_info *)info;
unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
if (off < info->fix.smem_len) {
vma->vm_pgoff += 1;
return dma_mmap_writecombine(fbi->dev, vma, fbi->map_cpu,
fbi->map_dma, fbi->map_size);
}
return -EINVAL;
}
static struct fb_ops pxafb_ops = { static struct fb_ops pxafb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_check_var = pxafb_check_var, .fb_check_var = pxafb_check_var,
...@@ -404,6 +418,7 @@ static struct fb_ops pxafb_ops = { ...@@ -404,6 +418,7 @@ static struct fb_ops pxafb_ops = {
.fb_imageblit = cfb_imageblit, .fb_imageblit = cfb_imageblit,
.fb_blank = pxafb_blank, .fb_blank = pxafb_blank,
.fb_cursor = soft_cursor, .fb_cursor = soft_cursor,
.fb_mmap = pxafb_mmap,
}; };
/* /*
......
...@@ -814,6 +814,33 @@ static int sa1100fb_blank(int blank, struct fb_info *info) ...@@ -814,6 +814,33 @@ static int sa1100fb_blank(int blank, struct fb_info *info)
return 0; return 0;
} }
static int sa1100fb_mmap(struct fb_info *info, struct file *file,
struct vm_area_struct *vma)
{
struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;
unsigned long start, len, off = vma->vm_pgoff << PAGE_SHIFT;
if (off < info->fix.smem_len) {
vma->vm_pgoff += 1; /* skip over the palette */
return dma_mmap_writecombine(fbi->dev, vma, fbi->map_cpu,
fbi->map_dma, fbi->map_size);
}
start = info->fix.mmio_start;
len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len);
if ((vma->vm_end - vma->vm_start + off) > len)
return -EINVAL;
off += start & PAGE_MASK;
vma->vm_pgoff = off >> PAGE_SHIFT;
vma->vm_flags |= VM_IO;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
return io_remap_page_range(vma, vma->vm_start, off,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
}
static struct fb_ops sa1100fb_ops = { static struct fb_ops sa1100fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_check_var = sa1100fb_check_var, .fb_check_var = sa1100fb_check_var,
...@@ -825,6 +852,7 @@ static struct fb_ops sa1100fb_ops = { ...@@ -825,6 +852,7 @@ static struct fb_ops sa1100fb_ops = {
.fb_imageblit = cfb_imageblit, .fb_imageblit = cfb_imageblit,
.fb_blank = sa1100fb_blank, .fb_blank = sa1100fb_blank,
.fb_cursor = soft_cursor, .fb_cursor = soft_cursor,
.fb_mmap = sa1100fb_mmap,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment