1 /* SPDX-License-Identifier: HPND-sell-variant */
2 /* Ported from xf86-video-ast driver */
7 /* Std. Table Index Definition */
8 #define TextModeIndex 0
10 #define VGAModeIndex 2
11 #define HiCModeIndex 3
12 #define TrueCModeIndex 4
14 #define Charx8Dot 0x00000001
15 #define HalfDCLK 0x00000002
16 #define DoubleScanMode 0x00000004
17 #define LineCompareOff 0x00000008
18 #define HBorder 0x00000020
19 #define VBorder 0x00000010
20 #define WideScreenMode 0x00000100
21 #define NewModeInfo 0x00000200
22 #define NHSync 0x00000400
23 #define PHSync 0x00000800
24 #define NVSync 0x00001000
25 #define PVSync 0x00002000
26 #define SyncPP (PVSync | PHSync)
27 #define SyncPN (PVSync | NHSync)
28 #define SyncNP (NVSync | PHSync)
29 #define SyncNN (NVSync | NHSync)
30 #define AST2500PreCatchCRT 0x00004000
33 #define VCLK25_175 0x00
34 #define VCLK28_322 0x01
40 #define VCLK56_25 0x07
43 #define VCLK78_75 0x0A
47 #define VCLK157_5 0x0E
49 /* #define VCLK193_25 0x10 */
52 #define VCLK106_5 0x12
53 #define VCLK146_25 0x13
54 #define VCLK148_5 0x14
56 #define VCLK88_75 0x16
59 #define VCLK97_75 0x19
60 #define VCLK118_25 0x1A
62 static struct ast_vbios_dclk_info dclk_table
[] = {
63 {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */
64 {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */
65 {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */
66 {0x76, 0x63, 0x01}, /* 03: VCLK36 */
67 {0xEE, 0x67, 0x01}, /* 04: VCLK40 */
68 {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */
69 {0xC6, 0x64, 0x01}, /* 06: VCLK50 */
70 {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */
71 {0x80, 0x64, 0x00}, /* 08: VCLK65 */
72 {0x7B, 0x63, 0x00}, /* 09: VCLK75 */
73 {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */
74 {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */
75 {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */
76 {0x85, 0x24, 0x00}, /* 0D: VCLK135 */
77 {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */
78 {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */
79 {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */
80 {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */
81 {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */
82 {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */
83 {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */
84 {0x47, 0x6c, 0x80}, /* 15: VCLK71 */
85 {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */
86 {0x77, 0x58, 0x80}, /* 17: VCLK119 */
87 {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */
88 {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */
89 {0x3b, 0x2c, 0x81}, /* 1A: VCLK118_25 */
92 static const struct ast_vbios_dclk_info dclk_table_ast2500
[] = {
93 {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */
94 {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */
95 {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */
96 {0x76, 0x63, 0x01}, /* 03: VCLK36 */
97 {0xEE, 0x67, 0x01}, /* 04: VCLK40 */
98 {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */
99 {0xC6, 0x64, 0x01}, /* 06: VCLK50 */
100 {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */
101 {0x80, 0x64, 0x00}, /* 08: VCLK65 */
102 {0x7B, 0x63, 0x00}, /* 09: VCLK75 */
103 {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */
104 {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */
105 {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */
106 {0x85, 0x24, 0x00}, /* 0D: VCLK135 */
107 {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */
108 {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */
109 {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */
110 {0x68, 0x6f, 0x80}, /* 11: VCLK83.5 */
111 {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */
112 {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */
113 {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */
114 {0x47, 0x6c, 0x80}, /* 15: VCLK71 */
115 {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */
116 {0x58, 0x01, 0x42}, /* 17: VCLK119 */
117 {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */
118 {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */
119 {0x44, 0x20, 0x43}, /* 1A: VCLK118_25 */
122 static struct ast_vbios_stdtable vbios_stdtable
[] = {
126 {0x00, 0x03, 0x00, 0x02},
127 {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
128 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
129 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
131 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
132 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
133 0x0c, 0x00, 0x0f, 0x08},
134 {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00,
137 /* Mode12/ExtEGATable */
140 {0x01, 0x0f, 0x00, 0x06},
141 {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e,
142 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143 0xe9, 0x8b, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
145 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
146 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
147 0x01, 0x00, 0x0f, 0x00},
148 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
154 {0x01, 0x0f, 0x00, 0x0e},
155 {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
156 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
159 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
160 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
161 0x01, 0x00, 0x00, 0x00},
162 {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f,
168 {0x01, 0x0f, 0x00, 0x0e},
169 {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
170 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
173 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
174 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
175 0x01, 0x00, 0x00, 0x00},
176 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
182 {0x01, 0x0f, 0x00, 0x0e},
183 {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
184 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
187 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
188 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
189 0x01, 0x00, 0x00, 0x00},
190 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f,
195 static const struct ast_vbios_enhtable res_640x480
[] = {
196 { 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175
, /* 60Hz */
197 (SyncNN
| HBorder
| VBorder
| Charx8Dot
), 60, 1, 0x2E },
198 { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5
, /* 72Hz */
199 (SyncNN
| HBorder
| VBorder
| Charx8Dot
), 72, 2, 0x2E },
200 { 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5
, /* 75Hz */
201 (SyncNN
| Charx8Dot
) , 75, 3, 0x2E },
202 { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36
, /* 85Hz */
203 (SyncNN
| Charx8Dot
) , 85, 4, 0x2E },
204 { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36
, /* end */
205 (SyncNN
| Charx8Dot
) , 0xFF, 4, 0x2E },
208 static const struct ast_vbios_enhtable res_800x600
[] = {
209 {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36
, /* 56Hz */
210 (SyncPP
| Charx8Dot
), 56, 1, 0x30 },
211 {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40
, /* 60Hz */
212 (SyncPP
| Charx8Dot
), 60, 2, 0x30 },
213 {1040, 800, 56, 120, 666, 600, 37, 6, VCLK50
, /* 72Hz */
214 (SyncPP
| Charx8Dot
), 72, 3, 0x30 },
215 {1056, 800, 16, 80, 625, 600, 1, 3, VCLK49_5
, /* 75Hz */
216 (SyncPP
| Charx8Dot
), 75, 4, 0x30 },
217 {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25
, /* 85Hz */
218 (SyncPP
| Charx8Dot
), 84, 5, 0x30 },
219 {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25
, /* end */
220 (SyncPP
| Charx8Dot
), 0xFF, 5, 0x30 },
223 static const struct ast_vbios_enhtable res_1024x768
[] = {
224 {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65
, /* 60Hz */
225 (SyncNN
| Charx8Dot
), 60, 1, 0x31 },
226 {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75
, /* 70Hz */
227 (SyncNN
| Charx8Dot
), 70, 2, 0x31 },
228 {1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75
, /* 75Hz */
229 (SyncPP
| Charx8Dot
), 75, 3, 0x31 },
230 {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5
, /* 85Hz */
231 (SyncPP
| Charx8Dot
), 84, 4, 0x31 },
232 {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5
, /* end */
233 (SyncPP
| Charx8Dot
), 0xFF, 4, 0x31 },
236 static const struct ast_vbios_enhtable res_1280x1024
[] = {
237 {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108
, /* 60Hz */
238 (SyncPP
| Charx8Dot
), 60, 1, 0x32 },
239 {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135
, /* 75Hz */
240 (SyncPP
| Charx8Dot
), 75, 2, 0x32 },
241 {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5
, /* 85Hz */
242 (SyncPP
| Charx8Dot
), 85, 3, 0x32 },
243 {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5
, /* end */
244 (SyncPP
| Charx8Dot
), 0xFF, 3, 0x32 },
247 static const struct ast_vbios_enhtable res_1600x1200
[] = {
248 {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162
, /* 60Hz */
249 (SyncPP
| Charx8Dot
), 60, 1, 0x33 },
250 {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162
, /* end */
251 (SyncPP
| Charx8Dot
), 0xFF, 1, 0x33 },
255 static const struct ast_vbios_enhtable res_1360x768
[] = {
256 {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5
, /* 60Hz */
257 (SyncPP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 60, 1, 0x39 },
258 {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5
, /* end */
259 (SyncPP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
260 AST2500PreCatchCRT
), 0xFF, 1, 0x39 },
263 static const struct ast_vbios_enhtable res_1600x900
[] = {
264 {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75
, /* 60Hz CVT RB */
265 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
266 AST2500PreCatchCRT
), 60, 1, 0x3A },
267 {2112, 1600, 88, 168, 934, 900, 3, 5, VCLK118_25
, /* 60Hz CVT */
268 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 60, 2, 0x3A },
269 {2112, 1600, 88, 168, 934, 900, 3, 5, VCLK118_25
, /* 60Hz CVT */
270 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 0xFF, 2, 0x3A },
273 static const struct ast_vbios_enhtable res_1920x1080
[] = {
274 {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5
, /* 60Hz */
275 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
276 AST2500PreCatchCRT
), 60, 1, 0x38 },
277 {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5
, /* 60Hz */
278 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
279 AST2500PreCatchCRT
), 0xFF, 1, 0x38 },
283 static const struct ast_vbios_enhtable res_1280x800
[] = {
284 {1440, 1280, 48, 32, 823, 800, 3, 6, VCLK71
, /* 60Hz RB */
285 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
286 AST2500PreCatchCRT
), 60, 1, 0x35 },
287 {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5
, /* 60Hz */
288 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 60, 2, 0x35 },
289 {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5
, /* 60Hz */
290 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 0xFF, 2, 0x35 },
294 static const struct ast_vbios_enhtable res_1440x900
[] = {
295 {1600, 1440, 48, 32, 926, 900, 3, 6, VCLK88_75
, /* 60Hz RB */
296 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
297 AST2500PreCatchCRT
), 60, 1, 0x36 },
298 {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5
, /* 60Hz */
299 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 60, 2, 0x36 },
300 {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5
, /* 60Hz */
301 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 0xFF, 2, 0x36 },
304 static const struct ast_vbios_enhtable res_1680x1050
[] = {
305 {1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119
, /* 60Hz RB */
306 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
307 AST2500PreCatchCRT
), 60, 1, 0x37 },
308 {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25
, /* 60Hz */
309 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 60, 2, 0x37 },
310 {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25
, /* 60Hz */
311 (SyncPN
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
), 0xFF, 2, 0x37 },
314 static const struct ast_vbios_enhtable res_1920x1200
[] = {
315 {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154
, /* 60Hz RB*/
316 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
317 AST2500PreCatchCRT
), 60, 1, 0x34 },
318 {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154
, /* 60Hz RB */
319 (SyncNP
| Charx8Dot
| LineCompareOff
| WideScreenMode
| NewModeInfo
|
320 AST2500PreCatchCRT
), 0xFF, 1, 0x34 },