1 /* 2 * SiS 300/305/540/630(S)/730(S) 3 * SiS 315(H/PRO)/55x/(M)65x/(M)661(F/M)X/740/741(GX)/330/(M)760 4 * frame buffer driver for Linux kernels >=2.4.14 and >=2.6.3 5 * 6 * Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the named License, 11 * or any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 21 */ 22 23 #ifndef _SISFB_MAIN 24 #define _SISFB_MAIN 25 26 #include <linux/spinlock.h> 27 28 #include "vstruct.h" 29 #include "sis.h" 30 31 #define MODE_INDEX_NONE 0 /* index for mode=none */ 32 33 /* Fbcon stuff */ 34 static struct fb_var_screeninfo my_default_var = { 35 .xres = 0, 36 .yres = 0, 37 .xres_virtual = 0, 38 .yres_virtual = 0, 39 .xoffset = 0, 40 .yoffset = 0, 41 .bits_per_pixel = 0, 42 .grayscale = 0, 43 .red = {0, 8, 0}, 44 .green = {0, 8, 0}, 45 .blue = {0, 8, 0}, 46 .transp = {0, 0, 0}, 47 .nonstd = 0, 48 .activate = FB_ACTIVATE_NOW, 49 .height = -1, 50 .width = -1, 51 .accel_flags = 0, 52 .pixclock = 0, 53 .left_margin = 0, 54 .right_margin = 0, 55 .upper_margin = 0, 56 .lower_margin = 0, 57 .hsync_len = 0, 58 .vsync_len = 0, 59 .sync = 0, 60 .vmode = FB_VMODE_NONINTERLACED, 61 }; 62 63 /* Boot-time parameters */ 64 static int sisfb_off = 0; 65 static int sisfb_parm_mem = 0; 66 static int sisfb_accel = -1; 67 static int sisfb_ypan = -1; 68 static int sisfb_max = -1; 69 static int sisfb_userom = 1; 70 static int sisfb_useoem = -1; 71 #ifdef MODULE 72 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) 73 static int sisfb_mode_idx = -1; 74 #else 75 static int sisfb_mode_idx = MODE_INDEX_NONE; /* Don't use a mode by default if we are a module */ 76 #endif 77 #else 78 static int sisfb_mode_idx = -1; /* Use a default mode if we are inside the kernel */ 79 #endif 80 static int sisfb_parm_rate = -1; 81 static int sisfb_crt1off = 0; 82 static int sisfb_forcecrt1 = -1; 83 static int sisfb_crt2type = -1; /* CRT2 type (for overriding autodetection) */ 84 static int sisfb_crt2flags = 0; 85 static int sisfb_pdc = 0xff; 86 static int sisfb_pdca = 0xff; 87 static int sisfb_scalelcd = -1; 88 static int sisfb_specialtiming = CUT_NONE; 89 static int sisfb_lvdshl = -1; 90 static int sisfb_dstn = 0; 91 static int sisfb_fstn = 0; 92 static int sisfb_tvplug = -1; /* Tv plug type (for overriding autodetection) */ 93 static int sisfb_tvstd = -1; 94 static int sisfb_tvxposoffset = 0; 95 static int sisfb_tvyposoffset = 0; 96 static int sisfb_filter = -1; 97 static int sisfb_nocrt2rate = 0; 98 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 99 static int sisfb_inverse = 0; 100 static char sisfb_fontname[40]; 101 #endif 102 #if !defined(__i386__) && !defined(__x86_64__) 103 static int sisfb_resetcard = 0; 104 static int sisfb_videoram = 0; 105 #endif 106 107 /* List of supported chips */ 108 static struct sisfb_chip_info { 109 int chip; 110 int vgaengine; 111 int mni; 112 int hwcursor_size; 113 int CRT2_write_enable; 114 const char *chip_name; 115 } sisfb_chip_info[] __devinitdata = { 116 { SIS_300, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 300/305" }, 117 { SIS_540, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 540" }, 118 { SIS_630, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 630" }, 119 { SIS_315H, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 315H" }, 120 { SIS_315, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 315" }, 121 { SIS_315PRO, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 315PRO" }, 122 { SIS_550, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 55x" }, 123 { SIS_650, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 650" }, 124 { SIS_330, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 330" }, 125 { SIS_660, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 660" }, 126 }; 127 128 static struct pci_device_id __devinitdata sisfb_pci_table[] = { 129 #ifdef CONFIG_FB_SIS_300 130 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 131 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_540_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 132 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 133 #endif 134 #ifdef CONFIG_FB_SIS_315 135 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315H, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 136 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 137 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315PRO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, 138 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_550_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6}, 139 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_650_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7}, 140 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8}, 141 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_660_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9}, 142 #endif 143 { 0 } 144 }; 145 146 MODULE_DEVICE_TABLE(pci, sisfb_pci_table); 147 148 static struct sis_video_info *card_list = NULL; 149 150 /* TODO: This is not handled card-wise because the DRM 151 does not refer to a unique fb when calling sis_alloc 152 or sis_free. Therefore, this is handled globally for 153 now (hoping that nobody is crazy enough to run two 154 SiS cards at the same time). 155 */ 156 SIS_HEAP sisfb_heap; 157 158 #define MD_SIS300 1 159 #define MD_SIS315 2 160 161 /* Mode table */ 162 static const struct _sisbios_mode { 163 char name[15]; 164 u8 mode_no[2]; 165 u16 vesa_mode_no_1; /* "SiS defined" VESA mode number */ 166 u16 vesa_mode_no_2; /* Real VESA mode numbers */ 167 u16 xres; 168 u16 yres; 169 u16 bpp; 170 u16 rate_idx; 171 u16 cols; 172 u16 rows; 173 u8 chipset; 174 } sisbios_mode[] = { 175 /*0*/ {"none", {0xff,0xff}, 0x0000, 0x0000, 0, 0, 0, 0, 0, 0, MD_SIS300|MD_SIS315}, 176 {"320x200x8", {0x59,0x59}, 0x0138, 0x0000, 320, 200, 8, 1, 40, 12, MD_SIS300|MD_SIS315}, 177 {"320x200x16", {0x41,0x41}, 0x010e, 0x0000, 320, 200, 16, 1, 40, 12, MD_SIS300|MD_SIS315}, 178 {"320x200x24", {0x4f,0x4f}, 0x0000, 0x0000, 320, 200, 32, 1, 40, 12, MD_SIS300|MD_SIS315}, /* That's for people who mix up color- and fb depth */ 179 {"320x200x32", {0x4f,0x4f}, 0x0000, 0x0000, 320, 200, 32, 1, 40, 12, MD_SIS300|MD_SIS315}, 180 {"320x240x8", {0x50,0x50}, 0x0132, 0x0000, 320, 240, 8, 1, 40, 15, MD_SIS300|MD_SIS315}, 181 {"320x240x16", {0x56,0x56}, 0x0135, 0x0000, 320, 240, 16, 1, 40, 15, MD_SIS300|MD_SIS315}, 182 {"320x240x24", {0x53,0x53}, 0x0000, 0x0000, 320, 240, 32, 1, 40, 15, MD_SIS300|MD_SIS315}, 183 {"320x240x32", {0x53,0x53}, 0x0000, 0x0000, 320, 240, 32, 1, 40, 15, MD_SIS300|MD_SIS315}, 184 {"320x240x8", {0x5a,0x5a}, 0x0132, 0x0000, 320, 480, 8, 1, 40, 30, MD_SIS315}, /* FSTN */ 185 /*10*/ {"320x240x16", {0x5b,0x5b}, 0x0135, 0x0000, 320, 480, 16, 1, 40, 30, MD_SIS315}, /* FSTN */ 186 {"400x300x8", {0x51,0x51}, 0x0133, 0x0000, 400, 300, 8, 1, 50, 18, MD_SIS300|MD_SIS315}, 187 {"400x300x16", {0x57,0x57}, 0x0136, 0x0000, 400, 300, 16, 1, 50, 18, MD_SIS300|MD_SIS315}, 188 {"400x300x24", {0x54,0x54}, 0x0000, 0x0000, 400, 300, 32, 1, 50, 18, MD_SIS300|MD_SIS315}, 189 {"400x300x32", {0x54,0x54}, 0x0000, 0x0000, 400, 300, 32, 1, 50, 18, MD_SIS300|MD_SIS315}, 190 {"512x384x8", {0x52,0x52}, 0x0000, 0x0000, 512, 384, 8, 1, 64, 24, MD_SIS300|MD_SIS315}, 191 {"512x384x16", {0x58,0x58}, 0x0000, 0x0000, 512, 384, 16, 1, 64, 24, MD_SIS300|MD_SIS315}, 192 {"512x384x24", {0x5c,0x5c}, 0x0000, 0x0000, 512, 384, 32, 1, 64, 24, MD_SIS300|MD_SIS315}, 193 {"512x384x32", {0x5c,0x5c}, 0x0000, 0x0000, 512, 384, 32, 1, 64, 24, MD_SIS300|MD_SIS315}, 194 {"640x400x8", {0x2f,0x2f}, 0x0000, 0x0000, 640, 400, 8, 1, 80, 25, MD_SIS300|MD_SIS315}, 195 /*20*/ {"640x400x16", {0x5d,0x5d}, 0x0000, 0x0000, 640, 400, 16, 1, 80, 25, MD_SIS300|MD_SIS315}, 196 {"640x400x24", {0x5e,0x5e}, 0x0000, 0x0000, 640, 400, 32, 1, 80, 25, MD_SIS300|MD_SIS315}, 197 {"640x400x32", {0x5e,0x5e}, 0x0000, 0x0000, 640, 400, 32, 1, 80, 25, MD_SIS300|MD_SIS315}, 198 {"640x480x8", {0x2e,0x2e}, 0x0101, 0x0101, 640, 480, 8, 1, 80, 30, MD_SIS300|MD_SIS315}, 199 {"640x480x16", {0x44,0x44}, 0x0111, 0x0111, 640, 480, 16, 1, 80, 30, MD_SIS300|MD_SIS315}, 200 {"640x480x24", {0x62,0x62}, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, MD_SIS300|MD_SIS315}, 201 {"640x480x32", {0x62,0x62}, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, MD_SIS300|MD_SIS315}, 202 {"720x480x8", {0x31,0x31}, 0x0000, 0x0000, 720, 480, 8, 1, 90, 30, MD_SIS300|MD_SIS315}, 203 {"720x480x16", {0x33,0x33}, 0x0000, 0x0000, 720, 480, 16, 1, 90, 30, MD_SIS300|MD_SIS315}, 204 {"720x480x24", {0x35,0x35}, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, MD_SIS300|MD_SIS315}, 205 /*30*/ {"720x480x32", {0x35,0x35}, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, MD_SIS300|MD_SIS315}, 206 {"720x576x8", {0x32,0x32}, 0x0000, 0x0000, 720, 576, 8, 1, 90, 36, MD_SIS300|MD_SIS315}, 207 {"720x576x16", {0x34,0x34}, 0x0000, 0x0000, 720, 576, 16, 1, 90, 36, MD_SIS300|MD_SIS315}, 208 {"720x576x24", {0x36,0x36}, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, MD_SIS300|MD_SIS315}, 209 {"720x576x32", {0x36,0x36}, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, MD_SIS300|MD_SIS315}, 210 {"768x576x8", {0x5f,0x5f}, 0x0000, 0x0000, 768, 576, 8, 1, 96, 36, MD_SIS300|MD_SIS315}, 211 {"768x576x16", {0x60,0x60}, 0x0000, 0x0000, 768, 576, 16, 1, 96, 36, MD_SIS300|MD_SIS315}, 212 {"768x576x24", {0x61,0x61}, 0x0000, 0x0000, 768, 576, 32, 1, 96, 36, MD_SIS300|MD_SIS315}, 213 {"768x576x32", {0x61,0x61}, 0x0000, 0x0000, 768, 576, 32, 1, 96, 36, MD_SIS300|MD_SIS315}, 214 {"800x480x8", {0x70,0x70}, 0x0000, 0x0000, 800, 480, 8, 1, 100, 30, MD_SIS300|MD_SIS315}, 215 /*40*/ {"800x480x16", {0x7a,0x7a}, 0x0000, 0x0000, 800, 480, 16, 1, 100, 30, MD_SIS300|MD_SIS315}, 216 {"800x480x24", {0x76,0x76}, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_SIS300|MD_SIS315}, 217 {"800x480x32", {0x76,0x76}, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_SIS300|MD_SIS315}, 218 #define DEFAULT_MODE 43 /* index for 800x600x8 */ 219 #define DEFAULT_LCDMODE 43 /* index for 800x600x8 */ 220 #define DEFAULT_TVMODE 43 /* index for 800x600x8 */ 221 {"800x600x8", {0x30,0x30}, 0x0103, 0x0103, 800, 600, 8, 2, 100, 37, MD_SIS300|MD_SIS315}, 222 {"800x600x16", {0x47,0x47}, 0x0114, 0x0114, 800, 600, 16, 2, 100, 37, MD_SIS300|MD_SIS315}, 223 {"800x600x24", {0x63,0x63}, 0x013b, 0x0115, 800, 600, 32, 2, 100, 37, MD_SIS300|MD_SIS315}, 224 {"800x600x32", {0x63,0x63}, 0x013b, 0x0115, 800, 600, 32, 2, 100, 37, MD_SIS300|MD_SIS315}, 225 {"848x480x8", {0x39,0x39}, 0x0000, 0x0000, 848, 480, 8, 2, 106, 30, MD_SIS300|MD_SIS315}, 226 {"848x480x16", {0x3b,0x3b}, 0x0000, 0x0000, 848, 480, 16, 2, 106, 30, MD_SIS300|MD_SIS315}, 227 {"848x480x24", {0x3e,0x3e}, 0x0000, 0x0000, 848, 480, 32, 2, 106, 30, MD_SIS300|MD_SIS315}, 228 /*50*/ {"848x480x32", {0x3e,0x3e}, 0x0000, 0x0000, 848, 480, 32, 2, 106, 30, MD_SIS300|MD_SIS315}, 229 {"856x480x8", {0x3f,0x3f}, 0x0000, 0x0000, 856, 480, 8, 2, 107, 30, MD_SIS300|MD_SIS315}, 230 {"856x480x16", {0x42,0x42}, 0x0000, 0x0000, 856, 480, 16, 2, 107, 30, MD_SIS300|MD_SIS315}, 231 {"856x480x24", {0x45,0x45}, 0x0000, 0x0000, 856, 480, 32, 2, 107, 30, MD_SIS300|MD_SIS315}, 232 {"856x480x32", {0x45,0x45}, 0x0000, 0x0000, 856, 480, 32, 2, 107, 30, MD_SIS300|MD_SIS315}, 233 {"1024x576x8", {0x71,0x71}, 0x0000, 0x0000, 1024, 576, 8, 1, 128, 36, MD_SIS300|MD_SIS315}, 234 {"1024x576x16", {0x74,0x74}, 0x0000, 0x0000, 1024, 576, 16, 1, 128, 36, MD_SIS300|MD_SIS315}, 235 {"1024x576x24", {0x77,0x77}, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, MD_SIS300|MD_SIS315}, 236 {"1024x576x32", {0x77,0x77}, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, MD_SIS300|MD_SIS315}, 237 {"1024x600x8", {0x20,0x20}, 0x0000, 0x0000, 1024, 600, 8, 1, 128, 37, MD_SIS300 }, 238 /*60*/ {"1024x600x16", {0x21,0x21}, 0x0000, 0x0000, 1024, 600, 16, 1, 128, 37, MD_SIS300 }, 239 {"1024x600x24", {0x22,0x22}, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, MD_SIS300 }, 240 {"1024x600x32", {0x22,0x22}, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, MD_SIS300 }, 241 {"1024x768x8", {0x38,0x38}, 0x0105, 0x0105, 1024, 768, 8, 2, 128, 48, MD_SIS300|MD_SIS315}, 242 {"1024x768x16", {0x4a,0x4a}, 0x0117, 0x0117, 1024, 768, 16, 2, 128, 48, MD_SIS300|MD_SIS315}, 243 {"1024x768x24", {0x64,0x64}, 0x013c, 0x0118, 1024, 768, 32, 2, 128, 48, MD_SIS300|MD_SIS315}, 244 {"1024x768x32", {0x64,0x64}, 0x013c, 0x0118, 1024, 768, 32, 2, 128, 48, MD_SIS300|MD_SIS315}, 245 {"1152x768x8", {0x23,0x23}, 0x0000, 0x0000, 1152, 768, 8, 1, 144, 48, MD_SIS300 }, 246 {"1152x768x16", {0x24,0x24}, 0x0000, 0x0000, 1152, 768, 16, 1, 144, 48, MD_SIS300 }, 247 {"1152x768x24", {0x25,0x25}, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, MD_SIS300 }, 248 /*70*/ {"1152x768x32", {0x25,0x25}, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, MD_SIS300 }, 249 {"1152x864x8", {0x29,0x29}, 0x0000, 0x0000, 1152, 864, 8, 1, 144, 54, MD_SIS300|MD_SIS315}, 250 {"1152x864x16", {0x2a,0x2a}, 0x0000, 0x0000, 1152, 864, 16, 1, 144, 54, MD_SIS300|MD_SIS315}, 251 {"1152x864x24", {0x2b,0x2b}, 0x0000, 0x0000, 1152, 864, 32, 1, 144, 54, MD_SIS300|MD_SIS315}, 252 {"1152x864x32", {0x2b,0x2b}, 0x0000, 0x0000, 1152, 864, 32, 1, 144, 54, MD_SIS300|MD_SIS315}, 253 {"1280x720x8", {0x79,0x79}, 0x0000, 0x0000, 1280, 720, 8, 1, 160, 45, MD_SIS300|MD_SIS315}, 254 {"1280x720x16", {0x75,0x75}, 0x0000, 0x0000, 1280, 720, 16, 1, 160, 45, MD_SIS300|MD_SIS315}, 255 {"1280x720x24", {0x78,0x78}, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, MD_SIS300|MD_SIS315}, 256 {"1280x720x32", {0x78,0x78}, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, MD_SIS300|MD_SIS315}, 257 {"1280x768x8", {0x55,0x23}, 0x0000, 0x0000, 1280, 768, 8, 1, 160, 48, MD_SIS300|MD_SIS315}, 258 /*80*/ {"1280x768x16", {0x5a,0x24}, 0x0000, 0x0000, 1280, 768, 16, 1, 160, 48, MD_SIS300|MD_SIS315}, 259 {"1280x768x24", {0x5b,0x25}, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, MD_SIS300|MD_SIS315}, 260 {"1280x768x32", {0x5b,0x25}, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, MD_SIS300|MD_SIS315}, 261 {"1280x800x8", {0x14,0x14}, 0x0000, 0x0000, 1280, 800, 8, 1, 160, 50, MD_SIS315}, 262 {"1280x800x16", {0x15,0x15}, 0x0000, 0x0000, 1280, 800, 16, 1, 160, 50, MD_SIS315}, 263 {"1280x800x24", {0x16,0x16}, 0x0000, 0x0000, 1280, 800, 32, 1, 160, 50, MD_SIS315}, 264 {"1280x800x32", {0x16,0x16}, 0x0000, 0x0000, 1280, 800, 32, 1, 160, 50, MD_SIS315}, 265 {"1280x960x8", {0x7c,0x7c}, 0x0000, 0x0000, 1280, 960, 8, 1, 160, 60, MD_SIS300|MD_SIS315}, 266 {"1280x960x16", {0x7d,0x7d}, 0x0000, 0x0000, 1280, 960, 16, 1, 160, 60, MD_SIS300|MD_SIS315}, 267 {"1280x960x24", {0x7e,0x7e}, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_SIS300|MD_SIS315}, 268 /*90*/ {"1280x960x32", {0x7e,0x7e}, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_SIS300|MD_SIS315}, 269 {"1280x1024x8", {0x3a,0x3a}, 0x0107, 0x0107, 1280, 1024, 8, 2, 160, 64, MD_SIS300|MD_SIS315}, 270 {"1280x1024x16", {0x4d,0x4d}, 0x011a, 0x011a, 1280, 1024, 16, 2, 160, 64, MD_SIS300|MD_SIS315}, 271 {"1280x1024x24", {0x65,0x65}, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315}, 272 {"1280x1024x32", {0x65,0x65}, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315}, 273 {"1360x768x8", {0x48,0x48}, 0x0000, 0x0000, 1360, 768, 8, 1, 170, 48, MD_SIS300|MD_SIS315}, 274 {"1360x768x16", {0x4b,0x4b}, 0x0000, 0x0000, 1360, 768, 16, 1, 170, 48, MD_SIS300|MD_SIS315}, 275 {"1360x768x24", {0x4e,0x4e}, 0x0000, 0x0000, 1360, 768, 32, 1, 170, 48, MD_SIS300|MD_SIS315}, 276 {"1360x768x32", {0x4e,0x4e}, 0x0000, 0x0000, 1360, 768, 32, 1, 170, 48, MD_SIS300|MD_SIS315}, 277 {"1360x1024x8", {0x67,0x67}, 0x0000, 0x0000, 1360, 1024, 8, 1, 170, 64, MD_SIS300 }, 278 /*100*/ {"1360x1024x16", {0x6f,0x6f}, 0x0000, 0x0000, 1360, 1024, 16, 1, 170, 64, MD_SIS300 }, 279 {"1360x1024x24", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300 }, 280 {"1360x1024x32", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300 }, 281 {"1400x1050x8", {0x26,0x26}, 0x0000, 0x0000, 1400, 1050, 8, 1, 175, 65, MD_SIS315}, 282 {"1400x1050x16", {0x27,0x27}, 0x0000, 0x0000, 1400, 1050, 16, 1, 175, 65, MD_SIS315}, 283 {"1400x1050x24", {0x28,0x28}, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_SIS315}, 284 {"1400x1050x32", {0x28,0x28}, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_SIS315}, 285 {"1600x1200x8", {0x3c,0x3c}, 0x0130, 0x011c, 1600, 1200, 8, 1, 200, 75, MD_SIS300|MD_SIS315}, 286 {"1600x1200x16", {0x3d,0x3d}, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, MD_SIS300|MD_SIS315}, 287 {"1600x1200x24", {0x66,0x66}, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315}, 288 /*110*/ {"1600x1200x32", {0x66,0x66}, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315}, 289 {"1680x1050x8", {0x17,0x17}, 0x0000, 0x0000, 1680, 1050, 8, 1, 210, 65, MD_SIS315}, 290 {"1680x1050x16", {0x18,0x18}, 0x0000, 0x0000, 1680, 1050, 16, 1, 210, 65, MD_SIS315}, 291 {"1680x1050x24", {0x19,0x19}, 0x0000, 0x0000, 1680, 1050, 32, 1, 210, 65, MD_SIS315}, 292 {"1680x1050x32", {0x19,0x19}, 0x0000, 0x0000, 1680, 1050, 32, 1, 210, 65, MD_SIS315}, 293 {"1920x1440x8", {0x68,0x68}, 0x013f, 0x0000, 1920, 1440, 8, 1, 240, 75, MD_SIS300|MD_SIS315}, 294 {"1920x1440x16", {0x69,0x69}, 0x0140, 0x0000, 1920, 1440, 16, 1, 240, 75, MD_SIS300|MD_SIS315}, 295 {"1920x1440x24", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315}, 296 {"1920x1440x32", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315}, 297 {"2048x1536x8", {0x6c,0x6c}, 0x0000, 0x0000, 2048, 1536, 8, 1, 256, 96, MD_SIS315}, 298 {"2048x1536x16", {0x6d,0x6d}, 0x0000, 0x0000, 2048, 1536, 16, 1, 256, 96, MD_SIS315}, 299 {"2048x1536x24", {0x6e,0x6e}, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_SIS315}, 300 {"2048x1536x32", {0x6e,0x6e}, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_SIS315}, 301 {"\0", {0x00,0x00}, 0, 0, 0, 0, 0, 0, 0} 302 }; 303 304 #define SIS_LCD_NUMBER 17 305 static const struct _sis_lcd_data { 306 u32 lcdtype; 307 u16 xres; 308 u16 yres; 309 u8 default_mode_idx; 310 } sis_lcd_data[] = { 311 { LCD_640x480, 640, 480, 23 }, 312 { LCD_800x600, 800, 600, 43 }, 313 { LCD_1024x600, 1024, 600, 59 }, 314 { LCD_1024x768, 1024, 768, 63 }, 315 { LCD_1152x768, 1152, 768, 67 }, 316 { LCD_1152x864, 1152, 864, 71 }, 317 { LCD_1280x720, 1280, 720, 75 }, 318 { LCD_1280x768, 1280, 768, 79 }, 319 { LCD_1280x800, 1280, 800, 83 }, 320 { LCD_1280x960, 1280, 960, 87 }, 321 { LCD_1280x1024, 1280, 1024, 91 }, 322 { LCD_1400x1050, 1400, 1050, 103 }, 323 { LCD_1680x1050, 1680, 1050, 111 }, 324 { LCD_1600x1200, 1600, 1200, 107 }, 325 { LCD_640x480_2, 640, 480, 23 }, 326 { LCD_640x480_3, 640, 480, 23 }, 327 { LCD_320x480, 320, 480, 9 }, 328 }; 329 330 /* CR36 evaluation */ 331 const USHORT sis300paneltype[] = 332 { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, 333 LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768, 334 LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, 335 LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN }; 336 337 const USHORT sis310paneltype[] = 338 { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, 339 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, 340 LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, 341 LCD_640x480_2, LCD_640x480_3, LCD_UNKNOWN, LCD_UNKNOWN }; 342 343 const USHORT sis661paneltype[] = 344 { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, 345 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, 346 LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, 347 LCD_1280x800, LCD_1680x1050, LCD_1280x720, LCD_UNKNOWN }; 348 349 #define FL_550_DSTN 0x01 350 #define FL_550_FSTN 0x02 351 #define FL_300 0x04 352 #define FL_315 0x08 353 354 static struct _sis_crt2type { 355 char name[32]; 356 u32 type_no; 357 u32 tvplug_no; 358 u16 flags; 359 } sis_crt2type[] __initdata = { 360 {"NONE", 0, -1, FL_300|FL_315}, 361 {"LCD", CRT2_LCD, -1, FL_300|FL_315}, 362 {"TV", CRT2_TV, -1, FL_300|FL_315}, 363 {"VGA", CRT2_VGA, -1, FL_300|FL_315}, 364 {"SVIDEO", CRT2_TV, TV_SVIDEO, FL_300|FL_315}, 365 {"COMPOSITE", CRT2_TV, TV_AVIDEO, FL_300|FL_315}, 366 {"CVBS", CRT2_TV, TV_AVIDEO, FL_300|FL_315}, 367 {"SVIDEO+COMPOSITE", CRT2_TV, TV_AVIDEO|TV_SVIDEO, FL_300|FL_315}, 368 {"COMPOSITE+SVIDEO", CRT2_TV, TV_AVIDEO|TV_SVIDEO, FL_300|FL_315}, 369 {"SVIDEO+CVBS", CRT2_TV, TV_AVIDEO|TV_SVIDEO, FL_300|FL_315}, 370 {"CVBS+SVIDEO", CRT2_TV, TV_AVIDEO|TV_SVIDEO, FL_300|FL_315}, 371 {"SCART", CRT2_TV, TV_SCART, FL_300|FL_315}, 372 {"HIVISION", CRT2_TV, TV_HIVISION, FL_315}, 373 {"YPBPR480I", CRT2_TV, TV_YPBPR|TV_YPBPR525I, FL_315}, 374 {"YPBPR480P", CRT2_TV, TV_YPBPR|TV_YPBPR525P, FL_315}, 375 {"YPBPR720P", CRT2_TV, TV_YPBPR|TV_YPBPR750P, FL_315}, 376 {"YPBPR1080I", CRT2_TV, TV_YPBPR|TV_YPBPR1080I, FL_315}, 377 {"DSTN", CRT2_LCD, -1, FL_315|FL_550_DSTN}, 378 {"FSTN", CRT2_LCD, -1, FL_315|FL_550_FSTN}, 379 {"\0", -1, -1, 0} 380 }; 381 382 /* TV standard */ 383 static struct _sis_tvtype { 384 char name[6]; 385 u32 type_no; 386 } sis_tvtype[] __initdata = { 387 {"PAL", TV_PAL}, 388 {"NTSC", TV_NTSC}, 389 {"PALM", TV_PAL|TV_PALM}, 390 {"PALN", TV_PAL|TV_PALN}, 391 {"NTSCJ", TV_NTSC|TV_NTSCJ}, 392 {"\0", -1} 393 }; 394 395 static const struct _sis_vrate { 396 u16 idx; 397 u16 xres; 398 u16 yres; 399 u16 refresh; 400 BOOLEAN SiS730valid32bpp; 401 } sisfb_vrate[] = { 402 {1, 320, 200, 70, TRUE}, 403 {1, 320, 240, 60, TRUE}, 404 {1, 320, 480, 60, TRUE}, 405 {1, 400, 300, 60, TRUE}, 406 {1, 512, 384, 60, TRUE}, 407 {1, 640, 400, 72, TRUE}, 408 {1, 640, 480, 60, TRUE}, {2, 640, 480, 72, TRUE}, {3, 640, 480, 75, TRUE}, 409 {4, 640, 480, 85, TRUE}, {5, 640, 480, 100, TRUE}, {6, 640, 480, 120, TRUE}, 410 {7, 640, 480, 160, TRUE}, {8, 640, 480, 200, TRUE}, 411 {1, 720, 480, 60, TRUE}, 412 {1, 720, 576, 58, TRUE}, 413 {1, 768, 576, 58, TRUE}, 414 {1, 800, 480, 60, TRUE}, {2, 800, 480, 75, TRUE}, {3, 800, 480, 85, TRUE}, 415 {1, 800, 600, 56, TRUE}, {2, 800, 600, 60, TRUE}, {3, 800, 600, 72, TRUE}, 416 {4, 800, 600, 75, TRUE}, {5, 800, 600, 85, TRUE}, {6, 800, 600, 105, TRUE}, 417 {7, 800, 600, 120, TRUE}, {8, 800, 600, 160, TRUE}, 418 {1, 848, 480, 39, TRUE}, {2, 848, 480, 60, TRUE}, 419 {1, 856, 480, 39, TRUE}, {2, 856, 480, 60, TRUE}, 420 {1, 1024, 576, 60, TRUE}, {2, 1024, 576, 75, TRUE}, {3, 1024, 576, 85, TRUE}, 421 {1, 1024, 600, 60, TRUE}, 422 {1, 1024, 768, 43, TRUE}, {2, 1024, 768, 60, TRUE}, {3, 1024, 768, 70, FALSE}, 423 {4, 1024, 768, 75, FALSE}, {5, 1024, 768, 85, TRUE}, {6, 1024, 768, 100, TRUE}, 424 {7, 1024, 768, 120, TRUE}, 425 {1, 1152, 768, 60, TRUE}, 426 {1, 1152, 864, 75, TRUE}, {2, 1152, 864, 84, TRUE}, 427 {1, 1280, 720, 60, TRUE}, {2, 1280, 720, 75, TRUE}, {3, 1280, 720, 85, TRUE}, 428 {1, 1280, 768, 60, TRUE}, 429 {1, 1280, 800, 60, TRUE}, 430 {1, 1280, 960, 60, TRUE}, {2, 1280, 960, 85, TRUE}, 431 {1, 1280, 1024, 43, TRUE}, {2, 1280, 1024, 60, TRUE}, {3, 1280, 1024, 75, TRUE}, 432 {4, 1280, 1024, 85, TRUE}, 433 {1, 1360, 768, 60, TRUE}, 434 {1, 1360, 1024, 59, TRUE}, 435 {1, 1400, 1050, 60, TRUE}, {2, 1400, 1050, 75, TRUE}, 436 {1, 1600, 1200, 60, TRUE}, {2, 1600, 1200, 65, TRUE}, {3, 1600, 1200, 70, TRUE}, 437 {4, 1600, 1200, 75, TRUE}, {5, 1600, 1200, 85, TRUE}, {6, 1600, 1200, 100, TRUE}, 438 {7, 1600, 1200, 120, TRUE}, 439 {1, 1680, 1050, 60, TRUE}, 440 {1, 1920, 1440, 60, TRUE}, {2, 1920, 1440, 65, TRUE}, {3, 1920, 1440, 70, TRUE}, 441 {4, 1920, 1440, 75, TRUE}, {5, 1920, 1440, 85, TRUE}, {6, 1920, 1440, 100, TRUE}, 442 {1, 2048, 1536, 60, TRUE}, {2, 2048, 1536, 65, TRUE}, {3, 2048, 1536, 70, TRUE}, 443 {4, 2048, 1536, 75, TRUE}, {5, 2048, 1536, 85, TRUE}, 444 {0, 0, 0, 0, FALSE} 445 }; 446 447 static const struct _sisfbddcsmodes { 448 u32 mask; 449 u16 h; 450 u16 v; 451 u32 d; 452 } sisfb_ddcsmodes[] = { 453 { 0x10000, 67, 75, 108000}, 454 { 0x08000, 48, 72, 50000}, 455 { 0x04000, 46, 75, 49500}, 456 { 0x01000, 35, 43, 44900}, 457 { 0x00800, 48, 60, 65000}, 458 { 0x00400, 56, 70, 75000}, 459 { 0x00200, 60, 75, 78800}, 460 { 0x00100, 80, 75, 135000}, 461 { 0x00020, 31, 60, 25200}, 462 { 0x00008, 38, 72, 31500}, 463 { 0x00004, 37, 75, 31500}, 464 { 0x00002, 35, 56, 36000}, 465 { 0x00001, 38, 60, 40000} 466 }; 467 468 static const struct _sisfbddcfmodes { 469 u16 x; 470 u16 y; 471 u16 v; 472 u16 h; 473 u32 d; 474 } sisfb_ddcfmodes[] = { 475 { 1280, 1024, 85, 92, 157500}, 476 { 1600, 1200, 60, 75, 162000}, 477 { 1600, 1200, 65, 82, 175500}, 478 { 1600, 1200, 70, 88, 189000}, 479 { 1600, 1200, 75, 94, 202500}, 480 { 1600, 1200, 85, 107,229500}, 481 { 1920, 1440, 60, 90, 234000}, 482 { 1920, 1440, 75, 113,297000} 483 }; 484 485 #ifdef CONFIG_FB_SIS_300 486 static struct _chswtable { 487 u16 subsysVendor; 488 u16 subsysCard; 489 char *vendorName; 490 char *cardName; 491 } mychswtable[] __devinitdata = { 492 { 0x1631, 0x1002, "Mitachi", "0x1002" }, 493 { 0x1071, 0x7521, "Mitac" , "7521P" }, 494 { 0, 0, "" , "" } 495 }; 496 #endif 497 498 static struct _customttable { 499 u16 chipID; 500 char *biosversion; 501 char *biosdate; 502 u32 bioschksum; 503 u16 biosFootprintAddr[5]; 504 u8 biosFootprintData[5]; 505 u16 pcisubsysvendor; 506 u16 pcisubsyscard; 507 char *vendorName; 508 char *cardName; 509 u32 SpecialID; 510 char *optionName; 511 } mycustomttable[] __devinitdata = { 512 { SIS_630, "2.00.07", "09/27/2002-13:38:25", 513 0x3240A8, 514 { 0x220, 0x227, 0x228, 0x229, 0x0ee }, 515 { 0x01, 0xe3, 0x9a, 0x6a, 0xef }, 516 0x1039, 0x6300, 517 "Barco", "iQ R200L/300/400", CUT_BARCO1366, "BARCO_1366" 518 }, 519 { SIS_630, "2.00.07", "09/27/2002-13:38:25", 520 0x323FBD, 521 { 0x220, 0x227, 0x228, 0x229, 0x0ee }, 522 { 0x00, 0x5a, 0x64, 0x41, 0xef }, 523 0x1039, 0x6300, 524 "Barco", "iQ G200L/300/400/500", CUT_BARCO1024, "BARCO_1024" 525 }, 526 { SIS_650, "", "", 527 0, 528 { 0, 0, 0, 0, 0 }, 529 { 0, 0, 0, 0, 0 }, 530 0x0e11, 0x083c, 531 "Inventec (Compaq)", "3017cl/3045US", CUT_COMPAQ12802, "COMPAQ_1280" 532 }, 533 { SIS_650, "", "", 534 0, 535 { 0x00c, 0, 0, 0, 0 }, 536 { 'e' , 0, 0, 0, 0 }, 537 0x1558, 0x0287, 538 "Clevo", "L285/L287 (Version 1)", CUT_CLEVO1024, "CLEVO_L28X_1" 539 }, 540 { SIS_650, "", "", 541 0, 542 { 0x00c, 0, 0, 0, 0 }, 543 { 'y' , 0, 0, 0, 0 }, 544 0x1558, 0x0287, 545 "Clevo", "L285/L287 (Version 2)", CUT_CLEVO10242, "CLEVO_L28X_2" 546 }, 547 { SIS_650, "", "", 548 0, 549 { 0, 0, 0, 0, 0 }, 550 { 0, 0, 0, 0, 0 }, 551 0x1558, 0x0400, /* possibly 401 and 402 as well; not panelsize specific (?) */ 552 "Clevo", "D400S/D410S/D400H/D410H", CUT_CLEVO1400, "CLEVO_D4X0" 553 }, 554 { SIS_650, "", "", 555 0, /* Shift LCD in LCD-via-CRT1 mode */ 556 { 0, 0, 0, 0, 0 }, 557 { 0, 0, 0, 0, 0 }, 558 0x1558, 0x2263, 559 "Clevo", "D22ES/D27ES", CUT_UNIWILL1024, "CLEVO_D2X0ES" 560 }, 561 { SIS_650, "", "", 562 0, /* Shift LCD in LCD-via-CRT1 mode */ 563 { 0, 0, 0, 0, 0 }, 564 { 0, 0, 0, 0, 0 }, 565 0x1734, 0x101f, 566 "Uniwill", "N243S9", CUT_UNIWILL1024, "UNIWILL_N243S9" 567 }, 568 { SIS_650, "", "", 569 0, /* Shift LCD in LCD-via-CRT1 mode */ 570 { 0, 0, 0, 0, 0 }, 571 { 0, 0, 0, 0, 0 }, 572 0x1584, 0x5103, 573 "Uniwill", "N35BS1", CUT_UNIWILL10242, "UNIWILL_N35BS1" 574 }, 575 { SIS_650, "1.09.2c", "", /* Other versions, too? */ 576 0, /* Shift LCD in LCD-via-CRT1 mode */ 577 { 0, 0, 0, 0, 0 }, 578 { 0, 0, 0, 0, 0 }, 579 0x1019, 0x0f05, 580 "ECS", "A928", CUT_UNIWILL1024, "ECS_A928" 581 }, 582 { SIS_740, "1.11.27a", "", 583 0, 584 { 0, 0, 0, 0, 0 }, 585 { 0, 0, 0, 0, 0 }, 586 0x1043, 0x1612, 587 "Asus", "L3000D/L3500D", CUT_ASUSL3000D, "ASUS_L3X00" 588 }, 589 { SIS_650, "1.10.9k", "", 590 0, 591 { 0, 0, 0, 0, 0 }, 592 { 0, 0, 0, 0, 0 }, 593 0x1025, 0x0028, 594 "Acer", "Aspire 1700", CUT_ACER1280, "ACER_ASPIRE1700" 595 }, 596 { SIS_650, "1.10.7w", "", 597 0, 598 { 0, 0, 0, 0, 0 }, 599 { 0, 0, 0, 0, 0 }, 600 0x14c0, 0x0012, 601 "Compal", "??? (V1)", CUT_COMPAL1400_1, "COMPAL_1400_1" 602 }, 603 { SIS_650, "1.10.7x", "", 604 0, 605 { 0, 0, 0, 0, 0 }, 606 { 0, 0, 0, 0, 0 }, 607 0x14c0, 0x0012, 608 "Compal", "??? (V2)", CUT_COMPAL1400_2, "COMPAL_1400_2" 609 }, 610 { SIS_650, "1.10.8o", "", 611 0, /* For EMI (unknown) */ 612 { 0, 0, 0, 0, 0 }, 613 { 0, 0, 0, 0, 0 }, 614 0x1043, 0x1612, 615 "Asus", "A2H (V1)", CUT_ASUSA2H_1, "ASUS_A2H_1" 616 }, 617 { SIS_650, "1.10.8q", "", 618 0, /* For EMI */ 619 { 0, 0, 0, 0, 0 }, 620 { 0, 0, 0, 0, 0 }, 621 0x1043, 0x1612, 622 "Asus", "A2H (V2)", CUT_ASUSA2H_2, "ASUS_A2H_2" 623 }, 624 { 4321, "", "", /* never autodetected */ 625 0, 626 { 0, 0, 0, 0, 0 }, 627 { 0, 0, 0, 0, 0 }, 628 0, 0, 629 "Generic", "LVDS/Parallel 848x480", CUT_PANEL848, "PANEL848x480" 630 }, 631 { 0, "", "", 632 0, 633 { 0, 0, 0, 0 }, 634 { 0, 0, 0, 0 }, 635 0, 0, 636 "", "", CUT_NONE, "" 637 } 638 }; 639 640 static const struct _sis_TV_filter { 641 u8 filter[9][4]; 642 } sis_TV_filter[] = { 643 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_0 */ 644 {0x00,0xE0,0x10,0x60}, 645 {0x00,0xEE,0x10,0x44}, 646 {0x00,0xF4,0x10,0x38}, 647 {0xF8,0xF4,0x18,0x38}, 648 {0xFC,0xFB,0x14,0x2A}, 649 {0x00,0x00,0x10,0x20}, 650 {0x00,0x04,0x10,0x18}, 651 {0xFF,0xFF,0xFF,0xFF} }}, 652 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_1 */ 653 {0x00,0xE0,0x10,0x60}, 654 {0x00,0xEE,0x10,0x44}, 655 {0x00,0xF4,0x10,0x38}, 656 {0xF8,0xF4,0x18,0x38}, 657 {0xFC,0xFB,0x14,0x2A}, 658 {0x00,0x00,0x10,0x20}, 659 {0x00,0x04,0x10,0x18}, 660 {0xFF,0xFF,0xFF,0xFF} }}, 661 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_2 */ 662 {0xF5,0xEE,0x1B,0x44}, 663 {0xF8,0xF4,0x18,0x38}, 664 {0xEB,0x04,0x25,0x18}, 665 {0xF1,0x05,0x1F,0x16}, 666 {0xF6,0x06,0x1A,0x14}, 667 {0xFA,0x06,0x16,0x14}, 668 {0x00,0x04,0x10,0x18}, 669 {0xFF,0xFF,0xFF,0xFF} }}, 670 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_3 */ 671 {0xF1,0x04,0x1F,0x18}, 672 {0xEE,0x0D,0x22,0x06}, 673 {0xF7,0x06,0x19,0x14}, 674 {0xF4,0x0B,0x1C,0x0A}, 675 {0xFA,0x07,0x16,0x12}, 676 {0xF9,0x0A,0x17,0x0C}, 677 {0x00,0x07,0x10,0x12}, 678 {0xFF,0xFF,0xFF,0xFF} }}, 679 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_4 - 320 */ 680 {0x00,0xE0,0x10,0x60}, 681 {0x00,0xEE,0x10,0x44}, 682 {0x00,0xF4,0x10,0x38}, 683 {0xF8,0xF4,0x18,0x38}, 684 {0xFC,0xFB,0x14,0x2A}, 685 {0x00,0x00,0x10,0x20}, 686 {0x00,0x04,0x10,0x18}, 687 {0xFF,0xFF,0xFF,0xFF} }}, 688 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_5 - 640 */ 689 {0xF5,0xEE,0x1B,0x44}, 690 {0xF8,0xF4,0x18,0x38}, 691 {0xEB,0x04,0x25,0x18}, 692 {0xF1,0x05,0x1F,0x16}, 693 {0xF6,0x06,0x1A,0x14}, 694 {0xFA,0x06,0x16,0x14}, 695 {0x00,0x04,0x10,0x18}, 696 {0xFF,0xFF,0xFF,0xFF} }}, 697 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_6 - 720 */ 698 {0xEB,0x04,0x25,0x18}, 699 {0xE7,0x0E,0x29,0x04}, 700 {0xEE,0x0C,0x22,0x08}, 701 {0xF6,0x0B,0x1A,0x0A}, 702 {0xF9,0x0A,0x17,0x0C}, 703 {0xFC,0x0A,0x14,0x0C}, 704 {0x00,0x08,0x10,0x10}, 705 {0xFF,0xFF,0xFF,0xFF} }}, 706 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_7 - 800 */ 707 {0xEC,0x02,0x24,0x1C}, 708 {0xF2,0x04,0x1E,0x18}, 709 {0xEB,0x15,0x25,0xF6}, 710 {0xF4,0x10,0x1C,0x00}, 711 {0xF8,0x0F,0x18,0x02}, 712 {0x00,0x04,0x10,0x18}, 713 {0x01,0x06,0x0F,0x14}, 714 {0xFF,0xFF,0xFF,0xFF} }}, 715 { {{0x00,0x00,0x00,0x40}, /* PALFilter_0 */ 716 {0x00,0xE0,0x10,0x60}, 717 {0x00,0xEE,0x10,0x44}, 718 {0x00,0xF4,0x10,0x38}, 719 {0xF8,0xF4,0x18,0x38}, 720 {0xFC,0xFB,0x14,0x2A}, 721 {0x00,0x00,0x10,0x20}, 722 {0x00,0x04,0x10,0x18}, 723 {0xFF,0xFF,0xFF,0xFF} }}, 724 { {{0x00,0x00,0x00,0x40}, /* PALFilter_1 */ 725 {0x00,0xE0,0x10,0x60}, 726 {0x00,0xEE,0x10,0x44}, 727 {0x00,0xF4,0x10,0x38}, 728 {0xF8,0xF4,0x18,0x38}, 729 {0xFC,0xFB,0x14,0x2A}, 730 {0x00,0x00,0x10,0x20}, 731 {0x00,0x04,0x10,0x18}, 732 {0xFF,0xFF,0xFF,0xFF} }}, 733 { {{0x00,0x00,0x00,0x40}, /* PALFilter_2 */ 734 {0xF5,0xEE,0x1B,0x44}, 735 {0xF8,0xF4,0x18,0x38}, 736 {0xF1,0xF7,0x01,0x32}, 737 {0xF5,0xFB,0x1B,0x2A}, 738 {0xF9,0xFF,0x17,0x22}, 739 {0xFB,0x01,0x15,0x1E}, 740 {0x00,0x04,0x10,0x18}, 741 {0xFF,0xFF,0xFF,0xFF} }}, 742 { {{0x00,0x00,0x00,0x40}, /* PALFilter_3 */ 743 {0xF5,0xFB,0x1B,0x2A}, 744 {0xEE,0xFE,0x22,0x24}, 745 {0xF3,0x00,0x1D,0x20}, 746 {0xF9,0x03,0x17,0x1A}, 747 {0xFB,0x02,0x14,0x1E}, 748 {0xFB,0x04,0x15,0x18}, 749 {0x00,0x06,0x10,0x14}, 750 {0xFF,0xFF,0xFF,0xFF} }}, 751 { {{0x00,0x00,0x00,0x40}, /* PALFilter_4 - 320 */ 752 {0x00,0xE0,0x10,0x60}, 753 {0x00,0xEE,0x10,0x44}, 754 {0x00,0xF4,0x10,0x38}, 755 {0xF8,0xF4,0x18,0x38}, 756 {0xFC,0xFB,0x14,0x2A}, 757 {0x00,0x00,0x10,0x20}, 758 {0x00,0x04,0x10,0x18}, 759 {0xFF,0xFF,0xFF,0xFF} }}, 760 { {{0x00,0x00,0x00,0x40}, /* PALFilter_5 - 640 */ 761 {0xF5,0xEE,0x1B,0x44}, 762 {0xF8,0xF4,0x18,0x38}, 763 {0xF1,0xF7,0x1F,0x32}, 764 {0xF5,0xFB,0x1B,0x2A}, 765 {0xF9,0xFF,0x17,0x22}, 766 {0xFB,0x01,0x15,0x1E}, 767 {0x00,0x04,0x10,0x18}, 768 {0xFF,0xFF,0xFF,0xFF} }}, 769 { {{0x00,0x00,0x00,0x40}, /* PALFilter_6 - 720 */ 770 {0xF5,0xEE,0x1B,0x2A}, 771 {0xEE,0xFE,0x22,0x24}, 772 {0xF3,0x00,0x1D,0x20}, 773 {0xF9,0x03,0x17,0x1A}, 774 {0xFB,0x02,0x14,0x1E}, 775 {0xFB,0x04,0x15,0x18}, 776 {0x00,0x06,0x10,0x14}, 777 {0xFF,0xFF,0xFF,0xFF} }}, 778 { {{0x00,0x00,0x00,0x40}, /* PALFilter_7 - 800 */ 779 {0xF5,0xEE,0x1B,0x44}, 780 {0xF8,0xF4,0x18,0x38}, 781 {0xFC,0xFB,0x14,0x2A}, 782 {0xEB,0x05,0x25,0x16}, 783 {0xF1,0x05,0x1F,0x16}, 784 {0xFA,0x07,0x16,0x12}, 785 {0x00,0x07,0x10,0x12}, 786 {0xFF,0xFF,0xFF,0xFF} }} 787 }; 788 789 /* ---------------------- Prototypes ------------------------- */ 790 791 /* Interface used by the world */ 792 #ifndef MODULE 793 int sisfb_setup(char *options); 794 #endif 795 796 /* Interface to the low level console driver */ 797 int sisfb_init(void); 798 799 800 /* fbdev routines */ 801 static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, 802 struct fb_info *info); 803 804 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 805 static int sisfb_get_fix(struct fb_fix_screeninfo *fix, 806 int con, 807 struct fb_info *info); 808 static int sisfb_get_var(struct fb_var_screeninfo *var, 809 int con, 810 struct fb_info *info); 811 static int sisfb_set_var(struct fb_var_screeninfo *var, 812 int con, 813 struct fb_info *info); 814 static void sisfb_crtc_to_var(struct sis_video_info *ivideo, 815 struct fb_var_screeninfo *var); 816 static int sisfb_get_cmap(struct fb_cmap *cmap, 817 int kspc, 818 int con, 819 struct fb_info *info); 820 static int sisfb_set_cmap(struct fb_cmap *cmap, 821 int kspc, 822 int con, 823 struct fb_info *info); 824 static int sisfb_update_var(int con, 825 struct fb_info *info); 826 static int sisfb_switch(int con, 827 struct fb_info *info); 828 static void sisfb_blank(int blank, 829 struct fb_info *info); 830 static void sisfb_set_disp(int con, 831 struct fb_var_screeninfo *var, 832 struct fb_info *info); 833 static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green, 834 unsigned *blue, unsigned *transp, 835 struct fb_info *fb_info); 836 static void sisfb_do_install_cmap(int con, 837 struct fb_info *info); 838 static int sisfb_ioctl(struct inode *inode, struct file *file, 839 unsigned int cmd, unsigned long arg, int con, 840 struct fb_info *info); 841 #endif 842 843 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) 844 static int sisfb_ioctl(struct inode *inode, struct file *file, 845 unsigned int cmd, unsigned long arg, 846 struct fb_info *info); 847 static int sisfb_set_par(struct fb_info *info); 848 static int sisfb_blank(int blank, 849 struct fb_info *info); 850 extern void fbcon_sis_fillrect(struct fb_info *info, 851 const struct fb_fillrect *rect); 852 extern void fbcon_sis_copyarea(struct fb_info *info, 853 const struct fb_copyarea *area); 854 extern int fbcon_sis_sync(struct fb_info *info); 855 #endif 856 857 /* Internal 2D accelerator functions */ 858 extern int sisfb_initaccel(struct sis_video_info *ivideo); 859 extern void sisfb_syncaccel(struct sis_video_info *ivideo); 860 861 /* Internal general routines */ 862 static void sisfb_search_mode(char *name, BOOLEAN quiet); 863 static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags); 864 static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate, 865 int index); 866 static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, 867 unsigned blue, unsigned transp, 868 struct fb_info *fb_info); 869 static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, 870 struct fb_info *info); 871 static void sisfb_pre_setmode(struct sis_video_info *ivideo); 872 static void sisfb_post_setmode(struct sis_video_info *ivideo); 873 static char * sis_find_rom(struct pci_dev *pdev); 874 static BOOLEAN sisfb_CheckVBRetrace(struct sis_video_info *ivideo); 875 static BOOLEAN sisfbcheckvretracecrt2(struct sis_video_info *ivideo); 876 static BOOLEAN sisfbcheckvretracecrt1(struct sis_video_info *ivideo); 877 static BOOLEAN sisfb_bridgeisslave(struct sis_video_info *ivideo); 878 static void sisfb_detect_VB_connect(struct sis_video_info *ivideo); 879 static void sisfb_get_VB_type(struct sis_video_info *ivideo); 880 static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val); 881 static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val); 882 883 /* SiS-specific exported functions */ 884 void sis_malloc(struct sis_memreq *req); 885 void sis_free(u32 base); 886 887 /* Internal heap routines */ 888 static int sisfb_heap_init(struct sis_video_info *ivideo); 889 static SIS_OH *sisfb_poh_new_node(void); 890 static SIS_OH *sisfb_poh_allocate(u32 size); 891 static void sisfb_delete_node(SIS_OH *poh); 892 static void sisfb_insert_node(SIS_OH *pohList, SIS_OH *poh); 893 static SIS_OH *sisfb_poh_free(u32 base); 894 static void sisfb_free_node(SIS_OH *poh); 895 896 /* Sensing routines */ 897 static void SiS_Sense30x(struct sis_video_info *ivideo); 898 static void SiS_SenseCh(struct sis_video_info *ivideo); 899 900 /* Routines from init.c/init301.c */ 901 extern USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN); 902 extern USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, 903 BOOLEAN FSTN, USHORT CustomT, int LCDwith, int LCDheight); 904 extern USHORT SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); 905 extern USHORT SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); 906 907 extern void SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); 908 extern BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo, USHORT ModeNo); 909 extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable); 910 extern void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable); 911 912 extern BOOLEAN SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); 913 914 extern BOOLEAN sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, 915 unsigned char modeno, int *htotal, int *vtotal, unsigned char rateindex); 916 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) 917 extern int sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, 918 PSIS_HW_INFO HwDeviceExtension, 919 unsigned char modeno, unsigned char rateindex); 920 extern int sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, 921 unsigned char modeno, unsigned char rateindex, 922 struct fb_var_screeninfo *var); 923 #endif 924 925 /* Chrontel TV, DDC and DPMS functions */ 926 extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx); 927 extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx); 928 extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); 929 extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); 930 extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh); 931 extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime); 932 extern void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo); 933 extern USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, ULONG VBFlags, int VGAEngine, 934 USHORT adaptnum, USHORT DDCdatatype, unsigned char *buffer); 935 extern USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr); 936 extern void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo); 937 extern void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr); 938 extern void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo); 939 extern void SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo); 940 #endif 941 942 943