diff options
author | Jaya Kumar <jayakumar.lkml@gmail.com> | 2008-03-19 20:01:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-19 21:53:37 -0400 |
commit | de7c6d15e354bc94a846f03749819768c331280a (patch) | |
tree | c917a58576c73d8deb218c1e09858ebaba195697 /drivers/video/fb_defio.c | |
parent | 9fedc9f1b18f6b931c3b695d7280f17fc308309b (diff) |
fbdev: defio and Metronomefb
Implement support for the E-Ink Metronome controller. It provides an mmapable
interface to the controller using defio support. It was tested with a gumstix
pxa255 with Vizplex media using Xfbdev and various X clients such as xeyes,
xpdf, xloadimage.
This patch also fixes the following bug: Defio would cause a hang on write
access to the framebuffer as the page fault would be called ad-infinitum. It
fixes fb_defio by setting the mapping to be used by page_mkclean.
Signed-off-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/fb_defio.c')
-rw-r--r-- | drivers/video/fb_defio.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 0f8cfb988c90..24843fdd5395 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2006 Jaya Kumar | 4 | * Copyright (C) 2006 Jaya Kumar |
5 | * | 5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | 6 | * This file is subject to the terms and conditions of the GNU General Public |
7 | * License. See the file COPYING in the main directory of this archive | 7 | * License. See the file COPYING in the main directory of this archive |
8 | * for more details. | 8 | * for more details. |
9 | */ | 9 | */ |
10 | 10 | ||
@@ -31,7 +31,7 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
31 | unsigned long offset; | 31 | unsigned long offset; |
32 | struct page *page; | 32 | struct page *page; |
33 | struct fb_info *info = vma->vm_private_data; | 33 | struct fb_info *info = vma->vm_private_data; |
34 | /* info->screen_base is in System RAM */ | 34 | /* info->screen_base is virtual memory */ |
35 | void *screen_base = (void __force *) info->screen_base; | 35 | void *screen_base = (void __force *) info->screen_base; |
36 | 36 | ||
37 | offset = vmf->pgoff << PAGE_SHIFT; | 37 | offset = vmf->pgoff << PAGE_SHIFT; |
@@ -43,6 +43,15 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
43 | return VM_FAULT_SIGBUS; | 43 | return VM_FAULT_SIGBUS; |
44 | 44 | ||
45 | get_page(page); | 45 | get_page(page); |
46 | |||
47 | if (vma->vm_file) | ||
48 | page->mapping = vma->vm_file->f_mapping; | ||
49 | else | ||
50 | printk(KERN_ERR "no mapping available\n"); | ||
51 | |||
52 | BUG_ON(!page->mapping); | ||
53 | page->index = vmf->pgoff; | ||
54 | |||
46 | vmf->page = page; | 55 | vmf->page = page; |
47 | return 0; | 56 | return 0; |
48 | } | 57 | } |
@@ -138,11 +147,20 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_init); | |||
138 | 147 | ||
139 | void fb_deferred_io_cleanup(struct fb_info *info) | 148 | void fb_deferred_io_cleanup(struct fb_info *info) |
140 | { | 149 | { |
150 | void *screen_base = (void __force *) info->screen_base; | ||
141 | struct fb_deferred_io *fbdefio = info->fbdefio; | 151 | struct fb_deferred_io *fbdefio = info->fbdefio; |
152 | struct page *page; | ||
153 | int i; | ||
142 | 154 | ||
143 | BUG_ON(!fbdefio); | 155 | BUG_ON(!fbdefio); |
144 | cancel_delayed_work(&info->deferred_work); | 156 | cancel_delayed_work(&info->deferred_work); |
145 | flush_scheduled_work(); | 157 | flush_scheduled_work(); |
158 | |||
159 | /* clear out the mapping that we setup */ | ||
160 | for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { | ||
161 | page = vmalloc_to_page(screen_base + i); | ||
162 | page->mapping = NULL; | ||
163 | } | ||
146 | } | 164 | } |
147 | EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); | 165 | EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); |
148 | 166 | ||