pata_hpt3x2n: fix clock turnaround
[safe/jmp/linux-2.6] / drivers / video / matrox / matroxfb_base.h
index 9c25c2f..f3a4e15 100644 (file)
@@ -54,9 +54,6 @@
 #include "../macmodes.h"
 #endif
 
-/* always compile support for 32MB... It cost almost nothing */
-#define CONFIG_FB_MATROX_32MB
-
 #ifdef MATROXFB_DEBUG
 
 #define DEBUG
@@ -200,7 +197,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags,
                virt->vaddr = ioremap_nocache(phys, size);
        else
                virt->vaddr = ioremap(phys, size);
-       return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */
+       return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */
 }
 
 static inline void mga_iounmap(vaddr_t va) {
@@ -424,6 +421,7 @@ struct matrox_fb_info {
                      } mmio;
 
        unsigned int    max_pixel_clock;
+       unsigned int    max_pixel_clock_panellink;
 
        struct matrox_switch*   hw_switch;
 
@@ -463,9 +461,7 @@ struct matrox_fb_info {
                int             nopciretry;
                int             noinit;
                int             sgram;
-#ifdef CONFIG_FB_MATROX_32MB
                int             support32MB;
-#endif
 
                int             accelerator;
                int             text_type_aux;
@@ -518,52 +514,16 @@ struct matrox_fb_info {
                                        dll:1;
                                      } memory;
                              } values;
-       u_int32_t cmap[17];
+       u_int32_t cmap[16];
 };
 
 #define info2minfo(info) container_of(info, struct matrox_fb_info, fbcon)
 
-#ifdef CONFIG_FB_MATROX_MULTIHEAD
-#define ACCESS_FBINFO2(info, x) (info->x)
-#define ACCESS_FBINFO(x) ACCESS_FBINFO2(minfo,x)
-
-#define MINFO minfo
-
-#define WPMINFO2 struct matrox_fb_info* minfo
-#define WPMINFO  WPMINFO2 ,
-#define CPMINFO2 const struct matrox_fb_info* minfo
-#define CPMINFO         CPMINFO2 ,
-#define PMINFO2  minfo
-#define PMINFO   PMINFO2 ,
-
-#define MINFO_FROM(x)     struct matrox_fb_info* minfo = x
-#else
-
-extern struct matrox_fb_info matroxfb_global_mxinfo;
-
-#define ACCESS_FBINFO(x) (matroxfb_global_mxinfo.x)
-#define ACCESS_FBINFO2(info, x) (matroxfb_global_mxinfo.x)
-
-#define MINFO (&matroxfb_global_mxinfo)
-
-#define WPMINFO2 void
-#define WPMINFO
-#define CPMINFO2 void
-#define CPMINFO
-#define PMINFO2
-#define PMINFO
-
-#define MINFO_FROM(x)
-
-#endif
-
-#define MINFO_FROM_INFO(x) MINFO_FROM(info2minfo(x))
-
 struct matrox_switch {
-       int     (*preinit)(WPMINFO2);
-       void    (*reset)(WPMINFO2);
-       int     (*init)(WPMINFO struct my_timming*);
-       void    (*restore)(WPMINFO2);
+       int     (*preinit)(struct matrox_fb_info *minfo);
+       void    (*reset)(struct matrox_fb_info *minfo);
+       int     (*init)(struct matrox_fb_info *minfo, struct my_timming*);
+       void    (*restore)(struct matrox_fb_info *minfo);
 };
 
 struct matroxfb_driver {
@@ -726,11 +686,11 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
 #endif
 #endif
 
-#define mga_inb(addr)          mga_readb(ACCESS_FBINFO(mmio.vbase), (addr))
-#define mga_inl(addr)          mga_readl(ACCESS_FBINFO(mmio.vbase), (addr))
-#define mga_outb(addr,val)     mga_writeb(ACCESS_FBINFO(mmio.vbase), (addr), (val))
-#define mga_outw(addr,val)     mga_writew(ACCESS_FBINFO(mmio.vbase), (addr), (val))
-#define mga_outl(addr,val)     mga_writel(ACCESS_FBINFO(mmio.vbase), (addr), (val))
+#define mga_inb(addr)          mga_readb(minfo->mmio.vbase, (addr))
+#define mga_inl(addr)          mga_readl(minfo->mmio.vbase, (addr))
+#define mga_outb(addr,val)     mga_writeb(minfo->mmio.vbase, (addr), (val))
+#define mga_outw(addr,val)     mga_writew(minfo->mmio.vbase, (addr), (val))
+#define mga_outl(addr,val)     mga_writel(minfo->mmio.vbase, (addr), (val))
 #define mga_readr(port,idx)    (mga_outb((port),(idx)), mga_inb((port)+1))
 #define mga_setr(addr,port,val)        mga_outw(addr, ((val)<<8) | (port))
 
@@ -749,19 +709,20 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
 #define isMilleniumII(x) (0)
 #endif
 
-#define matroxfb_DAC_lock()                   spin_lock(&ACCESS_FBINFO(lock.DAC))
-#define matroxfb_DAC_unlock()                 spin_unlock(&ACCESS_FBINFO(lock.DAC))
-#define matroxfb_DAC_lock_irqsave(flags)      spin_lock_irqsave(&ACCESS_FBINFO(lock.DAC),flags)
-#define matroxfb_DAC_unlock_irqrestore(flags) spin_unlock_irqrestore(&ACCESS_FBINFO(lock.DAC),flags)
-extern void matroxfb_DAC_out(CPMINFO int reg, int val);
-extern int matroxfb_DAC_in(CPMINFO int reg);
+#define matroxfb_DAC_lock()                   spin_lock(&minfo->lock.DAC)
+#define matroxfb_DAC_unlock()                 spin_unlock(&minfo->lock.DAC)
+#define matroxfb_DAC_lock_irqsave(flags)      spin_lock_irqsave(&minfo->lock.DAC, flags)
+#define matroxfb_DAC_unlock_irqrestore(flags) spin_unlock_irqrestore(&minfo->lock.DAC, flags)
+extern void matroxfb_DAC_out(const struct matrox_fb_info *minfo, int reg,
+                            int val);
+extern int matroxfb_DAC_in(const struct matrox_fb_info *minfo, int reg);
 extern void matroxfb_var2my(struct fb_var_screeninfo* fvsi, struct my_timming* mt);
-extern int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc);
-extern int matroxfb_enable_irq(WPMINFO int reenable);
+extern int matroxfb_wait_for_sync(struct matrox_fb_info *minfo, u_int32_t crtc);
+extern int matroxfb_enable_irq(struct matrox_fb_info *minfo, int reenable);
 
 #ifdef MATROXFB_USE_SPINLOCKS
-#define CRITBEGIN  spin_lock_irqsave(&ACCESS_FBINFO(lock.accel), critflags);
-#define CRITEND           spin_unlock_irqrestore(&ACCESS_FBINFO(lock.accel), critflags);
+#define CRITBEGIN  spin_lock_irqsave(&minfo->lock.accel, critflags);
+#define CRITEND           spin_unlock_irqrestore(&minfo->lock.accel, critflags);
 #define CRITFLAGS  unsigned long critflags;
 #else
 #define CRITBEGIN