Skip to contentSkip to conversation

fbdev: defio and Metronomefb v2

RFC New Jaya Kumar 1 participant 1 message Nov 25, 2007

Subsystems (2)
lore
Share & tools
lore

Jaya Kumar

author
#0 lore raw

RFC 1/1 fbdev: defio and Metronomefb v2

Hi Tony, Geert, fbdev,

Appended is an updated version of the metronomefb code.

The patch is still against 2.6.22.10 since I still haven't worked on getting mainline on to gumstix connex. The fixes to metronomefb since last time are:

- fixed xfbdev/metronomefb grayscale handling.
- added a doc for how xfbdev uses cmap
- switched to using gpio interrupt for ready
- added metronomefb doc

Still a lot of stuff to do, but please let me know if it looks okay so far.

Thanks,
jaya

---

 Documentation/fb/cmap_xfbdev.txt |   52 ++
 Documentation/fb/metronomefb.txt |   38 +
 drivers/video/Kconfig            |   14 
 drivers/video/Makefile           |    1 
 drivers/video/fb_defio.c         |   22 
 drivers/video/metronomefb.c      |  976 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 1101 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 +976 -0

976 lines not on this page · raw message

Documentation/fb/cmap_xfbdev.txt +52 -0

52 lines not on this page · raw message

Documentation/fb/metronomefb.txt +38 -0
diff -uprN -X linux-2.6.22.10-vanilla/Documentation/dontdiff linux-2.6.22.10-vanilla/Documentation/fb/metronomefb.txt linux-2.6.22.10/Documentation/fb/metronomefb.txt
@@ -0,0 +1,38 @@
+			Metronomefb
+			-----------
+Maintained by Jaya Kumar <jayakumar.lkml.gmail.com>
+Last revised: Nov 20, 2007
+
+Metronomefb is a driver for the Metronome display controller. The controller
+is from E-Ink Corporation. It is intended to be used to drive the E-Ink
+Vizplex display media. E-Ink hosts some details of this controller and the
+display media here http://www.e-ink.com/products/matrix/metronome.html .
+
+Metronome is interfaced to the host CPU through the AMLCD interface. The
+host CPU generates the control information and the image in a framebuffer
+which is then delivered to the AMLCD interface by a host specific method.
+Currently, that's implemented for the PXA's LCDC controller. The display and
+error status are each pulled through individual GPIOs.
+
+Metronomefb was written for the PXA255/gumstix/lyre combination and
+therefore currently has board set specific code in it. If other boards based on
+other architectures are available, then the host specific code can be separated
+and abstracted out.
+
+Metronomefb requires waveform information which is delivered via the AMLCD
+interface to the metronome controller. The waveform information is expected to
+be delivered from userspace via the firmware class interface. The waveform file
+can be compressed as long as your udev or hotplug script is aware of the need
+to uncompress it before delivering it. metronomefb will ask for waveform.wbf
+which would typically go into /lib/firmware/waveform.wbf depending on your
+udev/hotplug setup. I have only tested with a single waveform file which was
+originally labeled 23P01201_60_WT0107_MTC. I do not know what it stands for.
+Caution should be exercised when manipulating the waveform as there may be
+a possibility that it could have some permanent effects on the display media.
+I neither have access to nor know exactly what the waveform does in terms of
+the physical media.
+
+Metronomefb uses the deferred IO interface so that it can provide a memory
+mappable frame buffer. It has been tested with tinyx (Xfbdev). It is known
+to work at this time with xeyes, xclock, xloadimage, xpdf.
+

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/