diff -NurpP --minimal linux-2.6.8-rc2-h1940-0.03/drivers/video/h1940fb.c linux-2.6.8-rc2-h1940-0.04/drivers/video/h1940fb.c --- linux-2.6.8-rc2-h1940-0.03/drivers/video/h1940fb.c 2004-07-23 18:13:14.000000000 +0200 +++ linux-2.6.8-rc2-h1940-0.04/drivers/video/h1940fb.c 2004-07-29 17:43:52.000000000 +0200 @@ -10,6 +10,9 @@ * based on skeletonfb.c, sa1100fb.c * * ChangeLog + * 2004-07-27: Arnaud Patard + * - code cleanup + * - added a forgotten return in h1940fb_init * * 2004-07-19: Herbert Pötzl * - code cleanup and extended debugging @@ -31,6 +34,7 @@ #include #include +#include #include "h1940fb.h" extern void *dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, int gfp); @@ -38,8 +42,8 @@ extern void *dma_alloc_writecombine(stru static struct h1940fb_info info; -#if 0 -#define dprintk(msg...) printk(KERNEL_DEBUG "h1940fb: " msg) +#if 1 +#define dprintk(msg...) printk(KERN_INFO "h1940fb: " msg) #else #define dprintk(msg...) while (0) { } #endif @@ -92,9 +96,9 @@ static int h1940fb_setcolreg(unsigned re struct h1940fb_info *fbi = (struct h1940fb_info *)info; int bpp, m = 0; - dprintk("setcolreg(reg=%d, RGBA=%d,%d,%d,%d info=%p)\n", +/* dprintk("setcolreg(reg=%d, RGBA=%d,%d,%d,%d info=%p)\n", regno, red, green, blue, transp, info); - +*/ bpp = fbi->fb.var.bits_per_pixel; m = 1 << bpp; if (regno >= m) { @@ -133,7 +137,7 @@ static int h1940fb_pan_display(struct fb } /** - * h1940fb_blank - NOT a required function. Blanks the display. + * xxxfb_blank - NOT a required function. Blanks the display. * @blank_mode: the blank mode we want. * @info: frame buffer structure that represents a single frame buffer * @@ -190,21 +194,32 @@ static int __init h1940fb_map_video_memo { dprintk("map_video_memory(fbi=%p)\n", fbi); +/* fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + PAGE_SIZE); fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size, &fbi->map_dma, GFP_KERNEL); +*/ + fbi->map_cpu = (void *)H1940_VA_FBMEM; + fbi->map_dma = H1940_PA_FBMEM; + fbi->map_size = fbi->fb.fix.smem_len; if (fbi->map_cpu) { /* prevent initial garbage on screen */ dprintk("map_video_memory: clear %p:%08x\n", fbi->map_cpu, fbi->map_size); - memset(fbi->map_cpu, 0x00, fbi->map_size); + memset(fbi->map_cpu, 0xf0, fbi->map_size); - fbi->fb.screen_base = fbi->map_cpu + PAGE_SIZE; +/* fbi->fb.screen_base = fbi->map_cpu + PAGE_SIZE; fbi->screen_dma = fbi->map_dma + PAGE_SIZE; fbi->fb.fix.smem_start = fbi->screen_dma; - dprintk("map_video_memory: dma=%08x\n", fbi->screen_dma); +*/ + fbi->screen_dma = fbi->map_dma; + fbi->fb.screen_base = fbi->map_cpu; + fbi->fb.fix.smem_start = fbi->screen_dma; + + dprintk("map_video_memory: dma=%08x cpu=%p size=%08x\n", + fbi->map_dma, fbi->map_cpu, fbi->fb.fix.smem_len); } return fbi->map_cpu ? 0 : -ENOMEM; @@ -281,6 +296,9 @@ int __devinit h1940fb_init(void) char driver_name[]="h1940fb"; int ret; + if (!request_mem_region(0x80000000, SZ_1M, "Video Memory")) + return -EBUSY; + strcpy(info.fb.fix.id, driver_name); info.fb.fix.type = FB_TYPE_PACKED_PIXELS; @@ -300,7 +318,7 @@ int __devinit h1940fb_init(void) info.fb.fbops = &h1940fb_ops; info.fb.flags = FBINFO_FLAG_DEFAULT; info.fb.monspecs = monspecs; - info.fb.currcon = 0; + info.fb.currcon = -1; info.fb.pseudo_palette = &info.pseudo_pal; @@ -323,6 +341,9 @@ int __devinit h1940fb_init(void) info.fb.fix.smem_len = info.fb.var.xres * info.fb.var.yres * info.fb.var.bits_per_pixel / 8; + if (!request_mem_region(S3C2410_VA_LCD, SZ_1M, "LCD")) + return -EBUSY; + /* Initialize video memory */ ret = h1940fb_map_video_memory(&info); if (ret) { @@ -344,7 +365,10 @@ int __devinit h1940fb_init(void) printk(KERN_INFO "fb%d: %s frame buffer device\n", info.fb.node, info.fb.fix.id); + return 0; failed: + release_mem_region(S3C2410_VA_LCD, SZ_1M); + release_mem_region(0x80000000, SZ_1M); return ret; } @@ -355,30 +379,25 @@ failed: static void __exit h1940fb_cleanup(void) { unregister_framebuffer(&info.fb); + release_mem_region(S3C2410_VA_LCD, SZ_1M); + release_mem_region(0x80000000, SZ_1M); } +#ifndef MODULE + int __devinit h1940fb_setup(char *options) { dprintk("setup(%s)\n", options); return 0; } -/* ------------------------------------------------------------------------- */ - - /* - * Frame buffer operations - */ - -/* ------------------------------------------------------------------------- */ - - - /* - * Modularization - */ +#else module_init(h1940fb_init); module_exit(h1940fb_cleanup); +#endif + MODULE_AUTHOR("Arnaud Patard "); MODULE_DESCRIPTION("Framebuffer driver for the iPAQ h1940"); MODULE_LICENSE("GPL"); diff -NurpP --minimal linux-2.6.8-rc2-h1940-0.03/include/asm-arm/arch/h1940.h linux-2.6.8-rc2-h1940-0.04/include/asm-arm/arch/h1940.h --- linux-2.6.8-rc2-h1940-0.03/include/asm-arm/arch/h1940.h 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.8-rc2-h1940-0.04/include/asm-arm/arch/h1940.h 2004-07-27 16:25:51.000000000 +0200 @@ -0,0 +1,5 @@ + +#define H1940_VA_FBMEM 0xE0000000UL +#define H1940_PA_FBMEM 0x33F00000UL +#define H1940_SZ_FBMEM 0x00100000UL +