Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / video / leo.c
index 7547e89..a23cfdb 100644 (file)
@@ -32,9 +32,8 @@ static int leo_setcolreg(unsigned, unsigned, unsigned, unsigned,
                         unsigned, struct fb_info *);
 static int leo_blank(int, struct fb_info *);
 
-static int leo_mmap(struct fb_info *, struct file *, struct vm_area_struct *);
-static int leo_ioctl(struct inode *, struct file *, unsigned int,
-                    unsigned long, struct fb_info *);
+static int leo_mmap(struct fb_info *, struct vm_area_struct *);
+static int leo_ioctl(struct fb_info *, unsigned int, unsigned long);
 static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *);
 
 /*
@@ -51,7 +50,9 @@ static struct fb_ops leo_ops = {
        .fb_imageblit           = cfb_imageblit,
        .fb_mmap                = leo_mmap,
        .fb_ioctl               = leo_ioctl,
-       .fb_cursor              = soft_cursor,
+#ifdef CONFIG_COMPAT
+       .fb_compat_ioctl        = sbusfb_compat_ioctl,
+#endif
 };
 
 #define LEO_OFF_LC_SS0_KRN     0x00200000UL
@@ -180,11 +181,11 @@ struct leo_ld_gbl {
 
 struct leo_par {
        spinlock_t              lock;
-       struct leo_lx_krn       *lx_krn;
-       struct leo_lc_ss0_usr   *lc_ss0_usr;
-       struct leo_ld_ss0       *ld_ss0;
-       struct leo_ld_ss1       *ld_ss1;
-       struct leo_cursor       *cursor;
+       struct leo_lx_krn       __iomem *lx_krn;
+       struct leo_lc_ss0_usr   __iomem *lc_ss0_usr;
+       struct leo_ld_ss0       __iomem *ld_ss0;
+       struct leo_ld_ss1       __iomem *ld_ss1;
+       struct leo_cursor       __iomem *cursor;
        u32                     extent;
        u32                     clut_data[256];
 
@@ -195,10 +196,9 @@ struct leo_par {
        unsigned long           fbsize;
 
        struct sbus_dev         *sdev;
-       struct list_head        list;
 };
 
-static void leo_wait(struct leo_lx_krn *lx_krn)
+static void leo_wait(struct leo_lx_krn __iomem *lx_krn)
 {
        int i;
        
@@ -223,7 +223,7 @@ static int leo_setcolreg(unsigned regno,
                         unsigned transp, struct fb_info *info)
 {
        struct leo_par *par = (struct leo_par *) info->par;
-        struct leo_lx_krn *lx_krn = par->lx_krn;
+        struct leo_lx_krn __iomem *lx_krn = par->lx_krn;
        unsigned long flags;
        u32 val;
        int i;
@@ -263,24 +263,24 @@ static int leo_setcolreg(unsigned regno,
 static int leo_blank(int blank, struct fb_info *info)
 {
        struct leo_par *par = (struct leo_par *) info->par;
-       struct leo_lx_krn *lx_krn = par->lx_krn;
+       struct leo_lx_krn __iomem *lx_krn = par->lx_krn;
        unsigned long flags;
        u32 val;
 
        spin_lock_irqsave(&par->lock, flags);
 
        switch (blank) {
-       case 0: /* Unblanking */
+       case FB_BLANK_UNBLANK: /* Unblanking */
                val = sbus_readl(&lx_krn->krn_csr);
                val |= LEO_KRN_CSR_ENABLE;
                sbus_writel(val, &lx_krn->krn_csr);
                par->flags &= ~LEO_FLAG_BLANKED;
                break;
 
-       case 1: /* Normal blanking */
-       case 2: /* VESA blank (vsync off) */
-       case 3: /* VESA blank (hsync off) */
-       case 4: /* Poweroff */
+       case FB_BLANK_NORMAL: /* Normal blanking */
+       case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
+       case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
+       case FB_BLANK_POWERDOWN: /* Poweroff */
                val = sbus_readl(&lx_krn->krn_csr);
                val &= ~LEO_KRN_CSR_ENABLE;
                sbus_writel(val, &lx_krn->krn_csr);
