sis_main.h 38 KB

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