Merge branch 'fbdev/stable-updates'
authorPaul Mundt <lethal@linux-sh.org>
Fri, 24 Jun 2011 08:16:40 +0000 (17:16 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Fri, 24 Jun 2011 08:16:40 +0000 (17:16 +0900)
35 files changed:
drivers/staging/xgifb/XGI_main_26.c
drivers/video/68328fb.c
drivers/video/Kconfig
drivers/video/acornfb.c
drivers/video/arkfb.c
drivers/video/atmel_lcdfb.c
drivers/video/aty/radeon_base.c
drivers/video/au1200fb.c
drivers/video/controlfb.c
drivers/video/da8xx-fb.c
drivers/video/fb-puv3.c
drivers/video/fb_defio.c
drivers/video/g364fb.c
drivers/video/gxt4500.c
drivers/video/hgafb.c
drivers/video/imsttfb.c
drivers/video/intelfb/intelfbhw.c
drivers/video/mb862xx/mb862xxfbdrv.c
drivers/video/mx3fb.c
drivers/video/neofb.c
drivers/video/platinumfb.c
drivers/video/pm2fb.c
drivers/video/pm3fb.c
drivers/video/s3c-fb.c
drivers/video/s3fb.c
drivers/video/savage/savagefb_driver.c
drivers/video/sis/sis_main.c
drivers/video/skeletonfb.c
drivers/video/sm501fb.c
drivers/video/tridentfb.c
drivers/video/valkyriefb.c
drivers/video/vfb.c
drivers/video/vga16fb.c
drivers/video/vt8500lcdfb.c
drivers/video/vt8623fb.c

index cadec2a..e92f6fa 100644 (file)
@@ -1365,26 +1365,16 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 }
 
 #ifdef XGIFB_PAN
-static int XGIfb_pan_var(struct fb_var_screeninfo *var)
+static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
        unsigned int base;
 
        /* printk("Inside pan_var"); */
 
-       if (var->xoffset > (var->xres_virtual - var->xres)) {
-               /* printk("Pan: xo: %d xv %d xr %d\n",
-                       var->xoffset, var->xres_virtual, var->xres); */
-               return -EINVAL;
-       }
-       if (var->yoffset > (var->yres_virtual - var->yres)) {
-               /* printk("Pan: yo: %d yv %d yr %d\n",
-                       var->yoffset, var->yres_virtual, var->yres); */
-               return -EINVAL;
-       }
-       base = var->yoffset * var->xres_virtual + var->xoffset;
+       base = var->yoffset * info->var.xres_virtual + var->xoffset;
 
        /* calculate base bpp dep. */
-       switch (var->bits_per_pixel) {
+       switch (info->var.bits_per_pixel) {
        case 16:
                base >>= 1;
                break;
@@ -1682,9 +1672,9 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
 
        /* printk("\nInside pan_display:\n"); */
 
-       if (var->xoffset > (var->xres_virtual - var->xres))
+       if (var->xoffset > (info->var.xres_virtual - info->var.xres))
                return -EINVAL;
-       if (var->yoffset > (var->yres_virtual - var->yres))
+       if (var->yoffset > (info->var.yres_virtual - info->var.yres))
                return -EINVAL;
 
        if (var->vmode & FB_VMODE_YWRAP) {
@@ -1697,7 +1687,7 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
                                                > info->var.yres_virtual)
                        return -EINVAL;
        }
-       err = XGIfb_pan_var(var);
+       err = XGIfb_pan_var(var, info);
        if (err < 0)
                return err;
 
index 75a39ea..a425d65 100644 (file)
@@ -378,8 +378,8 @@ static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
                    || var->xoffset)
                        return -EINVAL;
        } else {
-               if (var->xoffset + var->xres > info->var.xres_virtual ||
-                   var->yoffset + var->yres > info->var.yres_virtual)
+               if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+                   var->yoffset + info->var.yres > info->var.yres_virtual)
                        return -EINVAL;
        }
        info->var.xoffset = var->xoffset;
index 549b960..5e19de9 100644 (file)
@@ -1756,9 +1756,10 @@ config FB_AU1100
 config FB_AU1200
        bool "Au1200 LCD Driver"
        depends on (FB = y) && MIPS && SOC_AU1200
-       select FB_CFB_FILLRECT
-       select FB_CFB_COPYAREA
-       select FB_CFB_IMAGEBLIT
+       select FB_SYS_FILLRECT
+       select FB_SYS_COPYAREA
+       select FB_SYS_IMAGEBLIT
+       select FB_SYS_FOPS
        help
          This is the framebuffer driver for the AMD Au1200 SOC.  It can drive
          various panels and CRTs by passing in kernel cmd line option
index 6183a57..b303f17 100644 (file)
@@ -850,9 +850,10 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
        u_int y_bottom = var->yoffset;
 
        if (!(var->vmode & FB_VMODE_YWRAP))
-               y_bottom += var->yres;
+               y_bottom += info->var.yres;
 
-       BUG_ON(y_bottom > var->yres_virtual);
+       if (y_bottom > info->var.yres_virtual)
+               return -EINVAL;
 
        acornfb_update_dma(info, var);
 
index 8686429..555dd4c 100644 (file)
@@ -908,13 +908,14 @@ static int arkfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
        unsigned int offset;
 
        /* Calculate the offset */
-       if (var->bits_per_pixel == 0) {
-               offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2);
+       if (info->var.bits_per_pixel == 0) {
+               offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
+                      + (var->xoffset / 2);
                offset = offset >> 2;
        } else {
                offset = (var->yoffset * info->fix.line_length) +
-                        (var->xoffset * var->bits_per_pixel / 8);
-               offset = offset >> ((var->bits_per_pixel == 4) ? 2 : 3);
+                        (var->xoffset * info->var.bits_per_pixel / 8);
+               offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 3);
        }
 
        /* Set the offset */
