Skip to contentSkip to conversation

fbdev: defio and Metronomefb

RFC In review Jaya Kumar 2 participants 3 messages Nov 3, 2007 – Nov 4, 2007

Subsystems (2)
lore
Share & tools
lore

Jaya Kumar

author
#0 lore raw

RFC 1/1 fbdev: defio and Metronomefb

Hi Tony, Peter, Hugh, fbdev, mm, lkml,

Appended is my attempt at fixing up the problems identified in defio and adding a driver, metronomefb that supports Xfbdev with X11 apps on a new E-Ink controller.

I would be grateful for a review of the defio changes.

The patch is against 2.6.22.10 since that's the kernel that I've managed to get running on this board. I will update once I've gotten something more recent running. I ran xeyes, xclock and nothing panic-ed.

The metronomefb code is still early. I intend to do the following:
- fix xfbdev/metronomefb grayscale handling
- switch to using gpio interrupt for rdy
- support other resolutions for alternative display panels
- expose led and panel border selection through led api
- explore bitmap for page list to optimize and avoid duplicate page copies and maybe (depending on how the xfbdev issues go)
- change from defio on vm fbmem to defio direct on metromem img

I'm pausing here to see if things are okay so far. I would welcome any feedback.

Thanks,
jaya

ps: if anyone is curious, here's how the driver and E-Ink display look during use. http://www.youtube.com/watch?v=Or3R3Q8oyuE [ Apologies for Flash ]

---

 Kconfig       |   14 
 Makefile      |    1 
 fb_defio.c    |   22 +
 metronomefb.c |  974 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1009 insertions(+), 2 deletions(-)
drivers/video/fb_defio.c +20 -2
diff -uprN -X linux-2.6.22.10-vanilla/Documentation/dontdiff linux-2.6.22.10-vanilla/drivers/video/fb_defio.c linux-2.6.22.10/drivers/video/fb_defio.c
@@ -4,7 +4,7 @@
  *  Copyright (C) 2006 Jaya Kumar
  *
  * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file COPYING in the main directory of this archive
+ * License. See the file COPYING in the main directory of this archive
  * for more details.
  */
 
@@ -32,7 +32,7 @@ static struct page* fb_deferred_io_nopag
 	unsigned long offset;
 	struct page *page;
 	struct fb_info *info = vma->vm_private_data;
-	/* info->screen_base is in System RAM */
+	/* info->screen_base is virtual memory */
 	void *screen_base = (void __force *) info->screen_base;
 
 	offset = (vaddr - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
@@ -44,6 +44,15 @@ static struct page* fb_deferred_io_nopag
 		return NOPAGE_OOM;
 
 	get_page(page);
+
+	if (vma->vm_file)
+		page->mapping = vma->vm_file->f_mapping;
+	else
+		printk(KERN_ERR "no mapping available\n");
+
+	BUG_ON(!page->mapping);
+	page->index = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
+
 	if (type)
 		*type = VM_FAULT_MINOR;
 	return page;
@@ -140,11 +149,20 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_init);
 
 void fb_deferred_io_cleanup(struct fb_info *info)
 {
+	void *screen_base = (void __force *) info->screen_base;
 	struct fb_deferred_io *fbdefio = info->fbdefio;
+	struct page *page;
+	int i;
 
 	BUG_ON(!fbdefio);
 	cancel_delayed_work(&info->deferred_work);
 	flush_scheduled_work();
+
+	/* clear out the mapping that we setup */
+	for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
+		page = vmalloc_to_page(screen_base + i);
+		page->mapping = NULL;
+	}
 }
 EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup);
 
drivers/video/Kconfig +14 -0
diff -uprN -X linux-2.6.22.10-vanilla/Documentation/dontdiff linux-2.6.22.10-vanilla/drivers/video/Kconfig linux-2.6.22.10/drivers/video/Kconfig
@@ -1829,6 +1829,20 @@ config FB_XILINX
 	  framebuffer. ML300 carries a 640*480 LCD display on the board,
 	  ML403 uses a standard DB15 VGA connector.
 
+config FB_METRONOME
+       tristate "Metronome display controller support"
+       depends on FB && ARCH_PXA && MMU
+       select FB_SYS_FILLRECT
+       select FB_SYS_COPYAREA
+       select FB_SYS_IMAGEBLIT
+       select FB_SYS_FOPS
+       select FB_DEFERRED_IO
+       help
+         This enables support for the Metronome display controller. Tested
+         with an E-Ink 800x600 display and Gumstix Connex through an AMLCD 
+         interface. Please read <file:Documentation/fb/metronomefb.txt> 
+         for more information.
+
 config FB_VIRTUAL
 	tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
 	depends on FB
drivers/video/Makefile +1 -0
diff -uprN -X linux-2.6.22.10-vanilla/Documentation/dontdiff linux-2.6.22.10-vanilla/drivers/video/Makefile linux-2.6.22.10/drivers/video/Makefile
@@ -113,6 +113,7 @@ obj-$(CONFIG_FB_IBM_GXT4500)	  += gxt450
 obj-$(CONFIG_FB_PS3)		  += ps3fb.o
 obj-$(CONFIG_FB_SM501)            += sm501fb.o
 obj-$(CONFIG_FB_XILINX)           += xilinxfb.o
+obj-$(CONFIG_FB_METRONOME)        += metronomefb.o
 
 # Platform or fallback drivers go here
 obj-$(CONFIG_FB_VESA)             += vesafb.o
drivers/video/metronomefb.c +974 -0

974 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 1 line · Jaya Kumar

+ interface. Please read <file:Documentation/fb/metronomefb.txt>

Documentation/fb/metronomefb.txt is missing?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#2 lore raw
Quoted 4 lines · Geert Uytterhoeven
Quoted 1 line · Jaya Kumar

+ interface. Please read <file:Documentation/fb/metronomefb.txt>

Documentation/fb/metronomefb.txt is missing?

Oops. I forgot to write that document. Ok, will do.

Thanks,
jaya

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>