UBI: silence warning
[pandora-kernel.git] / drivers / video / s3fb.c
index 4d0e204..7d53bc2 100644 (file)
@@ -183,18 +183,13 @@ static void s3fb_settile_fast(struct fb_info *info, struct fb_tilemap *map)
        }
 }
 
-static int s3fb_get_tilemax(struct fb_info *info)
-{
-       return 256;
-}
-
 static struct fb_tile_ops s3fb_tile_ops = {
        .fb_settile     = svga_settile,
        .fb_tilecopy    = svga_tilecopy,
        .fb_tilefill    = svga_tilefill,
        .fb_tileblit    = svga_tileblit,
        .fb_tilecursor  = svga_tilecursor,
-       .fb_get_tilemax = s3fb_get_tilemax,
+       .fb_get_tilemax = svga_get_tilemax,
 };
 
 static struct fb_tile_ops s3fb_fast_tile_ops = {
@@ -203,7 +198,7 @@ static struct fb_tile_ops s3fb_fast_tile_ops = {
        .fb_tilefill    = svga_tilefill,
        .fb_tileblit    = svga_tileblit,
        .fb_tilecursor  = svga_tilecursor,
-       .fb_get_tilemax = s3fb_get_tilemax,
+       .fb_get_tilemax = svga_get_tilemax,
 };
 
 
@@ -405,11 +400,17 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
        struct s3fb_info *par = info->par;
        int rv, mem, step;
+       u16 m, n, r;
 
        /* Find appropriate format */
        rv = svga_match_format (s3fb_formats, var, NULL);
-       if ((rv < 0) || ((par->chip == CHIP_988_VIRGE_VX) ? (rv == 7) : (rv == 6)))
-       {               /* 24bpp on VIRGE VX, 32bpp on others */
+
+       /* 32bpp mode is not supported on VIRGE VX,
+          24bpp is not supported on others */
+       if ((par->chip == CHIP_988_VIRGE_VX) ? (rv == 7) : (rv == 6))
+               rv = -EINVAL;
+
+       if (rv < 0) {
                printk(KERN_ERR "fb%d: unsupported mode requested\n", info->node);
                return rv;
        }
@@ -427,20 +428,26 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
        /* Check whether have enough memory */
        mem = ((var->bits_per_pixel * var->xres_virtual) >> 3) * var->yres_virtual;
-       if (mem > info->screen_size)
-       {
+       if (mem > info->screen_size) {
                printk(KERN_ERR "fb%d: not enough framebuffer memory (%d kB requested , %d kB available)\n",
                        info->node, mem >> 10, (unsigned int) (info->screen_size >> 10));
                return -EINVAL;
        }
 
        rv = svga_check_timings (&s3_timing_regs, var, info->node);
-       if (rv < 0)
-       {
+       if (rv < 0) {
                printk(KERN_ERR "fb%d: invalid timings requested\n", info->node);
                return rv;
        }
 
+       rv = svga_compute_pll(&s3_pll, PICOS2KHZ(var->pixclock), &m, &n, &r,
+                               info->node);
+       if (rv < 0) {
+               printk(KERN_ERR "fb%d: invalid pixclock value requested\n",
+                       info->node);
+               return rv;
+       }
+
        return 0;
 }
 
@@ -459,9 +466,10 @@ static int s3fb_set_par(struct fb_info *info)
                info->flags &= ~FBINFO_MISC_TILEBLITTING;
                info->tileops = NULL;
 
-               /* supports blit rectangles of any dimension */
-               info->pixmap.blit_x = ~(u32)0;
+               /* in 4bpp supports 8p wide tiles only, any tiles otherwise */
+               info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0);
                info->pixmap.blit_y = ~(u32)0;
+
                offset_value = (info->var.xres_virtual * bpp) / 64;
                screen_size = info->var.yres_virtual * info->fix.line_length;
        } else {
@@ -470,6 +478,7 @@ static int s3fb_set_par(struct fb_info *info)
 
                info->flags |= FBINFO_MISC_TILEBLITTING;
                info->tileops = fasttext ? &s3fb_fast_tile_ops : &s3fb_tile_ops;
+
                /* supports 8x16 tiles only */
                info->pixmap.blit_x = 1 << (8 - 1);
                info->pixmap.blit_y = 1 << (16 - 1);
@@ -799,23 +808,6 @@ static int s3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
        return 0;
 }
 
-/* Get capabilities of accelerator based on the mode */
-
-static void s3fb_get_caps(struct fb_info *info, struct fb_blit_caps *caps,
-                         struct fb_var_screeninfo *var)
-{
-       if (var->bits_per_pixel == 0) {
-               /* can only support 256 8x16 bitmap */
-               caps->x = 1 << (8 - 1);
-               caps->y = 1 << (16 - 1);
-               caps->len = 256;
-       } else {
-               caps->x = ~(u32)0;
-               caps->y = ~(u32)0;
-               caps->len = ~(u32)0;
-       }
-}
-
 /* ------------------------------------------------------------------------- */
 
 /* Frame buffer operations */
@@ -832,7 +824,7 @@ static struct fb_ops s3fb_ops = {
        .fb_fillrect    = s3fb_fillrect,
        .fb_copyarea    = cfb_copyarea,
        .fb_imageblit   = s3fb_imageblit,
-       .fb_get_caps    = s3fb_get_caps,
+       .fb_get_caps    = svga_get_caps,
 };
 
 /* ------------------------------------------------------------------------- */