index 4484c72..8b5d755 100644 (file)
@@ -39,7 +39,8 @@
                                         | FBINFO_HWACCEL_YPAN)
 
 static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
-                                       struct fb_var_screeninfo *var)
+                                       struct fb_var_screeninfo *var,
+                                       struct fb_info *info)
 {
 
 }
@@ -50,14 +51,16 @@ static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
                                        | FBINFO_HWACCEL_YPAN)
 
 static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
-                                    struct fb_var_screeninfo *var)
+                                    struct fb_var_screeninfo *var,
+                                    struct fb_info *info)
 {
        u32 dma2dcfg;
        u32 pixeloff;
 
-       pixeloff = (var->xoffset * var->bits_per_pixel) & 0x1f;
+       pixeloff = (var->xoffset * info->var.bits_per_pixel) & 0x1f;
 
-       dma2dcfg = ((var->xres_virtual - var->xres) * var->bits_per_pixel) / 8;
+       dma2dcfg = (info-var.xres_virtual - info->var.xres)
+                * info->var.bits_per_pixel / 8;
        dma2dcfg |= pixeloff << ATMEL_LCDC_PIXELOFF_OFFSET;
        lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg);
 
@@ -249,14 +252,14 @@ static void atmel_lcdfb_update_dma(struct fb_info *info,
        unsigned long dma_addr;
 
        dma_addr = (fix->smem_start + var->yoffset * fix->line_length
-                   + var->xoffset * var->bits_per_pixel / 8);
+                   + var->xoffset * info->var.bits_per_pixel / 8);
 
        dma_addr &= ~3UL;
 
        /* Set framebuffer DMA base address and pixel offset */
        lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);
 
-       atmel_lcdfb_update_dma2d(sinfo, var);
+       atmel_lcdfb_update_dma2d(sinfo, var, info);
 }
 
 static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
index 32f8cf6..1506848 100644 (file)
@@ -845,16 +845,16 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var,
 {
         struct radeonfb_info *rinfo = info->par;
 
-        if ((var->xoffset + var->xres > var->xres_virtual)
-           || (var->yoffset + var->yres > var->yres_virtual))
-               return -EINVAL;
+       if ((var->xoffset + info->var.xres > info->var.xres_virtual)
+           || (var->yoffset + info->var.yres > info->var.yres_virtual))
+               return -EINVAL;
                 
         if (rinfo->asleep)
                return 0;
 
        radeon_fifo_wait(2);
-        OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset)
-                            * var->bits_per_pixel / 8) & ~7);
+       OUTREG(CRTC_OFFSET, (var->yoffset * info->fix.line_length +
+                            var->xoffset * info->var.bits_per_pixel / 8) & ~7);
         return 0;
 }
 
index 5dff32a..ed5dcdb 100644 (file)
 #include <asm/mach-au1x00/au1000.h>
 #include "au1200fb.h"
 
-#ifdef CONFIG_PM
-#include <asm/mach-au1x00/au1xxx_pm.h>
-#endif
-
-#ifndef CONFIG_FB_AU1200_DEVS
-#define CONFIG_FB_AU1200_DEVS 4
-#endif
-
 #define DRIVER_NAME "au1200fb"
 #define DRIVER_DESC "LCD controller driver for AU1200 processors"
 
