Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / video / savage / savagefb.h
index 8594b1e..58cfdfb 100644 (file)
@@ -60,7 +60,6 @@
 
 #define S3_SAVAGE_SERIES(chip)    ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000))
 
-
 /* Chip tags.  These are used to group the adapters into
  * related families.
  */
@@ -128,6 +127,10 @@ typedef enum {
 #define BCI_CMD_SET_ROP(cmd, rop)    ((cmd) |= ((rop & 0xFF) << 16))
 #define BCI_CMD_SEND_COLOR           0x00008000
 
+#define DISP_CRT     1
+#define DISP_LCD     2
+#define DISP_DFP     3
+
 struct xtimings {
        unsigned int Clock;
        unsigned int HDisplay;
@@ -166,6 +169,11 @@ struct savagefb_par {
        struct savagefb_i2c_chan chan;
        unsigned char   *edid;
        u32 pseudo_palette[16];
+       int paletteEnabled;
+       int pm_state;
+       int display_type;
+       int dvi;
+       int crtonly;
        int dacSpeedBpp;
        int maxClock;
        int minClock;
@@ -237,108 +245,153 @@ struct savagefb_par {
 
 
 /* IO functions */
+static inline u8 savage_in8(u32 addr, struct savagefb_par *par)
+{
+       return readb(par->mmio.vbase + addr);
+}
+
+static inline u16 savage_in16(u32 addr, struct savagefb_par *par)
+{
+       return readw(par->mmio.vbase + addr);
+}
+
+static inline u32 savage_in32(u32 addr, struct savagefb_par *par)
+{
+       return readl(par->mmio.vbase + addr);
+}
+
+static inline void savage_out8(u32 addr, u8 val, struct savagefb_par *par)
+{
+       writeb(val, par->mmio.vbase + addr);
+}
+
+static inline void savage_out16(u32 addr, u16 val, struct savagefb_par *par)
+{
+       writew(val, par->mmio.vbase + addr);
+}
+
+static inline void savage_out32(u32 addr, u32 val, struct savagefb_par *par)
+{
+       writel(val, par->mmio.vbase + addr);
+}
+
+static inline u8 vga_in8(int addr, struct savagefb_par *par)
+{
+       return savage_in8(0x8000 + addr, par);
+}
+
+static inline u16 vga_in16(int addr, struct savagefb_par *par)
+{
+       return savage_in16(0x8000 + addr, par);
+}
+
+static inline u8 vga_in32(int addr, struct savagefb_par *par)
+{
+       return savage_in32(0x8000 + addr, par);
+}
+
+static inline void vga_out8(int addr, u8 val, struct savagefb_par *par)
+{
+       savage_out8(0x8000 + addr, val, par);
+}
 
-#define  vga_in8(addr)         (inb (addr))
-#define vga_in16(addr)         (inw (addr))
-#define vga_in32(addr)         (inl (addr))
+static inline void vga_out16(int addr, u16 val, struct savagefb_par *par)
+{
+       savage_out16(0x8000 + addr, val, par);
+}
 
-#define  vga_out8(addr,val)    (outb ((val), (addr)))
-#define vga_out16(addr,val)    (outw ((val), (addr)))
-#define vga_out32(addr,val)    (outl ((val), (addr)))
+static inline void vga_out32(int addr, u32 val, struct savagefb_par *par)
+{
+       savage_out32(0x8000 + addr, val, par);
+}
 
-#define savage_in16(addr)      readw(par->mmio.vbase + (addr))
-#define savage_in32(addr)      readl(par->mmio.vbase + (addr))
+static inline u8 VGArCR (u8 index, struct savagefb_par *par)
+{
+       vga_out8(0x3d4, index,  par);
+       return vga_in8(0x3d5, par);
+}
 
-#define savage_out16(addr,val) writew((val), par->mmio.vbase + (addr))
-#define savage_out32(addr,val) writel((val), par->mmio.vbase + (addr))
+static inline u8 VGArGR (u8 index, struct savagefb_par *par)
+{
+       vga_out8(0x3ce, index, par);
+       return vga_in8(0x3cf, par);
+}
 
-static inline u8 VGArCR (u8 index)
+static inline u8 VGArSEQ (u8 index, struct savagefb_par *par)
 {
-  outb (index, 0x3d4);
-  return inb (0x3d5);
+       vga_out8(0x3c4, index, par);
+       return vga_in8(0x3c5, par);
 }
 
-static inline u8 VGArGR (u8 index)
+static inline void VGAwCR(u8 index, u8 val, struct savagefb_par *par)
 {
-  outb (index, 0x3ce);
-  return inb (0x3cf);
+       vga_out8(0x3d4, index, par);
+       vga_out8(0x3d5, val, par);
 }
 
-static inline u8 VGArSEQ (u8 index)
+static inline void VGAwGR(u8 index, u8 val, struct savagefb_par *par)
 {
-  outb (index, 0x3c4);
-  return inb (0x3c5);
+       vga_out8(0x3ce, index, par);
+       vga_out8(0x3cf, val, par);
 }
 
-#define VGAwCR(index, val) \
-do {                       \
-  vga_out8 (0x3d4, index); \
-  vga_out8 (0x3d5, val);   \
-} while (0)
-
-#define VGAwGR(index, val) \
-do {                       \
-  vga_out8 (0x3ce, index); \
-  vga_out8 (0x3cf, val);   \
-} while (0)
-
-#define VGAwSEQ(index, val) \
-do {                        \
-  vga_out8 (0x3c4, index);  \
-  vga_out8 (0x3c5, val);    \
-} while (0)
-
-#define VGAenablePalette() \
-do {                       \
-  u8 tmp;                  \
-                           \
-  tmp = vga_in8 (0x3da);   \
-  vga_out8 (0x3c0, 0x00);  \
-  paletteEnabled = 1;      \
-} while (0)
-
-#define VGAdisablePalette() \
-do {                        \
-  u8 tmp;                   \
-                            \
-  tmp = vga_in8 (0x3da);    \
-  vga_out8 (0x3c0, 0x20);   \
-  paletteEnabled = 0;       \
-} while (0)
-
-#define VGAwATTR(index, value) \
-do {                           \
-  u8 tmp;                      \
-                               \
-  if (paletteEnabled)          \
-    index &= ~0x20;            \
-  else                         \
-    index |= 0x20;             \
-                               \
-  tmp = vga_in8 (0x3da);       \
-  vga_out8 (0x3c0, index);     \
-  vga_out8 (0x3c0, value);     \
-} while (0)
-
-#define VGAwMISC(value)    \
-do {                       \
-  vga_out8 (0x3c2, value); \
-} while (0)
+static inline void VGAwSEQ(u8 index, u8 val, struct savagefb_par *par)
+{
+       vga_out8(0x3c4, index, par);
+       vga_out8 (0x3c5, val, par);
+}
+
+static inline void VGAenablePalette(struct savagefb_par *par)
+{
+       u8 tmp;
+
+       tmp = vga_in8(0x3da, par);
+       vga_out8(0x3c0, 0x00, par);
+       par->paletteEnabled = 1;
+}
+
+static inline void VGAdisablePalette(struct savagefb_par *par)
+{
+       u8 tmp;
+
+       tmp = vga_in8(0x3da, par);
+       vga_out8(0x3c0, 0x20, par);
+       par->paletteEnabled = 0;
+}
+
+static inline void VGAwATTR(u8 index, u8 value, struct savagefb_par *par)
+{
+       u8 tmp;
+
+       if (par->paletteEnabled)
+               index &= ~0x20;
+       else
+               index |= 0x20;
+
+       tmp = vga_in8(0x3da, par);
+       vga_out8(0x3c0, index, par);
+       vga_out8 (0x3c0, value, par);
+}
+
+static inline void VGAwMISC(u8 value, struct savagefb_par *par)
+{
+       vga_out8(0x3c2, value, par);
+}
 
 #ifndef CONFIG_FB_SAVAGE_ACCEL
 #define savagefb_set_clip(x)
 #endif
 
-#define VerticalRetraceWait() \
-{ \
-       vga_out8 (0x3d4, 0x17); \
-       if (vga_in8 (0x3d5) & 0x80) { \
-               while ((vga_in8(0x3da) & 0x08) == 0x08) ; \
-               while ((vga_in8(0x3da) & 0x08) == 0x00) ; \
-       } \
+static inline void VerticalRetraceWait(struct savagefb_par *par)
+{
+       vga_out8(0x3d4, 0x17, par);
+       if (vga_in8(0x3d5, par) & 0x80) {
+               while ((vga_in8(0x3da, par) & 0x08) == 0x08);
+               while ((vga_in8(0x3da, par) & 0x08) == 0x00);
+       }
 }
 
-extern int savagefb_probe_i2c_connector(struct savagefb_par *par,
+extern int savagefb_probe_i2c_connector(struct fb_info *info,
                                        u8 **out_edid);
 extern void savagefb_create_i2c_busses(struct fb_info *info);
 extern void savagefb_delete_i2c_busses(struct fb_info *info);