viamode.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. /*
  2. * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
  3. * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public
  6. * License as published by the Free Software Foundation;
  7. * either version 2, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
  10. * the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. * A PARTICULAR PURPOSE.See the GNU General Public License
  12. * for more details.
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc.,
  16. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include <linux/via-core.h>
  19. #include "global.h"
  20. struct io_reg CN400_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
  21. {VIASR, SR15, 0x02, 0x02},
  22. {VIASR, SR16, 0xBF, 0x08},
  23. {VIASR, SR17, 0xFF, 0x1F},
  24. {VIASR, SR18, 0xFF, 0x4E},
  25. {VIASR, SR1A, 0xFB, 0x08},
  26. {VIASR, SR1E, 0x0F, 0x01},
  27. {VIASR, SR2A, 0xFF, 0x00},
  28. {VIACR, CR32, 0xFF, 0x00},
  29. {VIACR, CR33, 0xFF, 0x00},
  30. {VIACR, CR35, 0xFF, 0x00},
  31. {VIACR, CR36, 0x08, 0x00},
  32. {VIACR, CR69, 0xFF, 0x00},
  33. {VIACR, CR6A, 0xFF, 0x40},
  34. {VIACR, CR6B, 0xFF, 0x00},
  35. {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
  36. {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
  37. {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
  38. {VIACR, CR8B, 0xFF, 0x69}, /* LCD Power Sequence Control 0 */
  39. {VIACR, CR8C, 0xFF, 0x57}, /* LCD Power Sequence Control 1 */
  40. {VIACR, CR8D, 0xFF, 0x00}, /* LCD Power Sequence Control 2 */
  41. {VIACR, CR8E, 0xFF, 0x7B}, /* LCD Power Sequence Control 3 */
  42. {VIACR, CR8F, 0xFF, 0x03}, /* LCD Power Sequence Control 4 */
  43. {VIACR, CR90, 0xFF, 0x30}, /* LCD Power Sequence Control 5 */
  44. {VIACR, CR91, 0xFF, 0xA0}, /* 24/12 bit LVDS Data off */
  45. {VIACR, CR96, 0xFF, 0x00},
  46. {VIACR, CR97, 0xFF, 0x00},
  47. {VIACR, CR99, 0xFF, 0x00},
  48. {VIACR, CR9B, 0xFF, 0x00}
  49. };
  50. /* Video Mode Table for VT3314 chipset*/
  51. /* Common Setting for Video Mode */
  52. struct io_reg CN700_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
  53. {VIASR, SR15, 0x02, 0x02},
  54. {VIASR, SR16, 0xBF, 0x08},
  55. {VIASR, SR17, 0xFF, 0x1F},
  56. {VIASR, SR18, 0xFF, 0x4E},
  57. {VIASR, SR1A, 0xFB, 0x82},
  58. {VIASR, SR1B, 0xFF, 0xF0},
  59. {VIASR, SR1F, 0xFF, 0x00},
  60. {VIASR, SR1E, 0xFF, 0x01},
  61. {VIASR, SR22, 0xFF, 0x1F},
  62. {VIASR, SR2A, 0x0F, 0x00},
  63. {VIASR, SR2E, 0xFF, 0xFF},
  64. {VIASR, SR3F, 0xFF, 0xFF},
  65. {VIASR, SR40, 0xF7, 0x00},
  66. {VIASR, CR30, 0xFF, 0x04},
  67. {VIACR, CR32, 0xFF, 0x00},
  68. {VIACR, CR33, 0x7F, 0x00},
  69. {VIACR, CR35, 0xFF, 0x00},
  70. {VIACR, CR36, 0xFF, 0x31},
  71. {VIACR, CR41, 0xFF, 0x80},
  72. {VIACR, CR42, 0xFF, 0x00},
  73. {VIACR, CR55, 0x80, 0x00},
  74. {VIACR, CR5D, 0x80, 0x00}, /*Horizontal Retrace Start bit[11] should be 0*/
  75. {VIACR, CR68, 0xFF, 0x67}, /* Default FIFO For IGA2 */
  76. {VIACR, CR69, 0xFF, 0x00},
  77. {VIACR, CR6A, 0xFD, 0x40},
  78. {VIACR, CR6B, 0xFF, 0x00},
  79. {VIACR, CR77, 0xFF, 0x00}, /* LCD scaling Factor */
  80. {VIACR, CR78, 0xFF, 0x00}, /* LCD scaling Factor */
  81. {VIACR, CR79, 0xFF, 0x00}, /* LCD scaling Factor */
  82. {VIACR, CR9F, 0x03, 0x00}, /* LCD scaling Factor */
  83. {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
  84. {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
  85. {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
  86. {VIACR, CR8B, 0xFF, 0x5D}, /* LCD Power Sequence Control 0 */
  87. {VIACR, CR8C, 0xFF, 0x2B}, /* LCD Power Sequence Control 1 */
  88. {VIACR, CR8D, 0xFF, 0x6F}, /* LCD Power Sequence Control 2 */
  89. {VIACR, CR8E, 0xFF, 0x2B}, /* LCD Power Sequence Control 3 */
  90. {VIACR, CR8F, 0xFF, 0x01}, /* LCD Power Sequence Control 4 */
  91. {VIACR, CR90, 0xFF, 0x01}, /* LCD Power Sequence Control 5 */
  92. {VIACR, CR91, 0xFF, 0xA0}, /* 24/12 bit LVDS Data off */
  93. {VIACR, CR96, 0xFF, 0x00},
  94. {VIACR, CR97, 0xFF, 0x00},
  95. {VIACR, CR99, 0xFF, 0x00},
  96. {VIACR, CR9B, 0xFF, 0x00},
  97. {VIACR, CR9D, 0xFF, 0x80},
  98. {VIACR, CR9E, 0xFF, 0x80}
  99. };
  100. struct io_reg KM400_ModeXregs[] = {
  101. {VIASR, SR10, 0xFF, 0x01}, /* Unlock Register */
  102. {VIASR, SR16, 0xFF, 0x08}, /* Display FIFO threshold Control */
  103. {VIASR, SR17, 0xFF, 0x1F}, /* Display FIFO Control */
  104. {VIASR, SR18, 0xFF, 0x4E}, /* GFX PREQ threshold */
  105. {VIASR, SR1A, 0xFF, 0x0a}, /* GFX PREQ threshold */
  106. {VIASR, SR1F, 0xFF, 0x00}, /* Memory Control 0 */
  107. {VIASR, SR1B, 0xFF, 0xF0}, /* Power Management Control 0 */
  108. {VIASR, SR1E, 0xFF, 0x01}, /* Power Management Control */
  109. {VIASR, SR20, 0xFF, 0x00}, /* Sequencer Arbiter Control 0 */
  110. {VIASR, SR21, 0xFF, 0x00}, /* Sequencer Arbiter Control 1 */
  111. {VIASR, SR22, 0xFF, 0x1F}, /* Display Arbiter Control 1 */
  112. {VIASR, SR2A, 0xFF, 0x00}, /* Power Management Control 5 */
  113. {VIASR, SR2D, 0xFF, 0xFF}, /* Power Management Control 1 */
  114. {VIASR, SR2E, 0xFF, 0xFF}, /* Power Management Control 2 */
  115. {VIACR, CR33, 0xFF, 0x00},
  116. {VIACR, CR55, 0x80, 0x00},
  117. {VIACR, CR5D, 0x80, 0x00},
  118. {VIACR, CR36, 0xFF, 0x01}, /* Power Mangement 3 */
  119. {VIACR, CR68, 0xFF, 0x67}, /* Default FIFO For IGA2 */
  120. {VIACR, CR6A, 0x20, 0x20}, /* Extended FIFO On */
  121. {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
  122. {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
  123. {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
  124. {VIACR, CR8B, 0xFF, 0x2D}, /* LCD Power Sequence Control 0 */
  125. {VIACR, CR8C, 0xFF, 0x2D}, /* LCD Power Sequence Control 1 */
  126. {VIACR, CR8D, 0xFF, 0xC8}, /* LCD Power Sequence Control 2 */
  127. {VIACR, CR8E, 0xFF, 0x36}, /* LCD Power Sequence Control 3 */
  128. {VIACR, CR8F, 0xFF, 0x00}, /* LCD Power Sequence Control 4 */
  129. {VIACR, CR90, 0xFF, 0x10}, /* LCD Power Sequence Control 5 */
  130. {VIACR, CR91, 0xFF, 0xA0}, /* 24/12 bit LVDS Data off */
  131. {VIACR, CR96, 0xFF, 0x03}, /* DVP0 ; DVP0 Clock Skew */
  132. {VIACR, CR97, 0xFF, 0x03}, /* DFP high ; DFPH Clock Skew */
  133. {VIACR, CR99, 0xFF, 0x03}, /* DFP low ; DFPL Clock Skew*/
  134. {VIACR, CR9B, 0xFF, 0x07} /* DVI on DVP1 ; DVP1 Clock Skew*/
  135. };
  136. /* For VT3324: Common Setting for Video Mode */
  137. struct io_reg CX700_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
  138. {VIASR, SR15, 0x02, 0x02},
  139. {VIASR, SR16, 0xBF, 0x08},
  140. {VIASR, SR17, 0xFF, 0x1F},
  141. {VIASR, SR18, 0xFF, 0x4E},
  142. {VIASR, SR1A, 0xFB, 0x08},
  143. {VIASR, SR1B, 0xFF, 0xF0},
  144. {VIASR, SR1E, 0xFF, 0x01},
  145. {VIASR, SR2A, 0xFF, 0x00},
  146. {VIASR, SR2D, 0xC0, 0xC0}, /* delayed E3_ECK */
  147. {VIACR, CR32, 0xFF, 0x00},
  148. {VIACR, CR33, 0xFF, 0x00},
  149. {VIACR, CR35, 0xFF, 0x00},
  150. {VIACR, CR36, 0x08, 0x00},
  151. {VIACR, CR47, 0xC8, 0x00}, /* Clear VCK Plus. */
  152. {VIACR, CR69, 0xFF, 0x00},
  153. {VIACR, CR6A, 0xFF, 0x40},
  154. {VIACR, CR6B, 0xFF, 0x00},
  155. {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
  156. {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
  157. {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
  158. {VIACR, CRD4, 0xFF, 0x81}, /* Second power sequence control */
  159. {VIACR, CR8B, 0xFF, 0x5D}, /* LCD Power Sequence Control 0 */
  160. {VIACR, CR8C, 0xFF, 0x2B}, /* LCD Power Sequence Control 1 */
  161. {VIACR, CR8D, 0xFF, 0x6F}, /* LCD Power Sequence Control 2 */
  162. {VIACR, CR8E, 0xFF, 0x2B}, /* LCD Power Sequence Control 3 */
  163. {VIACR, CR8F, 0xFF, 0x01}, /* LCD Power Sequence Control 4 */
  164. {VIACR, CR90, 0xFF, 0x01}, /* LCD Power Sequence Control 5 */
  165. {VIACR, CR91, 0xFF, 0x80}, /* 24/12 bit LVDS Data off */
  166. {VIACR, CR96, 0xFF, 0x00},
  167. {VIACR, CR97, 0xFF, 0x00},
  168. {VIACR, CR99, 0xFF, 0x00},
  169. {VIACR, CR9B, 0xFF, 0x00}
  170. };
  171. struct io_reg VX855_ModeXregs[] = {
  172. {VIASR, SR10, 0xFF, 0x01},
  173. {VIASR, SR15, 0x02, 0x02},
  174. {VIASR, SR16, 0xBF, 0x08},
  175. {VIASR, SR17, 0xFF, 0x1F},
  176. {VIASR, SR18, 0xFF, 0x4E},
  177. {VIASR, SR1A, 0xFB, 0x08},
  178. {VIASR, SR1B, 0xFF, 0xF0},
  179. {VIASR, SR1E, 0x07, 0x01},
  180. {VIASR, SR2A, 0xF0, 0x00},
  181. {VIASR, SR58, 0xFF, 0x00},
  182. {VIASR, SR59, 0xFF, 0x00},
  183. {VIASR, SR2D, 0xC0, 0xC0}, /* delayed E3_ECK */
  184. {VIACR, CR32, 0xFF, 0x00},
  185. {VIACR, CR33, 0x7F, 0x00},
  186. {VIACR, CR35, 0xFF, 0x00},
  187. {VIACR, CR36, 0x08, 0x00},
  188. {VIACR, CR69, 0xFF, 0x00},
  189. {VIACR, CR6A, 0xFD, 0x60},
  190. {VIACR, CR6B, 0xFF, 0x00},
  191. {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
  192. {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
  193. {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
  194. {VIACR, CRD4, 0xFF, 0x81}, /* Second power sequence control */
  195. {VIACR, CR91, 0xFF, 0x80}, /* 24/12 bit LVDS Data off */
  196. {VIACR, CR96, 0xFF, 0x00},
  197. {VIACR, CR97, 0xFF, 0x00},
  198. {VIACR, CR99, 0xFF, 0x00},
  199. {VIACR, CR9B, 0xFF, 0x00},
  200. {VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */
  201. };
  202. /* Video Mode Table */
  203. /* Common Setting for Video Mode */
  204. struct io_reg CLE266_ModeXregs[] = { {VIASR, SR1E, 0xF0, 0x00},
  205. {VIASR, SR2A, 0x0F, 0x00},
  206. {VIASR, SR15, 0x02, 0x02},
  207. {VIASR, SR16, 0xBF, 0x08},
  208. {VIASR, SR17, 0xFF, 0x1F},
  209. {VIASR, SR18, 0xFF, 0x4E},
  210. {VIASR, SR1A, 0xFB, 0x08},
  211. {VIACR, CR32, 0xFF, 0x00},
  212. {VIACR, CR35, 0xFF, 0x00},
  213. {VIACR, CR36, 0x08, 0x00},
  214. {VIACR, CR6A, 0xFF, 0x80},
  215. {VIACR, CR6A, 0xFF, 0xC0},
  216. {VIACR, CR55, 0x80, 0x00},
  217. {VIACR, CR5D, 0x80, 0x00},
  218. {VIAGR, GR20, 0xFF, 0x00},
  219. {VIAGR, GR21, 0xFF, 0x00},
  220. {VIAGR, GR22, 0xFF, 0x00},
  221. };
  222. /* Mode:1024X768 */
  223. struct io_reg PM1024x768[] = { {VIASR, 0x16, 0xBF, 0x0C},
  224. {VIASR, 0x18, 0xFF, 0x4C}
  225. };
  226. struct patch_table res_patch_table[] = {
  227. {ARRAY_SIZE(PM1024x768), PM1024x768}
  228. };
  229. /* struct VPITTable {
  230. unsigned char Misc;
  231. unsigned char SR[StdSR];
  232. unsigned char CR[StdCR];
  233. unsigned char GR[StdGR];
  234. unsigned char AR[StdAR];
  235. };*/
  236. struct VPITTable VPIT = {
  237. /* Msic */
  238. 0xC7,
  239. /* Sequencer */
  240. {0x01, 0x0F, 0x00, 0x0E},
  241. /* Graphic Controller */
  242. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0F, 0xFF},
  243. /* Attribute Controller */
  244. {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  245. 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
  246. 0x01, 0x00, 0x0F, 0x00}
  247. };
  248. /********************/
  249. /* Mode Table */
  250. /********************/
  251. /* 480x640 */
  252. static struct crt_mode_table CRTM480x640[] = {
  253. /* r_rate, hsp, vsp */
  254. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  255. {REFRESH_60, M480X640_R60_HSP, M480X640_R60_VSP,
  256. {624, 480, 480, 144, 504, 48, 663, 640, 640, 23, 641, 3} } /* GTF*/
  257. };
  258. /* 640x480*/
  259. static struct crt_mode_table CRTM640x480[] = {
  260. /*r_rate,hsp,vsp */
  261. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  262. {REFRESH_60, M640X480_R60_HSP, M640X480_R60_VSP,
  263. {800, 640, 648, 144, 656, 96, 525, 480, 480, 45, 490, 2} },
  264. {REFRESH_75, M640X480_R75_HSP, M640X480_R75_VSP,
  265. {840, 640, 640, 200, 656, 64, 500, 480, 480, 20, 481, 3} },
  266. {REFRESH_85, M640X480_R85_HSP, M640X480_R85_VSP,
  267. {832, 640, 640, 192, 696, 56, 509, 480, 480, 29, 481, 3} },
  268. {REFRESH_100, M640X480_R100_HSP, M640X480_R100_VSP,
  269. {848, 640, 640, 208, 680, 64, 509, 480, 480, 29, 481, 3} }, /*GTF*/
  270. {REFRESH_120, M640X480_R120_HSP, M640X480_R120_VSP,
  271. {848, 640, 640, 208, 680, 64, 515, 480, 480, 35, 481, 3} } /*GTF*/
  272. };
  273. /*720x480 (GTF)*/
  274. static struct crt_mode_table CRTM720x480[] = {
  275. /*r_rate,hsp,vsp */
  276. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  277. {REFRESH_60, M720X480_R60_HSP, M720X480_R60_VSP,
  278. {896, 720, 720, 176, 736, 72, 497, 480, 480, 17, 481, 3} }
  279. };
  280. /*720x576 (GTF)*/
  281. static struct crt_mode_table CRTM720x576[] = {
  282. /*r_rate,hsp,vsp */
  283. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  284. {REFRESH_60, M720X576_R60_HSP, M720X576_R60_VSP,
  285. {912, 720, 720, 192, 744, 72, 597, 576, 576, 21, 577, 3} }
  286. };
  287. /* 800x480 (CVT) */
  288. static struct crt_mode_table CRTM800x480[] = {
  289. /* r_rate, hsp, vsp */
  290. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  291. {REFRESH_60, M800X480_R60_HSP, M800X480_R60_VSP,
  292. {992, 800, 800, 192, 824, 72, 500, 480, 480, 20, 483, 7} }
  293. };
  294. /* 800x600*/
  295. static struct crt_mode_table CRTM800x600[] = {
  296. /*r_rate,hsp,vsp */
  297. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  298. {REFRESH_60, M800X600_R60_HSP, M800X600_R60_VSP,
  299. {1056, 800, 800, 256, 840, 128, 628, 600, 600, 28, 601, 4} },
  300. {REFRESH_75, M800X600_R75_HSP, M800X600_R75_VSP,
  301. {1056, 800, 800, 256, 816, 80, 625, 600, 600, 25, 601, 3} },
  302. {REFRESH_85, M800X600_R85_HSP, M800X600_R85_VSP,
  303. {1048, 800, 800, 248, 832, 64, 631, 600, 600, 31, 601, 3} },
  304. {REFRESH_100, M800X600_R100_HSP, M800X600_R100_VSP,
  305. {1072, 800, 800, 272, 848, 88, 636, 600, 600, 36, 601, 3} },
  306. {REFRESH_120, M800X600_R120_HSP, M800X600_R120_VSP,
  307. {1088, 800, 800, 288, 856, 88, 643, 600, 600, 43, 601, 3} }
  308. };
  309. /* 848x480 (CVT) */
  310. static struct crt_mode_table CRTM848x480[] = {
  311. /* r_rate, hsp, vsp */
  312. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  313. {REFRESH_60, M848X480_R60_HSP, M848X480_R60_VSP,
  314. {1056, 848, 848, 208, 872, 80, 500, 480, 480, 20, 483, 5} }
  315. };
  316. /*856x480 (GTF) convert to 852x480*/
  317. static struct crt_mode_table CRTM852x480[] = {
  318. /*r_rate,hsp,vsp */
  319. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  320. {REFRESH_60, M852X480_R60_HSP, M852X480_R60_VSP,
  321. {1064, 856, 856, 208, 872, 88, 497, 480, 480, 17, 481, 3} }
  322. };
  323. /*1024x512 (GTF)*/
  324. static struct crt_mode_table CRTM1024x512[] = {
  325. /*r_rate,hsp,vsp */
  326. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  327. {REFRESH_60, M1024X512_R60_HSP, M1024X512_R60_VSP,
  328. {1296, 1024, 1024, 272, 1056, 104, 531, 512, 512, 19, 513, 3} }
  329. };
  330. /* 1024x600*/
  331. static struct crt_mode_table CRTM1024x600[] = {
  332. /*r_rate,hsp,vsp */
  333. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  334. {REFRESH_60, M1024X600_R60_HSP, M1024X600_R60_VSP,
  335. {1312, 1024, 1024, 288, 1064, 104, 622, 600, 600, 22, 601, 3} },
  336. };
  337. /* 1024x768*/
  338. static struct crt_mode_table CRTM1024x768[] = {
  339. /*r_rate,hsp,vsp */
  340. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  341. {REFRESH_60, M1024X768_R60_HSP, M1024X768_R60_VSP,
  342. {1344, 1024, 1024, 320, 1048, 136, 806, 768, 768, 38, 771, 6} },
  343. {REFRESH_75, M1024X768_R75_HSP, M1024X768_R75_VSP,
  344. {1312, 1024, 1024, 288, 1040, 96, 800, 768, 768, 32, 769, 3} },
  345. {REFRESH_85, M1024X768_R85_HSP, M1024X768_R85_VSP,
  346. {1376, 1024, 1024, 352, 1072, 96, 808, 768, 768, 40, 769, 3} },
  347. {REFRESH_100, M1024X768_R100_HSP, M1024X768_R100_VSP,
  348. {1392, 1024, 1024, 368, 1096, 112, 814, 768, 768, 46, 769, 3} }
  349. };
  350. /* 1152x864*/
  351. static struct crt_mode_table CRTM1152x864[] = {
  352. /*r_rate,hsp,vsp */
  353. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  354. {REFRESH_75, M1152X864_R75_HSP, M1152X864_R75_VSP,
  355. {1600, 1152, 1152, 448, 1216, 128, 900, 864, 864, 36, 865, 3} }
  356. };
  357. /* 1280x720 (HDMI 720P)*/
  358. static struct crt_mode_table CRTM1280x720[] = {
  359. /*r_rate,hsp,vsp */
  360. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  361. {REFRESH_60, M1280X720_R60_HSP, M1280X720_R60_VSP,
  362. {1648, 1280, 1280, 368, 1392, 40, 750, 720, 720, 30, 725, 5} },
  363. {REFRESH_50, M1280X720_R50_HSP, M1280X720_R50_VSP,
  364. {1632, 1280, 1280, 352, 1328, 128, 741, 720, 720, 21, 721, 3} }
  365. };
  366. /*1280x768 (GTF)*/
  367. static struct crt_mode_table CRTM1280x768[] = {
  368. /*r_rate,hsp,vsp */
  369. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  370. {REFRESH_60, M1280X768_R60_HSP, M1280X768_R60_VSP,
  371. {1680, 1280, 1280, 400, 1344, 136, 795, 768, 768, 27, 769, 3} },
  372. {REFRESH_50, M1280X768_R50_HSP, M1280X768_R50_VSP,
  373. {1648, 1280, 1280, 368, 1336, 128, 791, 768, 768, 23, 769, 3} }
  374. };
  375. /* 1280x800 (CVT) */
  376. static struct crt_mode_table CRTM1280x800[] = {
  377. /* r_rate, hsp, vsp */
  378. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  379. {REFRESH_60, M1280X800_R60_HSP, M1280X800_R60_VSP,
  380. {1680, 1280, 1280, 400, 1352, 128, 831, 800, 800, 31, 803, 6} }
  381. };
  382. /*1280x960*/
  383. static struct crt_mode_table CRTM1280x960[] = {
  384. /*r_rate,hsp,vsp */
  385. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  386. {REFRESH_60, M1280X960_R60_HSP, M1280X960_R60_VSP,
  387. {1800, 1280, 1280, 520, 1376, 112, 1000, 960, 960, 40, 961, 3} }
  388. };
  389. /* 1280x1024*/
  390. static struct crt_mode_table CRTM1280x1024[] = {
  391. /*r_rate,hsp,vsp */
  392. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  393. {REFRESH_60, M1280X1024_R60_HSP, M1280X1024_R60_VSP,
  394. {1688, 1280, 1280, 408, 1328, 112, 1066, 1024, 1024, 42, 1025,
  395. 3} },
  396. {REFRESH_75, M1280X1024_R75_HSP, M1280X1024_R75_VSP,
  397. {1688, 1280, 1280, 408, 1296, 144, 1066, 1024, 1024, 42, 1025,
  398. 3} },
  399. {REFRESH_85, M1280X1024_R85_HSP, M1280X1024_R85_VSP,
  400. {1728, 1280, 1280, 448, 1344, 160, 1072, 1024, 1024, 48, 1025, 3} }
  401. };
  402. /* 1368x768 (GTF) */
  403. static struct crt_mode_table CRTM1368x768[] = {
  404. /* r_rate, hsp, vsp */
  405. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  406. {REFRESH_60, M1368X768_R60_HSP, M1368X768_R60_VSP,
  407. {1800, 1368, 1368, 432, 1440, 144, 795, 768, 768, 27, 769, 3} }
  408. };
  409. /*1440x1050 (GTF)*/
  410. static struct crt_mode_table CRTM1440x1050[] = {
  411. /*r_rate,hsp,vsp */
  412. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  413. {REFRESH_60, M1440X1050_R60_HSP, M1440X1050_R60_VSP,
  414. {1936, 1440, 1440, 496, 1536, 152, 1077, 1040, 1040, 37, 1041, 3} }
  415. };
  416. /* 1600x1200*/
  417. static struct crt_mode_table CRTM1600x1200[] = {
  418. /*r_rate,hsp,vsp */
  419. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  420. {REFRESH_60, M1600X1200_R60_HSP, M1600X1200_R60_VSP,
  421. {2160, 1600, 1600, 560, 1664, 192, 1250, 1200, 1200, 50, 1201,
  422. 3} },
  423. {REFRESH_75, M1600X1200_R75_HSP, M1600X1200_R75_VSP,
  424. {2160, 1600, 1600, 560, 1664, 192, 1250, 1200, 1200, 50, 1201, 3} }
  425. };
  426. /* 1680x1050 (CVT) */
  427. static struct crt_mode_table CRTM1680x1050[] = {
  428. /* r_rate, hsp, vsp */
  429. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  430. {REFRESH_60, M1680x1050_R60_HSP, M1680x1050_R60_VSP,
  431. {2240, 1680, 1680, 560, 1784, 176, 1089, 1050, 1050, 39, 1053,
  432. 6} },
  433. {REFRESH_75, M1680x1050_R75_HSP, M1680x1050_R75_VSP,
  434. {2272, 1680, 1680, 592, 1800, 176, 1099, 1050, 1050, 49, 1053, 6} }
  435. };
  436. /* 1680x1050 (CVT Reduce Blanking) */
  437. static struct crt_mode_table CRTM1680x1050_RB[] = {
  438. /* r_rate, hsp, vsp */
  439. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  440. {REFRESH_60, M1680x1050_RB_R60_HSP, M1680x1050_RB_R60_VSP,
  441. {1840, 1680, 1680, 160, 1728, 32, 1080, 1050, 1050, 30, 1053, 6} }
  442. };
  443. /* 1920x1080 (CVT)*/
  444. static struct crt_mode_table CRTM1920x1080[] = {
  445. /*r_rate,hsp,vsp */
  446. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  447. {REFRESH_60, M1920X1080_R60_HSP, M1920X1080_R60_VSP,
  448. {2576, 1920, 1920, 656, 2048, 200, 1120, 1080, 1080, 40, 1083, 5} }
  449. };
  450. /* 1920x1080 (CVT with Reduce Blanking) */
  451. static struct crt_mode_table CRTM1920x1080_RB[] = {
  452. /* r_rate, hsp, vsp */
  453. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  454. {REFRESH_60, M1920X1080_RB_R60_HSP, M1920X1080_RB_R60_VSP,
  455. {2080, 1920, 1920, 160, 1968, 32, 1111, 1080, 1080, 31, 1083, 5} }
  456. };
  457. /* 1920x1440*/
  458. static struct crt_mode_table CRTM1920x1440[] = {
  459. /*r_rate,hsp,vsp */
  460. /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  461. {REFRESH_60, M1920X1440_R60_HSP, M1920X1440_R60_VSP,
  462. {2600, 1920, 1920, 680, 2048, 208, 1500, 1440, 1440, 60, 1441,
  463. 3} },
  464. {REFRESH_75, M1920X1440_R75_HSP, M1920X1440_R75_VSP,
  465. {2640, 1920, 1920, 720, 2064, 224, 1500, 1440, 1440, 60, 1441, 3} }
  466. };
  467. /* 1400x1050 (CVT) */
  468. static struct crt_mode_table CRTM1400x1050[] = {
  469. /* r_rate, hsp, vsp */
  470. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  471. {REFRESH_60, M1400X1050_R60_HSP, M1400X1050_R60_VSP,
  472. {1864, 1400, 1400, 464, 1488, 144, 1089, 1050, 1050, 39, 1053,
  473. 4} },
  474. {REFRESH_75, M1400X1050_R75_HSP, M1400X1050_R75_VSP,
  475. {1896, 1400, 1400, 496, 1504, 144, 1099, 1050, 1050, 49, 1053, 4} }
  476. };
  477. /* 1400x1050 (CVT Reduce Blanking) */
  478. static struct crt_mode_table CRTM1400x1050_RB[] = {
  479. /* r_rate, hsp, vsp */
  480. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  481. {REFRESH_60, M1400X1050_RB_R60_HSP, M1400X1050_RB_R60_VSP,
  482. {1560, 1400, 1400, 160, 1448, 32, 1080, 1050, 1050, 30, 1053, 4} }
  483. };
  484. /* 960x600 (CVT) */
  485. static struct crt_mode_table CRTM960x600[] = {
  486. /* r_rate, hsp, vsp */
  487. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  488. {REFRESH_60, M960X600_R60_HSP, M960X600_R60_VSP,
  489. {1216, 960, 960, 256, 992, 96, 624, 600, 600, 24, 603, 6} }
  490. };
  491. /* 1000x600 (GTF) */
  492. static struct crt_mode_table CRTM1000x600[] = {
  493. /* r_rate, hsp, vsp */
  494. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  495. {REFRESH_60, M1000X600_R60_HSP, M1000X600_R60_VSP,
  496. {1288, 1000, 1000, 288, 1040, 104, 622, 600, 600, 22, 601, 3} }
  497. };
  498. /* 1024x576 (GTF) */
  499. static struct crt_mode_table CRTM1024x576[] = {
  500. /* r_rate, hsp, vsp */
  501. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  502. {REFRESH_60, M1024X576_R60_HSP, M1024X576_R60_VSP,
  503. {1312, 1024, 1024, 288, 1064, 104, 597, 576, 576, 21, 577, 3} }
  504. };
  505. /* 1088x612 (CVT) */
  506. static struct crt_mode_table CRTM1088x612[] = {
  507. /* r_rate, hsp, vsp */
  508. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  509. {REFRESH_60, M1088X612_R60_HSP, M1088X612_R60_VSP,
  510. {1392, 1088, 1088, 304, 1136, 104, 636, 612, 612, 24, 615, 5} }
  511. };
  512. /* 1152x720 (CVT) */
  513. static struct crt_mode_table CRTM1152x720[] = {
  514. /* r_rate, hsp, vsp */
  515. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  516. {REFRESH_60, M1152X720_R60_HSP, M1152X720_R60_VSP,
  517. {1488, 1152, 1152, 336, 1208, 112, 748, 720, 720, 28, 723, 6} }
  518. };
  519. /* 1200x720 (GTF) */
  520. static struct crt_mode_table CRTM1200x720[] = {
  521. /* r_rate, hsp, vsp */
  522. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  523. {REFRESH_60, M1200X720_R60_HSP, M1200X720_R60_VSP,
  524. {1568, 1200, 1200, 368, 1256, 128, 746, 720, 720, 26, 721, 3} }
  525. };
  526. /* 1200x900 (DCON) */
  527. static struct crt_mode_table DCON1200x900[] = {
  528. /* r_rate, hsp, vsp */
  529. {REFRESH_49, M1200X900_R60_HSP, M1200X900_R60_VSP,
  530. /* The correct htotal is 1240, but this doesn't raster on VX855. */
  531. /* Via suggested changing to a multiple of 16, hence 1264. */
  532. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  533. {1264, 1200, 1200, 64, 1211, 32, 912, 900, 900, 12, 901, 10} }
  534. };
  535. /* 1280x600 (GTF) */
  536. static struct crt_mode_table CRTM1280x600[] = {
  537. /* r_rate, hsp, vsp */
  538. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  539. {REFRESH_60, M1280x600_R60_HSP, M1280x600_R60_VSP,
  540. {1648, 1280, 1280, 368, 1336, 128, 622, 600, 600, 22, 601, 3} }
  541. };
  542. /* 1360x768 (CVT) */
  543. static struct crt_mode_table CRTM1360x768[] = {
  544. /* r_rate, hsp, vsp */
  545. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  546. {REFRESH_60, M1360X768_R60_HSP, M1360X768_R60_VSP,
  547. {1776, 1360, 1360, 416, 1432, 136, 798, 768, 768, 30, 771, 5} }
  548. };
  549. /* 1360x768 (CVT Reduce Blanking) */
  550. static struct crt_mode_table CRTM1360x768_RB[] = {
  551. /* r_rate, hsp, vsp */
  552. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  553. {REFRESH_60, M1360X768_RB_R60_HSP, M1360X768_RB_R60_VSP,
  554. {1520, 1360, 1360, 160, 1408, 32, 790, 768, 768, 22, 771, 5} }
  555. };
  556. /* 1366x768 (GTF) */
  557. static struct crt_mode_table CRTM1366x768[] = {
  558. /* r_rate, hsp, vsp */
  559. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  560. {REFRESH_60, M1368X768_R60_HSP, M1368X768_R60_VSP,
  561. {1800, 1368, 1368, 432, 1440, 144, 795, 768, 768, 27, 769, 3} },
  562. {REFRESH_50, M1368X768_R50_HSP, M1368X768_R50_VSP,
  563. {1768, 1368, 1368, 400, 1424, 144, 791, 768, 768, 23, 769, 3} }
  564. };
  565. /* 1440x900 (CVT) */
  566. static struct crt_mode_table CRTM1440x900[] = {
  567. /* r_rate, hsp, vsp */
  568. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  569. {REFRESH_60, M1440X900_R60_HSP, M1440X900_R60_VSP,
  570. {1904, 1440, 1440, 464, 1520, 152, 934, 900, 900, 34, 903, 6} },
  571. {REFRESH_75, M1440X900_R75_HSP, M1440X900_R75_VSP,
  572. {1936, 1440, 1440, 496, 1536, 152, 942, 900, 900, 42, 903, 6} }
  573. };
  574. /* 1440x900 (CVT Reduce Blanking) */
  575. static struct crt_mode_table CRTM1440x900_RB[] = {
  576. /* r_rate, hsp, vsp */
  577. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  578. {REFRESH_60, M1440X900_RB_R60_HSP, M1440X900_RB_R60_VSP,
  579. {1600, 1440, 1440, 160, 1488, 32, 926, 900, 900, 26, 903, 6} }
  580. };
  581. /* 1600x900 (CVT) */
  582. static struct crt_mode_table CRTM1600x900[] = {
  583. /* r_rate, hsp, vsp */
  584. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  585. {REFRESH_60, M1600X900_R60_HSP, M1600X900_R60_VSP,
  586. {2112, 1600, 1600, 512, 1688, 168, 934, 900, 900, 34, 903, 5} }
  587. };
  588. /* 1600x900 (CVT Reduce Blanking) */
  589. static struct crt_mode_table CRTM1600x900_RB[] = {
  590. /* r_rate, hsp, vsp */
  591. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  592. {REFRESH_60, M1600X900_RB_R60_HSP, M1600X900_RB_R60_VSP,
  593. {1760, 1600, 1600, 160, 1648, 32, 926, 900, 900, 26, 903, 5} }
  594. };
  595. /* 1600x1024 (GTF) */
  596. static struct crt_mode_table CRTM1600x1024[] = {
  597. /* r_rate, hsp, vsp */
  598. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  599. {REFRESH_60, M1600X1024_R60_HSP, M1600X1024_R60_VSP,
  600. {2144, 1600, 1600, 544, 1704, 168, 1060, 1024, 1024, 36, 1025, 3} }
  601. };
  602. /* 1792x1344 (DMT) */
  603. static struct crt_mode_table CRTM1792x1344[] = {
  604. /* r_rate, hsp, vsp */
  605. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  606. {REFRESH_60, M1792x1344_R60_HSP, M1792x1344_R60_VSP,
  607. {2448, 1792, 1792, 656, 1920, 200, 1394, 1344, 1344, 50, 1345, 3} }
  608. };
  609. /* 1856x1392 (DMT) */
  610. static struct crt_mode_table CRTM1856x1392[] = {
  611. /* r_rate, hsp, vsp */
  612. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  613. {REFRESH_60, M1856x1392_R60_HSP, M1856x1392_R60_VSP,
  614. {2528, 1856, 1856, 672, 1952, 224, 1439, 1392, 1392, 47, 1393, 3} }
  615. };
  616. /* 1920x1200 (CVT) */
  617. static struct crt_mode_table CRTM1920x1200[] = {
  618. /* r_rate, hsp, vsp */
  619. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  620. {REFRESH_60, M1920X1200_R60_HSP, M1920X1200_R60_VSP,
  621. {2592, 1920, 1920, 672, 2056, 200, 1245, 1200, 1200, 45, 1203, 6} }
  622. };
  623. /* 1920x1200 (CVT with Reduce Blanking) */
  624. static struct crt_mode_table CRTM1920x1200_RB[] = {
  625. /* r_rate, hsp, vsp */
  626. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  627. {REFRESH_60, M1920X1200_RB_R60_HSP, M1920X1200_RB_R60_VSP,
  628. {2080, 1920, 1920, 160, 1968, 32, 1235, 1200, 1200, 35, 1203, 6} }
  629. };
  630. /* 2048x1536 (CVT) */
  631. static struct crt_mode_table CRTM2048x1536[] = {
  632. /* r_rate, hsp, vsp */
  633. /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
  634. {REFRESH_60, M2048x1536_R60_HSP, M2048x1536_R60_VSP,
  635. {2800, 2048, 2048, 752, 2200, 224, 1592, 1536, 1536, 56, 1539, 4} }
  636. };
  637. static struct VideoModeTable viafb_modes[] = {
  638. /* Display : 480x640 (GTF) */
  639. {CRTM480x640, ARRAY_SIZE(CRTM480x640)},
  640. /* Display : 640x480 */
  641. {CRTM640x480, ARRAY_SIZE(CRTM640x480)},
  642. /* Display : 720x480 (GTF) */
  643. {CRTM720x480, ARRAY_SIZE(CRTM720x480)},
  644. /* Display : 720x576 (GTF) */
  645. {CRTM720x576, ARRAY_SIZE(CRTM720x576)},
  646. /* Display : 800x600 */
  647. {CRTM800x600, ARRAY_SIZE(CRTM800x600)},
  648. /* Display : 800x480 (CVT) */
  649. {CRTM800x480, ARRAY_SIZE(CRTM800x480)},
  650. /* Display : 848x480 (CVT) */
  651. {CRTM848x480, ARRAY_SIZE(CRTM848x480)},
  652. /* Display : 852x480 (GTF) */
  653. {CRTM852x480, ARRAY_SIZE(CRTM852x480)},
  654. /* Display : 1024x512 (GTF) */
  655. {CRTM1024x512, ARRAY_SIZE(CRTM1024x512)},
  656. /* Display : 1024x600 */
  657. {CRTM1024x600, ARRAY_SIZE(CRTM1024x600)},
  658. /* Display : 1024x768 */
  659. {CRTM1024x768, ARRAY_SIZE(CRTM1024x768)},
  660. /* Display : 1152x864 */
  661. {CRTM1152x864, ARRAY_SIZE(CRTM1152x864)},
  662. /* Display : 1280x768 (GTF) */
  663. {CRTM1280x768, ARRAY_SIZE(CRTM1280x768)},
  664. /* Display : 960x600 (CVT) */
  665. {CRTM960x600, ARRAY_SIZE(CRTM960x600)},
  666. /* Display : 1000x600 (GTF) */
  667. {CRTM1000x600, ARRAY_SIZE(CRTM1000x600)},
  668. /* Display : 1024x576 (GTF) */
  669. {CRTM1024x576, ARRAY_SIZE(CRTM1024x576)},
  670. /* Display : 1088x612 (GTF) */
  671. {CRTM1088x612, ARRAY_SIZE(CRTM1088x612)},
  672. /* Display : 1152x720 (CVT) */
  673. {CRTM1152x720, ARRAY_SIZE(CRTM1152x720)},
  674. /* Display : 1200x720 (GTF) */
  675. {CRTM1200x720, ARRAY_SIZE(CRTM1200x720)},
  676. /* Display : 1200x900 (DCON) */
  677. {DCON1200x900, ARRAY_SIZE(DCON1200x900)},
  678. /* Display : 1280x600 (GTF) */
  679. {CRTM1280x600, ARRAY_SIZE(CRTM1280x600)},
  680. /* Display : 1280x800 (CVT) */
  681. {CRTM1280x800, ARRAY_SIZE(CRTM1280x800)},
  682. /* Display : 1280x960 */
  683. {CRTM1280x960, ARRAY_SIZE(CRTM1280x960)},
  684. /* Display : 1280x1024 */
  685. {CRTM1280x1024, ARRAY_SIZE(CRTM1280x1024)},
  686. /* Display : 1360x768 (CVT) */
  687. {CRTM1360x768, ARRAY_SIZE(CRTM1360x768)},
  688. /* Display : 1366x768 */
  689. {CRTM1366x768, ARRAY_SIZE(CRTM1366x768)},
  690. /* Display : 1368x768 (GTF) */
  691. {CRTM1368x768, ARRAY_SIZE(CRTM1368x768)},
  692. /* Display : 1440x900 (CVT) */
  693. {CRTM1440x900, ARRAY_SIZE(CRTM1440x900)},
  694. /* Display : 1440x1050 (GTF) */
  695. {CRTM1440x1050, ARRAY_SIZE(CRTM1440x1050)},
  696. /* Display : 1600x900 (CVT) */
  697. {CRTM1600x900, ARRAY_SIZE(CRTM1600x900)},
  698. /* Display : 1600x1024 (GTF) */
  699. {CRTM1600x1024, ARRAY_SIZE(CRTM1600x1024)},
  700. /* Display : 1600x1200 */
  701. {CRTM1600x1200, ARRAY_SIZE(CRTM1600x1200)},
  702. /* Display : 1680x1050 (CVT) */
  703. {CRTM1680x1050, ARRAY_SIZE(CRTM1680x1050)},
  704. /* Display : 1792x1344 (DMT) */
  705. {CRTM1792x1344, ARRAY_SIZE(CRTM1792x1344)},
  706. /* Display : 1856x1392 (DMT) */
  707. {CRTM1856x1392, ARRAY_SIZE(CRTM1856x1392)},
  708. /* Display : 1920x1440 */
  709. {CRTM1920x1440, ARRAY_SIZE(CRTM1920x1440)},
  710. /* Display : 2048x1536 */
  711. {CRTM2048x1536, ARRAY_SIZE(CRTM2048x1536)},
  712. /* Display : 1280x720 */
  713. {CRTM1280x720, ARRAY_SIZE(CRTM1280x720)},
  714. /* Display : 1920x1080 (CVT) */
  715. {CRTM1920x1080, ARRAY_SIZE(CRTM1920x1080)},
  716. /* Display : 1920x1200 (CVT) */
  717. {CRTM1920x1200, ARRAY_SIZE(CRTM1920x1200)},
  718. /* Display : 1400x1050 (CVT) */
  719. {CRTM1400x1050, ARRAY_SIZE(CRTM1400x1050)}
  720. };
  721. static struct VideoModeTable viafb_rb_modes[] = {
  722. /* Display : 1360x768 (CVT Reduce Blanking) */
  723. {CRTM1360x768_RB, ARRAY_SIZE(CRTM1360x768_RB)},
  724. /* Display : 1440x900 (CVT Reduce Blanking) */
  725. {CRTM1440x900_RB, ARRAY_SIZE(CRTM1440x900_RB)},
  726. /* Display : 1400x1050 (CVT Reduce Blanking) */
  727. {CRTM1400x1050_RB, ARRAY_SIZE(CRTM1400x1050_RB)},
  728. /* Display : 1600x900 (CVT Reduce Blanking) */
  729. {CRTM1600x900_RB, ARRAY_SIZE(CRTM1600x900_RB)},
  730. /* Display : 1680x1050 (CVT Reduce Blanking) */
  731. {CRTM1680x1050_RB, ARRAY_SIZE(CRTM1680x1050_RB)},
  732. /* Display : 1920x1080 (CVT Reduce Blanking) */
  733. {CRTM1920x1080_RB, ARRAY_SIZE(CRTM1920x1080_RB)},
  734. /* Display : 1920x1200 (CVT Reduce Blanking) */
  735. {CRTM1920x1200_RB, ARRAY_SIZE(CRTM1920x1200_RB)}
  736. };
  737. int NUM_TOTAL_CN400_ModeXregs = ARRAY_SIZE(CN400_ModeXregs);
  738. int NUM_TOTAL_CN700_ModeXregs = ARRAY_SIZE(CN700_ModeXregs);
  739. int NUM_TOTAL_KM400_ModeXregs = ARRAY_SIZE(KM400_ModeXregs);
  740. int NUM_TOTAL_CX700_ModeXregs = ARRAY_SIZE(CX700_ModeXregs);
  741. int NUM_TOTAL_VX855_ModeXregs = ARRAY_SIZE(VX855_ModeXregs);
  742. int NUM_TOTAL_CLE266_ModeXregs = ARRAY_SIZE(CLE266_ModeXregs);
  743. int NUM_TOTAL_PATCH_MODE = ARRAY_SIZE(res_patch_table);
  744. struct VideoModeTable *viafb_get_mode(int hres, int vres)
  745. {
  746. u32 i;
  747. for (i = 0; i < ARRAY_SIZE(viafb_modes); i++)
  748. if (viafb_modes[i].mode_array &&
  749. viafb_modes[i].crtc[0].crtc.hor_addr == hres &&
  750. viafb_modes[i].crtc[0].crtc.ver_addr == vres)
  751. return &viafb_modes[i];
  752. return NULL;
  753. }
  754. struct VideoModeTable *viafb_get_rb_mode(int hres, int vres)
  755. {
  756. u32 i;
  757. for (i = 0; i < ARRAY_SIZE(viafb_rb_modes); i++)
  758. if (viafb_rb_modes[i].mode_array &&
  759. viafb_rb_modes[i].crtc[0].crtc.hor_addr == hres &&
  760. viafb_rb_modes[i].crtc[0].crtc.ver_addr == vres)
  761. return &viafb_rb_modes[i];
  762. return NULL;
  763. }