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