[PATCH] neofb: take existing display configuration as default
[cascardo/linux.git] / drivers / video / neofb.c
index 8486e77..747602a 100644 (file)
@@ -485,7 +485,7 @@ static void vgaHWRestore(const struct fb_info *info,
  */
 static inline int neo2200_sync(struct fb_info *info)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        int waitcycles;
 
        while (readl(&par->neo2200->bltStat) & 1)
@@ -525,7 +525,7 @@ static inline void neo2200_wait_fifo(struct fb_info *info,
 static inline void neo2200_accel_init(struct fb_info *info,
                                      struct fb_var_screeninfo *var)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        Neo2200 __iomem *neo2200 = par->neo2200;
        u32 bltMod, pitch;
 
@@ -560,7 +560,7 @@ static inline void neo2200_accel_init(struct fb_info *info,
 static int
 neofb_open(struct fb_info *info, int user)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        int cnt = atomic_read(&par->ref_count);
 
        if (!cnt) {
@@ -575,7 +575,7 @@ neofb_open(struct fb_info *info, int user)
 static int
 neofb_release(struct fb_info *info, int user)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        int cnt = atomic_read(&par->ref_count);
 
        if (!cnt)
@@ -590,7 +590,7 @@ neofb_release(struct fb_info *info, int user)
 static int
 neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        unsigned int pixclock = var->pixclock;
        struct xtimings timings;
        int memlen, vramlen;
@@ -757,7 +757,7 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 static int neofb_set_par(struct fb_info *info)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        struct xtimings timings;
        unsigned char temp;
        int i, clock_hi = 0;
@@ -853,7 +853,7 @@ static int neofb_set_par(struct fb_info *info)
        /* If the user did not specify any display devices, then... */
        if (par->PanelDispCntlReg1 == 0x00) {
                /* Default to internal (i.e., LCD) only. */
-               par->PanelDispCntlReg1 |= 0x02;
+               par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
        }
 
        /* If we are using a fixed mode, then tell the chip we are. */
@@ -1216,7 +1216,7 @@ static int neofb_set_par(struct fb_info *info)
 static void neofb_update_start(struct fb_info *info,
                               struct fb_var_screeninfo *var)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        struct vgastate *state = &par->state;
        int oldExtCRTDispAddr;
        int Base;
@@ -1331,7 +1331,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
         *  wms...Enable VESA DPMS compatible powerdown mode
         *  run "setterm -powersave powerdown" to take advantage
         */
-       struct neofb_par *par = (struct neofb_par *)info->par;
+       struct neofb_par *par = info->par;
        int seqflags, lcdflags, dpmsflags, reg;
 
        switch (blank_mode) {
@@ -1404,7 +1404,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
 static void
 neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        u_long dst, rop;
 
        dst = rect->dx + rect->dy * info->var.xres_virtual;
@@ -1440,7 +1440,7 @@ static void
 neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area)
 {
        u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy;
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        u_long src, dst, bltCntl;
 
        bltCntl = NEO_BC3_FIFO_EN | NEO_BC3_SKIP_MAPPING | 0x0C0000;
@@ -1472,7 +1472,7 @@ neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area)
 static void
 neo2200_imageblit(struct fb_info *info, const struct fb_image *image)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        int s_pitch = (image->width * image->depth + 7) >> 3;
        int scan_align = info->pixmap.scan_align - 1;
        int buf_align = info->pixmap.buf_align - 1;
@@ -1686,7 +1686,7 @@ static struct fb_videomode __devinitdata mode800x480 = {
 static int __devinit neo_map_mmio(struct fb_info *info,
                                  struct pci_dev *dev)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
 
        DBG("neo_map_mmio");
 
@@ -1733,7 +1733,7 @@ static int __devinit neo_map_mmio(struct fb_info *info,
 
 static void neo_unmap_mmio(struct fb_info *info)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
 
        DBG("neo_unmap_mmio");
 
@@ -1796,7 +1796,7 @@ static void neo_unmap_video(struct fb_info *info)
 
 #ifdef CONFIG_MTRR
        {
-               struct neofb_par *par = (struct neofb_par *) info->par;
+               struct neofb_par *par = info->par;
 
                mtrr_del(par->mtrr, info->fix.smem_start,
                         info->fix.smem_len);
@@ -1811,7 +1811,7 @@ static void neo_unmap_video(struct fb_info *info)
 
 static int __devinit neo_scan_monitor(struct fb_info *info)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        unsigned char type, display;
        int w;
 
@@ -1890,7 +1890,7 @@ static int __devinit neo_scan_monitor(struct fb_info *info)
 
 static int __devinit neo_init_hw(struct fb_info *info)
 {
-       struct neofb_par *par = (struct neofb_par *) info->par;
+       struct neofb_par *par = info->par;
        int videoRam = 896;
        int maxClock = 65000;
        int CursorMem = 1024;
@@ -2014,7 +2014,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st
        struct fb_info *info;
        struct neofb_par *par;
 
-       info = framebuffer_alloc(sizeof(struct neofb_par) + sizeof(u32) * 256, &dev->dev);
+       info = framebuffer_alloc(sizeof(struct neofb_par), &dev->dev);
 
        if (!info)
                return NULL;
@@ -2081,7 +2081,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st
        info->fix.accel = id->driver_data;
 
        info->fbops = &neofb_ops;
-       info->pseudo_palette = (void *) (par + 1);
+       info->pseudo_palette = par->palette;
        return info;
 }