xref: /openbmc/linux/drivers/video/fbdev/sis/init.h (revision 5908986e)
1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * Data and prototypes for init.c
5  *
6  * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
7  *
8  * If distributed as part of the Linux kernel, the following license terms
9  * apply:
10  *
11  * * This program is free software; you can redistribute it and/or modify
12  * * it under the terms of the GNU General Public License as published by
13  * * the Free Software Foundation; either version 2 of the named License,
14  * * or any later version.
15  * *
16  * * This program is distributed in the hope that it will be useful,
17  * * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * * GNU General Public License for more details.
20  * *
21  * * You should have received a copy of the GNU General Public License
22  * * along with this program; if not, write to the Free Software
23  * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
24  *
25  * Otherwise, the following license terms apply:
26  *
27  * * Redistribution and use in source and binary forms, with or without
28  * * modification, are permitted provided that the following conditions
29  * * are met:
30  * * 1) Redistributions of source code must retain the above copyright
31  * *    notice, this list of conditions and the following disclaimer.
32  * * 2) Redistributions in binary form must reproduce the above copyright
33  * *    notice, this list of conditions and the following disclaimer in the
34  * *    documentation and/or other materials provided with the distribution.
35  * * 3) The name of the author may not be used to endorse or promote products
36  * *    derived from this software without specific prior written permission.
37  * *
38  * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
39  * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41  * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
42  * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43  * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44  * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
45  * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
47  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48  *
49  * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
50  *
51  */
52 
53 #ifndef _INIT_H_
54 #define _INIT_H_
55 
56 #include "initdef.h"
57 
58 #include "vgatypes.h"
59 #include "vstruct.h"
60 #ifdef SIS_CP
61 #undef SIS_CP
62 #endif
63 #include <linux/types.h>
64 #include <asm/io.h>
65 #include <linux/fb.h>
66 #include "sis.h"
67 #include <video/sisfb.h>
68 
69 /* Mode numbers */
70 static const unsigned short ModeIndex_320x200[]      = {0x59, 0x41, 0x00, 0x4f};
71 static const unsigned short ModeIndex_320x240[]      = {0x50, 0x56, 0x00, 0x53};
72 static const unsigned short ModeIndex_320x240_FSTN[] = {0x5a, 0x5b, 0x00, 0x00};  /* FSTN */
73 static const unsigned short ModeIndex_400x300[]      = {0x51, 0x57, 0x00, 0x54};
74 static const unsigned short ModeIndex_512x384[]      = {0x52, 0x58, 0x00, 0x5c};
75 static const unsigned short ModeIndex_640x400[]      = {0x2f, 0x5d, 0x00, 0x5e};
76 static const unsigned short ModeIndex_640x480[]      = {0x2e, 0x44, 0x00, 0x62};
77 static const unsigned short ModeIndex_720x480[]      = {0x31, 0x33, 0x00, 0x35};
78 static const unsigned short ModeIndex_720x576[]      = {0x32, 0x34, 0x00, 0x36};
79 static const unsigned short ModeIndex_768x576[]      = {0x5f, 0x60, 0x00, 0x61};
80 static const unsigned short ModeIndex_800x480[]      = {0x70, 0x7a, 0x00, 0x76};
81 static const unsigned short ModeIndex_800x600[]      = {0x30, 0x47, 0x00, 0x63};
82 static const unsigned short ModeIndex_848x480[]      = {0x39, 0x3b, 0x00, 0x3e};
83 static const unsigned short ModeIndex_856x480[]      = {0x3f, 0x42, 0x00, 0x45};
84 static const unsigned short ModeIndex_960x540[]      = {0x1d, 0x1e, 0x00, 0x1f};  /* 315 series only */
85 static const unsigned short ModeIndex_960x600[]      = {0x20, 0x21, 0x00, 0x22};  /* 315 series only */
86 static const unsigned short ModeIndex_1024x768[]     = {0x38, 0x4a, 0x00, 0x64};
87 static const unsigned short ModeIndex_1024x576[]     = {0x71, 0x74, 0x00, 0x77};
88 static const unsigned short ModeIndex_1024x600[]     = {0x20, 0x21, 0x00, 0x22};  /* 300 series only */
89 static const unsigned short ModeIndex_1280x1024[]    = {0x3a, 0x4d, 0x00, 0x65};
90 static const unsigned short ModeIndex_1280x960[]     = {0x7c, 0x7d, 0x00, 0x7e};
91 static const unsigned short ModeIndex_1152x768[]     = {0x23, 0x24, 0x00, 0x25};  /* 300 series only */
92 static const unsigned short ModeIndex_1152x864[]     = {0x29, 0x2a, 0x00, 0x2b};
93 static const unsigned short ModeIndex_300_1280x768[] = {0x55, 0x5a, 0x00, 0x5b};
94 static const unsigned short ModeIndex_310_1280x768[] = {0x23, 0x24, 0x00, 0x25};
95 static const unsigned short ModeIndex_1280x720[]     = {0x79, 0x75, 0x00, 0x78};
96 static const unsigned short ModeIndex_1280x800[]     = {0x14, 0x15, 0x00, 0x16};
97 static const unsigned short ModeIndex_1280x854[]     = {0x1a, 0x1b, 0x00, 0x1c};
98 static const unsigned short ModeIndex_1360x768[]     = {0x48, 0x4b, 0x00, 0x4e};
99 static const unsigned short ModeIndex_300_1360x1024[]= {0x67, 0x6f, 0x00, 0x72};  /* 300 series, BARCO only */
100 static const unsigned short ModeIndex_1400x1050[]    = {0x26, 0x27, 0x00, 0x28};  /* 315 series only */
101 static const unsigned short ModeIndex_1680x1050[]    = {0x17, 0x18, 0x00, 0x19};  /* 315 series only */
102 static const unsigned short ModeIndex_1600x1200[]    = {0x3c, 0x3d, 0x00, 0x66};
103 static const unsigned short ModeIndex_1920x1080[]    = {0x2c, 0x2d, 0x00, 0x73};  /* 315 series only */
104 static const unsigned short ModeIndex_1920x1440[]    = {0x68, 0x69, 0x00, 0x6b};
105 static const unsigned short ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00};
106 static const unsigned short ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};
107 
108 static const unsigned char SiS_MDA_DAC[] =
109 {
110 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
111         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
112         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
113         0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
114         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
115         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
116         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
117         0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F
118 };
119 
120 static const unsigned char SiS_CGA_DAC[] =
121 {
122         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
123         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
124         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
125         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
126         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
127         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
128         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
129         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
130 };
131 
132 static const unsigned char SiS_EGA_DAC[] =
133 {
134         0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15,
135         0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35,
136         0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D,
137         0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D,
138         0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17,
139         0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37,
140         0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F,
141         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
142 };
143 
144 static const unsigned char SiS_VGA_DAC[] =
145 {
146 	0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
147 	0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
148 	0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18,
149 	0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F,
150 	0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F,
151 	0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00,
152 	0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18,
153 	0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04,
154 	0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10,
155 	0x0B,0x0C,0x0D,0x0F,0x10
156 };
157 
158 static const struct SiS_St SiS_SModeIDTable[] =
159 {
160 	{0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00,0x40},
161 	{0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00,0x40},
162 	{0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01,0x40},
163 	{0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02,0x40},
164 	{0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02,0x40},
165 	{0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03,0x40},
166 	{0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04,0x40},
167 	{0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05,0x40},
168 	{0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03,0x40},
169 	{0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03,0x40},
170 	{0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04,0x40},
171 	{0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05,0x40},
172 	{0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05,0x40},
173 	{0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05,0x40},
174 	{0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05,0x40},
175 	{0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05,0x40},
176 	{0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04,0x40},
177 	{0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05,0x40},
178 	{0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05,0x40},
179 	{0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
180 };
181 
182 static const struct SiS_StResInfo_S SiS_StResInfo[]=
183 {
184 	{ 640,400},
185 	{ 640,350},
186 	{ 720,400},
187 	{ 720,350},
188 	{ 640,480}
189 };
190 
191 static const struct SiS_ModeResInfo_S SiS_ModeResInfo[] =
192 {
193 	{  320, 200, 8, 8},   /* 0x00 */
194 	{  320, 240, 8, 8},   /* 0x01 */
195 	{  320, 400, 8, 8},   /* 0x02 */
196 	{  400, 300, 8, 8},   /* 0x03 */
197 	{  512, 384, 8, 8},   /* 0x04 */
198 	{  640, 400, 8,16},   /* 0x05 */
199 	{  640, 480, 8,16},   /* 0x06 */
200 	{  800, 600, 8,16},   /* 0x07 */
201 	{ 1024, 768, 8,16},   /* 0x08 */
202 	{ 1280,1024, 8,16},   /* 0x09 */
203 	{ 1600,1200, 8,16},   /* 0x0a */
204 	{ 1920,1440, 8,16},   /* 0x0b */
205 	{ 2048,1536, 8,16},   /* 0x0c */
206 	{  720, 480, 8,16},   /* 0x0d */
207 	{  720, 576, 8,16},   /* 0x0e */
208 	{ 1280, 960, 8,16},   /* 0x0f */
209 	{  800, 480, 8,16},   /* 0x10 */
210 	{ 1024, 576, 8,16},   /* 0x11 */
211 	{ 1280, 720, 8,16},   /* 0x12 */
212 	{  856, 480, 8,16},   /* 0x13 */
213 	{ 1280, 768, 8,16},   /* 0x14 */
214 	{ 1400,1050, 8,16},   /* 0x15 */
215 	{ 1152, 864, 8,16},   /* 0x16 */
216 	{  848, 480, 8,16},   /* 0x17 */
217 	{ 1360, 768, 8,16},   /* 0x18 */
218 	{ 1024, 600, 8,16},   /* 0x19 */
219 	{ 1152, 768, 8,16},   /* 0x1a */
220 	{  768, 576, 8,16},   /* 0x1b */
221 	{ 1360,1024, 8,16},   /* 0x1c */
222 	{ 1680,1050, 8,16},   /* 0x1d */
223 	{ 1280, 800, 8,16},   /* 0x1e */
224 	{ 1920,1080, 8,16},   /* 0x1f */
225 	{  960, 540, 8,16},   /* 0x20 */
226 	{  960, 600, 8,16},   /* 0x21 */
227 	{ 1280, 854, 8,16}    /* 0x22 */
228 };
229 
230 #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315)
231 static const struct SiS_StandTable_S SiS_StandTable[]=
232 {
233 /* 0x00: MD_0_200 */
234  {
235   0x28,0x18,0x08,0x0800,
236   {0x09,0x03,0x00,0x02},
237   0x63,
238   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
239    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
240    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
241    0xff},
242   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
243    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
244    0x08,0x00,0x0f,0x00},
245   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
246    0xff}
247  },
248 /* 0x01: MD_1_200 */
249  {
250   0x28,0x18,0x08,0x0800,
251   {0x09,0x03,0x00,0x02},
252   0x63,
253   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
254    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
255    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
256    0xff},
257   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
258    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
259    0x08,0x00,0x0f,0x00},
260   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
261    0xff}
262  },
263 /* 0x02: MD_2_200 */
264  {
265   0x50,0x18,0x08,0x1000,
266   {0x01,0x03,0x00,0x02},
267   0x63,
268   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
269    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
270    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
271    0xff},
272   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
273    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
274    0x08,0x00,0x0f,0x00},
275   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
276    0xff}
277  },
278 /* 0x03: MD_3_200 - mode 0x03 - 0 */
279  {
280   0x50,0x18,0x08,0x1000,
281   {0x01,0x03,0x00,0x02},
282   0x63,
283   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
284    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
285    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
286    0xff},
287   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
288    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
289    0x08,0x00,0x0f,0x00},
290   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
291    0xff}
292  },
293 /* 0x04: MD_4 */
294  {
295   0x28,0x18,0x08,0x4000,
296   {0x09,0x03,0x00,0x02},
297   0x63,
298   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,   /* 0x2c is 2b for 300 */
299    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
300    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2,
301    0xff},
302   {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07,
303    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
304    0x01,0x00,0x03,0x00},
305   {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
306    0xff}
307  },
308 /* 0x05: MD_5 */
309  {
310   0x28,0x18,0x08,0x4000,
311   {0x09,0x03,0x00,0x02},
312   0x63,
313   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,   /* 0x2c is 2b for 300 */
314    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
315    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2,
316    0xff},
317   {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07,
318    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
319    0x01,0x00,0x03,0x00},
320   {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
321    0xff}
322  },
323 /* 0x06: MD_6 */
324  {
325   0x50,0x18,0x08,0x4000,
326   {0x01,0x01,0x00,0x06},
327   0x63,
328   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,   /* 55,81 is 54,80 for 300 */
329    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
330    0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2,
331    0xff},
332   {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
333    0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
334    0x01,0x00,0x01,0x00},
335   {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00,
336    0xff}
337  },
338 /* 0x07: MD_7 */
339  {
340   0x50,0x18,0x0e,0x1000,
341   {0x00,0x03,0x00,0x03},
342   0xa6,
343   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
344    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
345    0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3,
346    0xff},
347   {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
348    0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
349    0x0e,0x00,0x0f,0x08},
350   {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
351    0xff}
352  },
353 /* 0x08: MDA_DAC */
354  {
355   0x00,0x00,0x00,0x0000,
356   {0x00,0x00,0x00,0x15},
357   0x15,
358   {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
359    0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f,
360    0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,
361    0x00},
362   {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15,
363    0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
364    0x15,0x15,0x15,0x15},
365   {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
366    0x3f}
367  },
368 /* 0x09: CGA_DAC */
369  {
370   0x00,0x10,0x04,0x0114,
371   {0x11,0x09,0x15,0x00},
372   0x10,
373   {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,
374    0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a,
375    0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10,
376    0x04},
377   {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04,
378    0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e,
379    0x3e,0x2b,0x3b,0x2f},
380   {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
381    0x3f}
382  },
383 /* 0x0a: EGA_DAC */
384  {
385   0x00,0x10,0x04,0x0114,
386   {0x11,0x05,0x15,0x20},
387   0x30,
388   {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18,
389    0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38,
390    0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12,
391    0x06},
392   {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26,
393    0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e,
394    0x1e,0x0b,0x1b,0x0f},
395   {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
396    0x3f}
397  },
398 /* 0x0b: VGA_DAC */
399  {
400   0x00,0x10,0x04,0x0114,
401   {0x11,0x09,0x15,0x2a},
402   0x3a,
403   {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05,
404    0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20,
405    0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10,
406    0x1f},
407   {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d,
408    0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15,
409    0x1c,0x0e,0x11,0x15},
410   {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00,
411    0x04}
412  },
413 /* 0x0c */
414  {
415   0x08,0x0c,0x10,0x0a08,
416   {0x0c,0x0e,0x10,0x0b},
417   0x0c,
418   {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00,
419    0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00,
420    0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00,
421    0x06},
422   {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08,
423    0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00,
424    0x00,0x00,0x00,0x00},
425   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
426    0x00}
427  },
428 /* 0x0d: MD_D */
429  {
430   0x28,0x18,0x08,0x2000,
431   {0x09,0x0f,0x00,0x06},
432   0x63,
433   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,     /* 2c is 2b for 300 */
434    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
435    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3,
436    0xff},
437   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
438    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
439    0x01,0x00,0x0f,0x00},
440   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
441    0xff}
442  },
443 /* 0x0e: MD_E */
444  {
445   0x50,0x18,0x08,0x4000,
446   {0x01,0x0f,0x00,0x06},
447   0x63,
448   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,     /* 55,81 is 54,80 for 300 */
449    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
450    0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3,
451    0xff},
452   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
453    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
454    0x01,0x00,0x0f,0x00},
455   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
456    0xff}
457  },
458 /* 0x0f: ExtVGATable - modes > 0x13 */
459  {
460   0x00,0x00,0x00,0x0000,
461   {0x01,0x0f,0x00,0x0e},
462   0x23,
463   {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
464    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
465    0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
466    0xff},
467   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
468    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
469    0x01,0x00,0x00,0x00},
470   {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
471    0xff}
472  },
473 /* 0x10: ROM_SAVEPTR - totally different for 300 */
474  {
475   0x9f,0x3b,0x00,0x00c0,
476   {0x00,0x00,0x00,0x00},
477   0x00,
478   {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f,
479    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
480    0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0,
481    0x00},
482   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
483    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
484    0x00,0x00,0x00,0x00},
485   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
486    0x00}
487  },
488 /* 0x11: MD_F */
489  {
490   0x50,0x18,0x0e,0x8000,
491   {0x01,0x0f,0x00,0x06},
492   0xa2,
493   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
494    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
495    0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3,    /* 82,84 is 83,85 on 300 */
496    0xff},
497   {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00,
498    0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,
499    0x0b,0x00,0x05,0x00},
500   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,
501    0xff}
502  },
503 /* 0x12: MD_10 */
504  {
505   0x50,0x18,0x0e,0x8000,
506   {0x01,0x0f,0x00,0x06},
507   0xa3,
508   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
509    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
510    0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3,    /* 82,84 is 83,85 on 300 */
511    0xff},
512   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
513    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
514    0x01,0x00,0x0f,0x00},
515   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
516    0xff}
517  },
518 /* 0x13: MD_0_350 */
519  {
520   0x28,0x18,0x0e,0x0800,
521   {0x09,0x03,0x00,0x02},
522   0xa3,
523   {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f,    /* b1 is a0 on 300 */
524    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
525    0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3,
526    0xff},
527   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
528    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
529    0x08,0x00,0x0f,0x00},
530   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
531    0xff}
532  },
533 /* 0x14: MD_1_350 */
534  {
535   0x28,0x18,0x0e,0x0800,
536   {0x09,0x03,0x00,0x02},
537   0xa3,
538   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
539    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
540    0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3,
541    0xff},
542   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
543    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
544    0x08,0x00,0x0f,0x00},
545   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
546    0xff}
547  },
548 /* 0x15: MD_2_350 */
549  {
550   0x50,0x18,0x0e,0x1000,
551   {0x01,0x03,0x00,0x02},
552   0xa3,
553   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
554    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
555    0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3,
556    0xff},
557   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
558    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
559    0x08,0x00,0x0f,0x00},
560   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
561    0xff}
562  },
563 /* 0x16: MD_3_350 - mode 0x03 - 1 */
564  {
565   0x50,0x18,0x0e,0x1000,
566   {0x01,0x03,0x00,0x02},
567   0xa3,
568   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
569    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
570    0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3,
571    0xff},
572   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
573    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
574    0x08,0x00,0x0f,0x00},
575   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
576    0xff}
577  },
578 /* 0x17: MD_0_1_400 */
579  {
580   0x28,0x18,0x10,0x0800,
581   {0x08,0x03,0x00,0x02},
582   0x67,
583   {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f,    /* b1 is a0 on 300 */
584    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
585    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
586    0xff},
587   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
588    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
589    0x0c,0x00,0x0f,0x08},
590   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
591    0xff}
592  },
593 /* 0x18: MD_2_3_400 - mode 0x03 - 2 */
594  {
595   0x50,0x18,0x10,0x1000,
596   {0x00,0x03,0x00,0x02},
597   0x67,
598   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
599    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
600    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
601    0xff},
602   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
603    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
604    0x0c,0x00,0x0f,0x08},
605   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
606    0xff}
607  },
608 /* 0x19: MD_7_400 */
609  {
610   0x50,0x18,0x10,0x1000,
611   {0x00,0x03,0x00,0x02},
612   0x66,
613   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
614    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
615    0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3,
616    0xff},
617   {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
618    0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
619    0x0e,0x00,0x0f,0x08},
620   {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
621    0xff}
622  },
623 /* 0x1a: MD_11 */
624  {
625   0x50,0x1d,0x10,0xa000,
626   {0x01,0x0f,0x00,0x06},
627   0xe3,
628   {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,    /* 55,81 is 54,80 on 300 */
629    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
630    0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3,    /* e9,8b is ea,8c on 300 */
631    0xff},
632   {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
633    0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
634    0x01,0x00,0x0f,0x00},
635   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01,
636    0xff}
637  },
638 /* 0x1b: ExtEGATable - Modes <= 0x02 */
639  {
640   0x50,0x1d,0x10,0xa000,
641   {0x01,0x0f,0x00,0x06},
642   0xe3,
643   {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,    /* 55,81 is 54,80 on 300 */
644    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
645    0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,    /* e9,8b is ea,8c on 300 */
646    0xff},
647   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
648    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
649    0x01,0x00,0x0f,0x00},
650   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
651    0xff}
652  },
653 /* 0x1c: MD_13 */
654  {
655   0x28,0x18,0x08,0x2000,
656   {0x01,0x0f,0x00,0x0e},
657   0x63,
658   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
659    0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,
660    0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3,
661    0xff},
662   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
663    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
664    0x41,0x00,0x0f,0x00},
665   {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
666    0xff}
667  }
668 };
669 #endif
670 
671 /**************************************************************/
672 /* SIS VIDEO BRIDGE ----------------------------------------- */
673 /**************************************************************/
674 
675 static const unsigned char SiS_SoftSetting  = 0x30;   /* RAM setting */
676 
677 static const unsigned char SiS_OutputSelect = 0x40;
678 
679 static const unsigned char SiS_NTSCTiming[] = {
680 	0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
681 	0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
682 	0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
683 	0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
684 	0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
685 	0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40,
686 	0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50,
687 	0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
688 };
689 
690 static const unsigned char SiS_PALTiming[] = {
691 	0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70,
692 	0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
693 	0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
694 	0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17,
695 	0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02,
696 	0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40,
697 	0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63,
698 	0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00
699 };
700 
701 static const unsigned char SiS_HiTVExtTiming[] = {
702 	0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
703 	0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
704 	0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
705 	0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
706 	0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
707 	0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
708 	0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
709 	0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
710 };
711 
712 static const unsigned char SiS_HiTVSt1Timing[] = {
713 	0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
714 	0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
715 	0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
716 	0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03,
717 	0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10,
718 	0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40,
719 	0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86,
720 	0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00
721 };
722 
723 static const unsigned char SiS_HiTVSt2Timing[] = {
724 	0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
725 	0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
726 	0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
727 	0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
728 	0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
729 	0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
730 	0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
731 	0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
732 };
733 
734 #if 0
735 static const unsigned char SiS_HiTVTextTiming[] = {
736 	0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
737 	0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
738 	0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
739 	0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03,
740 	0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20,
741 	0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40,
742         0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96,
743 	0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00
744 };
745 #endif
746 
747 static const unsigned char SiS_HiTVGroup3Data[] = {
748 	0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
749 	0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6,
750 	0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
751 	0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44,
752 	0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
753 	0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9,
754 	0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75,
755 	0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
756 };
757 
758 static const unsigned char SiS_HiTVGroup3Simu[] = {
759 	0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
760 	0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6,
761 	0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
762 	0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11,
763 	0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
764 	0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4,
765 	0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
766 	0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
767 };
768 
769 #if 0
770 static const unsigned char SiS_HiTVGroup3Text[] = {
771 	0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
772 	0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
773 	0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
774 	0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22,
775 	0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
776 	0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca,
777 	0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
778 	0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
779 };
780 #endif
781 
782 static const struct SiS_TVData SiS_StPALData[] =
783 {
784  {    1,   1, 864, 525,1270, 400, 100, 0, 760,    0,0xf4,0xff,0x1c,0x22},
785  {    1,   1, 864, 525,1270, 350, 100, 0, 760,    0,0xf4,0xff,0x1c,0x22},
786  {    1,   1, 864, 525,1270, 400,   0, 0, 720,    0,0xf1,0x04,0x1f,0x18},
787  {    1,   1, 864, 525,1270, 350,   0, 0, 720,    0,0xf4,0x0b,0x1c,0x0a},
788  {    1,   1, 864, 525,1270, 480,  50, 0, 760,    0,0xf4,0xff,0x1c,0x22},
789  {    1,   1, 864, 525,1270, 600,  50, 0,   0,0x300,0xf4,0xff,0x1c,0x22}
790 };
791 
792 static const struct SiS_TVData SiS_ExtPALData[] =
793 {
794  {   27,  10, 848, 448,1270, 530,  50, 0,  50,    0,0xf4,0xff,0x1c,0x22},  /* 640x400, 320x200 */
795  {  108,  35, 848, 398,1270, 530,  50, 0,  50,    0,0xf4,0xff,0x1c,0x22},
796  {   12,   5, 954, 448,1270, 530,  50, 0,  50,    0,0xf1,0x04,0x1f,0x18},
797  {    9,   4, 960, 463,1644, 438,  50, 0,  50,    0,0xf4,0x0b,0x1c,0x0a},
798  {    9,   4, 848, 528,1270, 530,   0, 0,  50,    0,0xf5,0xfb,0x1b,0x2a},  /* 640x480, 320x240 */
799  {   36,  25,1060, 648,1270, 530, 438, 0, 438,    0,0xeb,0x05,0x25,0x16},  /* 800x600, 400x300 */
800  {    3,   2,1080, 619,1270, 540, 438, 0, 438,    0,0xf3,0x00,0x1d,0x20},  /* 720x576 */
801  {    1,   1,1170, 821,1270, 520, 686, 0, 686,    0,0xF3,0x00,0x1D,0x20},  /* 1024x768 */
802  {    1,   1,1170, 821,1270, 520, 686, 0, 686,    0,0xF3,0x00,0x1D,0x20},  /* 1024x768 (for NTSC equ) */
803  {    9,   4, 848, 528,1270, 530,   0, 0,  50,    0,0xf5,0xfb,0x1b,0x2a}   /* 720x480 */
804 };
805 
806 static const struct SiS_TVData SiS_StNTSCData[] =
807 {
808  {    1,   1, 858, 525,1270, 400,  50, 0, 760,    0,0xf1,0x04,0x1f,0x18},
809  {    1,   1, 858, 525,1270, 350,  50, 0, 640,    0,0xf1,0x04,0x1f,0x18},
810  {    1,   1, 858, 525,1270, 400,   0, 0, 720,    0,0xf1,0x04,0x1f,0x18},
811  {    1,   1, 858, 525,1270, 350,   0, 0, 720,    0,0xf4,0x0b,0x1c,0x0a},
812  {    1,   1, 858, 525,1270, 480,   0, 0, 760,    0,0xf1,0x04,0x1f,0x18}
813 };
814 
815 static const struct SiS_TVData SiS_ExtNTSCData[] =
816 {
817  {  143,  65, 858, 443,1270, 440, 171, 0, 171,    0,0xf1,0x04,0x1f,0x18},    /* 640x400, 320x200 */
818  {   88,  35, 858, 393,1270, 440, 171, 0, 171,    0,0xf1,0x04,0x1f,0x18},
819  {  143,  70, 924, 443,1270, 440,  92, 0,  92,    0,0xf1,0x04,0x1f,0x18},
820  {  143,  70, 924, 393,1270, 440,  92, 0,  92,    0,0xf4,0x0b,0x1c,0x0a},
821  {  143,  76, 836, 523,1270, 440, 224, 0,   0,    0,0xf1,0x05,0x1f,0x16},    /* 640x480, 320x240 */
822  {  143, 120,1056, 643,1270, 440,   0, 1,   0,    0,0xf4,0x10,0x1c,0x00},    /* 800x600, 400x300  */
823  {  143,  76, 836, 523,1270, 440,   0, 1,   0,    0,0xee,0x0c,0x22,0x08},    /* 720x480 - BETTER (from 300 series) */
824  {    1,   1,1100, 811,1412, 440,   0, 1,   0,    0,0xee,0x0c,0x22,0x08},    /* 1024x768 (525i) CORRECTED */
825 #if 0  /* flimmert und ist unten abgeschnitten (NTSCHT, NTSC clock) */
826  {   65,  64,1056, 791,1270, 480, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
827 #endif
828 #if 0
829  {    1,   1,1100, 811,1412, 440,   0, 1,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
830 #endif
831 #if 0
832  {    1,   1,1120, 821,1516, 420,   0, 1,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
833 #endif
834 #if 0
835  {    1,   1, 938, 821,1516, 420,   0, 1,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
836 #endif
837 #if 0 /* zoom hin, unten abgeschnitten (NTSC2HT, NTSC1024 clock) */
838  {    1,   1,1072, 791,1270, 480, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
839 #endif
840 #if 1 /* zu weit links (squeezed) (NTSC2HT, NTSC1024 clock) */
841  {    1,   1,1100, 846,1270, 440, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
842 #endif
843 #if 0 /* zu weit links, rechts abgeschnitten (NTSC2HT, NTSC1024 clock) */
844  {    1,   1,1100, 846,1412, 440, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
845 #endif
846 };
847 
848 static const struct SiS_TVData SiS_StHiTVData[] =  /* Slave + TVSimu */
849 {
850  {    1,   1, 0x37c,0x233,0x2b2,0x320,    0, 0, 0, 0, 0, 0, 0, 0},
851  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
852  {    1,   1, 0x37c,0x233,0x2b2,0x320,    0, 0, 0, 0, 0, 0, 0, 0},
853  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
854  {    1,   1, 0x37c,0x233,0x2b2,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
855  {    8,   5, 0x41a,0x2ab,0x670,0x3c0,0x150, 1, 0, 0, 0, 0, 0, 0}
856 };
857 
858 static const struct SiS_TVData SiS_St2HiTVData[] = /* Slave */
859 {
860  {    3,   1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},
861  {    1,   1, 0x37c,0x233,0x2b2,0x2bc, 	  0, 0, 0, 0, 0, 0, 0, 0},
862  {    3,   1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},
863  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
864  {    5,   2, 0x348,0x233,0x670,0x3c0,0x08d, 1, 0, 0, 0, 0, 0, 0},
865  {    8,   5, 0x41a,0x2ab,0x670,0x3c0,0x17c, 1, 0, 0, 0, 0, 0, 0}
866 };
867 
868 static const struct SiS_TVData SiS_ExtHiTVData[] =
869 { /* all ok */
870  {    6,   1, 0x348,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
871  {    3,   1, 0x3c0,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
872  {    6,   1, 0x348,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
873  {    3,   1, 0x3c0,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
874  {    5,   1, 0x348,0x233,0x670,0x3c0,0x166, 1, 0, 0, 0, 0, 0, 0},  /* 640x480   */
875  {   16,   5, 0x41a,0x2ab,0x670,0x3c0,0x143, 1, 0, 0, 0, 0, 0, 0},  /* 800x600   */
876  {   25,  12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},  /* 1024x768  */
877  {    5,   4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0, 0, 0, 0, 0},  /* 1280x1024 */
878  {    4,   1, 0x41a,0x233,0x60c,0x3c0,0x143, 1, 0, 0, 0, 0, 0, 0},  /* 800x480   */
879  {    5,   2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},  /* 1024x576  */
880  {    8,   5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0, 0, 0, 0, 0},  /* 1280x720  */
881  {    8,   3, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},  /* 960x600  */
882 };
883 
884 static const struct SiS_TVData SiS_St525pData[] =
885 {
886  {    1,   1, 0x6b4,0x20d,0x4f6,0x190,   50, 0, 0x2f8, 0, 0, 0, 0, 0},
887  {    1,   1, 0x6b4,0x20d,0x4f6,0x15e,   50, 0, 0x280, 0, 0, 0, 0, 0},
888  {    1,   1, 0x6b4,0x20d,0x4f6,0x190,   50, 0, 0x2f8, 0, 0, 0, 0, 0},
889  {    1,   1, 0x6b4,0x20d,0x4f6,0x15e,   50, 0, 0x280, 0, 0, 0, 0, 0},
890  {    1,   1, 0x6b4,0x20d,0x4f6,0x1e0,    0, 0, 0x2f8, 0, 0, 0, 0, 0}
891 };
892 
893 static const struct SiS_TVData SiS_St750pData[] =
894 {
895  {    1,   1, 0x672,0x2ee,0x500,0x190,   50, 0, 0x2f8, 0, 0, 0, 0, 0},
896  {    1,   1, 0x672,0x2ee,0x500,0x15e,   50, 0, 0x280, 0, 0, 0, 0, 0},
897  {    1,   1, 0x672,0x2ee,0x500,0x190,    0, 0, 0x2d0, 0, 0, 0, 0, 0},
898  {    1,   1, 0x672,0x2ee,0x500,0x15e,    0, 0, 0x2d0, 0, 0, 0, 0, 0},
899  {    1,   1, 0x672,0x2ee,0x500,0x1e0,    0, 0, 0x2f8, 0, 0, 0, 0, 0}
900 };
901 
902 static const struct SiS_TVData SiS_Ext750pData[] =
903 { /* all ok */
904  {    3,  1,  935, 470, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},  /* 320x200/640x400 */
905  {   24,  7,  935, 420, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},
906  {    3,  1,  935, 470, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},
907  {   24,  7,  935, 420, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},
908  {    2,  1, 1100, 590, 1130, 640,  50, 0, 0, 0, 0, 0, 0, 0},  /* 640x480 */
909  {    3,  2, 1210, 690, 1130, 660,  50, 0, 0, 0, 0, 0, 0, 0},  /* 800x600 OK */
910  {    2,  1, 1100, 562, 1130, 640,   0, 1, 0, 0, 0, 0, 0, 0},  /* 720x480 OK */
911  {    1,  1, 1375, 878, 1130, 640, 638, 0, 0, 0, 0, 0, 0, 0},  /* 1024x768 OK */
912  {    5,  3, 1100, 675, 1130, 640,   0, 1, 0, 0, 0, 0, 0, 0},  /* 720/768x576 OK */
913  {   25, 24, 1496, 755, 1120, 680,  50, 0, 0, 0, 0, 0, 0, 0}   /* 1280x720 OK */
914 };
915 
916 static const struct SiS_LCDData SiS_LCD1280x720Data[] =  /* 2.03.00 */
917 {
918 	{  44,   15,  864,  430, 1408,  806 }, /* 640x400 */
919 	{ 128,   35,  792,  385, 1408,  806 },
920 	{  44,   15,  864,  430, 1408,  806 },
921 	{ 128,   35,  792,  385, 1408,  806 },
922 	{  22,    9,  864,  516, 1408,  806 }, /* 640x480 */
923 	{   8,    5, 1056,  655, 1408,  806 }, /* 800x600 */
924 	{   0,    0,    0,    0,    0,    0 }, /* 1024x768 */
925 	{   0,    0,    0,    0,    0,    0 }, /* 1280x1024 */
926 	{   0,    0,    0,    0,    0,    0 },
927 	{   0,    0,    0,    0,    0,    0 },
928 	{   1,    1, 1408,  806, 1408,  806 }  /* 1280x720 */
929 };
930 
931 /* About 1280x768: For TMDS, Panel_1280x768 will only be set if
932  * the panel is a Fujitsu 7911 (VL-17WDX8) (with clock 81, 1688x802)
933  * Other TMDS panels of this resolution will be treated as custom.
934  * For LVDS, we know another type (_2).
935  * (Note: 1280x768_3 is now special for SiS301/NetVista
936  */
937 
938 static const struct SiS_LCDData SiS_StLCD1280x768_2Data[] = /* 2.03.00 */
939 {
940 	{  64,   21,  858,  434, 1408,  806 }, /* 640x400 */
941 	{  32,    9,  858,  372, 1408,  806 },
942 	{  64,   21,  858,  434, 1408,  806 },
943 	{  32,    9,  858,  372, 1408,  806 },
944 	{ 143,   68, 1024,  527, 1408,  806 }, /* 640x480 */
945 	{  64,   51, 1364,  663, 1408,  806 }, /* 800x600 */
946 	{  88,   81, 1296,  806, 1408,  806 }, /* 1024x768 */
947 	{   0,    0,    0,    0,    0,    0 },
948 	{   1,    1, 1408,  806, 1408,  806 }, /* 1280x768 */
949 	{   0,    0,    0,    0,    0,    0 },
950 	{  16,   15, 1600,  750, 1600,  806 }  /* 1280x720 - from Ext */
951 };
952 
953 static const struct SiS_LCDData SiS_ExtLCD1280x768_2Data[] = /* 2.03.00 */
954 {
955 	{  16,    5,  960,  410, 1600,  806 }, /* 640x400 */
956 	{  64,   21, 1152,  364, 1600,  806 },
957 	{  16,    5,  960,  410, 1600,  806 },
958 	{  64,   21, 1152,  364, 1600,  806 },
959 	{  32,   13, 1040,  493, 1600,  806 }, /* 640x480 */
960 	{  16,    9, 1152,  618, 1600,  806 }, /* 800x600 */
961 	{  25,   21, 1344,  796, 1600,  806 }, /* 1024x768 */
962 	{   0,    0,    0,    0,    0,    0 },
963 	{   1,    1, 1600,  806, 1600,  806 }, /* 1280x768 */
964 	{   0,    0,    0,    0,    0,    0 },
965 	{  16,   15, 1600,  750, 1600,  806 }  /* 1280x720 */
966 };
967 
968 #if 0  /* Not used; _3 now reserved for NetVista (SiS301) */
969 static const struct SiS_LCDData SiS_LCD1280x768_3Data[] =
970 {
971 	{  64,   25, 1056,  422, 1664,  798 },			/* 640x400 */
972 	{ 128,   39,  884,  396, 1408,  806 }, /* ,640 */
973 	{  64,   25, 1056,  422, 1664,  798 },			/* 640x400 */
974 	{ 128,   39,  884,  396, 1408,  806 }, /* ,640 */
975 	{  32,   15, 1056,  513, 1408,  806 }, /* ,664 */	/* 640x480 */
976 	{ 176,  125, 1280,  640, 1408,  806 }, /* ,768 */	/* 800x600 */
977 	{  64,   61, 1342,  806, 1408,  806 },			/* 1024x768 */
978 	{   0,    0,    0,    0,    0,    0 },
979 	{   1,    1, 1408,  806, 1408,  806 },			/* 1280x768 */
980 	{   0,    0,    0,    0,    0,    0 },
981 	{  16,   15, 1600,  750, 1600,  806 }  /* 1280x720  from above */
982 };
983 #endif
984 
985 static const struct SiS_LCDData SiS_LCD1280x800Data[] = /* 0.93.12a (TMDS) */
986 {
987 	{ 128,   51, 1122,  412, 1408,  816 },  /* 640x400 */
988 	{ 128,   49, 1232,  361, 1408,  816 },
989 	{ 128,   51, 1122,  412, 1408,  816 },
990 	{ 128,   49, 1232,  361, 1408,  816 },
991 	{   8,    3,  880,  491, 1408,  816 },  /* 640x480 */
992 	{  11,    6, 1024,  612, 1408,  816 },  /* 800x600 */
993 	{  22,   21, 1400,  784, 1408,  816 },  /* 1024x768 */
994 	{   0,    0,    0,    0,    0,    0 },  /* 1280x1024 */
995 	{   1,    1, 1408,  816, 1408,  816 },  /* 1280x800 */
996 	{   0,    0,    0,    0,    0,    0 },  /* 1280x768 (patch index) */
997 	{   0,    0,    0,    0,    0,    0 }   /* 1280x720 */
998 };
999 
1000 static const struct SiS_LCDData SiS_LCD1280x800_2Data[] = /* 2.03.00 (LVDS) */
1001 {
1002 	{  97,   42, 1344,  409, 1552,  812 }, /* 640x400 */
1003 	{  97,   35, 1280,  358, 1552,  812 },
1004 	{  97,   42, 1344,  409, 1552,  812 },
1005 	{  97,   35, 1280,  358, 1552,  812 },
1006 	{  97,   39, 1040,  488, 1552,  812 }, /* 640x480 */
1007 	{ 194,  105, 1120,  608, 1552,  812 }, /* 800x600 */
1008 	{  97,   84, 1400,  780, 1552,  812 }, /* 1024x768 */
1009 	{   0,    0,    0,    0,    0,    0 }, /* 1280x1024 */
1010 	{   1,    1, 1552,  812, 1552,  812 }, /* 1280x800 */
1011 	{  97,   96, 1600,  780, 1552,  812 }, /* 1280x768 - patch index */
1012 	{  97,   90, 1600,  730, 1552,  812 }  /* 1280x720 */
1013 };
1014 
1015 #if 0
1016 static const struct SiS_LCDData SiS_LCD1280x800_3Data[] = /* 2.02.05a (LVDS); m250 */
1017 {
1018 	{ 128,   51, 1122,  412, 1408,  816 }, /* 640x400 */
1019 	{ 128,   49, 1232,  361, 1408,  816 },
1020 	{ 128,   51, 1122,  412, 1408,  816 },
1021 	{ 128,   49, 1232,  361, 1408,  816 },
1022 	{   8,    3,  880,  491, 1408,  816 }, /* 640x480 */
1023 	{  11,    6, 1024,  612, 1408,  816 }, /* 800x600 */
1024 	{  22,   21, 1400,  784, 1408,  816 }, /* 1024x768 */
1025 	{   0,    0,    0,    0,    0,    0 }, /* 1280x1024 */
1026 	{   1,    1, 1408,  816, 1408,  816 }, /* 1280x800 */
1027 	{   0,    0,    0,    0,    0,    0 }, /* 1280x768 - patch index */
1028 	{   0,    0,    0,    0,    0,    0 }  /* 1280x720 */
1029 };
1030 #endif
1031 
1032 static const struct SiS_LCDData SiS_LCD1280x854Data[] = /* 2.21.00CS (LVDS) */
1033 {
1034 	{  56,   15,  936,  410, 1664,  861 },  /* 640x400 */
1035 	{  64,   25, 1586,  355, 1664,  861 },
1036 	{  56,   15,  936,  410, 1664,  861 },
1037 	{  64,   25, 1586,  355, 1664,  861 },
1038 	{  91,   45, 1464,  485, 1664,  861 },  /* 640x480 */
1039 	{ 182,   75,  976,  605, 1664,  861 },  /* 800x600 */
1040 	{  91,   66, 1342,  774, 1664,  861 },  /* 1024x768 */
1041 	{   0,    0,    0,    0,    0,    0 },  /* 1280x1024 */
1042 	{  26,   25, 1708,  807, 1664,  861 },  /* 1280x800 */
1043 	{  13,   12, 1708,  774, 1664,  861 },  /* 1280x768 - patch index */
1044 	{  52,   45, 1708,  725, 1664,  861 },  /* 1280x720 */
1045 	{   0,    0,    0,    0,    0,    0 },
1046 	{   0,    0,    0,    0,    0,    0 },
1047 	{   1,    1, 1664,  861, 1664,  861 }   /* 1280x854 */
1048 };
1049 
1050 static const struct SiS_LCDData SiS_LCD1280x960Data[] =
1051 {
1052 	{    9,   2,  800,  500, 1800, 1000 },
1053 	{    9,   2,  800,  500, 1800, 1000 },
1054 	{    4,   1,  900,  500, 1800, 1000 },
1055 	{    4,   1,  900,  500, 1800, 1000 },
1056 	{    9,   2,  800,  500, 1800, 1000 },
1057 	{   30,  11, 1056,  625, 1800, 1000 },
1058 	{    5,   3, 1350,  800, 1800, 1000 },
1059 	{    1,   1, 1576, 1050, 1576, 1050 },
1060 	{    1,   1, 1800, 1000, 1800, 1000 },
1061 	{   0,    0,    0,    0,    0,    0 },
1062 	{   0,    0,    0,    0,    0,    0 },
1063 	{   0,    0,    0,    0,    0,    0 },
1064 	{   0,    0,    0,    0,    0,    0 },
1065 	{   0,    0,    0,    0,    0,    0 }
1066 };
1067 
1068 static const struct SiS_LCDData SiS_StLCD1400x1050Data[] =
1069 {
1070 	{ 211,  100, 2100,  408, 1688, 1066 },
1071 	{ 211,   64, 1536,  358, 1688, 1066 },
1072 	{ 211,  100, 2100,  408, 1688, 1066 },
1073 	{ 211,   64, 1536,  358, 1688, 1066 },
1074 	{ 211,   48,  840,  488, 1688, 1066 },
1075 	{ 211,   72, 1008,  609, 1688, 1066 },
1076 	{ 211,  128, 1400,  776, 1688, 1066 },
1077 	{ 211,  205, 1680, 1041, 1688, 1066 },
1078 	{   1,    1, 1688, 1066, 1688, 1066 },
1079 	{   0,    0,    0,    0,    0,    0 },
1080 	{   0,    0,    0,    0,    0,    0 },
1081 	{   0,    0,    0,    0,    0,    0 },
1082 	{   0,    0,    0,    0,    0,    0 },
1083 	{   0,    0,    0,    0,    0,    0 }
1084 };
1085 
1086 static const struct SiS_LCDData SiS_ExtLCD1400x1050Data[] =
1087 {
1088 /*	{ 211,   60, 1260,  410, 1688, 1066 },    640x400 (6330) */
1089 	{ 211,  100, 2100,  408, 1688, 1066 }, /* 640x400 (6325) WORKS */
1090 	{ 211,   64, 1536,  358, 1688, 1066 },
1091 	{ 211,  100, 2100,  408, 1688, 1066 },
1092 	{ 211,   64, 1536,  358, 1688, 1066 },
1093 /*	{ 211,   80, 1400,  490, 1688, 1066 },    640x480 (6330) */
1094 	{ 211,   48,  840,  488, 1688, 1066 }, /* 640x480 (6325) WORKS */
1095 /*	{ 211,  117, 1638,  613, 1688, 1066 },    800x600 (6330) */
1096 	{ 211,   72, 1008,  609, 1688, 1066 }, /* 800x600 (6325) WORKS */
1097 	{ 211,  128, 1400,  776, 1688, 1066 }, /* 1024x768 */
1098 	{ 211,  205, 1680, 1041, 1688, 1066 }, /* 1280x1024 - not used (always unscaled) */
1099 	{   1,    1, 1688, 1066, 1688, 1066 }, /* 1400x1050 */
1100 	{   0,    0,    0,    0,    0,    0 }, /* kludge */
1101 	{ 211,  120, 1400,  730, 1688, 1066 }, /* 1280x720 */
1102 	{   0,    0,    0,    0,    0,    0 },
1103 	{   0,    0,    0,    0,    0,    0 },
1104 	{   0,    0,    0,    0,    0,    0 }
1105 };
1106 
1107 static const struct SiS_LCDData SiS_LCD1680x1050Data[] =
1108 {
1109 	{  95,   24, 1260,  410, 1900, 1066 }, /*  0 640x400 */
1110 	{  10,    3, 1710,  362, 1900, 1066 },
1111 	{  95,   24, 1260,  410, 1900, 1066 },
1112 	{  10,    3, 1710,  362, 1900, 1066 },
1113 	{  95,   32, 1400,  490, 1900, 1066 }, /*  4 640x480 */
1114 	{  95,   42, 1470,  610, 1900, 1066 }, /*  5 800x600 */
1115 	{  95,   64, 1750,  784, 1900, 1066 }, /*  6 1024x768 */
1116 	{  95,   94, 1900, 1055, 1900, 1066 }, /*  7 1280x1024 */
1117 	{  41,   31, 1900,  806, 1900, 1066 }, /*  8 1280x768 */
1118 	{  95,   69, 1800,  817, 1900, 1066 }, /*  9 1280x800 patch index */
1119 	{  13,    9, 1900,  739, 1900, 1066 }, /* 10 1280x720 */
1120 	{  95,   94, 1880, 1066, 1900, 1066 }, /* 11 1400x1050 patch index */
1121 	{   1,    1, 1900, 1066, 1900, 1066 }, /* 12 1680x1050 */
1122 	{   0,    0,    0,    0,    0,    0 }
1123 };
1124 
1125 static const struct SiS_LCDData SiS_StLCD1600x1200Data[] =
1126 {
1127 	{27,  4, 800, 500, 2160, 1250 },
1128 	{27,  4, 800, 500, 2160, 1250 },
1129 	{ 6,  1, 900, 500, 2160, 1250 },
1130 	{ 6,  1, 900, 500, 2160, 1250 },
1131 	{27,  1, 800, 500, 2160, 1250 },
1132 	{ 4,  1,1080, 625, 2160, 1250 },
1133 	{ 5,  2,1350, 800, 2160, 1250 },
1134 	{135,88,1600,1100, 2160, 1250 },
1135 	{72, 49,1680,1092, 2160, 1250 },
1136 	{ 1,  1,2160,1250, 2160, 1250 },
1137 	{ 0,  0,   0,   0,    0,    0 },
1138 	{ 0,  0,   0,   0,    0,    0 },
1139 	{ 0,  0,   0,   0,    0,    0 },
1140 	{ 0,  0,   0,   0,    0,    0 }
1141 };
1142 
1143 static const struct SiS_LCDData SiS_ExtLCD1600x1200Data[] =
1144 {
1145 	{72,11, 990, 422, 2160, 1250 }, /* 640x400 (6330) WORKS */
1146 /*	{27, 4, 800, 500, 2160, 1250 },    640x400 (6235) */
1147 	{27, 4, 800, 500, 2160, 1250 },
1148 	{ 6, 1, 900, 500, 2160, 1250 },
1149 	{ 6, 1, 900, 500, 2160, 1250 },
1150 	{45, 8, 960, 505, 2160, 1250 }, /* 640x480 (6330) WORKS */
1151 /*	{27, 1, 800, 500, 2160, 1250 },    640x480 (6325) */
1152 	{ 4, 1,1080, 625, 2160, 1250 },
1153 	{ 5, 2,1350, 800, 2160, 1250 },
1154 	{27,16,1500,1064, 2160, 1250 }, /* 1280x1024 */
1155 	{72,49,1680,1092, 2160, 1250 }, /* 1400x1050 (6330, was not supported on 6325) */
1156 	{ 1, 1,2160,1250, 2160, 1250 },
1157 	{ 0, 0,   0,   0,    0,    0 },
1158 	{ 0, 0,   0,   0,    0,    0 },
1159 	{ 0, 0,   0,   0,    0,    0 },
1160 	{ 0, 0,   0,   0,    0,    0 }
1161 };
1162 
1163 static const struct SiS_LCDData SiS_NoScaleData[] =
1164 {
1165 	{ 1, 1, 800, 449, 800, 449 },  /* 0x00: 320x200, 640x400 */
1166 	{ 1, 1, 800, 449, 800, 449 },
1167 	{ 1, 1, 900, 449, 900, 449 },
1168 	{ 1, 1, 900, 449, 900, 449 },
1169 	{ 1, 1, 800, 525, 800, 525 },  /* 0x04: 320x240, 640x480  */
1170 	{ 1, 1,1056, 628,1056, 628 },  /* 0x05: 400x300, 800x600  */
1171 	{ 1, 1,1344, 806,1344, 806 },  /* 0x06: 512x384, 1024x768 */
1172 	{ 1, 1,1688,1066,1688,1066 },  /* 0x07: 1280x1024 */
1173         { 1, 1,1688, 802,1688, 802 },  /* 0x08: 1280x768: Fujitsu, TMDS only */
1174         { 1, 1,2160,1250,2160,1250 },  /* 0x09: 1600x1200 */
1175 	{ 1, 1,1800,1000,1800,1000 },  /* 0x0a: 1280x960  */
1176 	{ 1, 1,1688,1066,1688,1066 },  /* 0x0b: 1400x1050 */
1177 	{ 1, 1,1650, 750,1650, 750 },  /* 0x0c: 1280x720 (TMDS, projector)  */
1178 	{ 1, 1,1552, 812,1552, 812 },  /* 0x0d: 1280x800_2 (LVDS) (was: 1408,816/ 1656,841) */
1179 	{ 1, 1,1900,1066,1900,1066 },  /* 0x0e: 1680x1050 (LVDS) */
1180 	{ 1, 1,1660, 806,1660, 806 },  /* 0x0f: 1280x768_2 (LVDS) */
1181 	{ 1, 1,1664, 798,1664, 798 },  /* 0x10: 1280x768_3 (NetVista SiS 301) - TODO */
1182 	{ 1, 1,1688, 802,1688, 802 },  /* 0x11: 1280x768   (TMDS Fujitsu) */
1183 	{ 1, 1,1408, 806,1408, 806 },  /* 0x12: 1280x720 (LVDS) */
1184 	{ 1, 1, 896, 497, 896, 497 },  /* 0x13: 720x480 */
1185 	{ 1, 1, 912, 597, 912, 597 },  /* 0x14: 720x576 */
1186 	{ 1, 1, 912, 597, 912, 597 },  /* 0x15: 768x576 */
1187 	{ 1, 1,1056, 497,1056, 497 },  /* 0x16: 848x480 */
1188 	{ 1, 1,1064, 497,1064, 497 },  /* 0x17: 856x480 */
1189 	{ 1, 1,1056, 497,1056, 497 },  /* 0x18: 800x480 */
1190 	{ 1, 1,1328, 739,1328, 739 },  /* 0x19: 1024x576 */
1191 	{ 1, 1,1680, 892,1680, 892 },  /* 0x1a: 1152x864 */
1192 	{ 1, 1,1808, 808,1808, 808 },  /* 0x1b: 1360x768 */
1193 	{ 1, 1,1104, 563,1104, 563 },  /* 0x1c: 960x540 */
1194 	{ 1, 1,1120, 618,1120, 618 },  /* 0x1d: 960x600 */
1195 	{ 1, 1,1408, 816,1408, 816 },  /* 0x1f: 1280x800 (TMDS special) */
1196 	{ 1, 1,1760,1235,1760,1235 },  /* 0x20: 1600x1200 for LCDA */
1197 	{ 1, 1,2048,1320,2048,1320 },  /* 0x21: 1600x1200 for non-SiS LVDS */
1198 	{ 1, 1,1664, 861,1664, 861 }   /* 0x22: 1280x854 */
1199 };
1200 
1201 /**************************************************************/
1202 /* LVDS ----------------------------------------------------- */
1203 /**************************************************************/
1204 
1205 /* FSTN/DSTN 320x240, 2 variants */
1206 static const struct SiS_LVDSData SiS_LVDS320x240Data_1[]=
1207 {
1208 	{ 848, 433, 400, 525},
1209 	{ 848, 389, 400, 525},
1210 	{ 848, 433, 400, 525},
1211 	{ 848, 389, 400, 525},
1212 	{ 848, 518, 400, 525},
1213 	{1056, 628, 400, 525},
1214 	{ 400, 525, 400, 525}  /* xSTN */
1215 };
1216 
1217 static const struct SiS_LVDSData SiS_LVDS320x240Data_2[]=
1218 {
1219 	{ 800, 445, 800, 525},
1220 	{ 800, 395, 800, 525},
1221 	{ 800, 445, 800, 525},
1222 	{ 800, 395, 800, 525},
1223 	{ 800, 525, 800, 525},
1224 	{1056, 628,1056, 628},
1225 	{ 480, 525, 480, 525} /* xSTN */
1226 };
1227 
1228 static const struct SiS_LVDSData SiS_LVDS640x480Data_1[]=
1229 {
1230 	{ 800, 445, 800, 525},   /* 800, 449, 800, 449 */
1231 	{ 800, 395, 800, 525},
1232 	{ 800, 445, 800, 525},
1233 	{ 800, 395, 800, 525},
1234 	{ 800, 525, 800, 525}
1235 };
1236 
1237 static const struct SiS_LVDSData SiS_LVDS800x600Data_1[]=
1238 {
1239 	{ 848, 433,1060, 629},
1240 	{ 848, 389,1060, 629},
1241 	{ 848, 433,1060, 629},
1242 	{ 848, 389,1060, 629},
1243 	{ 848, 518,1060, 629},
1244 	{1056, 628,1056, 628}
1245 };
1246 
1247 static const struct SiS_LVDSData SiS_LVDS1024x600Data_1[] =
1248 {
1249 	{ 840, 604,1344, 800},
1250 	{ 840, 560,1344, 800},
1251 	{ 840, 604,1344, 800},
1252 	{ 840, 560,1344, 800},
1253 	{ 840, 689,1344, 800},
1254 	{1050, 800,1344, 800},
1255 	{1344, 800,1344, 800}
1256 };
1257 
1258 static const struct SiS_LVDSData SiS_LVDS1024x768Data_1[]=
1259 {
1260 	{ 840, 438,1344, 806},
1261 	{ 840, 409,1344, 806},
1262 	{ 840, 438,1344, 806},
1263 	{ 840, 409,1344, 806},
1264 	{ 840, 518,1344, 806},   /* 640x480 */
1265 	{1050, 638,1344, 806},   /* 800x600 */
1266 	{1344, 806,1344, 806},   /* 1024x768 */
1267 };
1268 
1269 static const struct SiS_LVDSData SiS_CHTVUNTSCData[]=
1270 {
1271 	{ 840, 600, 840, 600},
1272 	{ 840, 600, 840, 600},
1273 	{ 840, 600, 840, 600},
1274 	{ 840, 600, 840, 600},
1275 	{ 784, 600, 784, 600},
1276 	{1064, 750,1064, 750},
1277         {1160, 945,1160, 945}
1278 };
1279 
1280 static const struct SiS_LVDSData SiS_CHTVONTSCData[]=
1281 {
1282 	{ 840, 525, 840, 525},
1283 	{ 840, 525, 840, 525},
1284 	{ 840, 525, 840, 525},
1285 	{ 840, 525, 840, 525},
1286 	{ 784, 525, 784, 525},
1287 	{1040, 700,1040, 700},
1288         {1160, 840,1160, 840}
1289 };
1290 
1291 /* CRT1 CRTC data for slave modes */
1292 
1293 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_1[] =
1294 {
1295  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1296    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1297    0x00 }},
1298  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1299    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1300    0x00 }},
1301  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1302    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1303    0x00 }},
1304  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1305    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1306    0x00 }},
1307  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1308    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1309    0x00 }},
1310  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1311    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1312    0x01 }},
1313  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1314    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1315    0x00 }}
1316 };
1317 
1318 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_2[] =
1319 {
1320  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1321    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1322    0x00}},
1323  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1324    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1325    0x00}},
1326  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1327    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1328    0x00}},
1329  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1330    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1331    0x00}},
1332  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1333    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1334    0x00}},
1335  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1336    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1337    0x01}},
1338 #if 0
1339  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1340    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1341    0x00}}
1342 #endif
1343  {{0x5f,0x4f,0x83,0x55,0x81,0x0b,0x3e,
1344    0xe9,0x8b,0xe8,0x0c,0x00,0x00,0x05,
1345    0x00}},
1346 };
1347 
1348 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_2_H[] =
1349 {
1350  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1351    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1352    0x00}},
1353  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1354    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1355    0x00}},
1356  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1357    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1358    0x00}},
1359  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1360    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1361    0x00}},
1362  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1363    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1364    0x00}},
1365  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1366    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1367    0x01}},
1368  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1369    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1370    0x00}}
1371 };
1372 
1373 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_3[] =
1374 {
1375  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1376    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1377    0x00}},
1378  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1379    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1380    0x00}},
1381  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1382    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1383    0x00}},
1384  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1385    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1386    0x00}},
1387  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1388    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1389    0x00}},
1390  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1391    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1392    0x01}},
1393  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1394    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1395    0x00}}
1396 };
1397 
1398 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_3_H[] =
1399 {
1400  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1401    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1402    0x00}},
1403  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1404    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1405    0x00}},
1406  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1407    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1408    0x00}},
1409  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1410    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1411    0x00}},
1412  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1413    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1414    0x00}},
1415  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1416    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1417    0x01}},
1418  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1419    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1420    0x00}}
1421 };
1422 
1423 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1[] =
1424 {
1425  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1426    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1427    0x00}},
1428  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1429    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1430    0x00}},
1431  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1432    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1433    0x00}},
1434  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1435    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1436    0x00}},
1437  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1438    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1439    0x00}},
1440  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1441    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1442    0x01}}
1443 };
1444 
1445 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] =
1446 {
1447  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1448    0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
1449    0x00}},
1450  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1451    0x83,0x85,0x63,0xba,0x00,0x00,0x00,
1452    0x00}},
1453  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1454    0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
1455    0x00}},
1456  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1457    0x83,0x85,0x63,0xba,0x00,0x00,0x00,
1458    0x00}},
1459  {{0x2d,0x28,0x90,0x2c,0x80,0x0b,0x3e,
1460    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1461    0x00}}
1462 };
1463 
1464 #endif
1465 
1466