@@ -150,7 +142,7 @@ struct au1200_lcd_iodata_t {
 
 /* Private, per-framebuffer management information (independent of the panel itself) */
 struct au1200fb_device {
-       struct fb_info fb_info;                 /* FB driver info record */
+       struct fb_info *fb_info;                /* FB driver info record */
 
        int                                     plane;
        unsigned char*          fb_mem;         /* FrameBuffer memory map */
@@ -158,7 +150,6 @@ struct au1200fb_device {
        dma_addr_t              fb_phys;
 };
 
-static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
 /********************************************************************/
 
 /* LCD controller restrictions */
@@ -171,10 +162,18 @@ static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
 /* Default number of visible screen buffer to allocate */
 #define AU1200FB_NBR_VIDEO_BUFFERS 1
 
+/* Default maximum number of fb devices to create */
+#define MAX_DEVICE_COUNT       4
+
+/* Default window configuration entry to use (see windows[]) */
+#define DEFAULT_WINDOW_INDEX   2
+
 /********************************************************************/
 
+static struct fb_info *_au1200fb_infos[MAX_DEVICE_COUNT];
 static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR;
-static int window_index = 2; /* default is zero */
+static int device_count = MAX_DEVICE_COUNT;
+static int window_index = DEFAULT_WINDOW_INDEX;        /* default is zero */
 static int panel_index = 2; /* default is zero */
 static struct window_settings *win;
 static struct panel_settings *panel;
@@ -205,12 +204,6 @@ struct window_settings {
 extern int board_au1200fb_panel_init (void);
 extern int board_au1200fb_panel_shutdown (void);
 
-#ifdef CONFIG_PM
-int au1200fb_pm_callback(au1xxx_power_dev_t *dev,
-               au1xxx_request_t request, void *data);
-au1xxx_power_dev_t *LCD_pm_dev;
-#endif
-
 /*
  * Default window configurations
  */
@@ -652,25 +645,6 @@ static struct panel_settings known_lcd_panels[] =
 
 /********************************************************************/
 
-#ifdef CONFIG_PM
-static int set_brightness(unsigned int brightness)
-{
-       unsigned int hi1, divider;
-
-       /* limit brightness pwm duty to >= 30/1600 */
-       if (brightness < 30) {
-               brightness = 30;
-       }
-       divider = (lcd->pwmdiv & 0x3FFFF) + 1;
-       hi1 = (lcd->pwmhi >> 16) + 1;
-       hi1 = (((brightness & 0xFF) + 1) * divider >> 8);
-       lcd->pwmhi &= 0xFFFF;
-       lcd->pwmhi |= (hi1 << 16);
-
-       return brightness;
-}
-#endif /* CONFIG_PM */
-
 static int winbpp (unsigned int winctrl1)
 {
        int bits = 0;
@@ -712,8 +686,8 @@ static int fbinfo2index (struct fb_info *fb_info)
 {
        int i;
 
-       for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i) {
-               if (fb_info == (struct fb_info *)(&_au1200fb_devices[i].fb_info))
+       for (i = 0; i < device_count; ++i) {
+               if (fb_info == _au1200fb_infos[i])
                        return i;
        }
        printk("au1200fb: ERROR: fbinfo2index failed!\n");
@@ -962,7 +936,7 @@ static void au1200_setmode(struct au1200fb_device *fbdev)
        lcd->window[plane].winctrl2 = ( 0
                | LCD_WINCTRL2_CKMODE_00
                | LCD_WINCTRL2_DBM
-               | LCD_WINCTRL2_BX_N( fbdev->fb_info.fix.line_length)
+               | LCD_WINCTRL2_BX_N(fbdev->fb_info->fix.line_length)
                | LCD_WINCTRL2_SCX_1
                | LCD_WINCTRL2_SCY_1
                ) ;
@@ -1050,7 +1024,7 @@ static void au1200fb_update_fbinfo(struct fb_info *fbi)
 static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
        struct fb_info *fbi)
 {
-       struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;
+       struct au1200fb_device *fbdev = fbi->par;
        u32 pixclock;
        int screen_size, plane;
 
@@ -1142,7 +1116,7 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
  */
 static int au1200fb_fb_set_par(struct fb_info *fbi)
 {
-       struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;
+       struct au1200fb_device *fbdev = fbi->par;
 
        au1200fb_update_fbinfo(fbi);
        au1200_setmode(fbdev);
@@ -1246,11 +1220,7 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
        unsigned int len;
        unsigned long start=0, off;
-       struct au1200fb_device *fbdev = (struct au1200fb_device *) info;
-
-#ifdef CONFIG_PM
-       au1xxx_pm_access(LCD_pm_dev);
-#endif
+       struct au1200fb_device *fbdev = info->par;
 
        if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
                return -EINVAL;
@@ -1461,10 +1431,6 @@ static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd,
        int plane;
        int val;
 
-#ifdef CONFIG_PM
-       au1xxx_pm_access(LCD_pm_dev);
-#endif
-
        plane = fbinfo2index(info);
        print_dbg("au1200fb: ioctl %d on plane %d\n", cmd, plane);
 
@@ -1536,9 +1502,11 @@ static struct fb_ops au1200fb_fb_ops = {
        .fb_set_par     = au1200fb_fb_set_par,
        .fb_setcolreg   = au1200fb_fb_setcolreg,
        .fb_blank       = au1200fb_fb_blank,
-       .fb_fillrect    = cfb_fillrect,
-       .fb_copyarea    = cfb_copyarea,
-       .fb_imageblit   = cfb_imageblit,
+       .fb_fillrect    = sys_fillrect,
+       .fb_copyarea    = sys_copyarea,
+       .fb_imageblit   = sys_imageblit,
+       .fb_read        = fb_sys_read,
+       .fb_write       = fb_sys_write,
        .fb_sync        = NULL,
        .fb_ioctl       = au1200fb_ioctl,
        .fb_mmap        = au1200fb_fb_mmap,
@@ -1561,10 +1529,9 @@ static irqreturn_t au1200fb_handle_irq(int irq, void* dev_id)
 
 static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
 {
-       struct fb_info *fbi = &fbdev->fb_info;
+       struct fb_info *fbi = fbdev->fb_info;
        int bpp;
 
-       memset(fbi, 0, sizeof(struct fb_info));
        fbi->fbops = &au1200fb_fb_ops;
 
        bpp = winbpp(win->w[fbdev->plane].mode_winctrl1);
@@ -1623,24 +1590,36 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
 
 /* AU1200 LCD controller device driver */
 
-static int au1200fb_drv_probe(struct platform_device *dev)
+static int __devinit au1200fb_drv_probe(struct platform_device *dev)
 {
        struct au1200fb_device *fbdev;
+       struct fb_info *fbi = NULL;
        unsigned long page;
-       int bpp, plane, ret;
+       int bpp, plane, ret, irq;
 
-       if (!dev)
-               return -EINVAL;
+       /* shut gcc up */
+       ret = 0;
+       fbdev = NULL;
+
+       /* Kickstart the panel */
+       au1200_setpanel(panel);
 
-       for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) {
+       for (plane = 0; plane < device_count; ++plane) {
                bpp = winbpp(win->w[plane].mode_winctrl1);
                if (win->w[plane].xres == 0)
                        win->w[plane].xres = panel->Xres;
                if (win->w[plane].yres == 0)
                        win->w[plane].yres = panel->Yres;
 
-               fbdev = &_au1200fb_devices[plane];
-               memset(fbdev, 0, sizeof(struct au1200fb_device));
+               fbi = framebuffer_alloc(sizeof(struct au1200fb_device),
+                                       &dev->dev);
+               if (!fbi)
+                       goto failed;
+
+               _au1200fb_infos[plane] = fbi;
+               fbdev = fbi->par;
+               fbdev->fb_info = fbi;
+
                fbdev->plane = plane;
 
                /* Allocate the framebuffer to the maximum screen size */
@@ -1673,30 +1652,31 @@ static int au1200fb_drv_probe(struct platform_device *dev)
                        goto failed;
 
                /* Register new framebuffer */
-               if ((ret = register_framebuffer(&fbdev->fb_info)) < 0) {
+               ret = register_framebuffer(fbi);
+               if (ret < 0) {
                        print_err("cannot register new framebuffer");
                        goto failed;
                }
 
-               au1200fb_fb_set_par(&fbdev->fb_info);
+               au1200fb_fb_set_par(fbi);
 
 #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)
                if (plane == 0)
-                       if (fb_prepare_logo(&fbdev->fb_info, FB_ROTATE_UR)) {
+                       if (fb_prepare_logo(fbi, FB_ROTATE_UR)) {
                                /* Start display and show logo on boot */
-                               fb_set_cmap(&fbdev->fb_info.cmap,
-                                               &fbdev->fb_info);
-
-                               fb_show_logo(&fbdev->fb_info, FB_ROTATE_UR);
+                               fb_set_cmap(&fbi->cmap, fbi);
+                               fb_show_logo(fbi, FB_ROTATE_UR);
                        }
 #endif
        }
 
        /* Now hook interrupt too */
-       if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq,
-                         IRQF_DISABLED | IRQF_SHARED, "lcd", (void *)dev)) < 0) {
+       irq = platform_get_irq(dev, 0);
+       ret = request_irq(irq, au1200fb_handle_irq,
+                         IRQF_DISABLED | IRQF_SHARED, "lcd", (void *)dev);
+       if (ret) {
                print_err("fail to request interrupt line %d (err: %d)",
-                         AU1200_LCD_INT, ret);
+                         irq, ret);
                goto failed;
        }
 
@@ -1705,84 +1685,108 @@ static int au1200fb_drv_probe(struct platform_device *dev)
 failed:
        /* NOTE: This only does the current plane/window that failed; others are still active */
        if (fbdev->fb_mem)
-               dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),
+               dma_free_noncoherent(&dev->dev, PAGE_ALIGN(fbdev->fb_len),
                                fbdev->fb_mem, fbdev->fb_phys);
-       if (fbdev->fb_info.cmap.len != 0)
-               fb_dealloc_cmap(&fbdev->fb_info.cmap);
-       if (fbdev->fb_info.pseudo_palette)
-               kfree(fbdev->fb_info.pseudo_palette);
+       if (fbi) {
+               if (fbi->cmap.len != 0)
+                       fb_dealloc_cmap(&fbi->cmap);
+               kfree(fbi->pseudo_palette);
+       }
        if (plane == 0)
                free_irq(AU1200_LCD_INT, (void*)dev);
        return ret;
 }
 
-static int au1200fb_drv_remove(struct platform_device *dev)
+static int __devexit au1200fb_drv_remove(struct platform_device *dev)
 {
        struct au1200fb_device *fbdev;
+       struct fb_info *fbi;
        int plane;
 
-       if (!dev)
-               return -ENODEV;
-
        /* Turn off the panel */
        au1200_setpanel(NULL);
 
-       for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)
-       {
-               fbdev = &_au1200fb_devices[plane];
+       for (plane = 0; plane < device_count; ++plane)  {
+               fbi = _au1200fb_infos[plane];
+               fbdev = fbi->par;
 
                /* Clean up all probe data */
-               unregister_framebuffer(&fbdev->fb_info);
+               unregister_framebuffer(fbi);
                if (fbdev->fb_mem)
                        dma_free_noncoherent(&dev->dev,
                                        PAGE_ALIGN(fbdev->fb_len),
                                        fbdev->fb_mem, fbdev->fb_phys);
-               if (fbdev->fb_info.cmap.len != 0)
-                       fb_dealloc_cmap(&fbdev->fb_info.cmap);
-               if (fbdev->fb_info.pseudo_palette)
-                       kfree(fbdev->fb_info.pseudo_palette);
+               if (fbi->cmap.len != 0)
+                       fb_dealloc_cmap(&fbi->cmap);
+               kfree(fbi->pseudo_palette);
+
+               framebuffer_release(fbi);
+               _au1200fb_infos[plane] = NULL;
        }
 
-       free_irq(AU1200_LCD_INT, (void *)dev);
+       free_irq(platform_get_irq(dev, 0), (void *)dev);
 
        return 0;
 }
 
 #ifdef CONFIG_PM
-static int au1200fb_drv_suspend(struct platform_device *dev, u32 state)
+static int au1200fb_drv_suspend(struct device *dev)
 {
-       /* TODO */
+       au1200_setpanel(NULL);
+
+       lcd->outmask = 0;
+       au_sync();
+
        return 0;
 }
 
-static int au1200fb_drv_resume(struct platform_device *dev)
+static int au1200fb_drv_resume(struct device *dev)
 {
-       /* TODO */
+       struct fb_info *fbi;
+       int i;
+
+       /* Kickstart the panel */
+       au1200_setpanel(panel);
+
+       for (i = 0; i < device_count; i++) {
+               fbi = _au1200fb_infos[i];
+               au1200fb_fb_set_par(fbi);
+       }
+
        return 0;
 }
+
+static const struct dev_pm_ops au1200fb_pmops = {
+       .suspend        = au1200fb_drv_suspend,
+       .resume         = au1200fb_drv_resume,
+       .freeze         = au1200fb_drv_suspend,
+       .thaw           = au1200fb_drv_resume,
+};
+
+#define AU1200FB_PMOPS (&au1200fb_pmops)
+
+#else
+#define AU1200FB_PMOPS NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver au1200fb_driver = {
        .driver = {
-               .name           = "au1200-lcd",
-               .owner          = THIS_MODULE,
+               .name   = "au1200-lcd",
+               .owner  = THIS_MODULE,
+               .pm     = AU1200FB_PMOPS,
        },
        .probe          = au1200fb_drv_probe,
-       .remove         = au1200fb_drv_remove,
-#ifdef CONFIG_PM
-       .suspend        = au1200fb_drv_suspend,
-       .resume         = au1200fb_drv_resume,
-#endif
+       .remove         = __devexit_p(au1200fb_drv_remove),
 };
 
 /*-------------------------------------------------------------------------*/
 
 /* Kernel driver */
 
-static void au1200fb_setup(void)
+static int au1200fb_setup(void)
 {
-       charoptions = NULL;
-       char* this_opt;
+       char *options = NULL;
+       char *this_opt, *endptr;
        int num_panels = ARRAY_SIZE(known_lcd_panels);
        int panel_idx = -1;
 
@@ -1827,70 +1831,42 @@ static void au1200fb_setup(void)
                                nohwcursor = 1;
                        }
 
-                       /* Unsupported option */
-                       else {
-                               print_warn("Unsupported option \"%s\"", this_opt);
+                       else if (strncmp(this_opt, "devices:", 8) == 0) {
+                               this_opt += 8;
+                               device_count = simple_strtol(this_opt,
+                                                            &endptr, 0);
+                               if ((device_count < 0) ||
+                                   (device_count > MAX_DEVICE_COUNT))
+                                       device_count = MAX_DEVICE_COUNT;
                        }
-               }
-       }
-}
 
-#ifdef CONFIG_PM
-static int au1200fb_pm_callback(au1xxx_power_dev_t *dev,
-               au1xxx_request_t request, void *data) {
-       int retval = -1;
-       unsigned int d = 0;
-       unsigned int brightness = 0;
-
-       if (request == AU1XXX_PM_SLEEP) {
-               board_au1200fb_panel_shutdown();
-       }
-       else if (request == AU1XXX_PM_WAKEUP) {
-               if(dev->prev_state == SLEEP_STATE)
-               {
-                       int plane;
-                       au1200_setpanel(panel);
-                       for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)         {
-                               struct au1200fb_device *fbdev;
-                               fbdev = &_au1200fb_devices[plane];
-                               au1200fb_fb_set_par(&fbdev->fb_info);
+                       else if (strncmp(this_opt, "wincfg:", 7) == 0) {
+                               this_opt += 7;
+                               window_index = simple_strtol(this_opt,
+                                                            &endptr, 0);
+                               if ((window_index < 0) ||
+                                   (window_index >= ARRAY_SIZE(windows)))
+                                       window_index = DEFAULT_WINDOW_INDEX;
                        }
-               }
 
-               d = *((unsigned int*)data);
-               if(d <=10) brightness = 26;
-               else if(d<=20) brightness = 51;
-               else if(d<=30) brightness = 77;
-               else if(d<=40) brightness = 102;
-               else if(d<=50) brightness = 128;
-               else if(d<=60) brightness = 153;
-               else if(d<=70) brightness = 179;
-               else if(d<=80) brightness = 204;
-               else if(d<=90) brightness = 230;
-               else brightness = 255;
-               set_brightness(brightness);
-       } else if (request == AU1XXX_PM_GETSTATUS) {
-               return dev->cur_state;
-       } else if (request == AU1XXX_PM_ACCESS) {
-               if (dev->cur_state != SLEEP_STATE)
-                       return retval;
-               else {
-                       au1200_setpanel(panel);
+                       else if (strncmp(this_opt, "off", 3) == 0)
+                               return 1;
+                       /* Unsupported option */
+                       else {
+                               print_warn("Unsupported option \"%s\"", this_opt);
+                       }
                }
-       } else if (request == AU1XXX_PM_IDLE) {
-       } else if (request == AU1XXX_PM_CLEANUP) {
        }
-
-       return retval;
+       return 0;
 }
-#endif
 
 static int __init au1200fb_init(void)
 {
        print_info("" DRIVER_DESC "");
 
        /* Setup driver with options */
-       au1200fb_setup();
+       if (au1200fb_setup())
+               return -ENODEV;
 
        /* Point to the panel selected */
        panel = &known_lcd_panels[panel_index];
@@ -1899,17 +1875,6 @@ static int __init au1200fb_init(void)
        printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name);
        printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name);
 
-       /* Kickstart the panel, the framebuffers/windows come soon enough */
-       au1200_setpanel(panel);
-
-       #ifdef CONFIG_PM
-       LCD_pm_dev = new_au1xxx_power_device("LCD", &au1200fb_pm_callback, NULL);
-       if ( LCD_pm_dev == NULL)
-               printk(KERN_INFO "Unable to create a power management device entry for the au1200fb.\n");
-       else
-               printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n");
-       #endif
-
        return platform_driver_register(&au1200fb_driver);
 }
 
index c225dcc..f694401 100644 (file)
@@ -550,7 +550,7 @@ static void control_set_hardware(struct fb_info_control *p, struct fb_par_contro
 
 
 /*
- * Parse user speficied options (`video=controlfb:')
+ * Parse user specified options (`video=controlfb:')
  */
 static void __init control_setup(char *options)
 {
index fcdac87..8d4e4eb 100644 (file)
@@ -877,8 +877,8 @@ static int da8xx_pan_display(struct fb_var_screeninfo *var,
 
                        start   = fix->smem_start +
                                new_var.yoffset * fix->line_length +
-                               new_var.xoffset * var->bits_per_pixel / 8;
-                       end     = start + var->yres * fix->line_length - 1;
+                               new_var.xoffset * fbi->var.bits_per_pixel / 8;
+                       end     = start + fbi->var.yres * fix->line_length - 1;
                        par->dma_start  = start;
                        par->dma_end    = end;
                }
index 27f2c57..60a787f 100644 (file)
@@ -624,8 +624,8 @@ static int unifb_pan_display(struct fb_var_screeninfo *var,
                    || var->xoffset)
                        return -EINVAL;
        } else {
-               if (var->xoffset + var->xres > info->var.xres_virtual ||
-                   var->yoffset + var->yres > info->var.yres_virtual)
+               if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+                   var->yoffset + info->var.yres > info->var.yres_virtual)
                        return -EINVAL;
        }
        info->var.xoffset = var->xoffset;
index 8040001..a79c0de 100644 (file)
@@ -216,8 +216,7 @@ void fb_deferred_io_cleanup(struct fb_info *info)
        int i;
 
        BUG_ON(!fbdefio);
-       cancel_delayed_work(&info->deferred_work);
-       flush_scheduled_work();
+       cancel_delayed_work_sync(&info->deferred_work);
 
        /* clear out the mapping that we setup */
        for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
index d662317..223896c 100644 (file)
@@ -149,10 +149,11 @@ int g364fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 static int g364fb_pan_display(struct fb_var_screeninfo *var, 
                              struct fb_info *info)
 {
-       if (var->xoffset || var->yoffset + var->yres > var->yres_virtual)
+       if (var->xoffset ||
+           var->yoffset + info->var.yres > info->var.yres_virtual)
                return -EINVAL;
 
-       *(unsigned int *) TOP_REG = var->yoffset * var->xres;
+       *(unsigned int *) TOP_REG = var->yoffset * info->var.xres;
        return 0;
 }
 
index 896e53d..0fad23f 100644 (file)
@@ -543,8 +543,8 @@ static int gxt4500_pan_display(struct fb_var_screeninfo *var,
 
        if (var->xoffset & 7)
                return -EINVAL;
-       if (var->xoffset + var->xres > var->xres_virtual ||
-           var->yoffset + var->yres > var->yres_virtual)
+       if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+           var->yoffset + info->var.yres > info->var.yres_virtual)
                return -EINVAL;
 
        writereg(par, REFRESH_START, (var->xoffset << 16) | var->yoffset);
index 4052718..4394389 100644 (file)
@@ -422,8 +422,8 @@ static int hgafb_pan_display(struct fb_var_screeninfo *var,
                    var->xoffset)
                        return -EINVAL;
        } else {
-               if (var->xoffset + var->xres > info->var.xres_virtual
-                || var->yoffset + var->yres > info->var.yres_virtual
+               if (var->xoffset + info->var.xres > info->var.xres_virtual
+                || var->yoffset + info->var.yres > info->var.yres_virtual
                 || var->yoffset % 8)
                        return -EINVAL;
        }
index efb2c10..8149356 100644 (file)
@@ -749,7 +749,7 @@ set_offset (struct fb_var_screeninfo *var, struct fb_info *info)
 {
        struct imstt_par *par = info->par;
        __u32 off = var->yoffset * (info->fix.line_length >> 3)
-                   + ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3);
+                   + ((var->xoffset * (info->var.bits_per_pixel >> 3)) >> 3);
        write_reg_le32(par->dc_regs, SSR, off);
 }
 
