xref: /openbmc/linux/drivers/gpu/drm/ast/ast_tables.h (revision d2999e1b)
1 /*
2  * Copyright (c) 2005 ASPEED Technology Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of the authors not be used in
9  * advertising or publicity pertaining to distribution of the software without
10  * specific, written prior permission.  The authors makes no representations
11  * about the suitability of this software for any purpose.  It is provided
12  * "as is" without express or implied warranty.
13  *
14  * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22 /* Ported from xf86-video-ast driver */
23 
24 #ifndef AST_TABLES_H
25 #define AST_TABLES_H
26 
27 /* Std. Table Index Definition */
28 #define TextModeIndex		0
29 #define EGAModeIndex		1
30 #define VGAModeIndex		2
31 #define HiCModeIndex		3
32 #define TrueCModeIndex		4
33 
34 #define Charx8Dot               0x00000001
35 #define HalfDCLK                0x00000002
36 #define DoubleScanMode          0x00000004
37 #define LineCompareOff          0x00000008
38 #define SyncPP                  0x00000000
39 #define SyncPN                  0x00000040
40 #define SyncNP                  0x00000080
41 #define SyncNN                  0x000000C0
42 #define HBorder                 0x00000020
43 #define VBorder                 0x00000010
44 #define WideScreenMode		0x00000100
45 #define NewModeInfo		0x00000200
46 
47 /* DCLK Index */
48 #define VCLK25_175     		0x00
49 #define VCLK28_322     		0x01
50 #define VCLK31_5       		0x02
51 #define VCLK36         		0x03
52 #define VCLK40         		0x04
53 #define VCLK49_5       		0x05
54 #define VCLK50         		0x06
55 #define VCLK56_25      		0x07
56 #define VCLK65		 	0x08
57 #define VCLK75	        	0x09
58 #define VCLK78_75      		0x0A
59 #define VCLK94_5       		0x0B
60 #define VCLK108        		0x0C
61 #define VCLK135        		0x0D
62 #define VCLK157_5      		0x0E
63 #define VCLK162        		0x0F
64 /* #define VCLK193_25     		0x10 */
65 #define VCLK154     		0x10
66 #define VCLK83_5    		0x11
67 #define VCLK106_5   		0x12
68 #define VCLK146_25  		0x13
69 #define VCLK148_5   		0x14
70 #define VCLK71      		0x15
71 #define VCLK88_75   		0x16
72 #define VCLK119     		0x17
73 #define VCLK85_5     		0x18
74 #define VCLK97_75     		0x19
75 
76 static struct ast_vbios_dclk_info dclk_table[] = {
77 	{0x2C, 0xE7, 0x03},					/* 00: VCLK25_175	*/
78 	{0x95, 0x62, 0x03},				        /* 01: VCLK28_322	*/
79 	{0x67, 0x63, 0x01},				        /* 02: VCLK31_5         */
80 	{0x76, 0x63, 0x01},				        /* 03: VCLK36         	*/
81 	{0xEE, 0x67, 0x01},				        /* 04: VCLK40          	*/
82 	{0x82, 0x62, 0x01}, 			        /* 05: VCLK49_5        	*/
83 	{0xC6, 0x64, 0x01},                        	        /* 06: VCLK50          	*/
84 	{0x94, 0x62, 0x01},                        	        /* 07: VCLK56_25       	*/
85 	{0x80, 0x64, 0x00},                        	        /* 08: VCLK65		*/
86 	{0x7B, 0x63, 0x00},                        	        /* 09: VCLK75	        */
87 	{0x67, 0x62, 0x00},				        /* 0A: VCLK78_75       	*/
88 	{0x7C, 0x62, 0x00},                        	        /* 0B: VCLK94_5        	*/
89 	{0x8E, 0x62, 0x00},                        	        /* 0C: VCLK108         	*/
90 	{0x85, 0x24, 0x00},                        	        /* 0D: VCLK135         	*/
91 	{0x67, 0x22, 0x00},                        	        /* 0E: VCLK157_5       	*/
92 	{0x6A, 0x22, 0x00},				        /* 0F: VCLK162         	*/
93 	{0x4d, 0x4c, 0x80},				        /* 10: VCLK154      	*/
94 	{0xa7, 0x78, 0x80},					/* 11: VCLK83.5         */
95 	{0x28, 0x49, 0x80},					/* 12: VCLK106.5        */
96 	{0x37, 0x49, 0x80},					/* 13: VCLK146.25       */
97 	{0x1f, 0x45, 0x80},					/* 14: VCLK148.5        */
98 	{0x47, 0x6c, 0x80},					/* 15: VCLK71       */
99 	{0x25, 0x65, 0x80},					/* 16: VCLK88.75    */
100 	{0x77, 0x58, 0x80},					/* 17: VCLK119      */
101 	{0x32, 0x67, 0x80},				    /* 18: VCLK85_5     */
102 };
103 
104 static struct ast_vbios_stdtable vbios_stdtable[] = {
105 	/* MD_2_3_400 */
106 	{
107 		0x67,
108 		{0x00,0x03,0x00,0x02},
109 		{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
110 		 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
111 		 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
112 		 0xff},
113 		{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
114 		 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
115 		 0x0c,0x00,0x0f,0x08},
116 		{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
117 		 0xff}
118 	},
119 	/* Mode12/ExtEGATable */
120 	{
121 		0xe3,
122 		{0x01,0x0f,0x00,0x06},
123 		{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
124 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
125 		 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,
126 		 0xff},
127 		{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
128 		 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
129 		 0x01,0x00,0x0f,0x00},
130 		{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
131 		 0xff}
132 	},
133 	/* ExtVGATable */
134 	{
135 		0x2f,
136 		{0x01,0x0f,0x00,0x0e},
137 		{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
138 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
139 		 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
140 		 0xff},
141 		{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
142 		 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
143 		 0x01,0x00,0x00,0x00},
144 		{0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
145 		 0xff}
146 	},
147 	/* ExtHiCTable */
148 	{
149 		0x2f,
150 		{0x01,0x0f,0x00,0x0e},
151 		{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
152 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
153 		 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
154 		 0xff},
155 		{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
156 		 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
157 		 0x01,0x00,0x00,0x00},
158 		{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
159 		 0xff}
160 	},
161 	/* ExtTrueCTable */
162 	{
163 		0x2f,
164 		{0x01,0x0f,0x00,0x0e},
165 		{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
166 		 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
167 		 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
168 		 0xff},
169 		{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
170 		 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
171 		 0x01,0x00,0x00,0x00},
172 		{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
173 		 0xff}
174 	},
175 };
176 
177 static struct ast_vbios_enhtable res_640x480[] = {
178 	{ 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175,	/* 60Hz */
179 	  (SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E },
180 	{ 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5,	/* 72Hz */
181 	  (SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E  },
182 	{ 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5,	/* 75Hz */
183 	  (SyncNN | Charx8Dot) , 75, 3, 0x2E },
184 	{ 832, 640, 56, 56, 509, 480, 1, 3, VCLK36,		/* 85Hz */
185 	  (SyncNN | Charx8Dot) , 85, 4, 0x2E },
186 	{ 832, 640, 56, 56, 509, 480, 1, 3, VCLK36,		/* end */
187 	  (SyncNN | Charx8Dot) , 0xFF, 4, 0x2E },
188 };
189 
190 static struct ast_vbios_enhtable res_800x600[] = {
191 	{1024, 800, 24, 72, 625, 600, 1, 2, VCLK36,		/* 56Hz */
192 	 (SyncPP | Charx8Dot), 56, 1, 0x30 },
193 	{1056, 800, 40, 128, 628, 600, 1, 4, VCLK40,	/* 60Hz */
194 	 (SyncPP | Charx8Dot), 60, 2, 0x30 },
195 	{1040, 800, 56, 120, 666, 600, 37, 6, VCLK50,	/* 72Hz */
196 	 (SyncPP | Charx8Dot), 72, 3, 0x30 },
197 	{1056, 800, 16, 80, 625, 600, 1, 3, VCLK49_5,	/* 75Hz */
198 	 (SyncPP | Charx8Dot), 75, 4, 0x30 },
199 	{1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25,	/* 85Hz */
200 	 (SyncPP | Charx8Dot), 84, 5, 0x30 },
201 	{1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25,	/* end */
202 	 (SyncPP | Charx8Dot), 0xFF, 5, 0x30 },
203 };
204 
205 
206 static struct ast_vbios_enhtable res_1024x768[] = {
207 	{1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65,	/* 60Hz */
208 	 (SyncNN | Charx8Dot), 60, 1, 0x31 },
209 	{1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75,	/* 70Hz */
210 	 (SyncNN | Charx8Dot), 70, 2, 0x31 },
211 	{1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75,	/* 75Hz */
212 	 (SyncPP | Charx8Dot), 75, 3, 0x31 },
213 	{1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5,	/* 85Hz */
214 	 (SyncPP | Charx8Dot), 84, 4, 0x31 },
215 	{1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5,	/* end */
216 	 (SyncPP | Charx8Dot), 0xFF, 4, 0x31 },
217 };
218 
219 static struct ast_vbios_enhtable res_1280x1024[] = {
220 	{1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108,	/* 60Hz */
221 	 (SyncPP | Charx8Dot), 60, 1, 0x32 },
222 	{1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135,	/* 75Hz */
223 	 (SyncPP | Charx8Dot), 75, 2, 0x32 },
224 	{1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5,	/* 85Hz */
225 	 (SyncPP | Charx8Dot), 85, 3, 0x32 },
226 	{1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5,	/* end */
227 	 (SyncPP | Charx8Dot), 0xFF, 3, 0x32 },
228 };
229 
230 static struct ast_vbios_enhtable res_1600x1200[] = {
231 	{2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162,	/* 60Hz */
232 	 (SyncPP | Charx8Dot), 60, 1, 0x33 },
233 	{2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162,	/* end */
234 	 (SyncPP | Charx8Dot), 0xFF, 1, 0x33 },
235 };
236 
237 /* 16:9 */
238 static struct ast_vbios_enhtable res_1360x768[] = {
239 	{1792, 1360, 64,112, 795,  768, 3, 6, VCLK85_5,	         /* 60Hz */
240 	 (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x39 },
241 	{1792, 1360, 64,112, 795,  768, 3, 6, VCLK85_5,	         /* end */
242 	 (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x39 },
243 };
244 
245 static struct ast_vbios_enhtable res_1600x900[] = {
246 	{1760, 1600, 48, 32, 926,  900, 3, 5, VCLK97_75,	/* 60Hz CVT RB */
247 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x3A },
248 	{1760, 1600, 48, 32, 926,  900, 3, 5, VCLK97_75,	/* end */
249 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x3A }
250 };
251 
252 static struct ast_vbios_enhtable res_1920x1080[] = {
253 	{2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,	/* 60Hz */
254 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x38 },
255 	{2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,	/* 60Hz */
256 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x38 },
257 };
258 
259 
260 /* 16:10 */
261 static struct ast_vbios_enhtable res_1280x800[] = {
262 	{1440, 1280, 48, 32,  823,  800, 3, 6, VCLK71,	/* 60Hz RB */
263 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 35 },
264 	{1680, 1280, 72,128,  831,  800, 3, 6, VCLK83_5,	/* 60Hz */
265 	 (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x35 },
266 	{1680, 1280, 72,128,  831,  800, 3, 6, VCLK83_5,	/* 60Hz */
267 	 (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x35 },
268 
269 };
270 
271 static struct ast_vbios_enhtable res_1440x900[] = {
272 	{1600, 1440, 48, 32,  926,  900, 3, 6, VCLK88_75,	/* 60Hz RB */
273 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 },
274 	{1904, 1440, 80,152,  934,  900, 3, 6, VCLK106_5,	/* 60Hz */
275 	 (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 },
276 	{1904, 1440, 80,152,  934,  900, 3, 6, VCLK106_5,	/* 60Hz */
277 	 (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x36 },
278 };
279 
280 static struct ast_vbios_enhtable res_1680x1050[] = {
281 	{1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119,	/* 60Hz RB */
282 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 },
283 	{2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25,	/* 60Hz */
284 	 (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 },
285 	{2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25,	/* 60Hz */
286 	 (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x37 },
287 };
288 
289 static struct ast_vbios_enhtable res_1920x1200[] = {
290 	{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154,	/* 60Hz */
291 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x34 },
292 	{2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154,	/* 60Hz */
293 	 (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x34 },
294 };
295 
296 #endif
297