omapfb: add support for the OMAP2EVM LCD
[safe/jmp/linux-2.6] / drivers / video / epson1355fb.c
index f0a621e..2735b79 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/mm.h>
-#include <linux/tty.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/fb.h>
 
 #include <asm/types.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <video/epson1355.h>
 
 struct epson1355_par {
        unsigned long reg_addr;
+       u32 pseudo_palette[16];
 };
 
 /* ------------------------------------------------------------------------- */
 
-#ifdef CONFIG_SUPERH
-
-static inline u8 epson1355_read_reg(int index)
-{
-       return ctrl_inb(par.reg_addr + index);
-}
-
-static inline void epson1355_write_reg(u8 data, int index)
-{
-       ctrl_outb(data, par.reg_addr + index);
-}
-
-#elif defined(CONFIG_ARM)
+#if defined(CONFIG_ARM)
 
 # ifdef CONFIG_ARCH_CEIVA
-#  include <asm/arch/hardware.h>
+#  include <mach/hardware.h>
 #  define EPSON1355FB_BASE_PHYS        (CEIVA_PHYS_SED1355)
 # endif
 
@@ -290,7 +278,7 @@ static int epson1355fb_blank(int blank_mode, struct fb_info *info)
        struct epson1355_par *par = info->par;
 
        switch (blank_mode) {
-       case FB_BLANK_UNBLANKING:
+       case FB_BLANK_UNBLANK:
        case FB_BLANK_NORMAL:
                lcd_enable(par, 1);
                backlight_enable(1);
@@ -404,17 +392,10 @@ static inline unsigned long copy_to_user16(void *to, const void *from,
 
 
 static ssize_t
-epson1355fb_read(struct file *file, char *buf, size_t count, loff_t * ppos)
+epson1355fb_read(struct fb_info *info, char *buf, size_t count, loff_t * ppos)
 {
-       struct inode *inode = file->f_dentry->d_inode;
-       int fbidx = iminor(inode);
-       struct fb_info *info = registered_fb[fbidx];
        unsigned long p = *ppos;
 
-       /* from fbmem.c except for our own copy_*_user */
-       if (!info || !info->screen_base)
-               return -ENODEV;
-
        if (p >= info->fix.smem_len)
                return 0;
        if (count >= info->fix.smem_len)
@@ -435,20 +416,13 @@ epson1355fb_read(struct file *file, char *buf, size_t count, loff_t * ppos)
 }
 
 static ssize_t
-epson1355fb_write(struct file *file, const char *buf,
+epson1355fb_write(struct fb_info *info, const char *buf,
                  size_t count, loff_t * ppos)
 {
-       struct inode *inode = file->f_dentry->d_inode;
-       int fbidx = iminor(inode);
-       struct fb_info *info = registered_fb[fbidx];
        unsigned long p = *ppos;
        int err;
 
        /* from fbmem.c except for our own copy_*_user */
-       if (!info || !info->screen_base)
-               return -ENODEV;
-
-       /* from fbmem.c except for our own copy_*_user */
        if (p > info->fix.smem_len)
                return -ENOSPC;
        if (count >= info->fix.smem_len)
@@ -650,10 +624,11 @@ int __init epson1355fb_probe(struct platform_device *dev)
                goto bail;
        }
 
-       info = framebuffer_alloc(sizeof(struct epson1355_par) + sizeof(u32) * 256, &dev->dev);
-       if (!info)
+       info = framebuffer_alloc(sizeof(struct epson1355_par), &dev->dev);
+       if (!info) {
                rc = -ENOMEM;
                goto bail;
+       }
 
        default_par = info->par;
        default_par->reg_addr = (unsigned long) ioremap(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN);
@@ -662,7 +637,7 @@ int __init epson1355fb_probe(struct platform_device *dev)
                rc = -ENOMEM;
                goto bail;
        }
-       info->pseudo_palette = (void *)(default_par + 1);
+       info->pseudo_palette = default_par->pseudo_palette;
 
        info->screen_base = ioremap(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN);
        if (!info->screen_base) {