apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1 | #ifndef _XGIFB_MAIN |
| 2 | #define _XGIFB_MAIN |
| 3 | |
| 4 | |
| 5 | /* ------------------- Constant Definitions ------------------------- */ |
| 6 | |
| 7 | |
| 8 | #include "XGIfb.h" |
| 9 | #include "vb_struct.h" |
| 10 | #include "vb_def.h" |
| 11 | |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 12 | #define XGIFAIL(x) do { printk(x "\n"); return -EINVAL; } while (0) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 13 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 14 | #ifndef PCI_VENDOR_ID_XG |
| 15 | #define PCI_VENDOR_ID_XG 0x18CA |
| 16 | #endif |
| 17 | |
| 18 | #ifndef PCI_DEVICE_ID_XG_40 |
| 19 | #define PCI_DEVICE_ID_XG_40 0x040 |
| 20 | #endif |
| 21 | #ifndef PCI_DEVICE_ID_XG_41 |
| 22 | #define PCI_DEVICE_ID_XG_41 0x041 |
| 23 | #endif |
| 24 | #ifndef PCI_DEVICE_ID_XG_42 |
| 25 | #define PCI_DEVICE_ID_XG_42 0x042 |
| 26 | #endif |
| 27 | #ifndef PCI_DEVICE_ID_XG_20 |
| 28 | #define PCI_DEVICE_ID_XG_20 0x020 |
| 29 | #endif |
| 30 | #ifndef PCI_DEVICE_ID_XG_27 |
| 31 | #define PCI_DEVICE_ID_XG_27 0x027 |
| 32 | #endif |
| 33 | |
Javier Martinez Canillas | b6cdc40 | 2010-08-07 03:06:52 -0400 | [diff] [blame] | 34 | static DEFINE_PCI_DEVICE_TABLE(xgifb_pci_table) = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 35 | {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_20, PCI_ANY_ID, PCI_ANY_ID, |
| 36 | 0, 0, 0}, |
| 37 | {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_27, PCI_ANY_ID, PCI_ANY_ID, |
| 38 | 0, 0, 1}, |
| 39 | {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_40, PCI_ANY_ID, PCI_ANY_ID, |
| 40 | 0, 0, 2}, |
| 41 | {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_42, PCI_ANY_ID, PCI_ANY_ID, |
| 42 | 0, 0, 3}, |
| 43 | {0} |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | MODULE_DEVICE_TABLE(pci, xgifb_pci_table); |
Bill Pemberton | 23aada9 | 2010-06-17 13:10:34 -0400 | [diff] [blame] | 47 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 48 | /* To be included in fb.h */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 49 | #ifndef FB_ACCEL_XGI_XABRE |
| 50 | #define FB_ACCEL_XGI_XABRE 41 /* XGI 330 ("Xabre") */ |
| 51 | #endif |
| 52 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 53 | #define SEQ_DATA 0x15 |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 54 | |
Aaro Koskinen | f2df8c0 | 2011-10-11 21:47:30 +0300 | [diff] [blame] | 55 | #define XGISR (xgifb_info->dev_info.P3c4) |
| 56 | #define XGICR (xgifb_info->dev_info.P3d4) |
| 57 | #define XGIDACA (xgifb_info->dev_info.P3c8) |
| 58 | #define XGIDACD (xgifb_info->dev_info.P3c9) |
| 59 | #define XGIPART1 (xgifb_info->dev_info.Part1Port) |
| 60 | #define XGIPART2 (xgifb_info->dev_info.Part2Port) |
| 61 | #define XGIPART3 (xgifb_info->dev_info.Part3Port) |
| 62 | #define XGIPART4 (xgifb_info->dev_info.Part4Port) |
| 63 | #define XGIPART5 (xgifb_info->dev_info.Part5Port) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 64 | #define XGIDAC2A XGIPART5 |
| 65 | #define XGIDAC2D (XGIPART5 + 1) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 66 | |
| 67 | #define IND_XGI_PASSWORD 0x05 /* SRs */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 68 | #define IND_XGI_RAMDAC_CONTROL 0x07 |
| 69 | #define IND_XGI_DRAM_SIZE 0x14 |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 70 | #define IND_XGI_MODULE_ENABLE 0x1E |
| 71 | #define IND_XGI_PCI_ADDRESS_SET 0x20 |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 72 | |
| 73 | #define IND_XGI_SCRATCH_REG_CR30 0x30 /* CRs */ |
| 74 | #define IND_XGI_SCRATCH_REG_CR31 0x31 |
| 75 | #define IND_XGI_SCRATCH_REG_CR32 0x32 |
| 76 | #define IND_XGI_SCRATCH_REG_CR33 0x33 |
| 77 | #define IND_XGI_LCD_PANEL 0x36 |
| 78 | #define IND_XGI_SCRATCH_REG_CR37 0x37 |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 79 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 80 | #define IND_XGI_CRT2_WRITE_ENABLE_315 0x2F |
| 81 | |
| 82 | #define XGI_PASSWORD 0x86 /* SR05 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 83 | |
| 84 | #define XGI_DRAM_SIZE_MASK 0xF0 /*SR14 */ |
| 85 | #define XGI_DRAM_SIZE_1MB 0x00 |
| 86 | #define XGI_DRAM_SIZE_2MB 0x01 |
| 87 | #define XGI_DRAM_SIZE_4MB 0x02 |
| 88 | #define XGI_DRAM_SIZE_8MB 0x03 |
| 89 | #define XGI_DRAM_SIZE_16MB 0x04 |
| 90 | #define XGI_DRAM_SIZE_32MB 0x05 |
| 91 | #define XGI_DRAM_SIZE_64MB 0x06 |
| 92 | #define XGI_DRAM_SIZE_128MB 0x07 |
| 93 | #define XGI_DRAM_SIZE_256MB 0x08 |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 94 | |
| 95 | #define XGI_ENABLE_2D 0x40 /* SR1E */ |
| 96 | |
| 97 | #define XGI_MEM_MAP_IO_ENABLE 0x01 /* SR20 */ |
| 98 | #define XGI_PCI_ADDR_ENABLE 0x80 |
| 99 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 100 | #define XGI_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 101 | #define XGI_VB_OUTPUT_COMPOSITE 0x04 |
| 102 | #define XGI_VB_OUTPUT_SVIDEO 0x08 |
| 103 | #define XGI_VB_OUTPUT_SCART 0x10 |
| 104 | #define XGI_VB_OUTPUT_LCD 0x20 |
| 105 | #define XGI_VB_OUTPUT_CRT2 0x40 |
| 106 | #define XGI_VB_OUTPUT_HIVISION 0x80 |
| 107 | |
| 108 | #define XGI_VB_OUTPUT_DISABLE 0x20 /* CR31 */ |
| 109 | #define XGI_DRIVER_MODE 0x40 |
| 110 | |
| 111 | #define XGI_VB_COMPOSITE 0x01 /* CR32 */ |
| 112 | #define XGI_VB_SVIDEO 0x02 |
| 113 | #define XGI_VB_SCART 0x04 |
| 114 | #define XGI_VB_LCD 0x08 |
| 115 | #define XGI_VB_CRT2 0x10 |
| 116 | #define XGI_CRT1 0x20 |
| 117 | #define XGI_VB_HIVISION 0x40 |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 118 | #define XGI_VB_YPBPR 0x80 |
| 119 | #define XGI_VB_TV (XGI_VB_COMPOSITE | XGI_VB_SVIDEO | \ |
| 120 | XGI_VB_SCART | XGI_VB_HIVISION|XGI_VB_YPBPR) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 121 | |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 122 | #define XGI_EXTERNAL_CHIP_MASK 0x0E /* CR37 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 123 | #define XGI310_EXTERNAL_CHIP_LVDS 0x02 /* in CR37 << 1 ! */ |
| 124 | #define XGI310_EXTERNAL_CHIP_LVDS_CHRONTEL 0x03 /* in CR37 << 1 ! */ |
| 125 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 126 | /* ------------------- Global Variables ----------------------------- */ |
| 127 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 128 | /* display status */ |
Ruslan Pisarev | 44c4ec7 | 2011-07-21 11:57:40 +0300 | [diff] [blame] | 129 | static int XGIfb_crt1off; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 130 | static int XGIfb_forcecrt1 = -1; |
Ruslan Pisarev | 44c4ec7 | 2011-07-21 11:57:40 +0300 | [diff] [blame] | 131 | static int XGIfb_userom ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 132 | |
| 133 | /* global flags */ |
Ruslan Pisarev | 44c4ec7 | 2011-07-21 11:57:40 +0300 | [diff] [blame] | 134 | static int XGIfb_tvmode; |
Ruslan Pisarev | 44c4ec7 | 2011-07-21 11:57:40 +0300 | [diff] [blame] | 135 | static int enable_dstn; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 136 | static int XGIfb_ypan = -1; |
| 137 | |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 138 | /* TW: CRT2 type (for overriding autodetection) */ |
| 139 | static int XGIfb_crt2type = -1; |
| 140 | /* PR: Tv plug type (for overriding autodetection) */ |
| 141 | static int XGIfb_tvplug = -1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 142 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 143 | /* TW: For ioctl XGIFB_GET_INFO */ |
| 144 | /* XGIfb_info XGIfbinfo; */ |
| 145 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 146 | #define MD_XGI300 1 |
| 147 | #define MD_XGI315 2 |
| 148 | |
| 149 | /* mode table */ |
Aaro Koskinen | 7d2ab0c | 2011-10-11 21:47:29 +0300 | [diff] [blame] | 150 | static const struct _XGIbios_mode { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 151 | char name[15]; |
| 152 | u8 mode_no; |
| 153 | u16 vesa_mode_no_1; /* "XGI defined" VESA mode number */ |
| 154 | u16 vesa_mode_no_2; /* Real VESA mode numbers */ |
| 155 | u16 xres; |
| 156 | u16 yres; |
| 157 | u16 bpp; |
| 158 | u16 rate_idx; |
| 159 | u16 cols; |
| 160 | u16 rows; |
| 161 | u8 chipset; |
| 162 | } XGIbios_mode[] = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 163 | {"320x240x16", 0x56, 0x0000, 0x0000, 320, 240, 16, 1, 40, 15, |
| 164 | MD_XGI315}, |
| 165 | {"320x480x8", 0x5A, 0x0000, 0x0000, 320, 480, 8, 1, 40, 30, |
| 166 | MD_XGI315}, /* TW: FSTN */ |
| 167 | {"320x480x16", 0x5B, 0x0000, 0x0000, 320, 480, 16, 1, 40, 30, |
| 168 | MD_XGI315}, /* TW: FSTN */ |
| 169 | {"640x480x8", 0x2E, 0x0101, 0x0101, 640, 480, 8, 1, 80, 30, |
| 170 | MD_XGI300|MD_XGI315}, |
| 171 | {"640x480x16", 0x44, 0x0111, 0x0111, 640, 480, 16, 1, 80, 30, |
| 172 | MD_XGI300|MD_XGI315}, |
| 173 | {"640x480x24", 0x62, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, |
| 174 | MD_XGI300|MD_XGI315}, /* TW: That's for people who mix up color- |
| 175 | and fb depth */ |
| 176 | {"640x480x32", 0x62, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, |
| 177 | MD_XGI300|MD_XGI315}, |
| 178 | {"720x480x8", 0x31, 0x0000, 0x0000, 720, 480, 8, 1, 90, 30, |
| 179 | MD_XGI300|MD_XGI315}, |
| 180 | {"720x480x16", 0x33, 0x0000, 0x0000, 720, 480, 16, 1, 90, 30, |
| 181 | MD_XGI300|MD_XGI315}, |
| 182 | {"720x480x24", 0x35, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, |
| 183 | MD_XGI300|MD_XGI315}, |
| 184 | {"720x480x32", 0x35, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, |
| 185 | MD_XGI300|MD_XGI315}, |
| 186 | {"720x576x8", 0x32, 0x0000, 0x0000, 720, 576, 8, 1, 90, 36, |
| 187 | MD_XGI300|MD_XGI315}, |
| 188 | {"720x576x16", 0x34, 0x0000, 0x0000, 720, 576, 16, 1, 90, 36, |
| 189 | MD_XGI300|MD_XGI315}, |
| 190 | {"720x576x24", 0x36, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, |
| 191 | MD_XGI300|MD_XGI315}, |
| 192 | {"720x576x32", 0x36, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, |
| 193 | MD_XGI300|MD_XGI315}, |
| 194 | {"800x480x8", 0x70, 0x0000, 0x0000, 800, 480, 8, 1, 100, 30, |
| 195 | MD_XGI300|MD_XGI315}, |
| 196 | {"800x480x16", 0x7a, 0x0000, 0x0000, 800, 480, 16, 1, 100, 30, |
| 197 | MD_XGI300|MD_XGI315}, |
| 198 | {"800x480x24", 0x76, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, |
| 199 | MD_XGI300|MD_XGI315}, |
| 200 | {"800x480x32", 0x76, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, |
| 201 | MD_XGI300|MD_XGI315}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 202 | {"800x600x8", 0x30, 0x0103, 0x0103, 800, 600, 8, 1, 100, 37, |
| 203 | MD_XGI300|MD_XGI315}, |
Aaro Koskinen | c322830 | 2011-08-29 23:14:32 +0300 | [diff] [blame] | 204 | #define DEFAULT_MODE 20 /* index for 800x600x16 */ |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 205 | {"800x600x16", 0x47, 0x0114, 0x0114, 800, 600, 16, 1, 100, 37, |
| 206 | MD_XGI300|MD_XGI315}, |
| 207 | {"800x600x24", 0x63, 0x013b, 0x0115, 800, 600, 32, 1, 100, 37, |
| 208 | MD_XGI300|MD_XGI315}, |
| 209 | {"800x600x32", 0x63, 0x013b, 0x0115, 800, 600, 32, 1, 100, 37, |
| 210 | MD_XGI300|MD_XGI315}, |
| 211 | {"1024x576x8", 0x71, 0x0000, 0x0000, 1024, 576, 8, 1, 128, 36, |
| 212 | MD_XGI300|MD_XGI315}, |
| 213 | {"1024x576x16", 0x74, 0x0000, 0x0000, 1024, 576, 16, 1, 128, 36, |
| 214 | MD_XGI300|MD_XGI315}, |
| 215 | {"1024x576x24", 0x77, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, |
| 216 | MD_XGI300|MD_XGI315}, |
| 217 | {"1024x576x32", 0x77, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, |
| 218 | MD_XGI300|MD_XGI315}, |
| 219 | {"1024x600x8", 0x20, 0x0000, 0x0000, 1024, 600, 8, 1, 128, 37, |
| 220 | MD_XGI300 }, /* TW: 300 series only */ |
| 221 | {"1024x600x16", 0x21, 0x0000, 0x0000, 1024, 600, 16, 1, 128, 37, |
| 222 | MD_XGI300 }, |
| 223 | {"1024x600x24", 0x22, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, |
| 224 | MD_XGI300 }, |
| 225 | {"1024x600x32", 0x22, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, |
| 226 | MD_XGI300 }, |
| 227 | {"1024x768x8", 0x38, 0x0105, 0x0105, 1024, 768, 8, 1, 128, 48, |
| 228 | MD_XGI300|MD_XGI315}, |
| 229 | {"1024x768x16", 0x4A, 0x0117, 0x0117, 1024, 768, 16, 1, 128, 48, |
| 230 | MD_XGI300|MD_XGI315}, |
| 231 | {"1024x768x24", 0x64, 0x013c, 0x0118, 1024, 768, 32, 1, 128, 48, |
| 232 | MD_XGI300|MD_XGI315}, |
| 233 | {"1024x768x32", 0x64, 0x013c, 0x0118, 1024, 768, 32, 1, 128, 48, |
| 234 | MD_XGI300|MD_XGI315}, |
| 235 | {"1152x768x8", 0x23, 0x0000, 0x0000, 1152, 768, 8, 1, 144, 48, |
| 236 | MD_XGI300 }, /* TW: 300 series only */ |
| 237 | {"1152x768x16", 0x24, 0x0000, 0x0000, 1152, 768, 16, 1, 144, 48, |
| 238 | MD_XGI300 }, |
| 239 | {"1152x768x24", 0x25, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, |
| 240 | MD_XGI300 }, |
| 241 | {"1152x768x32", 0x25, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, |
| 242 | MD_XGI300 }, |
| 243 | {"1280x720x8", 0x79, 0x0000, 0x0000, 1280, 720, 8, 1, 160, 45, |
| 244 | MD_XGI300|MD_XGI315}, |
| 245 | {"1280x720x16", 0x75, 0x0000, 0x0000, 1280, 720, 16, 1, 160, 45, |
| 246 | MD_XGI300|MD_XGI315}, |
| 247 | {"1280x720x24", 0x78, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, |
| 248 | MD_XGI300|MD_XGI315}, |
| 249 | {"1280x720x32", 0x78, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, |
| 250 | MD_XGI300|MD_XGI315}, |
| 251 | {"1280x768x8", 0x23, 0x0000, 0x0000, 1280, 768, 8, 1, 160, 48, |
| 252 | MD_XGI315}, /* TW: 310/325 series only */ |
| 253 | {"1280x768x16", 0x24, 0x0000, 0x0000, 1280, 768, 16, 1, 160, 48, |
| 254 | MD_XGI315}, |
| 255 | {"1280x768x24", 0x25, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, |
| 256 | MD_XGI315}, |
| 257 | {"1280x768x32", 0x25, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, |
| 258 | MD_XGI315}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 259 | {"1280x960x8", 0x7C, 0x0000, 0x0000, 1280, 960, 8, 1, 160, 60, |
Aaro Koskinen | 7d2ab0c | 2011-10-11 21:47:29 +0300 | [diff] [blame] | 260 | MD_XGI300|MD_XGI315}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 261 | {"1280x960x16", 0x7D, 0x0000, 0x0000, 1280, 960, 16, 1, 160, 60, |
| 262 | MD_XGI300|MD_XGI315}, |
| 263 | {"1280x960x24", 0x7E, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, |
| 264 | MD_XGI300|MD_XGI315}, |
| 265 | {"1280x960x32", 0x7E, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, |
| 266 | MD_XGI300|MD_XGI315}, |
| 267 | {"1280x1024x8", 0x3A, 0x0107, 0x0107, 1280, 1024, 8, 1, 160, 64, |
| 268 | MD_XGI300|MD_XGI315}, |
| 269 | {"1280x1024x16", 0x4D, 0x011a, 0x011a, 1280, 1024, 16, 1, 160, 64, |
| 270 | MD_XGI300|MD_XGI315}, |
| 271 | {"1280x1024x24", 0x65, 0x013d, 0x011b, 1280, 1024, 32, 1, 160, 64, |
| 272 | MD_XGI300|MD_XGI315}, |
| 273 | {"1280x1024x32", 0x65, 0x013d, 0x011b, 1280, 1024, 32, 1, 160, 64, |
| 274 | MD_XGI300|MD_XGI315}, |
| 275 | {"1400x1050x8", 0x26, 0x0000, 0x0000, 1400, 1050, 8, 1, 175, 65, |
| 276 | MD_XGI315}, /* TW: 310/325 series only */ |
| 277 | {"1400x1050x16", 0x27, 0x0000, 0x0000, 1400, 1050, 16, 1, 175, 65, |
| 278 | MD_XGI315}, |
| 279 | {"1400x1050x24", 0x28, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, |
| 280 | MD_XGI315}, |
| 281 | {"1400x1050x32", 0x28, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, |
| 282 | MD_XGI315}, |
| 283 | {"1600x1200x8", 0x3C, 0x0130, 0x011c, 1600, 1200, 8, 1, 200, 75, |
| 284 | MD_XGI300|MD_XGI315}, |
| 285 | {"1600x1200x16", 0x3D, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, |
| 286 | MD_XGI300|MD_XGI315}, |
| 287 | {"1600x1200x24", 0x66, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, |
| 288 | MD_XGI300|MD_XGI315}, |
| 289 | {"1600x1200x32", 0x66, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, |
| 290 | MD_XGI300|MD_XGI315}, |
| 291 | {"1920x1440x8", 0x68, 0x013f, 0x0000, 1920, 1440, 8, 1, 240, 75, |
| 292 | MD_XGI300|MD_XGI315}, |
| 293 | {"1920x1440x16", 0x69, 0x0140, 0x0000, 1920, 1440, 16, 1, 240, 75, |
| 294 | MD_XGI300|MD_XGI315}, |
| 295 | {"1920x1440x24", 0x6B, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, |
| 296 | MD_XGI300|MD_XGI315}, |
| 297 | {"1920x1440x32", 0x6B, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, |
| 298 | MD_XGI300|MD_XGI315}, |
| 299 | {"2048x1536x8", 0x6c, 0x0000, 0x0000, 2048, 1536, 8, 1, 256, 96, |
| 300 | MD_XGI315}, /* TW: 310/325 series only */ |
| 301 | {"2048x1536x16", 0x6d, 0x0000, 0x0000, 2048, 1536, 16, 1, 256, 96, |
| 302 | MD_XGI315}, |
| 303 | {"2048x1536x24", 0x6e, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, |
| 304 | MD_XGI315}, |
| 305 | {"2048x1536x32", 0x6e, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, |
| 306 | MD_XGI315}, |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 307 | {"\0", 0x00, 0, 0, 0, 0, 0, 0, 0} |
| 308 | }; |
| 309 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 310 | /* TW: CR36 evaluation */ |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 311 | static const unsigned short XGI300paneltype[] = { |
| 312 | LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, |
| 313 | LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768, |
| 314 | LCD_1024x768, LCD_1024x768, LCD_1024x768, |
| 315 | LCD_1024x768, LCD_1024x768, LCD_1024x768, LCD_1024x768}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 316 | |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 317 | static const unsigned short XGI310paneltype[] = { |
| 318 | LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, |
| 319 | LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, |
| 320 | LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, |
| 321 | LCD_1024x768, LCD_1024x768, LCD_1024x768}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 322 | |
| 323 | static const struct _XGI_crt2type { |
| 324 | char name[10]; |
| 325 | int type_no; |
| 326 | int tvplug_no; |
| 327 | } XGI_crt2type[] = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 328 | {"NONE", 0, -1}, |
Aaro Koskinen | 289ea52 | 2011-10-11 21:47:37 +0300 | [diff] [blame] | 329 | {"LCD", XGIFB_DISP_LCD, -1}, |
| 330 | {"TV", XGIFB_DISP_TV, -1}, |
| 331 | {"VGA", XGIFB_DISP_CRT, -1}, |
| 332 | {"SVIDEO", XGIFB_DISP_TV, TVPLUG_SVIDEO}, |
| 333 | {"COMPOSITE", XGIFB_DISP_TV, TVPLUG_COMPOSITE}, |
| 334 | {"SCART", XGIFB_DISP_TV, TVPLUG_SCART}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 335 | {"none", 0, -1}, |
Aaro Koskinen | 289ea52 | 2011-10-11 21:47:37 +0300 | [diff] [blame] | 336 | {"lcd", XGIFB_DISP_LCD, -1}, |
| 337 | {"tv", XGIFB_DISP_TV, -1}, |
| 338 | {"vga", XGIFB_DISP_CRT, -1}, |
| 339 | {"svideo", XGIFB_DISP_TV, TVPLUG_SVIDEO}, |
| 340 | {"composite", XGIFB_DISP_TV, TVPLUG_COMPOSITE}, |
| 341 | {"scart", XGIFB_DISP_TV, TVPLUG_SCART}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 342 | {"\0", -1, -1} |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 343 | }; |
| 344 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 345 | /* TV standard */ |
| 346 | static const struct _XGI_tvtype { |
| 347 | char name[6]; |
| 348 | int type_no; |
| 349 | } XGI_tvtype[] = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 350 | {"PAL", 1}, |
| 351 | {"NTSC", 2}, |
| 352 | {"pal", 1}, |
| 353 | {"ntsc", 2}, |
| 354 | {"\0", -1} |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 355 | }; |
| 356 | |
| 357 | static const struct _XGI_vrate { |
| 358 | u16 idx; |
| 359 | u16 xres; |
| 360 | u16 yres; |
| 361 | u16 refresh; |
| 362 | } XGIfb_vrate[] = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 363 | {1, 640, 480, 60}, {2, 640, 480, 72}, |
| 364 | {3, 640, 480, 75}, {4, 640, 480, 85}, |
| 365 | |
| 366 | {5, 640, 480, 100}, {6, 640, 480, 120}, |
| 367 | {7, 640, 480, 160}, {8, 640, 480, 200}, |
| 368 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 369 | {1, 720, 480, 60}, |
| 370 | {1, 720, 576, 58}, |
| 371 | {1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 372 | {1, 800, 600, 60}, {2, 800, 600, 72}, {3, 800, 600, 75}, |
| 373 | {4, 800, 600, 85}, {5, 800, 600, 100}, |
| 374 | {6, 800, 600, 120}, {7, 800, 600, 160}, |
| 375 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 376 | {1, 1024, 768, 60}, {2, 1024, 768, 70}, {3, 1024, 768, 75}, |
| 377 | {4, 1024, 768, 85}, {5, 1024, 768, 100}, {6, 1024, 768, 120}, |
| 378 | {1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85}, |
| 379 | {1, 1024, 600, 60}, |
| 380 | {1, 1152, 768, 60}, |
| 381 | {1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85}, |
| 382 | {1, 1280, 768, 60}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 383 | {1, 1280, 1024, 60}, {2, 1280, 1024, 75}, {3, 1280, 1024, 85}, |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 384 | {1, 1280, 960, 70}, |
| 385 | {1, 1400, 1050, 60}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 386 | {1, 1600, 1200, 60}, {2, 1600, 1200, 65}, |
| 387 | {3, 1600, 1200, 70}, {4, 1600, 1200, 75}, |
| 388 | |
| 389 | {5, 1600, 1200, 85}, {6, 1600, 1200, 100}, |
| 390 | {7, 1600, 1200, 120}, |
| 391 | |
| 392 | {1, 1920, 1440, 60}, {2, 1920, 1440, 65}, |
| 393 | {3, 1920, 1440, 70}, {4, 1920, 1440, 75}, |
| 394 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 395 | {5, 1920, 1440, 85}, {6, 1920, 1440, 100}, |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 396 | {1, 2048, 1536, 60}, {2, 2048, 1536, 65}, |
| 397 | {3, 2048, 1536, 70}, {4, 2048, 1536, 75}, |
| 398 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 399 | {5, 2048, 1536, 85}, |
| 400 | {0, 0, 0, 0} |
| 401 | }; |
| 402 | |
| 403 | static const struct _chswtable { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 404 | int subsysVendor; |
| 405 | int subsysCard; |
| 406 | char *vendorName; |
| 407 | char *cardName; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 408 | } mychswtable[] = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 409 | { 0x1631, 0x1002, "Mitachi", "0x1002" }, |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 410 | { 0, 0, "" , "" } |
| 411 | }; |
| 412 | |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 413 | /* Eden Chen */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 414 | static const struct _XGI_TV_filter { |
| 415 | u8 filter[9][4]; |
| 416 | } XGI_TV_filter[] = { |
Kenji Toyama | 14e4385 | 2011-04-26 12:12:39 +0800 | [diff] [blame] | 417 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_0 */ |
| 418 | {0x00, 0xE0, 0x10, 0x60}, |
| 419 | {0x00, 0xEE, 0x10, 0x44}, |
| 420 | {0x00, 0xF4, 0x10, 0x38}, |
| 421 | {0xF8, 0xF4, 0x18, 0x38}, |
| 422 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 423 | {0x00, 0x00, 0x10, 0x20}, |
| 424 | {0x00, 0x04, 0x10, 0x18}, |
| 425 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 426 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_1 */ |
| 427 | {0x00, 0xE0, 0x10, 0x60}, |
| 428 | {0x00, 0xEE, 0x10, 0x44}, |
| 429 | {0x00, 0xF4, 0x10, 0x38}, |
| 430 | {0xF8, 0xF4, 0x18, 0x38}, |
| 431 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 432 | {0x00, 0x00, 0x10, 0x20}, |
| 433 | {0x00, 0x04, 0x10, 0x18}, |
| 434 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 435 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_2 */ |
| 436 | {0xF5, 0xEE, 0x1B, 0x44}, |
| 437 | {0xF8, 0xF4, 0x18, 0x38}, |
| 438 | {0xEB, 0x04, 0x25, 0x18}, |
| 439 | {0xF1, 0x05, 0x1F, 0x16}, |
| 440 | {0xF6, 0x06, 0x1A, 0x14}, |
| 441 | {0xFA, 0x06, 0x16, 0x14}, |
| 442 | {0x00, 0x04, 0x10, 0x18}, |
| 443 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 444 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_3 */ |
| 445 | {0xF1, 0x04, 0x1F, 0x18}, |
| 446 | {0xEE, 0x0D, 0x22, 0x06}, |
| 447 | {0xF7, 0x06, 0x19, 0x14}, |
| 448 | {0xF4, 0x0B, 0x1C, 0x0A}, |
| 449 | {0xFA, 0x07, 0x16, 0x12}, |
| 450 | {0xF9, 0x0A, 0x17, 0x0C}, |
| 451 | {0x00, 0x07, 0x10, 0x12}, |
| 452 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 453 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_4 */ |
| 454 | {0x00, 0xE0, 0x10, 0x60}, |
| 455 | {0x00, 0xEE, 0x10, 0x44}, |
| 456 | {0x00, 0xF4, 0x10, 0x38}, |
| 457 | {0xF8, 0xF4, 0x18, 0x38}, |
| 458 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 459 | {0x00, 0x00, 0x10, 0x20}, |
| 460 | {0x00, 0x04, 0x10, 0x18}, |
| 461 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 462 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_5 */ |
| 463 | {0xF5, 0xEE, 0x1B, 0x44}, |
| 464 | {0xF8, 0xF4, 0x18, 0x38}, |
| 465 | {0xEB, 0x04, 0x25, 0x18}, |
| 466 | {0xF1, 0x05, 0x1F, 0x16}, |
| 467 | {0xF6, 0x06, 0x1A, 0x14}, |
| 468 | {0xFA, 0x06, 0x16, 0x14}, |
| 469 | {0x00, 0x04, 0x10, 0x18}, |
| 470 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 471 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_6 */ |
| 472 | {0xEB, 0x04, 0x25, 0x18}, |
| 473 | {0xE7, 0x0E, 0x29, 0x04}, |
| 474 | {0xEE, 0x0C, 0x22, 0x08}, |
| 475 | {0xF6, 0x0B, 0x1A, 0x0A}, |
| 476 | {0xF9, 0x0A, 0x17, 0x0C}, |
| 477 | {0xFC, 0x0A, 0x14, 0x0C}, |
| 478 | {0x00, 0x08, 0x10, 0x10}, |
| 479 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 480 | { { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_7 */ |
| 481 | {0xEC, 0x02, 0x24, 0x1C}, |
| 482 | {0xF2, 0x04, 0x1E, 0x18}, |
| 483 | {0xEB, 0x15, 0x25, 0xF6}, |
| 484 | {0xF4, 0x10, 0x1C, 0x00}, |
| 485 | {0xF8, 0x0F, 0x18, 0x02}, |
| 486 | {0x00, 0x04, 0x10, 0x18}, |
| 487 | {0x01, 0x06, 0x0F, 0x14}, |
| 488 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 489 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_0 */ |
| 490 | {0x00, 0xE0, 0x10, 0x60}, |
| 491 | {0x00, 0xEE, 0x10, 0x44}, |
| 492 | {0x00, 0xF4, 0x10, 0x38}, |
| 493 | {0xF8, 0xF4, 0x18, 0x38}, |
| 494 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 495 | {0x00, 0x00, 0x10, 0x20}, |
| 496 | {0x00, 0x04, 0x10, 0x18}, |
| 497 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 498 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_1 */ |
| 499 | {0x00, 0xE0, 0x10, 0x60}, |
| 500 | {0x00, 0xEE, 0x10, 0x44}, |
| 501 | {0x00, 0xF4, 0x10, 0x38}, |
| 502 | {0xF8, 0xF4, 0x18, 0x38}, |
| 503 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 504 | {0x00, 0x00, 0x10, 0x20}, |
| 505 | {0x00, 0x04, 0x10, 0x18}, |
| 506 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 507 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_2 */ |
| 508 | {0xF5, 0xEE, 0x1B, 0x44}, |
| 509 | {0xF8, 0xF4, 0x18, 0x38}, |
| 510 | {0xF1, 0xF7, 0x01, 0x32}, |
| 511 | {0xF5, 0xFB, 0x1B, 0x2A}, |
| 512 | {0xF9, 0xFF, 0x17, 0x22}, |
| 513 | {0xFB, 0x01, 0x15, 0x1E}, |
| 514 | {0x00, 0x04, 0x10, 0x18}, |
| 515 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 516 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_3 */ |
| 517 | {0xF5, 0xFB, 0x1B, 0x2A}, |
| 518 | {0xEE, 0xFE, 0x22, 0x24}, |
| 519 | {0xF3, 0x00, 0x1D, 0x20}, |
| 520 | {0xF9, 0x03, 0x17, 0x1A}, |
| 521 | {0xFB, 0x02, 0x14, 0x1E}, |
| 522 | {0xFB, 0x04, 0x15, 0x18}, |
| 523 | {0x00, 0x06, 0x10, 0x14}, |
| 524 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 525 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_4 */ |
| 526 | {0x00, 0xE0, 0x10, 0x60}, |
| 527 | {0x00, 0xEE, 0x10, 0x44}, |
| 528 | {0x00, 0xF4, 0x10, 0x38}, |
| 529 | {0xF8, 0xF4, 0x18, 0x38}, |
| 530 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 531 | {0x00, 0x00, 0x10, 0x20}, |
| 532 | {0x00, 0x04, 0x10, 0x18}, |
| 533 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 534 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_5 */ |
| 535 | {0xF5, 0xEE, 0x1B, 0x44}, |
| 536 | {0xF8, 0xF4, 0x18, 0x38}, |
| 537 | {0xF1, 0xF7, 0x1F, 0x32}, |
| 538 | {0xF5, 0xFB, 0x1B, 0x2A}, |
| 539 | {0xF9, 0xFF, 0x17, 0x22}, |
| 540 | {0xFB, 0x01, 0x15, 0x1E}, |
| 541 | {0x00, 0x04, 0x10, 0x18}, |
| 542 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 543 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_6 */ |
| 544 | {0xF5, 0xEE, 0x1B, 0x2A}, |
| 545 | {0xEE, 0xFE, 0x22, 0x24}, |
| 546 | {0xF3, 0x00, 0x1D, 0x20}, |
| 547 | {0xF9, 0x03, 0x17, 0x1A}, |
| 548 | {0xFB, 0x02, 0x14, 0x1E}, |
| 549 | {0xFB, 0x04, 0x15, 0x18}, |
| 550 | {0x00, 0x06, 0x10, 0x14}, |
| 551 | {0xFF, 0xFF, 0xFF, 0xFF} } }, |
| 552 | { { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_7 */ |
| 553 | {0xF5, 0xEE, 0x1B, 0x44}, |
| 554 | {0xF8, 0xF4, 0x18, 0x38}, |
| 555 | {0xFC, 0xFB, 0x14, 0x2A}, |
| 556 | {0xEB, 0x05, 0x25, 0x16}, |
| 557 | {0xF1, 0x05, 0x1F, 0x16}, |
| 558 | {0xFA, 0x07, 0x16, 0x12}, |
| 559 | {0x00, 0x07, 0x10, 0x12}, |
| 560 | {0xFF, 0xFF, 0xFF, 0xFF} } } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 561 | }; |
| 562 | |
| 563 | static int filter = -1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 564 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 565 | #endif |