index 38065cf..fbad61d 100644 (file)
@@ -390,12 +390,12 @@ int intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
        xoffset = ROUND_DOWN_TO(var->xoffset, 8);
        yoffset = var->yoffset;
 
-       if ((xoffset + var->xres > var->xres_virtual) ||
-           (yoffset + var->yres > var->yres_virtual))
+       if ((xoffset + info->var.xres > info->var.xres_virtual) ||
+           (yoffset + info->var.yres > info->var.yres_virtual))
                return -EINVAL;
 
        offset = (yoffset * dinfo->pitch) +
-                (xoffset * var->bits_per_pixel) / 8;
+                (xoffset * info->var.bits_per_pixel) / 8;
 
        offset += dinfo->fb.offset << 12;
 
index f70bd63..2191de0 100644 (file)
@@ -278,7 +278,7 @@ static int mb862xxfb_pan(struct fb_var_screeninfo *var,
        reg = pack(var->yoffset, var->xoffset);
        outreg(disp, GC_L0WY_L0WX, reg);
 
-       reg = pack(var->yres_virtual, var->xres_virtual);
+       reg = pack(info->var.yres_virtual, info->var.xres_virtual);
        outreg(disp, GC_L0WH_L0WW, reg);
        return 0;
 }
index 7e3a490..bd76858 100644 (file)
@@ -1062,15 +1062,15 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
        y_bottom = var->yoffset;
 
        if (!(var->vmode & FB_VMODE_YWRAP))
