Skip to contentSkip to conversation

pxafb, am200epd, gumstix, metronomefb secondary framebuffer

RFC New Jaya Kumar 1 participant 1 message May 24, 2008

Subsystems (4)
lore
Share & tools
lore

Jaya Kumar

author
#0 lore raw

RFC 1/1 pxafb, am200epd, gumstix, metronomefb secondary framebuffer

Hi Eric, fbdev,

Sorry for my slow progress on solving the pxafb/am200epd shared framebuffer issue. I've finally managed to get things working now and am feeling like this is a good point to stop and ask for your feedback. There is still some cleanup to be done but I'd like to find out if I'm heading in the right direction.

My changes are as follows:

- removed drivers/video/am200epd.c since it was not the right way to implement a board support driver.
- added a new arch/arm/mach-pxa/am200epd.c driver that uses the generic GPIO API rather than manipulating GAFR/GPSR/etc.
- changes to arch/arm/mach-pxa/gumstix.c to support MFP to allow am200epd to use generic GPIO.
- changed metronomefb/am200epd/pxafb to allow for shared framebuffer rather than duplicate control of LCDC.
- callbacks share_video_mem/unshare to allow am200epd to know when pxafb has allocated and will free the framebuffer. am200epd handles refcounting of pxafb so that it can't be unloaded underneath it. I was not able to implement an equivalent using registered_fb[] because there isn't a way to identify the fb_info and to get notification of the framebuffer state.
- pxafb changes to use __devinit/exit for probe functions and __init for init/exit functions. This is needed so that it can work properly when built as a module.
- exports pxa_device_fb so that am200epd can be modular.
- cleanup am200epd board functions so that it doesn't refer to any pxa specific registers or descriptors.
- cleanup to use dev_dbg instead of printk

I would be grateful for your feedback and advice on this.

Thanks,
jaya

---

 b/arch/arm/mach-pxa/Kconfig             |   14 +
 b/arch/arm/mach-pxa/Makefile            |    1 
 b/arch/arm/mach-pxa/am200epd.c          |  347 ++++++++++++++++++++++++++++++++
 b/arch/arm/mach-pxa/devices.c           |    3 
 b/arch/arm/mach-pxa/gumstix.c           |   79 +++++--
 b/arch/arm/mach-pxa/pxa25x.c            |   32 ++
 b/drivers/video/Kconfig                 |   20 -
 b/drivers/video/Makefile                |    1 
 b/drivers/video/metronomefb.c           |  270 +++++++++++++-----------
 b/drivers/video/pxafb.c                 |  110 ++++++++--
 b/include/asm-arm/arch-pxa/mfp-pxa25x.h |    1 
 b/include/asm-arm/arch-pxa/pxafb.h      |    9 
 b/include/video/metronomefb.h           |   13 -
 drivers/video/am200epd.c                |  295 ---------------------------
 14 files changed, 721 insertions(+), 474 deletions(-)
arch/arm/mach-pxa/Kconfig +14 -0
index 5da7a68..423ae1e 100644
@@ -179,6 +179,20 @@ endchoice
 
 endif
 
+if MACH_GUMSTIX_F
+choice
+	prompt "Select base board for Gumstix board"
+config MACH_AM200EPD
+	tristate "Enable AM200EPD board support"
+	select FB_METRONOME
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select FB_SYS_FOPS
+	select FB_DEFERRED_IO
+endchoice
+endif
+
 
 if MACH_TRIZEPS4
 
arch/arm/mach-pxa/Makefile +1 -0
index 6a83085..ba7f52e 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_LEDS)		+= $(led-y)
 obj-$(CONFIG_PM)		+= pm.o sleep.o standby.o
 obj-$(CONFIG_CPU_FREQ)		+= cpu-pxa.o
 obj-$(CONFIG_PXA_SSP)		+= ssp.o
+obj-$(CONFIG_MACH_AM200EPD)	+= am200epd.o
 
 ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o
arch/arm/mach-pxa/am200epd.c new file +347 -0

347 lines not on this page · raw message