@@ -362,7 +362,7 @@ static struct sbus_mmap_map leo_mmap_map[] = {
        { .size = 0 }
 };
 
-static int leo_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma)
+static int leo_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
        struct leo_par *par = (struct leo_par *)info->par;
 
@@ -372,8 +372,7 @@ static int leo_mmap(struct fb_info *info, struct file *file, struct vm_area_stru
                                  vma);
 }
 
-static int leo_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                    unsigned long arg, struct fb_info *info)
+static int leo_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
 {
        struct leo_par *par = (struct leo_par *) info->par;
 
@@ -403,7 +402,7 @@ leo_init_fix(struct fb_info *info)
 static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl)
 {
        struct leo_par *par = (struct leo_par *) info->par;
-       struct leo_lx_krn *lx_krn = par->lx_krn;
+       struct leo_lx_krn __iomem *lx_krn = par->lx_krn;
        struct fb_wid_item *wi;
        unsigned long flags;
        u32 val;
@@ -465,7 +464,7 @@ static void leo_init_wids(struct fb_info *info)
 static void leo_switch_from_graph(struct fb_info *info)
 {
        struct leo_par *par = (struct leo_par *) info->par;
-       struct leo_ld *ss = (struct leo_ld *) par->ld_ss0;
+       struct leo_ld __iomem *ss = (struct leo_ld __iomem *) par->ld_ss0;
        unsigned long flags;
        u32 val;
 
@@ -564,33 +563,32 @@ static void leo_init_one(struct sbus_dev *sdev)
        all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
 
 #ifdef CONFIG_SPARC32
-       all->info.screen_base = (char *)
+       all->info.screen_base = (char __iomem *)
                prom_getintdefault(sdev->prom_node, "address", 0);
 #endif
        if (!all->info.screen_base)
-               all->info.screen_base = (char *)
+               all->info.screen_base = 
                        sbus_ioremap(&sdev->resource[0], LEO_OFF_SS0,
                                     0x800000, "leo ram");
 
-       all->par.lc_ss0_usr = (struct leo_lc_ss0_usr *)
+       all->par.lc_ss0_usr =
                sbus_ioremap(&sdev->resource[0], LEO_OFF_LC_SS0_USR,
                             0x1000, "leolc ss0usr");
-       all->par.ld_ss0 = (struct leo_ld_ss0 *)
+       all->par.ld_ss0 =
                sbus_ioremap(&sdev->resource[0], LEO_OFF_LD_SS0,
                             0x1000, "leold ss0");
-       all->par.ld_ss1 = (struct leo_ld_ss1 *)
+       all->par.ld_ss1 =
                sbus_ioremap(&sdev->resource[0], LEO_OFF_LD_SS1,
                             0x1000, "leold ss1");
-       all->par.lx_krn = (struct leo_lx_krn *)
+       all->par.lx_krn =
                sbus_ioremap(&sdev->resource[0], LEO_OFF_LX_KRN,
                             0x1000, "leolx krn");
-       all->par.cursor = (struct leo_cursor *)
+       all->par.cursor =
                sbus_ioremap(&sdev->resource[0], LEO_OFF_LX_CURSOR,
                             sizeof(struct leo_cursor), "leolx cursor");
 
-       all->info.flags = FBINFO_FLAG_DEFAULT;
+       all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
        all->info.fbops = &leo_ops;
-       all->info.currcon = -1;
        all->info.par = &all->par;
 
        leo_init_wids(&all->info);
@@ -626,6 +624,9 @@ int __init leo_init(void)
        struct sbus_bus *sbus;
        struct sbus_dev *sdev;
 
+       if (fb_get_options("leofb", NULL))
+               return -ENODEV;
+
        for_all_sbusdev(sdev, sbus) {
                if (!strcmp(sdev->prom_name, "leo"))
                        leo_init_one(sdev);
@@ -654,8 +655,8 @@ leo_setup(char *arg)
        return 0;
 }
 
-#ifdef MODULE
 module_init(leo_init);
+#ifdef MODULE
 module_exit(leo_exit);
 #endif