-               y_bottom += var->yres;
+               y_bottom += fbi->var.yres;
 
        if (y_bottom > fbi->var.yres_virtual)
                return -EINVAL;
 
        mutex_lock(&mx3_fbi->mutex);
 
-       offset = (var->yoffset * var->xres_virtual + var->xoffset) *
-               (var->bits_per_pixel / 8);
+       offset = var->yoffset * fbi->fix.line_length
+              + var->xoffset * (fbi->var.bits_per_pixel / 8);
        base = fbi->fix.smem_start + offset;
 
        dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n",
index 588527a..feea7b1 100644 (file)
@@ -1185,8 +1185,8 @@ static int neofb_pan_display(struct fb_var_screeninfo *var,
 
        DBG("neofb_update_start");
 
-       Base = (var->yoffset * var->xres_virtual + var->xoffset) >> 2;
-       Base *= (var->bits_per_pixel + 7) / 8;
+       Base = (var->yoffset * info->var.xres_virtual + var->xoffset) >> 2;
+       Base *= (info->var.bits_per_pixel + 7) / 8;
 
        neoUnlock();
 
index ef532d9..a0d0c3d 100644 (file)
@@ -490,7 +490,7 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var,
 
 
 /* 
- * Parse user speficied options (`video=platinumfb:')
+ * Parse user specified options (`video=platinumfb:')
  */
 static int __init platinumfb_setup(char *options)
 {
index 27f93aa..dc7bfa9 100644 (file)
@@ -973,8 +973,8 @@ static int pm2fb_pan_display(struct fb_var_screeninfo *var,
 {
        struct pm2fb_par *p = info->par;
        u32 base;
-       u32 depth = (var->bits_per_pixel + 7) & ~7;
-       u32 xres = (var->xres + 31) & ~31;
+       u32 depth = (info->var.bits_per_pixel + 7) & ~7;
+       u32 xres = (info->var.xres + 31) & ~31;
 
        depth = (depth > 32) ? 32 : depth;
        base = to3264(var->yoffset * xres + var->xoffset, depth, 1);
@@ -1773,7 +1773,7 @@ MODULE_DEVICE_TABLE(pci, pm2fb_id_table);
 
 #ifndef MODULE
 /**
- * Parse user speficied options.
+ * Parse user specified options.
  *
  * This is, comma-separated options following `video=pm2fb:'.
  */
index 6666f45..6632ee5 100644 (file)
@@ -1147,9 +1147,9 @@ static int pm3fb_pan_display(struct fb_var_screeninfo *var,
                                 struct fb_info *info)
 {
        struct pm3_par *par = info->par;
-       const u32 xres = (var->xres + 31) & ~31;
+       const u32 xres = (info->var.xres + 31) & ~31;
 
-       par->base = pm3fb_shift_bpp(var->bits_per_pixel,
+       par->base = pm3fb_shift_bpp(info->var.bits_per_pixel,
                                        (var->yoffset * xres)
                                        + var->xoffset);
        PM3_WAIT(par, 1);
@@ -1525,7 +1525,7 @@ static int __init pm3fb_setup(char *options)
 {
        char *this_opt;
 
-       /* Parse user speficied options (`video=pm3fb:') */
+       /* Parse user specified options (`video=pm3fb:') */
        if (!options || !*options)
                return 0;
 
index 4aecf21..fd9f20d 100644 (file)
@@ -883,7 +883,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
                }
        }
        /* Offset in bytes to the end of the displayed area */
-       end_boff = start_boff + var->yres * info->fix.line_length;
+       end_boff = start_boff + info->var.yres * info->fix.line_length;
 
        /* Temporarily turn off per-vsync update from shadow registers until
         * both start and end addresses are updated to prevent corruption */
index 4ca5d0c..946a949 100644 (file)
@@ -1019,12 +1019,13 @@ static int s3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
        unsigned int offset;
 
        /* Calculate the offset */
-       if (var->bits_per_pixel == 0) {
-               offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2);
+       if (info->var.bits_per_pixel == 0) {
+               offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
+                      + (var->xoffset / 2);
                offset = offset >> 2;
        } else {
                offset = (var->yoffset * info->fix.line_length) +
-                        (var->xoffset * var->bits_per_pixel / 8);
+                        (var->xoffset * info->var.bits_per_pixel / 8);
                offset = offset >> 2;
        }
 
@@ -1504,7 +1505,7 @@ static struct pci_driver s3fb_pci_driver = {
        .resume         = s3_pci_resume,
 };
 
-/* Parse user speficied options */
+/* Parse user specified options */
 
 #ifndef MODULE
 static int  __init s3fb_setup(char *options)
index 4de541c..beb4950 100644 (file)
@@ -1477,15 +1477,9 @@ static void savagefb_set_par_int(struct savagefb_par  *par, struct savage_reg *r
        vgaHWProtect(par, 0);
 }
 
-static void savagefb_update_start(struct savagefb_par      *par,
-                                 struct fb_var_screeninfo *var)
+static void savagefb_update_start(struct savagefb_par *par, int base)
 {
-       int base;
-
-       base = ((var->yoffset * var->xres_virtual + (var->xoffset & ~1))
-               * ((var->bits_per_pixel+7) / 8)) >> 2;
-
-       /* now program the start address registers */
+       /* program the start address registers */
        vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par);
        vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par);
        vga_out8(0x3d4, 0x69, par);
@@ -1550,8 +1544,12 @@ static int savagefb_pan_display(struct fb_var_screeninfo *var,
                                struct fb_info           *info)
 {
        struct savagefb_par *par = info->par;
+       int base;
+
+       base = (var->yoffset * info->fix.line_length
+            + (var->xoffset & ~1) * ((info->var.bits_per_pixel+7) / 8)) >> 2;
 
-       savagefb_update_start(par, var);
+       savagefb_update_start(par, base);
        return 0;
 }
 
index 7525984..078ca21 100644 (file)
@@ -1333,19 +1333,14 @@ sisfb_set_base_CRT2(struct sis_video_info *ivideo, unsigned int base)
 }
 
 static int
-sisfb_pan_var(struct sis_video_info *ivideo, struct fb_var_screeninfo *var)
+sisfb_pan_var(struct sis_video_info *ivideo, struct fb_info *info,
+             struct fb_var_screeninfo *var)
 {
-       if(var->xoffset > (var->xres_virtual - var->xres)) {
-               return -EINVAL;
-       }
-       if(var->yoffset > (var->yres_virtual - var->yres)) {
-               return -EINVAL;
-       }
-
-       ivideo->current_base = (var->yoffset * var->xres_virtual) + var->xoffset;
+       ivideo->current_base = var->yoffset * info->var.xres_virtual
+                            + var->xoffset;
 
        /* calculate base bpp dep. */
-       switch(var->bits_per_pixel) {
+       switch (info->var.bits_per_pixel) {
        case 32:
                break;
        case 16:
@@ -1635,20 +1630,15 @@ sisfb_pan_display(struct fb_var_screeninfo *var, struct fb_info* info)
        struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
        int err;
 
-       if(var->xoffset > (var->xres_virtual - var->xres))
-               return -EINVAL;
-
-       if(var->yoffset > (var->yres_virtual - var->yres))
-               return -EINVAL;
-
-       if(var->vmode & FB_VMODE_YWRAP)
+       if (var->vmode & FB_VMODE_YWRAP)
                return -EINVAL;
 
-       if(var->xoffset + info->var.xres > info->var.xres_virtual ||
-          var->yoffset + info->var.yres > info->var.yres_virtual)
+       if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+           var->yoffset + info->var.yres > info->var.yres_virtual)
                return -EINVAL;
 
-       if((err = sisfb_pan_var(ivideo, var)) < 0)
+       err = sisfb_pan_var(ivideo, info, var);
+       if (err < 0)
                return err;
 
        info->var.xoffset = var->xoffset;
index 89158bc..30f7a81 100644 (file)
@@ -989,7 +989,7 @@ static struct platform_device *xxxfb_device;
  */
 int __init xxxfb_setup(char *options)
 {
-    /* Parse user speficied options (`video=xxxfb:') */
+    /* Parse user specified options (`video=xxxfb:') */
 }
 #endif /* MODULE */
 
index 6294dca..a78254c 100644 (file)
@@ -582,7 +582,7 @@ static int sm501fb_pan_crt(struct fb_var_screeninfo *var,
 {
        struct sm501fb_par  *par = info->par;
        struct sm501fb_info *fbi = par->info;
-       unsigned int bytes_pixel = var->bits_per_pixel / 8;
+       unsigned int bytes_pixel = info->var.bits_per_pixel / 8;
        unsigned long reg;
        unsigned long xoffs;
 
@@ -614,10 +614,10 @@ static int sm501fb_pan_pnl(struct fb_var_screeninfo *var,
        struct sm501fb_info *fbi = par->info;
        unsigned long reg;
 
-       reg = var->xoffset | (var->xres_virtual << 16);
+       reg = var->xoffset | (info->var.xres_virtual << 16);
        smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_WIDTH);
 
-       reg = var->yoffset | (var->yres_virtual << 16);
+       reg = var->yoffset | (info->var.yres_virtual << 16);
        smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_HEIGHT);
 
        sm501fb_sync_regs(fbi);
index c6c7756..34cf019 100644 (file)
@@ -987,8 +987,8 @@ static int tridentfb_pan_display(struct fb_var_screeninfo *var,
        unsigned int offset;
 
        debug("enter\n");
-       offset = (var->xoffset + (var->yoffset * var->xres_virtual))
-               * var->bits_per_pixel / 32;
+       offset = (var->xoffset + (var->yoffset * info->var.xres_virtual))
+               * info->var.bits_per_pixel / 32;
        set_screen_start(par, offset);
        debug("exit\n");
        return 0;
index 6b52bf6..3f5a041 100644 (file)
@@ -555,7 +555,7 @@ static int __init valkyrie_init_info(struct fb_info *info,
 
 
 /*
- * Parse user speficied options (`video=valkyriefb:')
+ * Parse user specified options (`video=valkyriefb:')
  */
 int __init valkyriefb_setup(char *options)
 {
index bc67251..bf2f780 100644 (file)
@@ -395,8 +395,8 @@ static int vfb_pan_display(struct fb_var_screeninfo *var,
                    || var->xoffset)
                        return -EINVAL;
        } else {
-               if (var->xoffset + var->xres > info->var.xres_virtual ||
-                   var->yoffset + var->yres > info->var.yres_virtual)
+               if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+                   var->yoffset + info->var.yres > info->var.yres_virtual)
                        return -EINVAL;
        }
        info->var.xoffset = var->xoffset;
index 305c975..0267acd 100644 (file)
@@ -207,7 +207,7 @@ static void vga16fb_pan_var(struct fb_info *info,
         * granularity if someone supports xoffset in bit resolution */
        vga_io_r(VGA_IS1_RC);           /* reset flip-flop */
        vga_io_w(VGA_ATT_IW, VGA_ATC_PEL);
-       if (var->bits_per_pixel == 8)
+       if (info->var.bits_per_pixel == 8)
                vga_io_w(VGA_ATT_IW, (xoffset & 3) << 1);
        else
                vga_io_w(VGA_ATT_IW, xoffset & 7);
index 0e120d6..c13c246 100644 (file)
@@ -210,8 +210,8 @@ static int vt8500lcd_pan_display(struct fb_var_screeninfo *var,
        struct vt8500lcd_info *fbi = to_vt8500lcd_info(info);
 
        writel((1 << 31)
-               | (((var->xres_virtual - var->xres) * pixlen / 4) << 20)
-               | (off >> 2), fbi->regbase + 0x20);
+            | (((info->var.xres_virtual - info->var.xres) * pixlen / 4) << 20)
+            | (off >> 2), fbi->regbase + 0x20);
        return 0;
 }
 
index f9b3e3d..4e74d26 100644 (file)
@@ -620,13 +620,14 @@ static int vt8623fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *i
        unsigned int offset;
 
        /* Calculate the offset */
-       if (var->bits_per_pixel == 0) {
-               offset = (var->yoffset / 16) * var->xres_virtual + var->xoffset;
+       if (info->var.bits_per_pixel == 0) {
+               offset = (var->yoffset / 16) * info->var.xres_virtual
+                      + var->xoffset;
                offset = offset >> 3;
        } else {
                offset = (var->yoffset * info->fix.line_length) +
-                        (var->xoffset * var->bits_per_pixel / 8);
-               offset = offset >> ((var->bits_per_pixel == 4) ? 2 : 1);
+                        (var->xoffset * info->var.bits_per_pixel / 8);
+               offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 1);
        }
 
        /* Set the offset */