vserver 1.9.5.x5
[linux-2.6.git] / drivers / video / pxafb.c
index 3e2bb2d..552a38e 100644 (file)
@@ -371,9 +371,10 @@ static int pxafb_blank(int blank, struct fb_info *info)
        DPRINTK("pxafb_blank: blank=%d\n", blank);
 
        switch (blank) {
-       case VESA_POWERDOWN:
-       case VESA_VSYNC_SUSPEND:
-       case VESA_HSYNC_SUSPEND:
+       case FB_BLANK_POWERDOWN:
+       case FB_BLANK_VSYNC_SUSPEND:
+       case FB_BLANK_HSYNC_SUSPEND:
+       case FB_BLANK_NORMAL:
                if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
                    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
                        for (i = 0; i < fbi->palette_size; i++)
@@ -383,7 +384,7 @@ static int pxafb_blank(int blank, struct fb_info *info)
                //TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
                break;
 
-       case VESA_NO_BLANKING:
+       case FB_BLANK_UNBLANK:
                //TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
                if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
                    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
@@ -393,6 +394,20 @@ static int pxafb_blank(int blank, struct fb_info *info)
        return 0;
 }
 
+static int pxafb_mmap(struct fb_info *info, struct file *file,
+                     struct vm_area_struct *vma)
+{
+       struct pxafb_info *fbi = (struct pxafb_info *)info;
+       unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
+
+       if (off < info->fix.smem_len) {
+               vma->vm_pgoff += 1;
+               return dma_mmap_writecombine(fbi->dev, vma, fbi->map_cpu,
+                                            fbi->map_dma, fbi->map_size);
+       }
+       return -EINVAL;
+}
+
 static struct fb_ops pxafb_ops = {
        .owner          = THIS_MODULE,
        .fb_check_var   = pxafb_check_var,
@@ -403,6 +418,7 @@ static struct fb_ops pxafb_ops = {
        .fb_imageblit   = cfb_imageblit,
        .fb_blank       = pxafb_blank,
        .fb_cursor      = soft_cursor,
+       .fb_mmap        = pxafb_mmap,
 };
 
 /*
@@ -652,6 +668,7 @@ static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on)
 
 static void pxafb_setup_gpio(struct pxafb_info *fbi)
 {
+       int gpio, ldd_bits;
         unsigned int lccr0 = fbi->lccr0;
 
        /*
@@ -662,49 +679,31 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi)
        if ((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
            (lccr0 & LCCR0_SDS) == LCCR0_Sngl &&
            (lccr0 & LCCR0_DPD) == LCCR0_4PixMono)
-       {
-               // bits 58-61
-               GPDR1 |= (0xf << 26);
-               GAFR1_U = (GAFR1_U & ~(0xff << 20)) | (0xaa << 20);
-
-               // bits 74-77
-               GPDR2 |= (0xf << 10);
-               GAFR2_L = (GAFR2_L & ~(0xff << 20)) | (0xaa << 20);
-       }
+               ldd_bits = 4;
 
        /* 8 bit interface */
         else if (((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
                  ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_DPD) == LCCR0_8PixMono)) ||
                  ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
                  (lccr0 & LCCR0_PAS) == LCCR0_Pas && (lccr0 & LCCR0_SDS) == LCCR0_Sngl))
-       {
-               // bits 58-65
-               GPDR1 |= (0x3f << 26);
-               GPDR2 |= (0x3);
-
-               GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
-               GAFR2_L = (GAFR2_L & ~0xf) | (0xa);
-
-               // bits 74-77
-               GPDR2 |= (0xf << 10);
-               GAFR2_L = (GAFR2_L & ~(0xff << 20)) | (0xaa << 20);
-       }
+               ldd_bits = 8;
 
        /* 16 bit interface */
        else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
                 ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_PAS) == LCCR0_Act))
-       {
-               // bits 58-77
-               GPDR1 |= (0x3f << 26);
-               GPDR2 |= 0x00003fff;
-
-               GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
-               GAFR2_L = (GAFR2_L & 0xf0000000) | 0x0aaaaaaa;
-       }
+               ldd_bits = 16;
 
        else {
                printk(KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n");
+               return;
         }
+
+       for (gpio = 58; ldd_bits; gpio++, ldd_bits--)
+               pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT);
+       pxa_gpio_mode(GPIO74_LCD_FCLK_MD);
+       pxa_gpio_mode(GPIO75_LCD_LCLK_MD);
+       pxa_gpio_mode(GPIO76_LCD_PCLK_MD);
+       pxa_gpio_mode(GPIO77_LCD_ACBIAS_MD);
 }
 
 static void pxafb_enable_controller(struct pxafb_info *fbi)
@@ -741,8 +740,8 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
 
        DPRINTK("Disabling LCD controller\n");
 
-       add_wait_queue(&fbi->ctrlr_wait, &wait);
        set_current_state(TASK_UNINTERRUPTIBLE);
+       add_wait_queue(&fbi->ctrlr_wait, &wait);
 
        LCSR = 0xffffffff;      /* Clear LCD Status Register */
        LCCR0 &= ~LCCR0_LDM;    /* Enable LCD Disable Done Interrupt */
@@ -1043,7 +1042,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
        fbi->fb.fbops           = &pxafb_ops;
        fbi->fb.flags           = FBINFO_DEFAULT;
        fbi->fb.node            = -1;
-       fbi->fb.currcon         = -1;
 
        addr = fbi;
        addr = addr + sizeof(struct pxafb_info);