init301.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. /* $XFree86$ */
  2. /* $XdotOrg$ */
  3. /*
  4. * Data and prototypes for init301.c
  5. *
  6. * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
  7. *
  8. * If distributed as part of the Linux kernel, the following license terms
  9. * apply:
  10. *
  11. * * This program is free software; you can redistribute it and/or modify
  12. * * it under the terms of the GNU General Public License as published by
  13. * * the Free Software Foundation; either version 2 of the named License,
  14. * * or any later version.
  15. * *
  16. * * This program is distributed in the hope that it will be useful,
  17. * * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * * GNU General Public License for more details.
  20. * *
  21. * * You should have received a copy of the GNU General Public License
  22. * * along with this program; if not, write to the Free Software
  23. * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  24. *
  25. * Otherwise, the following license terms apply:
  26. *
  27. * * Redistribution and use in source and binary forms, with or without
  28. * * modification, are permitted provided that the following conditions
  29. * * are met:
  30. * * 1) Redistributions of source code must retain the above copyright
  31. * * notice, this list of conditions and the following disclaimer.
  32. * * 2) Redistributions in binary form must reproduce the above copyright
  33. * * notice, this list of conditions and the following disclaimer in the
  34. * * documentation and/or other materials provided with the distribution.
  35. * * 3) The name of the author may not be used to endorse or promote products
  36. * * derived from this software without specific prior written permission.
  37. * *
  38. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  39. * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  40. * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  41. * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  42. * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  43. * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  44. * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  45. * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  46. * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  47. * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  48. *
  49. * Author: Thomas Winischhofer <thomas@winischhofer.net>
  50. *
  51. */
  52. #ifndef _INIT301_H_
  53. #define _INIT301_H_
  54. #include "osdef.h"
  55. #include "initdef.h"
  56. #ifdef SIS_XORG_XF86
  57. #include "sis.h"
  58. #include "sis_regs.h"
  59. #endif
  60. #ifdef SIS_LINUX_KERNEL
  61. #include "vgatypes.h"
  62. #include "vstruct.h"
  63. #ifdef SIS_CP
  64. #undef SIS_CP
  65. #endif
  66. #include <linux/config.h>
  67. #include <linux/version.h>
  68. #include <linux/types.h>
  69. #include <asm/io.h>
  70. #include <linux/fb.h>
  71. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
  72. #include <video/fbcon.h>
  73. #endif
  74. #include "sis.h"
  75. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
  76. #include <linux/sisfb.h>
  77. #else
  78. #include <video/sisfb.h>
  79. #endif
  80. #endif
  81. static const unsigned char SiS_YPbPrTable[3][64] = {
  82. {
  83. 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
  84. 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
  85. 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
  86. 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
  87. 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
  88. 0x03,0x0a,0x65,0x9d /*0x8d*/,0x08,0x92,0x8f,0x40,
  89. 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53 /*0x50*/,
  90. 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
  91. },
  92. {
  93. 0x33,0x06,0x06,0x09,0x0b,0x0c,0x0c,0x0c,
  94. 0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
  95. 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
  96. 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13,
  97. 0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
  98. 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
  99. 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4e,
  100. 0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
  101. },
  102. {
  103. #if 0 /* OK, but sticks to left edge */
  104. 0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
  105. 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
  106. 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
  107. 0xed,0x50,0x70,0x9f,0x16,0x59,0x21 /*0x2b*/,0x13,
  108. 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
  109. 0x4b,0x4b,0x65 /*0x6f*/,0x2f,0x63,0x92,0x0f,0x40,
  110. 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27,
  111. 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
  112. #endif
  113. #if 1 /* Perfect */
  114. 0x23,0x2d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
  115. 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
  116. 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
  117. 0xed,0x50,0x70,0x9f,0x16,0x59,0x60,0x13,
  118. 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
  119. 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40,
  120. 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x73,
  121. 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
  122. #endif
  123. }
  124. };
  125. static const unsigned char SiS_TVPhase[] =
  126. {
  127. 0x21,0xED,0xBA,0x08, /* 0x00 SiS_NTSCPhase */
  128. 0x2A,0x05,0xE3,0x00, /* 0x01 SiS_PALPhase */
  129. 0x21,0xE4,0x2E,0x9B, /* 0x02 SiS_PALMPhase */
  130. 0x21,0xF4,0x3E,0xBA, /* 0x03 SiS_PALNPhase */
  131. 0x1E,0x8B,0xA2,0xA7,
  132. 0x1E,0x83,0x0A,0xE0, /* 0x05 SiS_SpecialPhaseM */
  133. 0x00,0x00,0x00,0x00,
  134. 0x00,0x00,0x00,0x00,
  135. 0x21,0xF0,0x7B,0xD6, /* 0x08 SiS_NTSCPhase2 */
  136. 0x2A,0x09,0x86,0xE9, /* 0x09 SiS_PALPhase2 */
  137. 0x21,0xE6,0xEF,0xA4, /* 0x0a SiS_PALMPhase2 */
  138. 0x21,0xF6,0x94,0x46, /* 0x0b SiS_PALNPhase2 */
  139. 0x1E,0x8B,0xA2,0xA7,
  140. 0x1E,0x83,0x0A,0xE0, /* 0x0d SiS_SpecialPhaseM */
  141. 0x00,0x00,0x00,0x00,
  142. 0x00,0x00,0x00,0x00,
  143. 0x1e,0x8c,0x5c,0x7a, /* 0x10 SiS_SpecialPhase */
  144. 0x25,0xd4,0xfd,0x5e /* 0x11 SiS_SpecialPhaseJ */
  145. };
  146. static const unsigned char SiS_HiTVGroup3_1[] = {
  147. 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13,
  148. 0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6,
  149. 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
  150. 0xac, 0xda, 0x60, 0xfe, 0x6a, 0x9a, 0x06, 0x10,
  151. 0xd1, 0x04, 0x18, 0x0a, 0xff, 0x80, 0x00, 0x80,
  152. 0x3b, 0x77, 0x00, 0xef, 0xe0, 0x10, 0xb0, 0xe0,
  153. 0x10, 0x4f, 0x0f, 0x0f, 0x05, 0x0f, 0x08, 0x6e,
  154. 0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01
  155. };
  156. static const unsigned char SiS_HiTVGroup3_2[] = {
  157. 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a,
  158. 0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6,
  159. 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
  160. 0xac, 0x6a, 0x60, 0x2b, 0x52, 0xcd, 0x61, 0x10,
  161. 0x51, 0x04, 0x18, 0x0a, 0x1f, 0x80, 0x00, 0x80,
  162. 0xff, 0xa4, 0x04, 0x2b, 0x94, 0x21, 0x72, 0x94,
  163. 0x26, 0x05, 0x01, 0x0f, 0xed, 0x0f, 0x0a, 0x64,
  164. 0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01
  165. };
  166. /* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */
  167. static const unsigned char SiS_Part2CLVX_1[] = {
  168. 0x00,0x00,
  169. 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
  170. 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
  171. 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
  172. 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
  173. };
  174. static const unsigned char SiS_Part2CLVX_2[] = {
  175. 0x00,0x00,
  176. 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
  177. 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
  178. 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
  179. 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
  180. };
  181. static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
  182. 0xE0,0x01,
  183. 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
  184. 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
  185. 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
  186. 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
  187. 0x58,0x02,
  188. 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E,
  189. 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F,
  190. 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03,
  191. 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06,
  192. 0x00,0x03,
  193. 0x09,0x0F,0x09,0x7F,0x08,0x0F,0x09,0x00,0x07,0x0F,0x0A,0x00,0x06,0x0F,0x0A,0x01,
  194. 0x06,0x0E,0x0B,0x01,0x05,0x0E,0x0B,0x02,0x04,0x0E,0x0C,0x02,0x04,0x0D,0x0C,0x03,
  195. 0x03,0x0D,0x0D,0x03,0x02,0x0C,0x0D,0x05,0x02,0x0C,0x0E,0x04,0x01,0x0B,0x0E,0x06,
  196. 0x01,0x0B,0x0E,0x06,0x00,0x0A,0x0F,0x07,0x00,0x0A,0x0F,0x07,0x00,0x09,0x0F,0x08,
  197. 0xFF,0xFF
  198. };
  199. static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
  200. 0x58,0x02,
  201. 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
  202. 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
  203. 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
  204. 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
  205. 0x00,0x03,
  206. 0x08,0x12,0x08,0x7E,0x07,0x12,0x09,0x7E,0x06,0x12,0x0A,0x7E,0x05,0x11,0x0B,0x7F,
  207. 0x04,0x11,0x0C,0x7F,0x03,0x11,0x0C,0x00,0x03,0x10,0x0D,0x00,0x02,0x0F,0x0E,0x01,
  208. 0x01,0x0F,0x0F,0x01,0x01,0x0E,0x0F,0x02,0x00,0x0D,0x10,0x03,0x7F,0x0C,0x11,0x04,
  209. 0x7F,0x0C,0x11,0x04,0x7F,0x0B,0x11,0x05,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x12,0x07,
  210. 0x40,0x02,
  211. 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
  212. 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
  213. 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
  214. 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
  215. 0xFF,0xFF
  216. };
  217. static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
  218. 0x00,0x03,
  219. 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
  220. 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
  221. 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
  222. 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
  223. 0xFF,0xFF
  224. };
  225. static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
  226. 0x00,0x04,
  227. 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
  228. 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
  229. 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
  230. 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
  231. 0xFF,0xFF,
  232. };
  233. #ifdef SIS315H
  234. /* 661 et al LCD data structure (2.03.00) */
  235. static const unsigned char SiS_LCDStruct661[] = {
  236. /* 1024x768 */
  237. /* type|CR37| HDE | VDE | HT | VT | hss | hse */
  238. 0x02,0xC0,0x00,0x04,0x00,0x03,0x40,0x05,0x26,0x03,0x10,0x00,0x88,
  239. 0x00,0x02,0x00,0x06,0x00,0x41,0x5A,0x64,0x00,0x00,0x00,0x00,0x04,
  240. /* | vss | vse |clck| clock |CRT2DataP|CRT2DataP|idx */
  241. /* VESA non-VESA noscale */
  242. /* 1280x1024 */
  243. 0x03,0xC0,0x00,0x05,0x00,0x04,0x98,0x06,0x2A,0x04,0x30,0x00,0x70,
  244. 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x08,
  245. /* 1400x1050 */
  246. 0x09,0x20,0x78,0x05,0x1A,0x04,0x98,0x06,0x2A,0x04,0x18,0x00,0x38,
  247. 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x09,
  248. /* 1600x1200 */
  249. 0x0B,0xE0,0x40,0x06,0xB0,0x04,0x70,0x08,0xE2,0x04,0x40,0x00,0xC0,
  250. 0x00,0x01,0x00,0x03,0x00,0xA2,0x70,0x24,0x00,0x00,0x00,0x00,0x0A,
  251. /* 1280x768 (_2) */
  252. 0x0A,0xE0,0x00,0x05,0x00,0x03,0x7C,0x06,0x26,0x03,0x30,0x00,0x70,
  253. 0x00,0x03,0x00,0x06,0x00,0x4D,0xC8,0x48,0x00,0x00,0x00,0x00,0x06,
  254. /* 1280x720 */
  255. 0x0E,0xE0,0x00,0x05,0xD0,0x02,0x80,0x05,0x26,0x03,0x10,0x00,0x20,
  256. 0x00,0x01,0x00,0x06,0x00,0x45,0x9C,0x62,0x00,0x00,0x00,0x00,0x05,
  257. /* 1280x800 (_2) */
  258. 0x0C,0xE0,0x00,0x05,0x20,0x03,0x10,0x06,0x2C,0x03,0x30,0x00,0x70,
  259. 0x00,0x04,0x00,0x03,0x00,0x49,0xCE,0x1E,0x00,0x00,0x00,0x00,0x09,
  260. /* 1680x1050 */
  261. 0x0D,0xE0,0x90,0x06,0x1A,0x04,0x6C,0x07,0x2A,0x04,0x1A,0x00,0x4C,
  262. 0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x00,0x00,0x00,0x00,0x06,
  263. /* 1280x800_3 */
  264. 0x0C,0xE0,0x00,0x05,0x20,0x03,0xAA,0x05,0x2E,0x03,0x30,0x00,0x50,
  265. 0x00,0x04,0x00,0x03,0x00,0x47,0xA9,0x10,0x00,0x00,0x00,0x00,0x07,
  266. /* 800x600 */
  267. 0x01,0xC0,0x20,0x03,0x58,0x02,0x20,0x04,0x74,0x02,0x2A,0x00,0x80,
  268. 0x00,0x06,0x00,0x04,0x00,0x28,0x63,0x4B,0x00,0x00,0x00,0x00,0x00,
  269. /* 1280x854 */
  270. 0x08,0xE0,0x00,0x05,0x56,0x03,0x80,0x06,0x5d,0x03,0x10,0x00,0x70,
  271. 0x00,0x01,0x00,0x03,0x00,0x54,0x75,0x13,0x00,0x00,0x00,0x00,0x08
  272. };
  273. #endif
  274. #ifdef SIS300
  275. static unsigned char SiS300_TrumpionData[14][80] = {
  276. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
  277. 0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23,
  278. 0x00,0x00,0x03,0x28,0x03,0x10,0x05,0x08,0x40,0x10,0x00,0x10,0x04,0x23,0x00,0x23,
  279. 0x03,0x11,0x60,0xBC,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x09,0x04,0x04,0x05,
  280. 0x04,0x0C,0x09,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5A,0x01,0xBE,0x01,0x00 },
  281. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x27,0x00,0x80,0x02,
  282. 0x20,0x03,0x07,0x00,0x5E,0x01,0x0D,0x02,0x60,0x0C,0x30,0x11,0x00,0x00,0x04,0x23,
  283. 0x00,0x00,0x03,0x80,0x03,0x28,0x06,0x08,0x40,0x11,0x00,0x11,0x04,0x23,0x00,0x23,
  284. 0x03,0x11,0x60,0x90,0x01,0xFF,0x0F,0xF4,0x19,0x01,0x00,0x05,0x01,0x00,0x04,0x05,
  285. 0x04,0x0C,0x02,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEC,0x57,0x01,0xBE,0x01,0x00 },
  286. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
  287. 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
  288. 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
  289. 0x03,0x11,0x60,0xD9,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
  290. 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x59,0x01,0xBE,0x01,0x00 },
  291. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
  292. 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
  293. 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
  294. 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
  295. 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
  296. { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
  297. 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
  298. 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
  299. 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
  300. 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
  301. { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
  302. 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
  303. 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
  304. 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
  305. 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
  306. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
  307. 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
  308. 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
  309. 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
  310. 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
  311. /* variant 2 */
  312. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
  313. 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
  314. 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
  315. 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
  316. 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
  317. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
  318. 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
  319. 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
  320. 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
  321. 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
  322. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
  323. 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
  324. 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
  325. 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
  326. 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
  327. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
  328. 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
  329. 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
  330. 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
  331. 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
  332. { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
  333. 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
  334. 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
  335. 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
  336. 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
  337. { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
  338. 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
  339. 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
  340. 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
  341. 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
  342. { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
  343. 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
  344. 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
  345. 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
  346. 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 }
  347. };
  348. #endif
  349. void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
  350. #ifndef SIS_LINUX_KERNEL
  351. void SiS_LockCRT2(struct SiS_Private *SiS_Pr);
  352. #endif
  353. void SiS_EnableCRT2(struct SiS_Private *SiS_Pr);
  354. unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
  355. void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr);
  356. BOOLEAN SiS_IsDualEdge(struct SiS_Private *SiS_Pr);
  357. BOOLEAN SiS_IsVAMode(struct SiS_Private *SiS_Pr);
  358. void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
  359. unsigned short ModeIdIndex, int checkcrt2mode);
  360. void SiS_SetYPbPr(struct SiS_Private *SiS_Pr);
  361. void SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
  362. unsigned short ModeIdIndex);
  363. void SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
  364. unsigned short ModeIdIndex);
  365. unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex,
  366. unsigned short RefreshRateTableIndex);
  367. unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned short ModeIdIndex);
  368. void SiS_DisableBridge(struct SiS_Private *SiS_Pr);
  369. #ifndef SIS_LINUX_KERNEL
  370. void SiS_EnableBridge(struct SiS_Private *SiS_Pr);
  371. #endif
  372. BOOLEAN SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
  373. void SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr);
  374. void SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr);
  375. void SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
  376. unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax);
  377. void SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
  378. unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempax);
  379. #ifndef SIS_LINUX_KERNEL
  380. void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
  381. unsigned short SiS_GetCH70xx(struct SiS_Private *SiS_Pr, unsigned short tempax);
  382. #endif
  383. void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
  384. unsigned char orval,unsigned short andval);
  385. #ifdef SIS315H
  386. static void SiS_Chrontel701xOn(struct SiS_Private *SiS_Pr);
  387. static void SiS_Chrontel701xOff(struct SiS_Private *SiS_Pr);
  388. static void SiS_ChrontelInitTVVSync(struct SiS_Private *SiS_Pr);
  389. static void SiS_ChrontelDoSomething1(struct SiS_Private *SiS_Pr);
  390. void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr);
  391. void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr);
  392. #endif /* 315 */
  393. #ifdef SIS300
  394. static BOOLEAN SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr);
  395. void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo);
  396. #endif
  397. void SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime);
  398. unsigned short SiS_ReadDDC1Bit(struct SiS_Private *SiS_Pr);
  399. unsigned short SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine,
  400. unsigned short adaptnum, unsigned short DDCdatatype,
  401. unsigned char *buffer, unsigned int VBFlags2);
  402. #ifdef SIS_XORG_XF86
  403. unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags,
  404. int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype,
  405. BOOLEAN checkcr32, unsigned int VBFlags2);
  406. unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr);
  407. unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype,
  408. unsigned char *buffer);
  409. #else
  410. static unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags,
  411. int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype,
  412. BOOLEAN checkcr32, unsigned int VBFlags2);
  413. static unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr);
  414. static unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype,
  415. unsigned char *buffer);
  416. #endif
  417. static void SiS_SetSwitchDDC2(struct SiS_Private *SiS_Pr);
  418. static unsigned short SiS_SetStart(struct SiS_Private *SiS_Pr);
  419. static unsigned short SiS_SetStop(struct SiS_Private *SiS_Pr);
  420. static unsigned short SiS_SetSCLKLow(struct SiS_Private *SiS_Pr);
  421. static unsigned short SiS_SetSCLKHigh(struct SiS_Private *SiS_Pr);
  422. static unsigned short SiS_ReadDDC2Data(struct SiS_Private *SiS_Pr);
  423. static unsigned short SiS_WriteDDC2Data(struct SiS_Private *SiS_Pr, unsigned short tempax);
  424. static unsigned short SiS_CheckACK(struct SiS_Private *SiS_Pr);
  425. static unsigned short SiS_WriteDABDDC(struct SiS_Private *SiS_Pr);
  426. static unsigned short SiS_PrepareReadDDC(struct SiS_Private *SiS_Pr);
  427. static unsigned short SiS_PrepareDDC(struct SiS_Private *SiS_Pr);
  428. static void SiS_SendACK(struct SiS_Private *SiS_Pr, unsigned short yesno);
  429. static unsigned short SiS_DoProbeDDC(struct SiS_Private *SiS_Pr);
  430. #ifdef SIS300
  431. static void SiS_OEM300Setting(struct SiS_Private *SiS_Pr,
  432. unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefTabindex);
  433. static void SetOEMLCDData2(struct SiS_Private *SiS_Pr,
  434. unsigned short ModeNo, unsigned short ModeIdIndex,unsigned short RefTableIndex);
  435. #endif
  436. #ifdef SIS315H
  437. static void SiS_OEM310Setting(struct SiS_Private *SiS_Pr,
  438. unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
  439. static void SiS_OEM661Setting(struct SiS_Private *SiS_Pr,
  440. unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
  441. static void SiS_FinalizeLCD(struct SiS_Private *, unsigned short, unsigned short);
  442. #endif
  443. extern void SiS_SetReg(SISIOADDRESS, unsigned short, unsigned short);
  444. extern void SiS_SetRegByte(SISIOADDRESS, unsigned short);
  445. extern void SiS_SetRegShort(SISIOADDRESS, unsigned short);
  446. extern void SiS_SetRegLong(SISIOADDRESS, unsigned int);
  447. extern unsigned char SiS_GetReg(SISIOADDRESS, unsigned short);
  448. extern unsigned char SiS_GetRegByte(SISIOADDRESS);
  449. extern unsigned short SiS_GetRegShort(SISIOADDRESS);
  450. extern unsigned int SiS_GetRegLong(SISIOADDRESS);
  451. extern void SiS_SetRegANDOR(SISIOADDRESS, unsigned short, unsigned short, unsigned short);
  452. extern void SiS_SetRegOR(SISIOADDRESS, unsigned short, unsigned short);
  453. extern void SiS_SetRegAND(SISIOADDRESS, unsigned short, unsigned short);
  454. extern void SiS_DisplayOff(struct SiS_Private *SiS_Pr);
  455. extern void SiS_DisplayOn(struct SiS_Private *SiS_Pr);
  456. extern BOOLEAN SiS_SearchModeID(struct SiS_Private *, unsigned short *, unsigned short *);
  457. extern unsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
  458. unsigned short ModeIdIndex);
  459. extern unsigned short SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
  460. extern unsigned short SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
  461. extern unsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex,
  462. unsigned short RefreshRateTableIndex);
  463. extern void SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
  464. unsigned short ModeIdIndex);
  465. extern void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
  466. unsigned short ModeIdIndex);
  467. extern void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth);
  468. extern unsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
  469. extern unsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
  470. #ifdef SIS300
  471. extern void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *tempbx,
  472. unsigned short *tempcl);
  473. extern unsigned short SiS_GetFIFOThresholdB300(unsigned short tempbx, unsigned short tempcl);
  474. extern unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index);
  475. #ifdef SIS_LINUX_KERNEL
  476. extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
  477. extern unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
  478. #endif
  479. #endif
  480. #endif