[ARM] pxafb: add accelerator ID for PXA3xx GCU
[safe/jmp/linux-2.6] / include / linux / fb.h
index dff7a72..a34bdf5 100644 (file)
@@ -1,14 +1,13 @@
 #ifndef _LINUX_FB_H
 #define _LINUX_FB_H
 
-#include <asm/types.h>
+#include <linux/types.h>
 #include <linux/i2c.h>
 
 struct dentry;
 
 /* Definitions of frame buffers                                                */
 
-#define FB_MAJOR               29
 #define FB_MAX                 32      /* sufficient for now */
 
 /* ioctls
@@ -119,6 +118,12 @@ struct dentry;
 #define FB_ACCEL_NV_40          46      /* nVidia Arch 40               */
 #define FB_ACCEL_XGI_VOLARI_V  47      /* XGI Volari V3XT, V5, V8      */
 #define FB_ACCEL_XGI_VOLARI_Z  48      /* XGI Volari Z7                */
+#define FB_ACCEL_OMAP1610      49      /* TI OMAP16xx                  */
+#define FB_ACCEL_TRIDENT_TGUI  50      /* Trident TGUI                 */
+#define FB_ACCEL_TRIDENT_3DIMAGE 51    /* Trident 3DImage              */
+#define FB_ACCEL_TRIDENT_BLADE3D 52    /* Trident Blade3D              */
+#define FB_ACCEL_TRIDENT_BLADEXP 53    /* Trident BladeXP              */
+#define FB_ACCEL_CIRRUS_ALPINE   53    /* Cirrus Logic 543x/544x/5480  */
 #define FB_ACCEL_NEOMAGIC_NM2070 90    /* NeoMagic NM2070              */
 #define FB_ACCEL_NEOMAGIC_NM2090 91    /* NeoMagic NM2090              */
 #define FB_ACCEL_NEOMAGIC_NM2093 92    /* NeoMagic NM2093              */
@@ -128,6 +133,7 @@ struct dentry;
 #define FB_ACCEL_NEOMAGIC_NM2230 96    /* NeoMagic NM2230              */
 #define FB_ACCEL_NEOMAGIC_NM2360 97    /* NeoMagic NM2360              */
 #define FB_ACCEL_NEOMAGIC_NM2380 98    /* NeoMagic NM2380              */
+#define FB_ACCEL_PXA3XX                 99     /* PXA3xx                       */
 
 #define FB_ACCEL_SAVAGE4        0x80   /* S3 Savage4                   */
 #define FB_ACCEL_SAVAGE3D       0x81   /* S3 Savage3D                  */