arch/arm/mach-pxa/devices.c +3 -0
index d6c05b6..fe0eb07 100644
@@ -127,9 +127,12 @@ struct platform_device pxa_device_fb = {
 	.num_resources	= ARRAY_SIZE(pxafb_resources),
 	.resource	= pxafb_resources,
 };
+EXPORT_SYMBOL_GPL(pxa_device_fb);
 
 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
 {
+	if (!info->clkdev)
+		info->clkdev = &pxa_device_fb.dev;
 	pxa_register_device(&pxa_device_fb, info);
 }
 
arch/arm/mach-pxa/gumstix.c +63 -16

118 lines not on this page · raw message

arch/arm/mach-pxa/pxa25x.c +32 -0
index d9b5450..5a44278 100644
@@ -22,6 +22,7 @@
 #include <linux/platform_device.h>
 #include <linux/suspend.h>
 #include <linux/sysdev.h>
+#include <linux/delay.h>
 
 #include <asm/hardware.h>
 #include <asm/arch/irqs.h>
@@ -117,7 +118,38 @@ static struct clk pxa25x_hwuart_clk =
 	INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
 ;
 
+static void clk_32k_enable(struct clk *clk)
+{
+	int timeout = 500;
+
+	OSCC |= OSCC_OON;
+	do {
+		if (OSCC & OSCC_OOK)
+			break;
+		udelay(1);
+	} while (--timeout);
+	if (!timeout)
+		printk(KERN_ERR "gumstix: failed to start 32kHz clock\n");
+}
+
+static void clk_32k_disable(struct clk *clk)
+{
+	OSCC &= ~OSCC_OON;
+}
+
+static const struct clkops clk_32k_ops = {
+	.enable		= clk_32k_enable,
+	.disable	= clk_32k_disable,
+};
+
 static struct clk pxa25x_clks[] = {
+	{
+		.name           = "CLK_32K",
+		.ops            = &clk_32k_ops,
+		.rate           = 32000,
+		.delay          = 70,
+	},
+
 	INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
 	INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
 	INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
drivers/video/Kconfig +2 -18
index bb1dada..11448c3 100644
@@ -169,9 +169,8 @@ config FB_SYS_FOPS
        default n
 
 config FB_DEFERRED_IO
-	bool
-	depends on FB
-	default y
+       bool
+       depends on FB
 
 config FB_METRONOME
 	tristate
@@ -715,7 +714,6 @@ config FB_N411
        select FB_SYS_COPYAREA
        select FB_SYS_IMAGEBLIT
        select FB_SYS_FOPS
-       select FB_DEFERRED_IO
        select FB_HECUBA
        help
          This enables support for the Apollo display controller in its
@@ -1940,19 +1938,6 @@ config FB_XILINX
 	  framebuffer. ML300 carries a 640*480 LCD display on the board,
 	  ML403 uses a standard DB15 VGA connector.
 
-config FB_AM200EPD
-       tristate "AM-200 E-Ink EPD devkit 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
-       select FB_METRONOME
-       help
-         This enables support for the Metronome display controller used on
-         the E-Ink AM-200 EPD devkit.
-
 config FB_VIRTUAL
 	tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
 	depends on FB
@@ -1983,7 +1968,6 @@ config XEN_FBDEV_FRONTEND
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT
 	select FB_SYS_FOPS
-	select FB_DEFERRED_IO
 	default y
 	help
 	  This driver implements the front-end of the Xen virtual
drivers/video/Makefile +0 -1
index 04bca35..80d5842 100644
@@ -29,7 +29,6 @@ obj-$(CONFIG_FB_DEFERRED_IO)   += fb_defio.o
 
 # Hardware specific drivers go first
 obj-$(CONFIG_FB_AMIGA)            += amifb.o c2p.o
-obj-$(CONFIG_FB_AM200EPD)         += am200epd.o
 obj-$(CONFIG_FB_ARC)              += arcfb.o
 obj-$(CONFIG_FB_CLPS711X)         += clps711xfb.o
 obj-$(CONFIG_FB_CYBER2000)        += cyber2000fb.o
drivers/video/am200epd.c deleted +0 -295

295 lines not on this page · raw message

drivers/video/metronomefb.c +151 -119

480 lines not on this page · raw message

drivers/video/pxafb.c +91 -19

268 lines not on this page · raw message

include/asm-arm/arch-pxa/mfp-pxa25x.h +1 -0
index 0499323..6c82a74 100644
@@ -79,6 +79,7 @@
 #define GPIO43_HWUART_TXD	MFP_CFG_OUT(GPIO43, AF3, DRIVE_HIGH)
 #define GPIO44_HWUART_CTS	MFP_CFG_IN(GPIO44, AF3)
 #define GPIO45_HWUART_RTS	MFP_CFG_OUT(GPIO45, AF3, DRIVE_HIGH)
+#define GPIO45_HWUART_RTSL	MFP_CFG_OUT(GPIO45, AF3, DRIVE_LOW)
 #define GPIO48_HWUART_TXD	MFP_CFG_OUT(GPIO48, AF1, DRIVE_HIGH)
 #define GPIO49_HWUART_RXD	MFP_CFG_IN(GPIO49, AF1)
 #define GPIO50_HWUART_CTS	MFP_CFG_IN(GPIO50, AF1)
include/asm-arm/arch-pxa/pxafb.h +9 -0
index bbd2239..c703633 100644
@@ -138,9 +138,18 @@ struct pxafb_mach_info {
 	 * All other bits in LCCR4 should be left alone.
 	 */
 	u_int		lccr4;
+	unsigned int	custom_xfer_div; /* divides the pixel transfer */
+	/* size of extra mem needed for secondary driver */
+	unsigned int	extra_video_mem;
+	void		*extra_data; /* extra data for secondary */
 	void (*pxafb_backlight_power)(int);
 	void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
 	void (*smart_update)(struct fb_info *);
+	/* share_video_mem allows client drivers to get our framebuffer */
+	int (*share_video_mem)(unsigned char *, dma_addr_t, struct module *,
+				void *);
+	void (*unshare_video_mem)(void *);
+	struct device *clkdev;
 };
 void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
 void set_pxa_fb_parent(struct device *parent_dev);
include/video/metronomefb.h +7 -6
index dab04b4..83670cc 100644
@@ -30,7 +30,6 @@ struct metromem_cmd {
 /* struct used by metronome. board specific stuff comes from *board */
 struct metronomefb_par {
 	unsigned char *metromem;
-	struct metromem_desc *metromem_desc;
 	struct metromem_cmd *metromem_cmd;
 	unsigned char *metromem_wfm;
 	unsigned char *metromem_img;
@@ -38,25 +37,27 @@ struct metronomefb_par {
 	u16 *csum_table;
 	int metromemsize;
 	dma_addr_t metromem_dma;
-	dma_addr_t metromem_desc_dma;
 	struct fb_info *info;
 	struct metronome_board *board;
 	wait_queue_head_t waitq;
 	u8 frame_count;
+	int extra_size;
+	int dt;
 };
 
 /* board specific routines */
 struct metronome_board {
 	struct module *owner;
-	void (*free_irq)(struct fb_info *);
-	void (*init_gpio_regs)(struct metronomefb_par *);
-	void (*init_lcdc_regs)(struct metronomefb_par *);
-	void (*post_dma_setup)(struct metronomefb_par *);
+	struct module *fbmaster;
 	void (*set_rst)(struct metronomefb_par *, int);
 	void (*set_stdby)(struct metronomefb_par *, int);
+	void (*cleanup)(struct metronomefb_par *);
 	int (*met_wait_event)(struct metronomefb_par *);
 	int (*met_wait_event_intr)(struct metronomefb_par *);
 	int (*setup_irq)(struct fb_info *);
+	int (*setup_fb)(struct metronomefb_par *);
+	int (*setup_io)(struct metronomefb_par *);
+	int (*get_panel_type)(void);
 };
 
 #endif

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