VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / video / sis / init.h
1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * Data and prototypes for init.c
5  *
6  * Copyright (C) 2001-2004 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 EXPRESSED 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
53 #ifndef _INIT_
54 #define _INIT_
55
56 #include "osdef.h"
57
58 #include "initdef.h"
59 #include "vgatypes.h"
60 #include "vstruct.h"
61
62 #ifdef LINUX_XF86
63 #include "xf86.h"
64 #include "xf86Pci.h"
65 #include "xf86PciInfo.h"
66 #include "xf86_OSproc.h"
67 #include "sis.h"
68 #include "sis_regs.h"
69 #endif
70
71 #ifdef LINUX_KERNEL
72 #ifdef SIS_CP
73 #undef SIS_CP
74 #endif
75 #include <linux/config.h>
76 #include <linux/version.h>
77 #include <linux/types.h>
78 #include <asm/io.h>
79 #include <linux/fb.h>
80 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
81 #include <linux/sisfb.h>
82 #else
83 #include <video/sisfb.h>
84 #endif
85 #endif
86
87 /* Mode numbers */
88 const USHORT  ModeIndex_320x200[]      = {0x59, 0x41, 0x00, 0x4f};
89 const USHORT  ModeIndex_320x240[]      = {0x50, 0x56, 0x00, 0x53};
90 const USHORT  ModeIndex_320x240_FSTN[] = {0x5a, 0x5b, 0x00, 0x00};  /* FSTN */
91 const USHORT  ModeIndex_400x300[]      = {0x51, 0x57, 0x00, 0x54};
92 const USHORT  ModeIndex_512x384[]      = {0x52, 0x58, 0x00, 0x5c};
93 const USHORT  ModeIndex_640x400[]      = {0x2f, 0x5d, 0x00, 0x5e};
94 const USHORT  ModeIndex_640x480[]      = {0x2e, 0x44, 0x00, 0x62};
95 const USHORT  ModeIndex_720x480[]      = {0x31, 0x33, 0x00, 0x35};
96 const USHORT  ModeIndex_720x576[]      = {0x32, 0x34, 0x00, 0x36};
97 const USHORT  ModeIndex_768x576[]      = {0x5f, 0x60, 0x00, 0x61};
98 const USHORT  ModeIndex_800x480[]      = {0x70, 0x7a, 0x00, 0x76};
99 const USHORT  ModeIndex_800x600[]      = {0x30, 0x47, 0x00, 0x63};
100 const USHORT  ModeIndex_848x480[]      = {0x39, 0x3b, 0x00, 0x3e};
101 const USHORT  ModeIndex_856x480[]      = {0x3f, 0x42, 0x00, 0x45};
102 const USHORT  ModeIndex_960x540[]      = {0x1d, 0x1e, 0x00, 0x1f};  /* 315 series only */
103 const USHORT  ModeIndex_1024x768[]     = {0x38, 0x4a, 0x00, 0x64};
104 const USHORT  ModeIndex_1024x576[]     = {0x71, 0x74, 0x00, 0x77};
105 const USHORT  ModeIndex_1024x600[]     = {0x20, 0x21, 0x00, 0x22};  /* 300 series only */
106 const USHORT  ModeIndex_1280x1024[]    = {0x3a, 0x4d, 0x00, 0x65};
107 const USHORT  ModeIndex_1280x960[]     = {0x7c, 0x7d, 0x00, 0x7e};
108 const USHORT  ModeIndex_1152x768[]     = {0x23, 0x24, 0x00, 0x25};  /* 300 series only */
109 const USHORT  ModeIndex_1152x864[]     = {0x29, 0x2a, 0x00, 0x2b};
110 const USHORT  ModeIndex_300_1280x768[] = {0x55, 0x5a, 0x00, 0x5b};
111 const USHORT  ModeIndex_310_1280x768[] = {0x23, 0x24, 0x00, 0x25};
112 const USHORT  ModeIndex_1280x720[]     = {0x79, 0x75, 0x00, 0x78};
113 const USHORT  ModeIndex_1280x800[]     = {0x14, 0x15, 0x00, 0x16};
114 const USHORT  ModeIndex_1360x768[]     = {0x48, 0x4b, 0x00, 0x4e};
115 const USHORT  ModeIndex_300_1360x1024[]= {0x67, 0x6f, 0x00, 0x72};  /* 300 series, BARCO only */
116 const USHORT  ModeIndex_1400x1050[]    = {0x26, 0x27, 0x00, 0x28};  /* 315 series only */
117 const USHORT  ModeIndex_1680x1050[]    = {0x17, 0x18, 0x00, 0x19};  /* 315 series only */
118 const USHORT  ModeIndex_1600x1200[]    = {0x3c, 0x3d, 0x00, 0x66};
119 const USHORT  ModeIndex_1920x1080[]    = {0x2c, 0x2d, 0x00, 0x73};  /* 315 series only */
120 const USHORT  ModeIndex_1920x1440[]    = {0x68, 0x69, 0x00, 0x6b};
121 const USHORT  ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00};
122 const USHORT  ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};
123
124 const USHORT SiS_DRAMType[17][5]={
125         {0x0C,0x0A,0x02,0x40,0x39},
126         {0x0D,0x0A,0x01,0x40,0x48},
127         {0x0C,0x09,0x02,0x20,0x35},
128         {0x0D,0x09,0x01,0x20,0x44},
129         {0x0C,0x08,0x02,0x10,0x31},
130         {0x0D,0x08,0x01,0x10,0x40},
131         {0x0C,0x0A,0x01,0x20,0x34},
132         {0x0C,0x09,0x01,0x08,0x32},
133         {0x0B,0x08,0x02,0x08,0x21},
134         {0x0C,0x08,0x01,0x08,0x30},
135         {0x0A,0x08,0x02,0x04,0x11},
136         {0x0B,0x0A,0x01,0x10,0x28},
137         {0x09,0x08,0x02,0x02,0x01},
138         {0x0B,0x09,0x01,0x08,0x24},
139         {0x0B,0x08,0x01,0x04,0x20},
140         {0x0A,0x08,0x01,0x02,0x10},
141         {0x09,0x08,0x01,0x01,0x00}
142 };
143
144 const USHORT SiS_SDRDRAM_TYPE[13][5] =
145 {
146         { 2,12, 9,64,0x35},
147         { 1,13, 9,64,0x44},
148         { 2,12, 8,32,0x31},
149         { 2,11, 9,32,0x25},
150         { 1,12, 9,32,0x34},
151         { 1,13, 8,32,0x40},
152         { 2,11, 8,16,0x21},
153         { 1,12, 8,16,0x30},
154         { 1,11, 9,16,0x24},
155         { 1,11, 8, 8,0x20},
156         { 2, 9, 8, 4,0x01},
157         { 1,10, 8, 4,0x10},
158         { 1, 9, 8, 2,0x00}
159 };
160
161 const USHORT SiS_DDRDRAM_TYPE[4][5] =
162 {
163         { 2,12, 9,64,0x35},
164         { 2,12, 8,32,0x31},
165         { 2,11, 8,16,0x21},
166         { 2, 9, 8, 4,0x01}
167 };
168
169 const USHORT SiS_MDA_DAC[] =
170 {
171         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
172         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
173         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
174         0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
175         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
176         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
177         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
178         0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F
179 };
180
181 const USHORT SiS_CGA_DAC[] =
182 {
183         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
184         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
185         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
186         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
187         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
188         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
189         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
190         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
191 };
192
193 const USHORT SiS_EGA_DAC[] =
194 {
195         0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15,
196         0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35,
197         0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D,
198         0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D,
199         0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17,
200         0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37,
201         0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F,
202         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
203 };
204
205 const USHORT SiS_VGA_DAC[] =
206 {
207         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
208         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
209         0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18,
210         0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F,
211         0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F,
212         0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00,
213         0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18,
214         0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04,
215         0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10,
216         0x0B,0x0C,0x0D,0x0F,0x10
217 };
218
219 static const SiS_StResInfoStruct SiS_StResInfo[]=
220 {
221         { 640,400},
222         { 640,350},
223         { 720,400},
224         { 720,350},
225         { 640,480}
226 };
227
228 static const SiS_ModeResInfoStruct SiS_ModeResInfo[] =
229 {
230         {  320, 200, 8, 8},   /* 0x00 */
231         {  320, 240, 8, 8},   /* 0x01 */
232         {  320, 400, 8, 8},   /* 0x02 */
233         {  400, 300, 8, 8},   /* 0x03 */
234         {  512, 384, 8, 8},   /* 0x04 */
235         {  640, 400, 8,16},   /* 0x05 */
236         {  640, 480, 8,16},   /* 0x06 */
237         {  800, 600, 8,16},   /* 0x07 */
238         { 1024, 768, 8,16},   /* 0x08 */
239         { 1280,1024, 8,16},   /* 0x09 */
240         { 1600,1200, 8,16},   /* 0x0a */
241         { 1920,1440, 8,16},   /* 0x0b */
242         { 2048,1536, 8,16},   /* 0x0c */
243         {  720, 480, 8,16},   /* 0x0d */
244         {  720, 576, 8,16},   /* 0x0e */
245         { 1280, 960, 8,16},   /* 0x0f */
246         {  800, 480, 8,16},   /* 0x10 */
247         { 1024, 576, 8,16},   /* 0x11 */
248         { 1280, 720, 8,16},   /* 0x12 */
249         {  856, 480, 8,16},   /* 0x13 */
250         { 1280, 768, 8,16},   /* 0x14 */
251         { 1400,1050, 8,16},   /* 0x15 */
252         { 1152, 864, 8,16},   /* 0x16 */
253         {  848, 480, 8,16},   /* 0x17 */
254         { 1360, 768, 8,16},   /* 0x18 */
255         { 1024, 600, 8,16},   /* 0x19 */
256         { 1152, 768, 8,16},   /* 0x1a */
257         {  768, 576, 8,16},   /* 0x1b */
258         { 1360,1024, 8,16},   /* 0x1c */
259         { 1680,1050, 8,16},   /* 0x1d */
260         { 1280, 800, 8,16},   /* 0x1e */
261         { 1920,1080, 8,16},   /* 0x1f */
262         {  960, 540, 8,16}    /* 0x20 */
263 };
264
265 #if defined(SIS300) || defined(SIS315H)
266 static SiS_StandTableStruct SiS_StandTable[]=
267 {
268 /* 0x00: MD_0_200 */
269  {
270   0x28,0x18,0x08,0x0800,
271   {0x09,0x03,0x00,0x02},
272   0x63,
273   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
274    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
275    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
276    0xff},
277   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
278    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
279    0x08,0x00,0x0f,0x00},
280   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
281    0xff}
282  },
283 /* 0x01: MD_1_200 */
284  {
285   0x28,0x18,0x08,0x0800,
286   {0x09,0x03,0x00,0x02},
287   0x63,
288   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
289    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
290    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
291    0xff},
292   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
293    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
294    0x08,0x00,0x0f,0x00},
295   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
296    0xff}
297  },
298 /* 0x02: MD_2_200 */
299  {
300   0x50,0x18,0x08,0x1000,
301   {0x01,0x03,0x00,0x02},
302   0x63,
303   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
304    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
305    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
306    0xff},
307   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
308    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
309    0x08,0x00,0x0f,0x00},
310   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
311    0xff}
312  },
313 /* 0x03: MD_3_200 - mode 0x03 - 0 */
314  {
315   0x50,0x18,0x08,0x1000,
316   {0x01,0x03,0x00,0x02},
317   0x63,
318   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
319    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
320    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
321    0xff},
322   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
323    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
324    0x08,0x00,0x0f,0x00},
325   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
326    0xff}
327  },
328 /* 0x04: MD_4 */
329  {
330   0x28,0x18,0x08,0x4000,
331   {0x09,0x03,0x00,0x02},
332   0x63,
333   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,   /* 0x2c is 2b for 300 */
334    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
335    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2,
336    0xff},
337   {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07,
338    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
339    0x01,0x00,0x03,0x00},
340   {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
341    0xff}
342  },
343 /* 0x05: MD_5 */
344  {
345   0x28,0x18,0x08,0x4000,
346   {0x09,0x03,0x00,0x02},
347   0x63,
348   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,   /* 0x2c is 2b for 300 */
349    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
350    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2,
351    0xff},
352   {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07,
353    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
354    0x01,0x00,0x03,0x00},
355   {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
356    0xff}
357  },
358 /* 0x06: MD_6 */
359  {
360   0x50,0x18,0x08,0x4000,
361   {0x01,0x01,0x00,0x06},
362   0x63,
363   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,   /* 55,81 is 54,80 for 300 */
364    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
365    0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2,
366    0xff},
367   {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
368    0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
369    0x01,0x00,0x01,0x00},
370   {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00,
371    0xff}
372  },
373 /* 0x07: MD_7 */
374  {
375   0x50,0x18,0x0e,0x1000,
376   {0x00,0x03,0x00,0x03},
377   0xa6,
378   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
379    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
380    0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3,
381    0xff},
382   {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
383    0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
384    0x0e,0x00,0x0f,0x08},
385   {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
386    0xff}
387  },
388 /* 0x08: MDA_DAC */
389  {
390   0x00,0x00,0x00,0x0000,
391   {0x00,0x00,0x00,0x15},
392   0x15,
393   {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
394    0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f,
395    0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,
396    0x00},
397   {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15,
398    0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
399    0x15,0x15,0x15,0x15},
400   {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
401    0x3f}
402  },
403 /* 0x09: CGA_DAC */
404  {
405   0x00,0x10,0x04,0x0114,
406   {0x11,0x09,0x15,0x00},
407   0x10,
408   {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,
409    0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a,
410    0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10,
411    0x04},
412   {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04,
413    0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e,
414    0x3e,0x2b,0x3b,0x2f},
415   {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
416    0x3f}
417  },
418 /* 0x0a: EGA_DAC */
419  {
420   0x00,0x10,0x04,0x0114,
421   {0x11,0x05,0x15,0x20},
422   0x30,
423   {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18,
424    0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38,
425    0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12,
426    0x06},
427   {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26,
428    0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e,
429    0x1e,0x0b,0x1b,0x0f},
430   {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
431    0x3f}
432  },
433 /* 0x0b: VGA_DAC */
434  {
435   0x00,0x10,0x04,0x0114,
436   {0x11,0x09,0x15,0x2a},
437   0x3a,
438   {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05,
439    0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20,
440    0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10,
441    0x1f},
442   {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d,
443    0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15,
444    0x1c,0x0e,0x11,0x15},
445   {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00,
446    0x04}
447  },
448 /* 0x0c */
449  {
450   0x08,0x0c,0x10,0x0a08,
451   {0x0c,0x0e,0x10,0x0b},
452   0x0c,
453   {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00,
454    0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00,
455    0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00,
456    0x06},
457   {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08,
458    0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00,
459    0x00,0x00,0x00,0x00},
460   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
461    0x00}
462  },
463 /* 0x0d: MD_D */
464  {
465   0x28,0x18,0x08,0x2000,
466   {0x09,0x0f,0x00,0x06},
467   0x63,
468   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,     /* 2c is 2b for 300 */
469    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
470    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3,
471    0xff},
472   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
473    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
474    0x01,0x00,0x0f,0x00},
475   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
476    0xff}
477  },
478 /* 0x0e: MD_E */
479  {
480   0x50,0x18,0x08,0x4000,
481   {0x01,0x0f,0x00,0x06},
482   0x63,
483   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,     /* 55,81 is 54,80 for 300 */
484    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
485    0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3,
486    0xff},
487   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
488    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
489    0x01,0x00,0x0f,0x00},
490   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
491    0xff}
492  },
493 /* 0x0f: ExtVGATable - modes > 0x13 */
494  {
495   0x00,0x00,0x00,0x0000,
496   {0x01,0x0f,0x00,0x0e},
497   0x23,
498   {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
499    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
500    0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
501    0xff},
502   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
503    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
504    0x01,0x00,0x00,0x00},
505   {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
506    0xff}
507  },
508 /* 0x10: ROM_SAVEPTR - totally different for 300 */
509  {
510   0x9f,0x3b,0x00,0x00c0,
511   {0x00,0x00,0x00,0x00},
512   0x00,
513   {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f,
514    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
515    0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0,
516    0x00},
517   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
518    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
519    0x00,0x00,0x00,0x00},
520   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
521    0x00}
522  },
523 /* 0x11: MD_F */
524  {
525   0x50,0x18,0x0e,0x8000,
526   {0x01,0x0f,0x00,0x06},
527   0xa2,
528   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
529    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
530    0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3,    /* 82,84 is 83,85 on 300 */
531    0xff},
532   {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00,
533    0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,
534    0x0b,0x00,0x05,0x00},
535   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,
536    0xff}
537  },
538 /* 0x12: MD_10 */
539  {
540   0x50,0x18,0x0e,0x8000,
541   {0x01,0x0f,0x00,0x06},
542   0xa3,
543   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
544    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
545    0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3,    /* 82,84 is 83,85 on 300 */
546    0xff},
547   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
548    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
549    0x01,0x00,0x0f,0x00},
550   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
551    0xff}
552  },
553 /* 0x13: MD_0_350 */
554  {
555   0x28,0x18,0x0e,0x0800,
556   {0x09,0x03,0x00,0x02},
557   0xa3,
558   {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f,    /* b1 is a0 on 300 */
559    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
560    0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3,
561    0xff},
562   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
563    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
564    0x08,0x00,0x0f,0x00},
565   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
566    0xff}
567  },
568 /* 0x14: MD_1_350 */
569  {
570   0x28,0x18,0x0e,0x0800,
571   {0x09,0x03,0x00,0x02},
572   0xa3,
573   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
574    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
575    0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3,
576    0xff},
577   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
578    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
579    0x08,0x00,0x0f,0x00},
580   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
581    0xff}
582  },
583 /* 0x15: MD_2_350 */
584  {
585   0x50,0x18,0x0e,0x1000,
586   {0x01,0x03,0x00,0x02},
587   0xa3,
588   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
589    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
590    0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3,
591    0xff},
592   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
593    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
594    0x08,0x00,0x0f,0x00},
595   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
596    0xff}
597  },
598 /* 0x16: MD_3_350 - mode 0x03 - 1 */
599  {
600   0x50,0x18,0x0e,0x1000,
601   {0x01,0x03,0x00,0x02},
602   0xa3,
603   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
604    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
605    0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3,
606    0xff},
607   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
608    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
609    0x08,0x00,0x0f,0x00},
610   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
611    0xff}
612  },
613 /* 0x17: MD_0_1_400 */
614  {
615   0x28,0x18,0x10,0x0800,
616   {0x08,0x03,0x00,0x02},
617   0x67,
618   {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f,    /* b1 is a0 on 300 */
619    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
620    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
621    0xff},
622   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
623    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
624    0x0c,0x00,0x0f,0x08},
625   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
626    0xff}
627  },
628 /* 0x18: MD_2_3_400 - mode 0x03 - 2 */
629  {
630   0x50,0x18,0x10,0x1000,
631   {0x00,0x03,0x00,0x02},
632   0x67,
633   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
634    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
635    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
636    0xff},
637   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
638    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
639    0x0c,0x00,0x0f,0x08},
640   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
641    0xff}
642  },
643 /* 0x19: MD_7_400 */
644  {
645   0x50,0x18,0x10,0x1000,
646   {0x00,0x03,0x00,0x02},
647   0x66,
648   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
649    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
650    0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3,
651    0xff},
652   {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
653    0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
654    0x0e,0x00,0x0f,0x08},
655   {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
656    0xff}
657  },
658 /* 0x1a: MD_11 */
659  {
660   0x50,0x1d,0x10,0xa000,
661   {0x01,0x0f,0x00,0x06},
662   0xe3,
663   {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,    /* 55,81 is 54,80 on 300 */
664    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
665    0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3,    /* e9,8b is ea,8c on 300 */
666    0xff},
667   {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
668    0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
669    0x01,0x00,0x0f,0x00},
670   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01,
671    0xff}
672  },
673 /* 0x1b: ExtEGATable - Modes <= 0x02 */
674  {
675   0x50,0x1d,0x10,0xa000,
676   {0x01,0x0f,0x00,0x06},
677   0xe3,
678   {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,    /* 55,81 is 54,80 on 300 */
679    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
680    0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,    /* e9,8b is ea,8c on 300 */
681    0xff},
682   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
683    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
684    0x01,0x00,0x0f,0x00},
685   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
686    0xff}
687  },
688 /* 0x1c: MD_13 */
689  {
690   0x28,0x18,0x08,0x2000,
691   {0x01,0x0f,0x00,0x0e},
692   0x63,
693   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
694    0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,
695    0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3,
696    0xff},
697   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
698    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
699    0x41,0x00,0x0f,0x00},
700   {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
701    0xff}
702  }
703 };
704 #endif
705
706 /**************************************************************/
707 /* SIS VIDEO BRIDGE ----------------------------------------- */
708 /**************************************************************/
709
710 static const UCHAR SiS_SoftSetting  = 0x30;   /* RAM setting */
711
712 static const UCHAR SiS_OutputSelect = 0x40;
713
714 static const UCHAR SiS_NTSCTiming[] = {
715         0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
716         0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
717         0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
718         0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
719         0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
720         0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40,
721         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50,
722         0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
723 };
724
725 static const UCHAR SiS_PALTiming[] = {
726         0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70,
727         0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
728         0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
729         0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17,
730         0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02,
731         0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40,
732         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63,
733         0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00
734 };
735
736 static const UCHAR SiS_HiTVExtTiming[] = {
737         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
738         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
739         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
740         0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
741         0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
742         0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
743         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
744         0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
745 };
746
747 static const UCHAR SiS_HiTVSt1Timing[] = {
748         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
749         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
750         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
751         0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03,
752         0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10,
753         0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40,
754         0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86,
755         0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00
756 };
757
758 static const UCHAR SiS_HiTVSt2Timing[] = {
759         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
760         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
761         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
762         0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
763         0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
764         0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
765         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
766         0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
767 };
768
769 #if 0
770 static const UCHAR SiS_HiTVTextTiming[] = {
771         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
772         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
773         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
774         0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03,
775         0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20,
776         0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40,
777         0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96,
778         0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00
779 };
780 #endif
781
782 static const UCHAR SiS_HiTVGroup3Data[] = {
783         0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
784         0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6,
785         0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
786         0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44,
787         0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
788         0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9,
789         0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75,
790         0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
791 };
792
793 static const UCHAR SiS_HiTVGroup3Simu[] = {
794         0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
795         0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6,
796         0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
797         0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11,
798         0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
799         0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4,
800         0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
801         0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
802 };
803
804 #if 0
805 static const UCHAR SiS_HiTVGroup3Text[] = {
806         0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
807         0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
808         0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
809         0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22,
810         0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
811         0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca,
812         0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
813         0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
814 };
815 #endif
816
817 static const UCHAR SiS_NTSCPhase[]    = {0x21,0xed,0xba,0x08};
818 static const UCHAR SiS_PALPhase[]     = {0x2a,0x05,0xe3,0x00};
819 static const UCHAR SiS_PALMPhase[]    = {0x21,0xE4,0x2E,0x9B};
820 static const UCHAR SiS_PALNPhase[]    = {0x21,0xF4,0x3E,0xBA};
821 static const UCHAR SiS_NTSCPhase2[]   = {0x21,0xF0,0x7B,0xD6};
822 static const UCHAR SiS_PALPhase2[]    = {0x2a,0x09,0x86,0xe9};
823 static const UCHAR SiS_PALMPhase2[]   = {0x21,0xE6,0xEF,0xA4};
824 static const UCHAR SiS_PALNPhase2[]   = {0x21,0xF6,0x94,0x46};
825 static const UCHAR SiS_SpecialPhase[] = {0x1e,0x8c,0x5c,0x7a};
826 static const UCHAR SiS_SpecialPhaseM[]= {0x1e,0x83,0x0a,0xe0};
827 static const UCHAR SiS_SpecialPhaseJ[]= {0x25,0xd4,0xfd,0x5e};
828
829 static const SiS_TVDataStruct  SiS_StPALData[] =
830 {
831  {    1,   1, 864, 525,1270, 400, 100,   0, 760,0xf4,0xff,0x1c,0x22},
832  {    1,   1, 864, 525,1270, 350, 100,   0, 760,0xf4,0xff,0x1c,0x22},
833  {    1,   1, 864, 525,1270, 400,   0,   0, 720,0xf1,0x04,0x1f,0x18},
834  {    1,   1, 864, 525,1270, 350,   0,   0, 720,0xf4,0x0b,0x1c,0x0a},
835  {    1,   1, 864, 525,1270, 480,  50,   0, 760,0xf4,0xff,0x1c,0x22},
836  {    1,   1, 864, 525,1270, 600,  50,   0,   0,0xf4,0xff,0x1c,0x22}
837 };
838
839 static const SiS_TVDataStruct  SiS_ExtPALData[] =
840 {
841  {   27,  10, 848, 448,1270, 530,  50,   0,  50,0xf4,0xff,0x1c,0x22},  /* 640x400, 320x200 */
842  {  108,  35, 848, 398,1270, 530,  50,   0,  50,0xf4,0xff,0x1c,0x22},
843  {   12,   5, 954, 448,1270, 530,  50,   0,  50,0xf1,0x04,0x1f,0x18},
844  {    9,   4, 960, 463,1644, 438,  50,   0,  50,0xf4,0x0b,0x1c,0x0a},
845  {    9,   4, 848, 528,1270, 530,   0,   0,  50,0xf5,0xfb,0x1b,0x2a},  /* 640x480, 320x240 */
846 /*{  36,  25,1060, 648,1316, 530, 438,   0, 438,0xeb,0x05,0x25,0x16},*//* 800x600, 400x300 */
847  {   36,  25,1060, 648,1270, 530, 438,   0, 438,0xeb,0x05,0x25,0x16},  /* 800x600, 400x300 - better */
848  {    3,   2,1080, 619,1270, 540, 438,   0, 438,0xf3,0x00,0x1d,0x20},  /* 720x576 */
849  {    1,   1,1170, 821,1270, 520, 686,   0, 686,0xF3,0x00,0x1D,0x20},  /* 1024x768 */
850  {    1,   1,1170, 821,1270, 520, 686,   0, 686,0xF3,0x00,0x1D,0x20},  /* 1024x768 (for NTSC equ) */
851  {    9,   4, 848, 528,1270, 530,   0,   0,  50,0xf5,0xfb,0x1b,0x2a}   /* 720x480 test */
852 };
853
854 static const SiS_TVDataStruct  SiS_StNTSCData[] =
855 {
856  {    1,   1, 858, 525,1270, 400,  50,   0, 760,0xf1,0x04,0x1f,0x18},
857  {    1,   1, 858, 525,1270, 350,  50,   0, 640,0xf1,0x04,0x1f,0x18},
858  {    1,   1, 858, 525,1270, 400,   0,   0, 720,0xf1,0x04,0x1f,0x18},
859  {    1,   1, 858, 525,1270, 350,   0,   0, 720,0xf4,0x0b,0x1c,0x0a},
860  {    1,   1, 858, 525,1270, 480,   0,   0, 760,0xf1,0x04,0x1f,0x18}
861 };
862
863 static const SiS_TVDataStruct  SiS_ExtNTSCData[] =
864 {
865  {  143,  65, 858, 443,1270, 440, 171,   0, 171,0xf1,0x04,0x1f,0x18},    /* 640x400, 320x200 */
866  {   88,  35, 858, 393,1270, 440, 171,   0, 171,0xf1,0x04,0x1f,0x18},
867  {  143,  70, 924, 443,1270, 440,  92,   0,  92,0xf1,0x04,0x1f,0x18},
868  {  143,  70, 924, 393,1270, 440,  92,   0,  92,0xf4,0x0b,0x1c,0x0a},
869  {  143,  76, 836, 523,1270, 440, 224,   0,   0,0xf1,0x05,0x1f,0x16},    /* 640x480, 320x240 */
870  {  143, 120,1056, 643,1270, 440,   0, 128,   0,0xf4,0x10,0x1c,0x00},    /* 800x600, 400x300  */
871 /*{   2,   1, 858, 503,1270, 480,   0, 128,   0,0xee,0x0c,0x22,0x08},*/  /* 720x480  (old, from 650) */
872  {  143,  76, 836, 523,1270, 440,   0, 128,   0,0xee,0x0c,0x22,0x08},    /* 720x480 - BETTER (from 300 series) */
873 /*{  65,  64,1056, 791,1270, 480, 638,   0,   0,0xEE,0x0C,0x22,0x08} */  /* 1024x768 (525i) */
874  {    1,   1,1100, 811,1412, 440,   0, 128,   0,0xee,0x0c,0x22,0x08},    /* 1024x768 (525i) CORRECTED */
875  {   65,  64,1056, 791,1270, 480, 455,   0,   0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
876 };
877
878 static const SiS_TVDataStruct  SiS_StHiTVData[] =  /* Slave + TVSimu */
879 {
880  {    1,   1, 0x37c,0x233,0x2b2,0x320,    0,  0, 0, 0x00,0x00,0x00,0x00},
881  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0,  0, 0, 0x00,0x00,0x00,0x00},
882  {    1,   1, 0x37c,0x233,0x2b2,0x320,    0,  0, 0, 0x00,0x00,0x00,0x00},
883  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0,  0, 0, 0x00,0x00,0x00,0x00},
884  {    1,   1, 0x37c,0x233,0x2b2,0x3c0,    0,  0, 0, 0x00,0x00,0x00,0x00},
885  {    8,   5, 0x41a,0x2ab,0x670,0x3c0,0x150,128, 0, 0x00,0x00,0x00,0x00}
886 };
887
888 static const SiS_TVDataStruct  SiS_St2HiTVData[] = /* Slave */
889 {
890  {    3,   1, 0x348,0x1e3,0x670,0x3c0,0x032,  0, 0, 0x00,0x00,0x00,0x00},
891  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0,  0, 0, 0x00,0x00,0x00,0x00},
892  {    3,   1, 0x348,0x1e3,0x670,0x3c0,0x032,  0, 0, 0x00,0x00,0x00,0x00},
893  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0,  0, 0, 0x00,0x00,0x00,0x00},
894  {    5,   2, 0x348,0x233,0x670,0x3c0,0x08d,128, 0, 0x00,0x00,0x00,0x00},
895  {    8,   5, 0x41a,0x2ab,0x670,0x3c0,0x17c,128, 0, 0x00,0x00,0x00,0x00}
896 };
897
898 static const SiS_TVDataStruct  SiS_ExtHiTVData[] =
899 {
900  {    6,   1, 0x348,0x233,0x660,0x3c0,    0,  0, 0, 0x00,0x00,0x00,0x00},
901  {    3,   1, 0x3c0,0x233,0x660,0x3c0,    0,  0, 0, 0x00,0x00,0x00,0x00},
902  {    6,   1, 0x348,0x233,0x660,0x3c0,    0,  0, 0, 0x00,0x00,0x00,0x00},
903  {    3,   1, 0x3c0,0x233,0x660,0x3c0,    0,  0, 0, 0x00,0x00,0x00,0x00},
904  {    5,   1, 0x348,0x233,0x670,0x3c0,0x166,128, 0, 0x00,0x00,0x00,0x00},  /* 640x480   */
905  {   16,   5, 0x41a,0x2ab,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00},  /* 800x600   */
906  {   25,  12, 0x4ec,0x353,0x670,0x3c0,0x032,  0, 0, 0x00,0x00,0x00,0x00},  /* 1024x768  */
907  {    5,   4, 0x627,0x464,0x670,0x3c0,0x128,  0, 0, 0x00,0x00,0x00,0x00},  /* 1280x1024 */
908  {    4,   1, 0x41a,0x233,0x60c,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00},  /* 800x480   */
909  {    5,   2, 0x578,0x293,0x670,0x3c0,0x032,  0, 0, 0x00,0x00,0x00,0x00},  /* 1024x576  */
910  {    8,   5, 0x6d6,0x323,0x670,0x3c0,0x128,  0, 0, 0x00,0x00,0x00,0x00}   /* 1280x720  */
911 };
912
913 static const SiS_TVDataStruct  SiS_St525pData[] =
914 {
915  {    1,   1, 0x6b4,0x20d,0x4f6,0x190,   50,  0, 0x2f8, 0x00,0x00,0x00,0x00},
916  {    1,   1, 0x6b4,0x20d,0x4f6,0x15e,   50,  0, 0x280, 0x00,0x00,0x00,0x00},
917  {    1,   1, 0x6b4,0x20d,0x4f6,0x190,   50,  0, 0x2f8, 0x00,0x00,0x00,0x00},
918  {    1,   1, 0x6b4,0x20d,0x4f6,0x15e,   50,  0, 0x280, 0x00,0x00,0x00,0x00},
919  {    1,   1, 0x6b4,0x20d,0x4f6,0x1e0,    0,  0, 0x2f8, 0x00,0x00,0x00,0x00}
920 };
921
922 static const SiS_TVDataStruct  SiS_St750pData[] =
923 {
924  {    1,   1, 0x672,0x2ee,0x500,0x190,   50,  0, 0x2f8, 0x00,0x00,0x00,0x00},
925  {    1,   1, 0x672,0x2ee,0x500,0x15e,   50,  0, 0x280, 0x00,0x00,0x00,0x00},
926  {    1,   1, 0x672,0x2ee,0x500,0x190,    0,  0, 0x2d0, 0x00,0x00,0x00,0x00},
927  {    1,   1, 0x672,0x2ee,0x500,0x15e,    0,  0, 0x2d0, 0x00,0x00,0x00,0x00},
928  {    1,   1, 0x672,0x2ee,0x500,0x1e0,    0,  0, 0x2f8, 0x00,0x00,0x00,0x00}
929 };
930
931 static const SiS_TVDataStruct  SiS_Ext750pData[] =
932 {
933 #if 1
934  {  143,  65, 0x35a,0x1bb,0x4f6,0x1b8,0x0ab,  0, 0x0ab, 0x00,0x00,0x00,0x00},
935  {   88,  35, 0x35a,0x189,0x4f6,0x1b8,0x0ab,  0, 0x0ab, 0x00,0x00,0x00,0x00},
936  {   18,   5, 0x339,0x1ae,0x500,0x2d0,0x05c,  0, 0x05c, 0x00,0x00,0x00,0x00},
937  {  143,  70, 0x39c,0x189,0x4f6,0x1b8,0x05c,  0, 0x05c, 0x00,0x00,0x00,0x00},
938  {   99,  32, 0x320,0x1fe,0x500,0x2d0,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 640x480  */
939  {    5,   4, 0x5d8,0x29e,0x500,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 800x600  */
940 #if 0
941  {    2,   1, 0x35a,0x1f7,0x4f6,0x1e0,    0,128,     0, 0x00,0x00,0x00,0x00},  /* 720x480  */
942 #endif
943  {   99,  32, 0x320,0x1fe,0x500,0x2d0,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 720x480 test WORKS */
944  {   68,  64, 0x55f,0x346,0x500,0x2a8,0x27e,  0,     0, 0x00,0x00,0x00,0x00},  /* 1024x768 */
945  {    5,   2, 0x3a7,0x226,0x500,0x2a8,    0,128,     0, 0x00,0x00,0x00,0x00},  /* 720x576  */
946  {   25,  24, 0x5d8,0x2f3,0x460,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00}   /* 1280x720 WORKS */
947 #endif
948 #if 0
949  {    3,   1, 0x3a7,0x1d6,0x500,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},
950  {   24,   7, 0x3a7,0x1a4,0x500,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},
951  {    3,   1, 0x3a7,0x1d6,0x500,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},
952  {   24,   7, 0x3a7,0x1a4,0x500,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},
953  {   99,  32, 0x320,0x1fe,0x500,0x2d0,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 640x480   */
954  {    5,   4, 0x5d8,0x29e,0x500,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 800x600   */
955  {    2,   1, 0x35a,0x1f7,0x4f6,0x1e0,    0,128,     0, 0x00,0x00,0x00,0x00},  /* 720x480   */
956  {   68,  64, 0x55f,0x346,0x500,0x2a8,0x27e,  0,     0, 0x00,0x00,0x00,0x00},  /* 1024x768  */
957  {   25,  24, 0x5d8,0x2f3,0x460,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00}   /* 1280x720  */
958 #endif
959 #if 0
960  {  136,  35, 0x339,0x181,0x460,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* TEST (0.93) BAD */
961  {   17,   6, 0x339,0x203,0x460,0x2a8,   50,  0,    50, 0x00,0x00,0x00,0x00},
962  {  136,  35, 0x339,0x181,0x460,0x2a8,   50,  0,    50, 0x00,0x00,0x00,0x00},
963  {   17,   6, 0x339,0x203,0x460,0x2a8,   50,  0,    50, 0x00,0x00,0x00,0x00},
964  {   85,  46, 0x3f4,0x27b,0x460,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 640x480   */
965  {   17,  16, 0x55f,0x323,0x460,0x2a8,0x2b6,  0,     0, 0x00,0x00,0x00,0x00},  /* 800x600   */
966  {  136,  35, 0x339,0x181,0x460,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 720x480   */
967  {  187,  74, 0x39d,0x203,0x460,0x2a8,   50,  0,     0, 0x00,0x00,0x00,0x00},  /* 1024x768  */
968  {   25,  24, 0x5d8,0x2f3,0x460,0x2a8,   50,  0,    50, 0x00,0x00,0x00,0x00}   /* 1280x720  */
969 #endif
970 };
971
972 static const SiS_LCDDataStruct  SiS_LCD1280x720Data[] =
973 {
974         {  14,    5,  864,  432, 1344,  806 }, /* 640x400 */
975         {  16,    5,  864,  378, 1344,  806 },
976         {  14,    5,  864,  432, 1344,  806 },
977         {  16,    5,  864,  378, 1344,  806 },
978         {  24,   11,  924,  523, 1344,  806 }, /* 640x480 */
979         {   7,    5, 1152,  664, 1344,  806 }, /* 800x600 */
980         {   0,    0,    0,    0,    0,    0 },
981         {   0,    0,    0,    0,    0,    0 },
982         {   0,    0,    0,    0,    0,    0 },
983         {   0,    0,    0,    0,    0,    0 },
984         {   1,    1, 1344,  806, 1344,  806 }  /* 1280x720 */
985 };
986
987 /* About 1280x768: For TMDS, Panel_1280x768 will only be set if
988  * the panel is a Fujitsu 7911 (VL-17WDX8) (with clock 81, 1688x802)
989  * Other TMDS panels of this resolution will be treated as custom.
990  * For LVDS, we know two types. Data follows:
991  */
992
993 static const SiS_LCDDataStruct  SiS_StLCD1280x768_2Data[] =
994 {
995         {  64,   21,  858,  434, 1408,  806 }, /* 640x400 */
996         {  32,    9,  858,  372, 1408,  806 },
997         {  64,   21,  858,  434, 1408,  806 },
998         {  32,    9,  858,  372, 1408,  806 },
999         { 143,   68, 1024,  527, 1408,  806 }, /* 640x480 */
1000         {  64,   51, 1364,  663, 1408,  806 }, /* 800x600 */
1001         {  88,   81, 1296,  806, 1408,  806 }, /* 1024x768 */
1002         {   0,    0,    0,    0,    0,    0 },
1003         {   1,    1, 1408,  806, 1408,  806 }  /* 1280x768 */
1004 };
1005
1006 static const SiS_LCDDataStruct  SiS_ExtLCD1280x768_2Data[] =
1007 {
1008         {  64,   25, 1056,  422, 1408,  806 }, /*, 664 */
1009         { 128,   39,  884,  396, 1408,  806 }, /*, 640 */
1010         {  64,   25, 1056,  422, 1408,  806 }, /*, 664 */
1011         { 128,   39,  884,  396, 1408,  806 }, /*, 640 */
1012         {  32,   15, 1056,  513, 1408,  806 }, /*, 664 */
1013         { 176,  125, 1280,  640, 1408,  806 }, /*, 768 */
1014         {  88,   81, 1296,  806, 1408,  806 },
1015         {   0,    0,    0,    0,    0,    0 },
1016         {   1,    1, 1408,  806, 1408,  806 }
1017 };
1018
1019 static const SiS_LCDDataStruct  SiS_LCD1280x768_3Data[] =
1020 {
1021         {  64,   25, 1056,  422, 1664,  798 },                  /* 640x400 */
1022         { 128,   39,  884,  396, 1408,  806 }, /* ,640 */
1023         {  64,   25, 1056,  422, 1664,  798 },                  /* 640x400 */
1024         { 128,   39,  884,  396, 1408,  806 }, /* ,640 */
1025         {  32,   15, 1056,  513, 1408,  806 }, /* ,664 */       /* 640x480 */
1026         { 176,  125, 1280,  640, 1408,  806 }, /* ,768 */       /* 800x600 */
1027         {  64,   61, 1342,  806, 1408,  806 },                  /* 1024x768 */
1028         {   0,    0,    0,    0,    0,    0 },
1029         {   1,    1, 1408,  806, 1408,  806 }                   /* 1280x768 */
1030 };
1031
1032 static const SiS_LCDDataStruct  SiS_LCD1280x800Data[] =
1033 {
1034         { 128,   51, 1122,  412, 1408,  816 }, /* 640x400 */
1035         { 128,   49, 1232,  361, 1408,  816 },
1036         { 128,   51, 1122,  412, 1408,  816 },
1037         { 128,   49, 1232,  361, 1408,  816 },
1038         {   8,    3,  880,  491, 1408,  816 }, /* 640x480 */
1039         {  11,    6, 1024,  612, 1408,  816 }, /* 800x600 */
1040         {  22,   21, 1400,  784, 1408,  816 }, /* 1024x768 */
1041         {   0,    0,    0,    0,    0,    0 },
1042         {   1,    1, 1408,  816, 1408,  816 }  /* 1280x800 */
1043 };
1044
1045 static const SiS_LCDDataStruct  SiS_LCD1280x960Data[] =
1046 {
1047         {    9,   2,  800,  500, 1800, 1000 },
1048         {    9,   2,  800,  500, 1800, 1000 },
1049         {    4,   1,  900,  500, 1800, 1000 },
1050         {    4,   1,  900,  500, 1800, 1000 },
1051         {    9,   2,  800,  500, 1800, 1000 },
1052         {   30,  11, 1056,  625, 1800, 1000 },
1053         {    5,   3, 1350,  800, 1800, 1000 },
1054         {    1,   1, 1576, 1050, 1576, 1050 },
1055         {    1,   1, 1800, 1000, 1800, 1000 }
1056 };
1057
1058 static const SiS_LCDDataStruct  SiS_StLCD1400x1050Data[] =
1059 {
1060         { 211,  100, 2100,  408, 1688, 1066 },
1061         { 211,   64, 1536,  358, 1688, 1066 },
1062         { 211,  100, 2100,  408, 1688, 1066 },
1063         { 211,   64, 1536,  358, 1688, 1066 },
1064         { 211,   48,  840,  488, 1688, 1066 },
1065         { 211,   72, 1008,  609, 1688, 1066 },
1066         { 211,  128, 1400,  776, 1688, 1066 },
1067         { 211,  205, 1680, 1041, 1688, 1066 },
1068         {   1,    1, 1688, 1066, 1688, 1066 }
1069 };
1070
1071 static const SiS_LCDDataStruct  SiS_ExtLCD1400x1050Data[] =
1072 {
1073 /*      { 211,   60, 1260,  410, 1688, 1066 },    640x400 (6330) */
1074         { 211,  100, 2100,  408, 1688, 1066 }, /* 640x400 (6325) WORKS */
1075         { 211,   64, 1536,  358, 1688, 1066 },
1076         { 211,  100, 2100,  408, 1688, 1066 },
1077         { 211,   64, 1536,  358, 1688, 1066 },
1078 /*      { 211,   80, 1400,  490, 1688, 1066 },    640x480 (6330) */
1079         { 211,   48,  840,  488, 1688, 1066 }, /* 640x480 (6325) WORKS */
1080 /*      { 211,  117, 1638,  613, 1688, 1066 },    800x600 (6330) */
1081         { 211,   72, 1008,  609, 1688, 1066 }, /* 800x600 (6325) WORKS */
1082         { 211,  128, 1400,  776, 1688, 1066 }, /* 1024x768 */
1083         { 211,  205, 1680, 1041, 1688, 1066 }, /* 1280x1024 - not used (always unscaled) */
1084         {   1,    1, 1688, 1066, 1688, 1066 }, /* 1400x1050 */
1085         {   0,    0,    0,    0,    0,    0 }, /* kludge */
1086         { 211,  120, 1400,  730, 1688, 1066 }  /* 1280x720 */
1087 };
1088
1089 static const SiS_LCDDataStruct  SiS_LCD1680x1050Data[] =
1090 {
1091         {  95,   24, 1260,  410, 1900, 1066 }, /*  0 640x400 */
1092         {  10,    3, 1710,  362, 1900, 1066 },
1093         {  95,   24, 1260,  410, 1900, 1066 },
1094         {  10,    3, 1710,  362, 1900, 1066 },
1095         {  95,   32, 1400,  490, 1900, 1066 }, /*  4 640x480 */
1096         {  95,   42, 1470,  610, 1900, 1066 }, /*  5 800x600 */
1097         {  95,   64, 1750,  784, 1900, 1066 }, /*  6 1024x768 */
1098         {  95,   94, 1900, 1055, 1900, 1066 }, /*  7 1280x1024 */
1099         {  41,   31, 1900,  806, 1900, 1066 }, /*  8 1280x768 */
1100         {  95,   69, 1800,  817, 1900, 1066 }, /*  9 1280x800 patch */
1101         {  13,    9, 1900,  739, 1900, 1066 }, /* 10 1280x720 */
1102         {  95,   94, 1880, 1066, 1900, 1066 }, /* 11 1400x1050 patch */
1103         {   1,    1, 1900, 1066, 1900, 1066 }  /* 12 1680x1050 */
1104 };
1105
1106 static const SiS_LCDDataStruct  SiS_StLCD1600x1200Data[] =
1107 {
1108         {27,  4, 800, 500, 2160, 1250 },
1109         {27,  4, 800, 500, 2160, 1250 },
1110         { 6,  1, 900, 500, 2160, 1250 },
1111         { 6,  1, 900, 500, 2160, 1250 },
1112         {27,  1, 800, 500, 2160, 1250 },
1113         { 4,  1,1080, 625, 2160, 1250 },
1114         { 5,  2,1350, 800, 2160, 1250 },
1115         {135,88,1600,1100, 2160, 1250 },
1116         {72, 49,1680,1092, 2160, 1250 },
1117         { 1,  1,2160,1250, 2160, 1250 }
1118 };
1119
1120 static const SiS_LCDDataStruct  SiS_ExtLCD1600x1200Data[] =
1121 {
1122         {72,11, 990, 422, 2160, 1250 }, /* 640x400 (6330) WORKS */
1123 /*      {27, 4, 800, 500, 2160, 1250 },    640x400 (6235) */
1124         {27, 4, 800, 500, 2160, 1250 },
1125         { 6, 1, 900, 500, 2160, 1250 },
1126         { 6, 1, 900, 500, 2160, 1250 },
1127         {45, 8, 960, 505, 2160, 1250 }, /* 640x480 (6330) WORKS */
1128 /*      {27, 1, 800, 500, 2160, 1250 },    640x480 (6325) */
1129         { 4, 1,1080, 625, 2160, 1250 },
1130         { 5, 2,1350, 800, 2160, 1250 },
1131         {27,16,1500,1064, 2160, 1250 }, /* 1280x1024 */
1132         {72,49,1680,1092, 2160, 1250 }, /* 1400x1050 (6330, was not supported on 6325) */
1133         { 1, 1,2160,1250, 2160, 1250 }
1134 };
1135
1136 static const SiS_LCDDataStruct  SiS_NoScaleData[] =
1137 {
1138         { 1, 1, 800, 449, 800, 449 },  /* 0x00: 320x200, 640x400 */
1139         { 1, 1, 800, 449, 800, 449 },
1140         { 1, 1, 900, 449, 900, 449 },
1141         { 1, 1, 900, 449, 900, 449 },
1142         { 1, 1, 800, 525, 800, 525 },  /* 0x04: 320x240, 640x480  */
1143         { 1, 1,1056, 628,1056, 628 },  /* 0x05: 400x300, 800x600  */
1144         { 1, 1,1344, 806,1344, 806 },  /* 0x06: 512x384, 1024x768 */
1145         { 1, 1,1688,1066,1688,1066 },  /* 0x07: 1280x1024 */
1146         { 1, 1,1688, 802,1688, 802 },  /* 0x08: 1280x768: Fujitsu, TMDS only */
1147         { 1, 1,2160,1250,2160,1250 },  /* 0x09: 1600x1200 */
1148         { 1, 1,1800,1000,1800,1000 },  /* 0x0a: 1280x960  */
1149         { 1, 1,1688,1066,1688,1066 },  /* 0x0b: 1400x1050 */
1150         { 1, 1,1650, 750,1650, 750 },  /* 0x0c: 1280x720 (TMDS, projector)  */
1151         { 1, 1,1656, 841,1656, 841 },  /* 0x0d: 1280x800 (was: 1408, 816) */
1152         { 1, 1,1900,1066,1900,1066 },  /* 0x0e: 1680x1050 (LVDS) */
1153         { 1, 1,1408, 806,1408, 806 },  /* 0x0f: 1280x768_2 */
1154         { 1, 1,1664, 798,1664, 798 },  /* 0x10: 1280x768_3 */
1155         { 1, 1,1688, 802,1688, 802 },  /* 0x11: 1280x768: Std, TMDS only */
1156         { 1, 1,1344, 806,1344, 806 },  /* 0x12: 1280x720 (LVDS)  */
1157         { 1, 1, 896, 497, 896, 497 },  /* 0x13: 720x480 */
1158         { 1, 1, 912, 597, 912, 597 },  /* 0x14: 720x576 */
1159         { 1, 1, 912, 597, 912, 597 },  /* 0x15: 768x576 */
1160         { 1, 1,1056, 497,1056, 497 },  /* 0x16: 848x480 */
1161         { 1, 1,1064, 497,1064, 497 },  /* 0x17: 856x480 */
1162         { 1, 1,1056, 497,1056, 497 },  /* 0x18: 800x480 */
1163         { 1, 1,1328, 739,1328, 739 },  /* 0x19: 1024x576 */
1164         { 1, 1,1680, 892,1680, 892 },  /* 0x1a: 1152x864 */
1165         { 1, 1,1808, 808,1808, 808 },  /* 0x1b: 1360x768 */
1166         { 1, 1,1104, 563,1104, 563 }   /* 0x1c: 960x540 */
1167 };
1168
1169
1170 /**************************************************************/
1171 /* LVDS ----------------------------------------------------- */
1172 /**************************************************************/
1173
1174 static const SiS_LVDSDataStruct  SiS_LVDS320x480Data_1[]=
1175 {
1176         { 848, 433, 400, 525},
1177         { 848, 389, 400, 525},
1178         { 848, 433, 400, 525},
1179         { 848, 389, 400, 525},
1180         { 848, 518, 400, 525},
1181         {1056, 628, 400, 525},
1182         { 400, 525, 400, 525},
1183         { 800, 449,1000, 644},
1184         { 800, 525,1000, 635}
1185 };
1186
1187 static const SiS_LVDSDataStruct  SiS_LVDS640x480Data_1[]=
1188 {
1189         { 800, 445, 800, 525},   /* 800, 449, 800, 449 */
1190         { 800, 395, 800, 525},
1191         { 800, 445, 800, 525},
1192         { 800, 395, 800, 525},
1193         { 800, 525, 800, 525},
1194         { 800, 525, 800, 525},   /* pseudo */
1195         { 800, 525, 800, 525}    /* pseudo */
1196 };
1197
1198 /* FSTN 320x240 */
1199 static const SiS_LVDSDataStruct  SiS_LVDS640x480Data_2[]=
1200 {
1201         { 800, 445, 800, 525},
1202         { 800, 395, 800, 525},
1203         { 800, 445, 800, 525},
1204         { 800, 395, 800, 525},
1205         { 800, 525, 800, 525},
1206         { 800, 525, 800, 525},   /* pseudo */
1207         { 800, 525, 800, 525}    /* pseudo */
1208 };
1209
1210
1211 static const SiS_LVDSDataStruct  SiS_LVDS800x600Data_1[]=
1212 {
1213         { 848, 433,1060, 629},
1214         { 848, 389,1060, 629},
1215         { 848, 433,1060, 629},
1216         { 848, 389,1060, 629},
1217         { 848, 518,1060, 629},
1218         {1056, 628,1056, 628},
1219         {1056, 628,1056, 628}
1220 };
1221
1222 static const SiS_LVDSDataStruct  SiS_LVDS800x600Data_2[]=
1223 {
1224         {1056, 628,1056, 628},
1225         {1056, 628,1056, 628},
1226         {1056, 628,1056, 628},
1227         {1056, 628,1056, 628},
1228         {1056, 628,1056, 628},
1229         {1056, 628,1056, 628},
1230         {1056, 628,1056, 628}
1231 };
1232
1233 static const SiS_LVDSDataStruct  SiS_LVDS1024x768Data_1[]=
1234 {
1235         { 840, 438,1344, 806},
1236         { 840, 409,1344, 806},
1237         { 840, 438,1344, 806},
1238         { 840, 409,1344, 806},
1239         { 840, 518,1344, 806},   /* 640x480 */
1240         {1050, 638,1344, 806},   /* 800x600 */
1241         {1344, 806,1344, 806},   /* 1024x768 */
1242 };
1243
1244 static const SiS_LVDSDataStruct  SiS_LVDS1024x768Data_2[]=
1245 {
1246         {1344, 806,1344, 806},
1247         {1344, 806,1344, 806},
1248         {1344, 806,1344, 806},
1249         {1344, 806,1344, 806},
1250         {1344, 806,1344, 806},
1251         {1344, 806,1344, 806},
1252         {1344, 806,1344, 806},
1253 };
1254
1255 static const SiS_LVDSDataStruct  SiS_LVDS1280x1024Data_1[]=
1256 {
1257         {1048, 442,1688,1066},
1258         {1048, 392,1688,1066},
1259         {1048, 442,1688,1066},
1260         {1048, 392,1688,1066},
1261         {1048, 522,1688,1066},
1262         {1208, 642,1688,1066},
1263         {1432, 810,1688,1066},
1264         {1688,1066,1688,1066}
1265 };
1266
1267 static const SiS_LVDSDataStruct  SiS_LVDS1280x1024Data_2[]=
1268 {
1269         {1688,1066,1688,1066},
1270         {1688,1066,1688,1066},
1271         {1688,1066,1688,1066},
1272         {1688,1066,1688,1066},
1273         {1688,1066,1688,1066},
1274         {1688,1066,1688,1066},
1275         {1688,1066,1688,1066},
1276         {1688,1066,1688,1066}
1277 };
1278
1279 static const SiS_LVDSDataStruct  SiS_LVDS1400x1050Data_1[]=
1280 {
1281         { 928, 416, 1688,1066},
1282         { 928, 366, 1688,1066},
1283         { 928, 416, 1688,1066},
1284         { 928, 366, 1688,1066},
1285         { 928, 496, 1688,1066},
1286         {1088, 616, 1688,1066},
1287         {1312, 784, 1688,1066},
1288         {1568,1040, 1688,1066},
1289         {1688,1066, 1688,1066}
1290 };
1291
1292 static const SiS_LVDSDataStruct  SiS_LVDS1400x1050Data_2[]=
1293 {
1294         {1688,1066, 1688,1066},
1295         {1688,1066, 1688,1066},
1296         {1688,1066, 1688,1066},
1297         {1688,1066, 1688,1066},
1298         {1688,1066, 1688,1066},
1299         {1688,1066, 1688,1066},
1300         {1688,1066, 1688,1066},
1301         {1688,1066, 1688,1066},
1302         {1688,1066, 1688,1066},
1303 };
1304
1305 static const SiS_LVDSDataStruct  SiS_LVDS1600x1200Data_1[]=
1306 {
1307         {1088, 520, 2048,1320},
1308         {1088, 470, 2048,1320},
1309         {1088, 520, 2048,1320},
1310         {1088, 470, 2048,1320},
1311         {1088, 600, 2048,1320},
1312         {1248, 720, 2048,1320},
1313         {1472, 888, 2048,1320},
1314         {1728,1144, 2048,1320},
1315         {1848,1170, 2048,1320},
1316         {2048,1320, 2048,1320}
1317 #if 0
1318         {1088, 450, 2048,1250},
1319         {1088, 400, 2048,1250},
1320         {1088, 450, 2048,1250},
1321         {1088, 400, 2048,1250},
1322         {1088, 530, 2048,1250},
1323         {1248, 650, 2048,1250},
1324         {1472, 818, 2048,1250},
1325         {1728,1066, 2048,1250},
1326         {1848,1066, 2048,1250},
1327         {2048,1250, 2048,1250}
1328 #endif
1329 };
1330
1331 static const SiS_LVDSDataStruct  SiS_LVDS1600x1200Data_2[]=
1332 {
1333         {2048,1320, 2048,1320},
1334         {2048,1320, 2048,1320},
1335         {2048,1320, 2048,1320},
1336         {2048,1320, 2048,1320},
1337         {2048,1320, 2048,1320},
1338         {2048,1320, 2048,1320},
1339         {2048,1320, 2048,1320},
1340         {2048,1320, 2048,1320},
1341         {2048,1320, 2048,1320},
1342         {2048,1320, 2048,1320}
1343 };
1344
1345 static const SiS_LVDSDataStruct  SiS_LVDS1280x960Data_1[]=
1346 {
1347         { 840, 438,1344, 806},
1348         { 840, 409,1344, 806},
1349         { 840, 438,1344, 806},
1350         { 840, 409,1344, 806},
1351         { 840, 518,1344, 806},
1352         {1050, 638,1344, 806},
1353         {1344, 806,1344, 806},
1354         { 800, 449,1280, 801},
1355         { 800, 525,1280, 813}
1356 };
1357
1358 static const SiS_LVDSDataStruct  SiS_LVDS1280x960Data_2[]=
1359 {
1360         {1344, 806,1344, 806},
1361         {1344, 806,1344, 806},
1362         {1344, 806,1344, 806},
1363         {1344, 806,1344, 806},
1364         {1344, 806,1344, 806},
1365         {1344, 806,1344, 806},
1366         {1344, 806,1344, 806},
1367         { 800, 449,1280, 801},
1368         { 800, 525,1280, 813}
1369 };
1370
1371 static const SiS_LVDSDataStruct  SiS_LVDS1280x768Data_1[]=
1372 {
1373         { 768, 438, 1408, 806},
1374         { 768, 388, 1408, 806},
1375         { 768, 438, 1408, 806},
1376         { 768, 388, 1408, 806},
1377         { 768, 518, 1408, 806},
1378         { 928, 638, 1408, 806},
1379         {1152, 806, 1408, 806},
1380         {1408, 806, 1408, 806},
1381         {1408, 806, 1408, 806}
1382 };
1383
1384 static const SiS_LVDSDataStruct  SiS_LVDS1280x768Data_2[]=
1385 {
1386         {1408, 806, 1408, 806},
1387         {1408, 806, 1408, 806},
1388         {1408, 806, 1408, 806},
1389         {1408, 806, 1408, 806},
1390         {1408, 806, 1408, 806},
1391         {1408, 806, 1408, 806},
1392         {1408, 806, 1408, 806},
1393         {1408, 806, 1408, 806},
1394         {1408, 806, 1408, 806}
1395 };
1396
1397 static const SiS_LVDSDataStruct  SiS_LVDS1024x600Data_1[] =
1398 {
1399         { 840, 604,1344, 800},
1400         { 840, 560,1344, 800},
1401         { 840, 604,1344, 800},
1402         { 840, 560,1344, 800},
1403         { 840, 689,1344, 800},
1404         {1050, 800,1344, 800},
1405         {1344, 800,1344, 800}
1406 };
1407
1408 static const SiS_LVDSDataStruct  SiS_LVDS1024x600Data_2[] =
1409 {
1410         {1344, 800,1344, 800},
1411         {1344, 800,1344, 800},
1412         {1344, 800,1344, 800},
1413         {1344, 800,1344, 800},
1414         {1344, 800,1344, 800},
1415         {1344, 800,1344, 800},
1416         {1344, 800,1344, 800}
1417 };
1418
1419 static const SiS_LVDSDataStruct  SiS_LVDS1152x768Data_1[] =
1420 {
1421         { 840, 438,1344, 806},
1422         { 840, 409,1344, 806},
1423         { 840, 438,1344, 806},
1424         { 840, 409,1344, 806},
1425         { 840, 518,1344, 806},
1426         {1050, 638,1344, 806},
1427         {1344, 806,1344, 806}
1428 };
1429
1430 static const SiS_LVDSDataStruct  SiS_LVDS1152x768Data_2[] =
1431 {
1432         {1344, 806,1344, 806},
1433         {1344, 806,1344, 806},
1434         {1344, 806,1344, 806},
1435         {1344, 806,1344, 806},
1436         {1344, 806,1344, 806},
1437         {1344, 806,1344, 806},
1438         {1344, 806,1344, 806}
1439 };
1440
1441 /* Pass 1:1 data */
1442 static const SiS_LVDSDataStruct  SiS_LVDSXXXxXXXData_1[]=
1443 {
1444         { 800, 449,  800, 449},
1445         { 800, 449,  800, 449},
1446         { 900, 449,  900, 449},
1447         { 900, 449,  900, 449},
1448         { 800, 525,  800, 525},  /*  640x480   */
1449         {1056, 628, 1056, 628},  /*  800x600   */
1450         {1344, 806, 1344, 806},  /* 1024x768   */
1451         {1688,1066, 1688,1066},  /* 1280x1024  */  /* INSERTED ! */
1452         {1688, 806, 1688, 806},  /* 1280x768   */
1453         /* No other panels ! */
1454 };
1455
1456 /* Custom data for Barco iQ R series */
1457 static const SiS_LVDSDataStruct  SiS_LVDSBARCO1366Data_1[]=
1458 {
1459         { 832, 438,1331, 806},
1460         { 832, 388,1331, 806},
1461         { 832, 438,1331, 806},
1462         { 832, 388,1331, 806},
1463         { 832, 518,1331, 806},
1464         {1050, 638,1344, 806},
1465         {1344, 806,1344, 806},
1466         {1688,1066,1688,1066},
1467         {1688,1066,1688,1066}   /* 1360x1024 */
1468 };
1469
1470 /* Custom data for Barco iQ R series */
1471 static const SiS_LVDSDataStruct  SiS_LVDSBARCO1366Data_2[]=
1472 {
1473         {1344, 806,1344, 806},
1474         {1344, 806,1344, 806},
1475         {1344, 806,1344, 806},
1476         {1344, 806,1344, 806},
1477         {1344, 806,1344, 806},
1478         {1344, 806,1344, 806},
1479         {1344, 806,1344, 806},
1480         {1688,1066,1688,1066},
1481         {1688,1066,1688,1066}   /* 1360x1024 */
1482 };
1483
1484 /* Custom data for Barco iQ G series */
1485 static const SiS_LVDSDataStruct  SiS_LVDSBARCO1024Data_1[]=
1486 {
1487         { 832, 438,1331, 806},
1488         { 832, 409,1331, 806},
1489         { 832, 438,1331, 806},
1490         { 832, 409,1331, 806},
1491         { 832, 518,1331, 806},   /* 640x480 */
1492         {1050, 638,1344, 806},   /* 800x600 */
1493         {1344, 806,1344, 806},   /* 1024x768 */
1494 };
1495
1496 /* Custom data for Barco iQ G series */
1497 static const SiS_LVDSDataStruct  SiS_LVDSBARCO1024Data_2[]=
1498 {
1499         {1344, 806,1344, 806},
1500         {1344, 806,1344, 806},
1501         {1344, 806,1344, 806},
1502         {1344, 806,1344, 806},
1503         {1344, 806,1344, 806},
1504         {1344, 806,1344, 806},
1505         {1344, 806,1344, 806},
1506 };
1507
1508 /* Custom data for 848x480 parallel panel */
1509 static const SiS_LVDSDataStruct  SiS_LVDS848x480Data_1[]=
1510 {
1511         {   0,   0,   0,   0},
1512         {   0,   0,   0,   0},
1513         {   0,   0,   0,   0},
1514         {   0,   0,   0,   0},
1515         {1088, 525,1088, 525},  /* 640x480 TODO */
1516         {1088, 525,1088, 525},  /* 800x600 TODO */
1517         {1088, 525,1088, 525},  /* 1024x768 TODO */
1518         {   0,   0,   0,   0},
1519         {   0,   0,   0,   0},
1520         {   0,   0,   0,   0},
1521         {   0,   0,   0,   0},
1522         {1088, 525,1088, 525},  /* 848x480 */
1523         {1088, 525,1088, 525}   /* 1360x768 TODO */
1524 };
1525
1526 /* Custom data for 848x480 parallel panel */
1527 static const SiS_LVDSDataStruct  SiS_LVDS848x480Data_2[]=
1528 {
1529         {   0,   0,   0,   0},
1530         {   0,   0,   0,   0},
1531         {   0,   0,   0,   0},
1532         {   0,   0,   0,   0},
1533         {1088, 525,1088, 525},  /*  640x480 */
1534         {1088, 525,1088, 525},  /*  800x600 */
1535         {1088, 525,1088, 525},  /* 1024x768 */
1536         {   0,   0,   0,   0},
1537         {   0,   0,   0,   0},
1538         {   0,   0,   0,   0},
1539         {   0,   0,   0,   0},
1540         {1088, 525,1088, 525},  /* 848x480 */
1541         {1088, 525,1088, 525}   /* 1360x768 TODO */
1542 };
1543
1544 static const SiS_LVDSDataStruct  SiS_CHTVUNTSCData[]=
1545 {
1546         { 840, 600, 840, 600},
1547         { 840, 600, 840, 600},
1548         { 840, 600, 840, 600},
1549         { 840, 600, 840, 600},
1550         { 784, 600, 784, 600},
1551         {1064, 750,1064, 750},
1552         {1160, 945,1160, 945}
1553 };
1554
1555 static const SiS_LVDSDataStruct  SiS_CHTVONTSCData[]=
1556 {
1557         { 840, 525, 840, 525},
1558         { 840, 525, 840, 525},
1559         { 840, 525, 840, 525},
1560         { 840, 525, 840, 525},
1561         { 784, 525, 784, 525},
1562         {1040, 700,1040, 700},
1563         {1160, 840,1160, 840}
1564 };
1565
1566 /* Chrontel TV Skew */
1567
1568 static const SiS_LVDSDesStruct  SiS_CHTVUNTSCDesData[]=
1569 {
1570         { 0,   0},
1571         { 0,   0},
1572         { 0,   0},
1573         { 0,   0},
1574         { 0,   0},
1575         { 0,   0},
1576         { 0,   0}
1577 };
1578
1579 static const SiS_LVDSDesStruct  SiS_CHTVONTSCDesData[]=
1580 {
1581         { 0,   0},
1582         { 0,   0},
1583         { 0,   0},
1584         { 0,   0},
1585         { 0,   0},
1586         { 0,   0},
1587         { 0,   0}
1588 };
1589
1590 static const SiS_LVDSDesStruct  SiS_CHTVUPALDesData[]=
1591 {
1592         {256,   0},
1593         {256,   0},
1594         {256,   0},
1595         {256,   0},
1596         { 0,   0},
1597         { 0,   0},
1598         { 0,   0}
1599 };
1600
1601 static const SiS_LVDSDesStruct  SiS_CHTVOPALDesData[]=
1602 {
1603         {256,   0},
1604         {256,   0},
1605         {256,   0},
1606         {256,   0},
1607         { 0,   0},
1608         { 0,   0},
1609         { 0,   0}
1610 };
1611
1612 /* CRT1 CRTC data for slave modes */
1613
1614 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1320x480_1[] =
1615 {
1616  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1617    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1618    0x00 }},
1619  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1620    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1621    0x00 }},
1622  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1623    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1624    0x00 }},
1625  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1626    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1627    0x00 }},
1628  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1629    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1630    0x00 }},
1631  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1632    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1633    0x01 }},
1634  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1635    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1636    0x00 }}
1637 };
1638
1639 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1640x480_1[] =
1640 {
1641  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1642    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1643    0x00}},
1644  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1645    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1646    0x00}},
1647  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1648    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1649    0x00}},
1650  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1651    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1652    0x00}},
1653  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1654    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1655    0x00}},
1656  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1657    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1658    0x01}}
1659 };
1660
1661 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1640x480_1_H[] =
1662 {
1663  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1664    0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
1665    0x00}},
1666  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1667    0x83,0x85,0x63,0xba,0x00,0x00,0x00,
1668    0x00}},
1669  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1670    0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
1671    0x00}},
1672  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1673    0x83,0x85,0x63,0xba,0x00,0x00,0x00,
1674    0x00}},
1675  {{0x2d,0x28,0x90,0x2c,0x80,0x0b,0x3e,
1676    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1677    0x00}}
1678 };
1679
1680 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1640x480_2[] =
1681 {
1682  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1683    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1684    0x00}},
1685  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1686    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1687    0x00}},
1688  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1689    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1690    0x00}},
1691  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1692    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1693    0x00}},
1694  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1695    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1696    0x00}},
1697  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1698    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1699    0x01}},
1700  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1701    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1702    0x00}}
1703 };
1704
1705 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1640x480_2_H[] =
1706 {
1707  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1708    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1709    0x00}},
1710  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1711    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1712    0x00}},
1713  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1714    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1715    0x00}},
1716  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1717    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1718    0x00}},
1719  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1720    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1721    0x00}},
1722  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1723    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1724    0x01}},
1725  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1726    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1727    0x00}}
1728 };
1729
1730 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1640x480_3[] =
1731 {
1732  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1733    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1734    0x00}},
1735  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1736    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1737    0x00}},
1738  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1739    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1740    0x00}},
1741  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1742    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1743    0x00}},
1744  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1745    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1746    0x00}},
1747  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1748    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1749    0x01}},
1750  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1751    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1752    0x00}}
1753 };
1754
1755 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT1640x480_3_H[] =
1756 {
1757  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1758    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1759    0x00}},
1760  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1761    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1762    0x00}},
1763  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1764    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1765    0x00}},
1766  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1767    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1768    0x00}},
1769  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1770    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1771    0x00}},
1772  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1773    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1774    0x01}},
1775  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1776    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1777    0x00}}
1778 };
1779
1780 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11024x600_1[] =
1781 {
1782  {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e,
1783    0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01,
1784    0x00}},
1785  {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e,
1786    0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01,
1787    0x00}},
1788  {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e,
1789    0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01,
1790    0x00}},
1791  {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e,
1792    0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01,
1793    0x00}},
1794  {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba,
1795    0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01,
1796    0x00}},
1797  {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1,
1798    0xae,0x85,0x57,0x1f,0x30,0x00,0x26,
1799    0x01}},
1800  {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1,
1801    0xae,0x85,0x57,0x1f,0x30,0x00,0x02,
1802    0x01}}
1803 };
1804
1805 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11024x600_1_H[] =
1806 {
1807  {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
1808    0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
1809    0x00}},
1810  {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f,
1811    0x60,0x87,0x5d,0x83,0x10,0x00,0x44,
1812    0x00}},
1813  {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
1814    0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
1815    0x00}},
1816  {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f,
1817    0x60,0x87,0x5d,0x83,0x10,0x00,0x44,
1818    0x00}},
1819  {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e,
1820    0xe2,0x89,0xdf,0x05,0x00,0x00,0x44,
1821    0x00}},
1822  {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0,
1823    0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55,
1824    0x01}},
1825  {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
1826    0x02,0x88,0xff,0x25,0x10,0x00,0x01,
1827    0x01}}
1828 };
1829
1830 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11024x600_2[] =
1831 {
1832  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1833    0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
1834    0x00}},
1835  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1836    0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
1837    0x00}},
1838  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1839    0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
1840    0x00}},
1841  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1842    0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
1843    0x00}},
1844  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1845    0x72,0x88,0xdf,0x25,0x30,0x00,0x06,
1846    0x00}},
1847  {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1,
1848    0xae,0x84,0x57,0x25,0x30,0x00,0x02,
1849    0x01}},
1850  {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
1851    0x02,0x88,0xff,0x25,0x10,0x00,0x02,
1852    0x01}}
1853 };
1854
1855 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11024x600_2_H[] =
1856 {
1857  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1858    0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
1859    0x00}},
1860  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1861    0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
1862    0x00}},
1863  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1864    0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
1865    0x00}},
1866  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1867    0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
1868    0x00}},
1869  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1870    0x72,0x88,0xdf,0x25,0x30,0x00,0x01,
1871    0x00}},
1872  {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1,
1873    0xae,0x84,0x57,0x25,0x30,0x00,0x01,
1874    0x01}},
1875  {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
1876    0x02,0x88,0xff,0x25,0x10,0x00,0x01,
1877    0x01}}
1878 };
1879
1880 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11152x768_1[] =
1881 {
1882  {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f,
1883    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1884    0x00}},
1885  {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f,
1886    0x60,0x87,0x5d,0x83,0x10,0x00,0x01,
1887    0x00}},
1888  {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f,
1889    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1890    0x00}},
1891  {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f,
1892    0x60,0x87,0x5d,0x83,0x10,0x00,0x01,
1893    0x00}},
1894  {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e,
1895    0xe2,0x89,0xdf,0x05,0x00,0x00,0x01,
1896    0x00}},
1897  {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0,
1898    0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26,
1899    0x01}},
1900  {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
1901    0x02,0x88,0xff,0x25,0x10,0x00,0x02,
1902    0x01}}
1903 };
1904
1905 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11152x768_1_H[] =
1906 {
1907  {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
1908    0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
1909    0x00}},
1910  {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f,
1911    0x60,0x87,0x5d,0x83,0x10,0x00,0x44,
1912    0x00}},
1913  {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
1914    0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
1915    0x00}},
1916  {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f,
1917    0x60,0x87,0x5d,0x83,0x10,0x00,0x44,
1918    0x00}},
1919  {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e,
1920    0xe2,0x89,0xdf,0x05,0x00,0x00,0x44,
1921    0x00}},
1922  {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0,
1923    0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55,
1924    0x01}},
1925  {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
1926    0x02,0x88,0xff,0x25,0x10,0x00,0x01,
1927    0x01}}
1928 };
1929
1930 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11152x768_2[] =
1931 {
1932  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1933    0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
1934    0x00}},
1935  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1936    0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
1937    0x00}},
1938  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1939    0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
1940    0x00}},
1941  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1942    0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
1943    0x00}},
1944  {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
1945    0x72,0x88,0xdf,0x25,0x30,0x00,0x06,
1946    0x00}},
1947  {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1,
1948    0xae,0x84,0x57,0x25,0x30,0x00,0x02,
1949    0x01}},
1950  {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
1951    0x02,0x88,0xff,0x25,0x10,0x00,0x02,
1952    0x01}}
1953 };
1954
1955 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11152x768_2_H[] =
1956 {
1957  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1958    0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
1959    0x00}},
1960  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1961    0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
1962    0x00}},
1963  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1964    0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
1965    0x00}},
1966  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1967    0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
1968    0x00}},
1969  {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
1970    0x72,0x88,0xdf,0x25,0x30,0x00,0x01,
1971    0x00}},
1972  {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1,
1973    0xae,0x84,0x57,0x25,0x30,0x00,0x01,
1974    0x01}},
1975  {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
1976    0x02,0x88,0xff,0x25,0x10,0x00,0x01,
1977    0x01}}
1978 };
1979
1980 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11280x768_1[] =
1981 {
1982  {{0x5b,0x4f,0x9f,0x55,0x19,0xb4,0x1f,
1983    0x9c,0x8e,0x8f,0xb5,0x10,0x00,0x01,
1984    0x00}},
1985  {{0x5b,0x4f,0x9f,0x55,0x19,0x82,0x1f,
1986    0x6a,0x8c,0x5d,0x83,0x30,0x00,0x01,
1987    0x00}},
1988  {{0x5b,0x4f,0x9f,0x55,0x19,0xb4,0x1f,
1989    0x9c,0x8e,0x8f,0xb5,0x10,0x00,0x01,
1990    0x00}},
1991  {{0x5b,0x4f,0x9f,0x55,0x19,0x82,0x1f,
1992    0x6a,0x8c,0x5d,0x83,0x30,0x00,0x01,
1993    0x00}},
1994  {{0x5b,0x4f,0x9f,0x55,0x19,0x04,0x3e,
1995    0xec,0x8e,0xdf,0x05,0x20,0x00,0x01,
1996    0x00}},
1997  {{0x6f,0x63,0x93,0x69,0x8d,0x7c,0xf0,
1998    0x64,0x86,0x57,0x7d,0x20,0x00,0x05,
1999    0x01}},
2000  {{0x8b,0x7f,0x8f,0x85,0x09,0x24,0xf5,
2001    0x0c,0x8e,0xff,0x25,0x30,0x00,0x02,
2002    0x01}},
2003  {{0xab,0x9f,0x8f,0xa5,0x89,0x24,0xf5,
2004    0x0c,0x8e,0xff,0x25,0x30,0x00,0x06,
2005    0x01}},
2006  {{0xab,0x9f,0x8f,0xa5,0x89,0x24,0xf5,
2007    0x0c,0x8e,0xff,0x25,0x30,0x00,0x06,
2008    0x01}}
2009 };
2010
2011 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11280x768_1_H[] =
2012 {
2013  {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f,
2014    0x93,0x86,0x8f,0x9f,0x30,0x00,0x05,
2015    0x00}},
2016  {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f,
2017    0x60,0x84,0x5d,0x6d,0x10,0x00,0x05,
2018    0x00}},
2019  {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f,
2020    0x92,0x86,0x8f,0x9f,0x30,0x00,0x05,
2021    0x00}},
2022  {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f,
2023    0x60,0x84,0x5d,0x6d,0x10,0x00,0x05,
2024    0x00}},
2025  {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f,
2026    0xe2,0x86,0xdf,0xef,0x10,0x00,0x05,
2027    0x00}},
2028  {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0,
2029    0x5a,0x8e,0x57,0x67,0x20,0x00,0x01,
2030    0x01}},
2031  {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf5,
2032    0x02,0x86,0xff,0x0f,0x10,0x00,0x01,
2033    0x01}},
2034  {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a,
2035    0x02,0x86,0xff,0x0f,0x09,0x00,0x05,
2036    0x01}},
2037  {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a,
2038    0x02,0x86,0xff,0x0f,0x09,0x00,0x05,
2039    0x01}}
2040 };
2041
2042 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11280x768_2[] =
2043 {
2044  {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb,
2045    0x54,0x86,0xdb,0xda,0x00,0x00,0x02,
2046    0x00}},
2047  {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb,
2048    0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x02,
2049    0x00}},
2050  {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb,
2051    0x54,0x86,0xdb,0xda,0x00,0x00,0x02,
2052    0x00}},
2053  {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb,
2054    0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x02,
2055    0x00}},
2056  {{0xab,0x60,0x9f,0x80,0x04,0x24,0xb3,
2057    0x7c,0x8e,0x03,0x02,0x10,0x00,0x02,
2058    0x01}},
2059  {{0xab,0x63,0x8f,0x8a,0x8e,0x24,0xf1,
2060    0xb6,0x88,0x57,0x25,0x10,0x00,0x02,
2061    0x01}},
2062  {{0xab,0x7f,0x8f,0x98,0x9c,0x24,0xf5,
2063    0x0a,0x8c,0xff,0x25,0x30,0x00,0x02,
2064    0x01}},
2065  {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5,
2066    0x0a,0x8c,0xff,0x25,0x30,0x00,0x06,
2067    0x01}},
2068  {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5,
2069    0x0a,0x8c,0xff,0x25,0x30,0x00,0x06,
2070    0x01}}
2071 };
2072
2073 static const SiS_LVDSCRT1DataStruct  SiS_LVDSCRT11280x768_2_H[] =
2074 {
2075  {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb,
2076    0x54,0x86,0xdb,0xda,0x00,0x00,0x01,
2077    0x00}},
2078  {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb,
2079    0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x01,
2080    0x00}},
2081  {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb,
2082    0x54,0x86,0xdb,0xda,0x00,0x00,0x01,
2083    0x00}},
2084  {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb,
2085    0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x01,
2086    0x00}},
2087  {{0x83,0x38,0x97,0x58,0x9c,0x24,0xb3,
2088    0x7c,0x8e,0x03,0x02,0x10,0x00,0x01,
2089    0x01}},
2090  {{0x79,0x31,0x9d,0x58,0x9c,0x24,0xf1,
2091    0xb6,0x88,0x57,0x25,0x10,0x00,0x01,
2092    0x01}},
2093  {{0x6b,0x3f,0x8f,0x58,0x9c,0x24,0xf5,
2094    0x0a,0x8c,0xff,0x25,0x30,0x00,0x01,
2095    0x01}},
2096  {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5,
2097    0x0a,0x8c,0xff,0x25,0x30,0x00,0x06,
2098    0x01}},
2099  {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5,
2100    0x0a,0x8c,0xff,0x25,0x30,0x00,0x06,
2101    0x01}}
2102 };
2103
2104 /**************************************************************/
2105 /* COMMON --------------------------------------------------- */
2106 /**************************************************************/
2107
2108 #define SIS_PL_HSYNCP 0x01
2109 #define SIS_PL_HSYNCN 0x02
2110 #define SIS_PL_VSYNCP 0x04
2111 #define SIS_PL_VSYNCN 0x08
2112 #define SIS_PL_DVI    0x80
2113
2114 typedef struct _SiS_PlasmaModes
2115 {
2116   const char *name;
2117   ULONG  clock;
2118   USHORT HDisplay, HTotal, HFrontPorch, HSyncWidth;
2119   USHORT VDisplay, VTotal, VFrontPorch, VSyncWidth;
2120   UCHAR  SyncFlags;
2121 } SiS_PlasmaModes;
2122
2123 typedef struct _SiS_PlasmaTables
2124 {
2125    USHORT vendor;
2126    UCHAR  productnum;
2127    USHORT product[5];
2128    const char *DDCnames[5];
2129    const char *plasmaname;
2130    UCHAR  modenum;
2131    UCHAR  plasmamodes[20];  /* | 0x80 = DVI-capable, | 0x40 = analog */
2132 } SiS_PlasmaTables;
2133
2134 static const SiS_PlasmaModes SiS_PlasmaMode[] = {
2135    {  "640x400",                /* 00: IBM 400@70 */
2136       25175,
2137        640,  800, 17,  64,
2138        400,  449, 13,   2,
2139       SIS_PL_HSYNCN | SIS_PL_VSYNCN },
2140    {  "640x480",                /* 01: VESA 480@72 */
2141       31500,
2142        640,  832, 24,  40,
2143        480,  520,  9,   3,
2144       SIS_PL_HSYNCN | SIS_PL_VSYNCN },
2145    {  "800x600",                /* 02: VESA 600@72 */
2146       50000,
2147        800, 1040, 56, 120,
2148        600,  666, 37,   6,
2149       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2150    {  "864x480",                /* 03: Cereb wide 1 */
2151       42526,
2152        864, 1134, 22,  86,
2153        480,  500,  1,   3,
2154       SIS_PL_HSYNCP | SIS_PL_VSYNCN },
2155    {  "848x480",                /* 04: VESA wide (NEC1) */
2156       33750,
2157        848, 1088, 16, 112,
2158        480,  517,  6,   8,
2159       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2160    {  "1024x576",               /* 05: VESA wide (NEC2) */
2161       47250,
2162       1024, 1320, 16, 144,
2163        576,  596,  2,   4,
2164       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2165    {  "1280x720",               /* 06: VESA wide (NEC3) */
2166       76500,
2167       1280, 1696, 48, 176,
2168        720,  750,  4,   8,
2169       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2170    {  "1360x765",               /* 07: VESA wide (NEC4) */
2171       85500,
2172       1360, 1792, 64, 176,
2173        765,  795,  4,   8,
2174       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2175    {  "1024x600",               /* 08: CEREB wide 2 */
2176       51200,
2177       1024, 1352, 51, 164,
2178        600,  628,  1,   4,
2179       SIS_PL_HSYNCN | SIS_PL_VSYNCP },
2180    {  "1024x768",               /* 09: VESA 768@75 */
2181       78750,
2182       1024, 1312,  16, 96,
2183        768,  800,   1,  3,
2184       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2185    {  "1152x864",               /* 10: VESA 1152x864@75 */
2186       108000,
2187       1152, 1600, 64, 128,
2188        864,  900,  1,   3,
2189       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2190    {  "1280x1024",              /* 11: VESA 1024@60 */
2191       108000,
2192       1280, 1688, 48, 112,
2193       1024, 1066,  1,   3,
2194       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2195    {  "1280x768",               /* 12: W_XGA */
2196       81000,
2197       1280, 1688, 48, 112,
2198        768,  802,  3,   6,
2199       SIS_PL_HSYNCP | SIS_PL_VSYNCN },
2200    {  "1280x768",               /* 13: I/O Data W_XGA@56Hz */
2201       76064,
2202       1280, 1688, 48, 112,
2203        768,  802,  2,   3,
2204       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2205    {  "1376x768",               /* 14: I/O Wide XGA */
2206       87340,
2207       1376, 1808, 32, 128,
2208        768,  806,  3,   6,
2209       SIS_PL_HSYNCN | SIS_PL_VSYNCP },
2210    {  "1280x960",               /* 15: VESA 960@60 */
2211       108000,
2212       1280, 1800, 96, 112,
2213        960, 1000,  1,   3,
2214       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2215    {  "1400x1050",              /* 16: VESA 1050@60Hz */
2216       108000,
2217       1400, 1688, 48, 112,
2218       1050, 1066,  1,   3,
2219       SIS_PL_HSYNCN | SIS_PL_VSYNCN },
2220    {  "1360x768",               /* 17: VESA wide (NEC4/2) */
2221       85500,
2222       1360, 1792, 64, 112,
2223        765,  795,  3,   6,
2224       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2225    {  "800x600",                /* 18: VESA 600@56 */
2226       36000,
2227        800, 1024, 24,   2,
2228        600,  625,  1,   2,
2229       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2230    {  "1072x600",               /* 19: Panasonic 1072x600 (sync?) */
2231       54100,
2232        1072, 1424, 48, 176,
2233         600,  628, 16,   1,
2234       SIS_PL_HSYNCP | SIS_PL_VSYNCP },
2235    {  "848x480",                /* 20: Panasonic 848x480 (sync?) */
2236       33070,                    /* is 852x480, but we can't use 852 */
2237         848, 1068, 20,  40,     /* differs from DDC data, better centered */
2238         480,  516,  3,   5,     /* won't work assumingly, because data is % 8 */
2239       SIS_PL_HSYNCN | SIS_PL_VSYNCN },
2240 };
2241
2242 static const SiS_PlasmaTables SiS_PlasmaTable[] = {
2243 #if 0  /* Product IDs missing */
2244    { 0x38a3, 4,
2245      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2246      { "", "", "", "", "" },
2247      "NEC PlasmaSync 42VP4/42VP4D/42VP4G/42VP4DG",
2248      11,   /* All DVI, except 0, 7, 13 */
2249      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
2250       17|0xc0, 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2251    },
2252 #endif
2253 #if 0  /* Product IDs missing */
2254    { 0x38a3, 3,
2255      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2256      { "", "", "", "", "" },
2257      "NEC PlasmaSync 42PD1/50PD1/50PD2",
2258      5,   /* DVI entirely unknown */
2259      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0, 0     , 0     , 0     , 0     , 0     ,
2260        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2261    },
2262    { 0x38a3, 1,
2263      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2264      { "", "", "", "", "" },
2265      "NEC PlasmaSync 42PD3",
2266      10,   /* DVI entirely unknown */
2267      { 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 5|0xc0, 6|0xc0, 7|0x40, 8|0xc0, 9|0xc0,
2268        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2269    },
2270    { 0x38a3, 2,
2271      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2272      { "", "", "", "", "" },
2273      "NEC PlasmaSync 42VM3/61XM1",
2274      11,  /* DVI entirely unknown */
2275      { 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 5|0xc0, 6|0xc0, 8|0xc0, 9|0xc0,11|0xc0,
2276       17|0xc0, 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2277    },
2278    { 0x38a3, 2,
2279      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2280      { "", "", "", "", "" },
2281      "NEC PlasmaSync 42MP1/42MP2",
2282      6,   /* DVI entirely unknown */
2283      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0,11|0xc0, 0     , 0     , 0     , 0     ,
2284        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2285    },
2286    { 0x38a3, 1,
2287      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2288      { "", "", "", "", "" },
2289      "NEC PlasmaSync 50MP1",
2290      10,   /* DVI entirely unknown */
2291      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
2292        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2293    },
2294 #endif
2295    { 0x38a3, 4,
2296      { 0xa482, 0xa483, 0x0000, 0x0000, 0x0000 },
2297      { "PX-42VM", "", "", "", "" },
2298      "NEC PlasmaSync 42MP3/42MP4/50MP2/61MP1",
2299      11,   /* All DVI except 0, 7, 13, 17 */
2300      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
2301       17|0x40, 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2302    },
2303 #if 0  /* Product IDs missing */
2304    { 0x38a3, 1,
2305      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2306      { "", "", "", "", "" },
2307      "NEC PlasmaSync 3300W",
2308      3,
2309      { 0|0x40, 1|0xc0,18|0xc0, 0     , 0     , 0     , 0     , 0     , 0     , 0     ,
2310        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2311    },
2312    { 0x38a3, 1,
2313      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2314      { "", "", "", "", "" },
2315      "NEC PlasmaSync 4200W",
2316      4,   /* DVI entirely unknown */
2317      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 0     , 0     , 0     , 0     , 0     , 0     ,
2318        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2319    },
2320    { 0x38a3, 1,
2321      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2322      { "", "", "", "", "" },
2323      "NEC PlasmaSync 4210W",
2324      6,   /* DVI entirely unknown */
2325      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0,11|0xc0, 0     , 0     , 0     , 0     ,
2326        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2327    },
2328    { 0x38a3, 1,
2329      { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
2330      { "", "", "", "", "" },
2331      "NEC PlasmaSync 5000W",
2332      7,   /* DVI entirely unknown */
2333      { 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,11|0xc0, 0     , 0     , 0     ,
2334        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2335    },
2336 #endif
2337    { 0x412f, 2,
2338      { 0x000c, 0x000b, 0x0000, 0x0000, 0x0000 },
2339      { "", "", "", "", "" },
2340      "Pioneer 503CMX/PDA-5002",
2341      6,   /* DVI unknown */
2342      { 1|0xc0, 2|0xc0, 9|0xc0,11|0xc0,12|0xc0,15|0xc0, 0     , 0     , 0     , 0     ,
2343        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2344    },
2345    { 0x34a9, 1,
2346      { 0xa00e, 0x0000, 0x0000, 0x0000, 0x0000 },
2347      { "", "", "", "", "" },
2348      "Panasonic TH-42",
2349      5,   /* No DVI output */
2350      { 1|0x40, 2|0x40, 4|0x40, 9|0x40,15|0x40, 0     , 0     , 0     , 0     , 0     ,
2351        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2352    },
2353    { 0x34a9, 1,
2354      { 0xa005, 0x0000, 0x0000, 0x0000, 0x0000 },
2355      { "TH-42PW*4", "", "", "", "" },
2356      "Panasonic TH-42PW5",
2357      1,   /* No special modes otherwise; no DVI. */
2358      {20|0x40,19|0x40, 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     ,
2359        0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0     , 0       }
2360    },
2361    { 0x0000 }
2362 };
2363
2364 USHORT  SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
2365                           int Depth, BOOLEAN FSTN, int LCDwith, int LCDheight);
2366 USHORT  SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN,
2367                           USHORT CustomT, int LCDwith, int LCDheight);
2368 USHORT  SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth);
2369 USHORT  SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth);
2370
2371 void    SiS_SetReg(SISIOADDRESS port, USHORT index, USHORT data);
2372 void    SiS_SetRegByte(SISIOADDRESS port, USHORT data);
2373 void    SiS_SetRegShort(SISIOADDRESS port, USHORT data);
2374 void    SiS_SetRegLong(SISIOADDRESS port, ULONG data);
2375 UCHAR   SiS_GetReg(SISIOADDRESS port, USHORT index);
2376 UCHAR   SiS_GetRegByte(SISIOADDRESS port);
2377 USHORT  SiS_GetRegShort(SISIOADDRESS port);
2378 ULONG   SiS_GetRegLong(SISIOADDRESS port);
2379 void    SiS_SetRegANDOR(SISIOADDRESS Port,USHORT Index,USHORT DataAND,USHORT DataOR);
2380 void    SiS_SetRegAND(SISIOADDRESS Port,USHORT Index,USHORT DataAND);
2381 void    SiS_SetRegOR(SISIOADDRESS Port,USHORT Index,USHORT DataOR);
2382 void    SiS_DisplayOn(SiS_Private *SiS_Pr);
2383 void    SiS_DisplayOff(SiS_Private *SiS_Pr);
2384 void    SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
2385 void    SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2386 BOOLEAN SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2387 void    SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable);
2388 void    SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable);
2389 void    SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2390 USHORT  SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2391 BOOLEAN SiS_SearchModeID(SiS_Private *SiS_Pr, USHORT *ModeNo, USHORT *ModeIdIndex);
2392 UCHAR   SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex);
2393 USHORT  SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex);
2394 USHORT  SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
2395               USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo);
2396 void    SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT ModeIdIndex);
2397 void    SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex);
2398 #ifdef LINUX_XF86
2399 BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch);
2400 BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
2401                DisplayModePtr mode, BOOLEAN IsCustom);
2402 BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
2403                DisplayModePtr mode, BOOLEAN IsCustom);
2404 BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
2405                DisplayModePtr mode, BOOLEAN IsCustom);
2406 int     SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber);
2407 BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO);
2408 USHORT  SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags);
2409 DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi);
2410 #else
2411 BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo);
2412 #endif
2413 #ifdef LINUX_KERNEL
2414 int    sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
2415                               unsigned char modeno, unsigned char rateindex);
2416 int    sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
2417                          unsigned char modeno, unsigned char rateindex,
2418                          struct fb_var_screeninfo *var);
2419 BOOLEAN sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
2420                        unsigned char modeno, int *htotal, int *vtotal, unsigned char rateindex);
2421 #endif
2422
2423 extern void      SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
2424                                PSIS_HW_INFO HwInfo, int chkcrt2mode);
2425 extern void      SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
2426                                    PSIS_HW_INFO HwInfo);
2427 extern void      SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2428 extern void      SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo);
2429 extern void      SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2430 extern void      SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
2431 extern void      SiS_DisableBridge(SiS_Private *, PSIS_HW_INFO);
2432 extern BOOLEAN   SiS_SetCRT2Group(SiS_Private *, PSIS_HW_INFO, USHORT);
2433 extern USHORT    SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
2434                                 PSIS_HW_INFO HwInfo);
2435 extern void      SiS_WaitRetrace1(SiS_Private *SiS_Pr);
2436 extern USHORT    SiS_GetResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex);
2437 extern USHORT    SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempax);
2438 extern USHORT    SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
2439                                  USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo);
2440 extern BOOLEAN   SiS_IsVAMode(SiS_Private *, PSIS_HW_INFO);
2441 extern BOOLEAN   SiS_IsDualEdge(SiS_Private *, PSIS_HW_INFO);
2442
2443 #ifdef LINUX_XF86
2444 extern int      SiS_compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div,
2445                                  int *out_sbit, int *out_scale);
2446 extern void     SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk);
2447
2448 extern unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value);
2449 extern unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
2450 extern USHORT        SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags,
2451                                         BOOLEAN hcm);
2452 #endif
2453
2454 #endif
2455