@@ -168,8 +174,12 @@ struct fb_fix_screeninfo {
 /* Interpretation of offset for color fields: All offsets are from the right,
  * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
  * can use the offset as right argument to <<). A pixel afterwards is a bit
- * stream and is written to video memory as that unmodified. This implies
- * big-endian byte order if bits_per_pixel is greater than 8.
+ * stream and is written to video memory as that unmodified.
+ *
+ * For pseudocolor: offset and length should be the same for all color
+ * components. Offset specifies the position of the least significant bit
+ * of the pallette index in a pixel value. Length indicates the number
+ * of available palette entries (i.e. # of entries = 1 << length).
  */
 struct fb_bitfield {
        __u32 offset;                   /* beginning of bitfield        */
@@ -179,6 +189,7 @@ struct fb_bitfield {
 };
 
 #define FB_NONSTD_HAM          1       /* Hold-And-Modify (HAM)        */
+#define FB_NONSTD_REV_PIX_IN_B 2       /* order of pixels in each byte is reversed */
 
 #define FB_ACTIVATE_NOW                0       /* set values immediately (or vbl)*/
 #define FB_ACTIVATE_NXTOPEN    1       /* activate on next open        */
@@ -205,6 +216,7 @@ struct fb_bitfield {
 #define FB_VMODE_NONINTERLACED  0      /* non interlaced */
 #define FB_VMODE_INTERLACED    1       /* interlaced   */
 #define FB_VMODE_DOUBLE                2       /* double scan */
+#define FB_VMODE_ODD_FLD_FIRST 4       /* interlaced: top line first */
 #define FB_VMODE_MASK          255
 
 #define FB_VMODE_YWRAP         256     /* ywrap instead of panning     */
@@ -529,6 +541,8 @@ struct fb_cursor_user {
 #define FB_EVENT_CONBLANK               0x0C
 /*      Get drawing requirements        */
 #define FB_EVENT_GET_REQ                0x0D
+/*      Unbind from the console if possible */
+#define FB_EVENT_FB_UNBIND              0x0E
 
 struct fb_event {
        struct fb_info *info;
@@ -664,6 +678,9 @@ struct fb_ops {
        /* get capability given var */
        void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
                            struct fb_var_screeninfo *var);
+
+       /* teardown any resources to do with this framebuffer */
+       void (*fb_destroy)(struct fb_info *info);
 };
 
 #ifdef CONFIG_FB_TILEBLITTING
@@ -773,6 +790,8 @@ struct fb_tile_ops {
 #define FBINFO_MISC_USEREVENT          0x10000 /* event request
                                                  from userspace */
 #define FBINFO_MISC_TILEBLITTING       0x20000 /* use tile blitting */
+#define FBINFO_MISC_FIRMWARE           0x40000 /* a replaceable firmware
+                                                 inited framebuffer */
 
 /* A driver may set this flag to indicate that it does want a set_par to be
  * called every time when fbcon_switch is executed. The advantage is that with
@@ -786,9 +805,22 @@ struct fb_tile_ops {
  */
 #define FBINFO_MISC_ALWAYS_SETPAR   0x40000
 
+/*
+ * Host and GPU endianness differ.
+ */
+#define FBINFO_FOREIGN_ENDIAN  0x100000
+/*
+ * Big endian math. This is the same flags as above, but with different
+ * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
+ * and host endianness. Drivers should not use this flag.
+ */
+#define FBINFO_BE_MATH  0x100000
+
 struct fb_info {
        int node;
        int flags;
+       struct mutex lock;              /* Lock for open/release/ioctl funcs */
+       struct mutex mm_lock;           /* Lock for fb_mmap and smem_* fields */
        struct fb_var_screeninfo var;   /* Current var */
        struct fb_fix_screeninfo fix;   /* Current fix */
        struct fb_monspecs monspecs;    /* Current Monitor specs */
@@ -829,7 +861,12 @@ struct fb_info {
        u32 state;                      /* Hardware state i.e suspend */
        void *fbcon_par;                /* fbcon use-only private area */
        /* From here on everything is device dependent */
-       void *par;      
+       void *par;
+       /* we need the PCI or similiar aperture base/size not
+          smem_start/size as smem_start may just be an object
+          allocated inside the aperture so may not actually overlap */
+       resource_size_t aperture_base;
+       resource_size_t aperture_size;
 };
 
 #ifdef MODULE
@@ -868,7 +905,7 @@ struct fb_info {
 #define fb_writeq sbus_writeq
 #define fb_memset sbus_memset_io
 
-#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__)
+#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
 
 #define fb_readb __raw_readb
 #define fb_readw __raw_readw
@@ -894,15 +931,11 @@ struct fb_info {
 
 #endif
 
-#if defined (__BIG_ENDIAN)
-#define FB_LEFT_POS(bpp)          (32 - bpp)
-#define FB_SHIFT_HIGH(val, bits)  ((val) >> (bits))
-#define FB_SHIFT_LOW(val, bits)   ((val) << (bits))
-#else
-#define FB_LEFT_POS(bpp)          (0)
-#define FB_SHIFT_HIGH(val, bits)  ((val) << (bits))
-#define FB_SHIFT_LOW(val, bits)   ((val) >> (bits))
-#endif
+#define FB_LEFT_POS(p, bpp)          (fb_be_math(p) ? (32 - (bpp)) : 0)
+#define FB_SHIFT_HIGH(p, val, bits)  (fb_be_math(p) ? (val) >> (bits) : \
+                                                     (val) << (bits))
+#define FB_SHIFT_LOW(p, val, bits)   (fb_be_math(p) ? (val) << (bits) : \
+                                                     (val) >> (bits))
 
     /*
      *  `Generic' versions of the frame buffer device operations
@@ -942,6 +975,14 @@ extern int fb_new_modelist(struct fb_info *info);
 
 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
+extern struct class *fb_class;
+
+extern int lock_fb_info(struct fb_info *info);
+
+static inline void unlock_fb_info(struct fb_info *info)
+{
+       mutex_unlock(&info->lock);
+}
 
 static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
                                           u8 *src, u32 s_pitch, u32 height)
@@ -960,10 +1001,32 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
 
 /* drivers/video/fb_defio.c */
 extern void fb_deferred_io_init(struct fb_info *info);
+extern void fb_deferred_io_open(struct fb_info *info,
+                               struct inode *inode,
+                               struct file *file);
 extern void fb_deferred_io_cleanup(struct fb_info *info);
 extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
                                int datasync);
 
+static inline bool fb_be_math(struct fb_info *info)
+{
+#ifdef CONFIG_FB_FOREIGN_ENDIAN
+#if defined(CONFIG_FB_BOTH_ENDIAN)
+       return info->flags & FBINFO_BE_MATH;
+#elif defined(CONFIG_FB_BIG_ENDIAN)
+       return true;
+#elif defined(CONFIG_FB_LITTLE_ENDIAN)
+       return false;
+#endif /* CONFIG_FB_BOTH_ENDIAN */
+#else
+#ifdef __BIG_ENDIAN
+       return true;
+#else
+       return false;
+#endif /* __BIG_ENDIAN */
+#endif /* CONFIG_FB_FOREIGN_ENDIAN */
+}
+
 /* drivers/video/fbsysfs.c */
 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
 extern void framebuffer_release(struct fb_info *info);
@@ -1050,6 +1113,7 @@ struct fb_videomode {
        u32 flag;
 };
 
+extern const char *fb_mode_option;
 extern const struct fb_videomode vesa_modes[];
 
 struct fb_modelist {