blob: d1267904c280947aaac3916a659233f11fbe967d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/drivers/video/modedb.c -- Standard video mode database management
3 *
4 * Copyright (C) 1999 Geert Uytterhoeven
5 *
6 * 2001 - Documented with DocBook
7 * - Brad Douglas <brad@neruo.com>
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file COPYING in the main directory of this archive for
11 * more details.
12 */
13
14#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/fb.h>
16#include <linux/sched.h>
17
18#undef DEBUG
19
20#define name_matches(v, s, l) \
21 ((v).name && !strncmp((s), (v).name, (l)) && strlen((v).name) == (l))
22#define res_matches(v, x, y) \
23 ((v).xres == (x) && (v).yres == (y))
24
25#ifdef DEBUG
26#define DPRINTK(fmt, args...) printk("modedb %s: " fmt, __FUNCTION__ , ## args)
27#else
28#define DPRINTK(fmt, args...)
29#endif
30
31const char *global_mode_option;
32
33 /*
34 * Standard video mode definitions (taken from XFree86)
35 */
36
37#define DEFAULT_MODEDB_INDEX 0
38
39static const struct fb_videomode modedb[] = {
40 {
41 /* 640x400 @ 70 Hz, 31.5 kHz hsync */
42 NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
43 0, FB_VMODE_NONINTERLACED
44 }, {
45 /* 640x480 @ 60 Hz, 31.5 kHz hsync */
46 NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2,
47 0, FB_VMODE_NONINTERLACED
48 }, {
49 /* 800x600 @ 56 Hz, 35.15 kHz hsync */
50 NULL, 56, 800, 600, 27777, 128, 24, 22, 1, 72, 2,
51 0, FB_VMODE_NONINTERLACED
52 }, {
53 /* 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync */
54 NULL, 87, 1024, 768, 22271, 56, 24, 33, 8, 160, 8,
55 0, FB_VMODE_INTERLACED
56 }, {
57 /* 640x400 @ 85 Hz, 37.86 kHz hsync */
58 NULL, 85, 640, 400, 31746, 96, 32, 41, 1, 64, 3,
59 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
60 }, {
61 /* 640x480 @ 72 Hz, 36.5 kHz hsync */
62 NULL, 72, 640, 480, 31746, 144, 40, 30, 8, 40, 3,
63 0, FB_VMODE_NONINTERLACED
64 }, {
65 /* 640x480 @ 75 Hz, 37.50 kHz hsync */
66 NULL, 75, 640, 480, 31746, 120, 16, 16, 1, 64, 3,
67 0, FB_VMODE_NONINTERLACED
68 }, {
69 /* 800x600 @ 60 Hz, 37.8 kHz hsync */
70 NULL, 60, 800, 600, 25000, 88, 40, 23, 1, 128, 4,
71 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
72 }, {
73 /* 640x480 @ 85 Hz, 43.27 kHz hsync */
74 NULL, 85, 640, 480, 27777, 80, 56, 25, 1, 56, 3,
75 0, FB_VMODE_NONINTERLACED
76 }, {
77 /* 1152x864 @ 89 Hz interlaced, 44 kHz hsync */
78 NULL, 69, 1152, 864, 15384, 96, 16, 110, 1, 216, 10,
79 0, FB_VMODE_INTERLACED
80 }, {
81 /* 800x600 @ 72 Hz, 48.0 kHz hsync */
82 NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6,
83 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
84 }, {
85 /* 1024x768 @ 60 Hz, 48.4 kHz hsync */
86 NULL, 60, 1024, 768, 15384, 168, 8, 29, 3, 144, 6,
87 0, FB_VMODE_NONINTERLACED
88 }, {
89 /* 640x480 @ 100 Hz, 53.01 kHz hsync */
90 NULL, 100, 640, 480, 21834, 96, 32, 36, 8, 96, 6,
91 0, FB_VMODE_NONINTERLACED
92 }, {
93 /* 1152x864 @ 60 Hz, 53.5 kHz hsync */
94 NULL, 60, 1152, 864, 11123, 208, 64, 16, 4, 256, 8,
95 0, FB_VMODE_NONINTERLACED
96 }, {
97 /* 800x600 @ 85 Hz, 55.84 kHz hsync */
98 NULL, 85, 800, 600, 16460, 160, 64, 36, 16, 64, 5,
99 0, FB_VMODE_NONINTERLACED
100 }, {
101 /* 1024x768 @ 70 Hz, 56.5 kHz hsync */
102 NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6,
103 0, FB_VMODE_NONINTERLACED
104 }, {
105 /* 1280x1024 @ 87 Hz interlaced, 51 kHz hsync */
106 NULL, 87, 1280, 1024, 12500, 56, 16, 128, 1, 216, 12,
107 0, FB_VMODE_INTERLACED
108 }, {
109 /* 800x600 @ 100 Hz, 64.02 kHz hsync */
110 NULL, 100, 800, 600, 14357, 160, 64, 30, 4, 64, 6,
111 0, FB_VMODE_NONINTERLACED
112 }, {
113 /* 1024x768 @ 76 Hz, 62.5 kHz hsync */
114 NULL, 76, 1024, 768, 11764, 208, 8, 36, 16, 120, 3,
115 0, FB_VMODE_NONINTERLACED
116 }, {
117 /* 1152x864 @ 70 Hz, 62.4 kHz hsync */
118 NULL, 70, 1152, 864, 10869, 106, 56, 20, 1, 160, 10,
119 0, FB_VMODE_NONINTERLACED
120 }, {
121 /* 1280x1024 @ 61 Hz, 64.2 kHz hsync */
122 NULL, 61, 1280, 1024, 9090, 200, 48, 26, 1, 184, 3,
123 0, FB_VMODE_NONINTERLACED
124 }, {
125 /* 1400x1050 @ 60Hz, 63.9 kHz hsync */
126 NULL, 68, 1400, 1050, 9259, 136, 40, 13, 1, 112, 3,
127 0, FB_VMODE_NONINTERLACED
128 }, {
129 /* 1400x1050 @ 75,107 Hz, 82,392 kHz +hsync +vsync*/
130 NULL, 75, 1400, 1050, 9271, 120, 56, 13, 0, 112, 3,
131 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
132 }, {
133 /* 1400x1050 @ 60 Hz, ? kHz +hsync +vsync*/
134 NULL, 60, 1400, 1050, 9259, 128, 40, 12, 0, 112, 3,
135 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
136 }, {
137 /* 1024x768 @ 85 Hz, 70.24 kHz hsync */
138 NULL, 85, 1024, 768, 10111, 192, 32, 34, 14, 160, 6,
139 0, FB_VMODE_NONINTERLACED
140 }, {
141 /* 1152x864 @ 78 Hz, 70.8 kHz hsync */
142 NULL, 78, 1152, 864, 9090, 228, 88, 32, 0, 84, 12,
143 0, FB_VMODE_NONINTERLACED
144 }, {
145 /* 1280x1024 @ 70 Hz, 74.59 kHz hsync */
146 NULL, 70, 1280, 1024, 7905, 224, 32, 28, 8, 160, 8,
147 0, FB_VMODE_NONINTERLACED
148 }, {
149 /* 1600x1200 @ 60Hz, 75.00 kHz hsync */
150 NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3,
151 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
152 }, {
153 /* 1152x864 @ 84 Hz, 76.0 kHz hsync */
154 NULL, 84, 1152, 864, 7407, 184, 312, 32, 0, 128, 12,
155 0, FB_VMODE_NONINTERLACED
156 }, {
157 /* 1280x1024 @ 74 Hz, 78.85 kHz hsync */
158 NULL, 74, 1280, 1024, 7407, 256, 32, 34, 3, 144, 3,
159 0, FB_VMODE_NONINTERLACED
160 }, {
161 /* 1024x768 @ 100Hz, 80.21 kHz hsync */
162 NULL, 100, 1024, 768, 8658, 192, 32, 21, 3, 192, 10,
163 0, FB_VMODE_NONINTERLACED
164 }, {
165 /* 1280x1024 @ 76 Hz, 81.13 kHz hsync */
166 NULL, 76, 1280, 1024, 7407, 248, 32, 34, 3, 104, 3,
167 0, FB_VMODE_NONINTERLACED
168 }, {
169 /* 1600x1200 @ 70 Hz, 87.50 kHz hsync */
170 NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3,
171 0, FB_VMODE_NONINTERLACED
172 }, {
173 /* 1152x864 @ 100 Hz, 89.62 kHz hsync */
174 NULL, 100, 1152, 864, 7264, 224, 32, 17, 2, 128, 19,
175 0, FB_VMODE_NONINTERLACED
176 }, {
177 /* 1280x1024 @ 85 Hz, 91.15 kHz hsync */
178 NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3,
179 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
180 }, {
181 /* 1600x1200 @ 75 Hz, 93.75 kHz hsync */
182 NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3,
183 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
184 }, {
Olaf Heringb0c87972006-03-27 01:17:38 -0800185 /* 1680x1050 @ 60 Hz, 65.191 kHz hsync */
186 NULL, 60, 1680, 1050, 6848, 280, 104, 30, 3, 176, 6,
187 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
188 }, {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 /* 1600x1200 @ 85 Hz, 105.77 kHz hsync */
190 NULL, 85, 1600, 1200, 4545, 272, 16, 37, 4, 192, 3,
191 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
192 }, {
193 /* 1280x1024 @ 100 Hz, 107.16 kHz hsync */
194 NULL, 100, 1280, 1024, 5502, 256, 32, 26, 7, 128, 15,
195 0, FB_VMODE_NONINTERLACED
196 }, {
197 /* 1800x1440 @ 64Hz, 96.15 kHz hsync */
198 NULL, 64, 1800, 1440, 4347, 304, 96, 46, 1, 192, 3,
199 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
200 }, {
201 /* 1800x1440 @ 70Hz, 104.52 kHz hsync */
202 NULL, 70, 1800, 1440, 4000, 304, 96, 46, 1, 192, 3,
203 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
204 }, {
205 /* 512x384 @ 78 Hz, 31.50 kHz hsync */
206 NULL, 78, 512, 384, 49603, 48, 16, 16, 1, 64, 3,
207 0, FB_VMODE_NONINTERLACED
208 }, {
209 /* 512x384 @ 85 Hz, 34.38 kHz hsync */
210 NULL, 85, 512, 384, 45454, 48, 16, 16, 1, 64, 3,
211 0, FB_VMODE_NONINTERLACED
212 }, {
213 /* 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio */
214 NULL, 70, 320, 200, 79440, 16, 16, 20, 4, 48, 1,
215 0, FB_VMODE_DOUBLE
216 }, {
217 /* 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio */
218 NULL, 60, 320, 240, 79440, 16, 16, 16, 5, 48, 1,
219 0, FB_VMODE_DOUBLE
220 }, {
221 /* 320x240 @ 72 Hz, 36.5 kHz hsync */
222 NULL, 72, 320, 240, 63492, 16, 16, 16, 4, 48, 2,
223 0, FB_VMODE_DOUBLE
224 }, {
225 /* 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio */
226 NULL, 56, 400, 300, 55555, 64, 16, 10, 1, 32, 1,
227 0, FB_VMODE_DOUBLE
228 }, {
229 /* 400x300 @ 60 Hz, 37.8 kHz hsync */
230 NULL, 60, 400, 300, 50000, 48, 16, 11, 1, 64, 2,
231 0, FB_VMODE_DOUBLE
232 }, {
233 /* 400x300 @ 72 Hz, 48.0 kHz hsync */
234 NULL, 72, 400, 300, 40000, 32, 24, 11, 19, 64, 3,
235 0, FB_VMODE_DOUBLE
236 }, {
237 /* 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio */
238 NULL, 56, 480, 300, 46176, 80, 16, 10, 1, 40, 1,
239 0, FB_VMODE_DOUBLE
240 }, {
241 /* 480x300 @ 60 Hz, 37.8 kHz hsync */
242 NULL, 60, 480, 300, 41858, 56, 16, 11, 1, 80, 2,
243 0, FB_VMODE_DOUBLE
244 }, {
245 /* 480x300 @ 63 Hz, 39.6 kHz hsync */
246 NULL, 63, 480, 300, 40000, 56, 16, 11, 1, 80, 2,
247 0, FB_VMODE_DOUBLE
248 }, {
249 /* 480x300 @ 72 Hz, 48.0 kHz hsync */
250 NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3,
251 0, FB_VMODE_DOUBLE
Antonino Daplasdb6778d2005-08-08 14:22:43 +0800252 }, {
253 /* 1920x1200 @ 60 Hz, 74.5 Khz hsync */
254 NULL, 60, 1920, 1200, 5177, 128, 336, 1, 38, 208, 3,
255 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
256 FB_VMODE_NONINTERLACED
Michael Hanselmann1dfcdfa2005-11-08 21:39:06 -0800257 }, {
258 /* 1152x768, 60 Hz, PowerBook G4 Titanium I and II */
259 NULL, 60, 1152, 768, 15386, 158, 26, 29, 3, 136, 6,
260 FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
Dennis Munsief71689e2006-06-26 00:26:39 -0700261 }, {
262 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */
263 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5,
264 0, FB_VMODE_NONINTERLACED
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 },
266};
267
268#ifdef CONFIG_FB_MODE_HELPERS
269const struct fb_videomode vesa_modes[] = {
270 /* 0 640x350-85 VESA */
271 { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3,
272 FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA},
273 /* 1 640x400-85 VESA */
274 { NULL, 85, 640, 400, 31746, 96, 32, 41, 01, 64, 3,
275 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
276 /* 2 720x400-85 VESA */
277 { NULL, 85, 721, 400, 28169, 108, 36, 42, 01, 72, 3,
278 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
279 /* 3 640x480-60 VESA */
280 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
281 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
282 /* 4 640x480-72 VESA */
283 { NULL, 72, 640, 480, 31746, 128, 24, 29, 9, 40, 2,
284 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
285 /* 5 640x480-75 VESA */
286 { NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3,
287 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
288 /* 6 640x480-85 VESA */
289 { NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3,
290 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
291 /* 7 800x600-56 VESA */
292 { NULL, 56, 800, 600, 27777, 128, 24, 22, 01, 72, 2,
293 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
294 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
295 /* 8 800x600-60 VESA */
296 { NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4,
297 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
298 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
299 /* 9 800x600-72 VESA */
300 { NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6,
301 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
302 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
303 /* 10 800x600-75 VESA */
304 { NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3,
305 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
306 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
307 /* 11 800x600-85 VESA */
308 { NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3,
309 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
310 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
311 /* 12 1024x768i-43 VESA */
312 { NULL, 53, 1024, 768, 22271, 56, 8, 41, 0, 176, 8,
313 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
314 FB_VMODE_INTERLACED, FB_MODE_IS_VESA },
315 /* 13 1024x768-60 VESA */
316 { NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6,
317 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
318 /* 14 1024x768-70 VESA */
319 { NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6,
320 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
321 /* 15 1024x768-75 VESA */
322 { NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3,
323 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
324 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
325 /* 16 1024x768-85 VESA */
326 { NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3,
327 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
328 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
329 /* 17 1152x864-75 VESA */
330 { NULL, 75, 1153, 864, 9259, 256, 64, 32, 1, 128, 3,
331 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
332 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
333 /* 18 1280x960-60 VESA */
334 { NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3,
335 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
336 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
337 /* 19 1280x960-85 VESA */
338 { NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3,
339 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
340 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
341 /* 20 1280x1024-60 VESA */
342 { NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
343 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
344 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
345 /* 21 1280x1024-75 VESA */
346 { NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3,
347 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
348 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
349 /* 22 1280x1024-85 VESA */
350 { NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3,
351 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
352 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
353 /* 23 1600x1200-60 VESA */
354 { NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3,
355 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
356 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
357 /* 24 1600x1200-65 VESA */
358 { NULL, 65, 1600, 1200, 5698, 304, 64, 46, 1, 192, 3,
359 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
360 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
361 /* 25 1600x1200-70 VESA */
362 { NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3,
363 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
364 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
365 /* 26 1600x1200-75 VESA */
366 { NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3,
367 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
368 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
369 /* 27 1600x1200-85 VESA */
370 { NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3,
371 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
372 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
373 /* 28 1792x1344-60 VESA */
374 { NULL, 60, 1792, 1344, 4882, 328, 128, 46, 1, 200, 3,
375 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
376 /* 29 1792x1344-75 VESA */
377 { NULL, 75, 1792, 1344, 3831, 352, 96, 69, 1, 216, 3,
378 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
379 /* 30 1856x1392-60 VESA */
380 { NULL, 60, 1856, 1392, 4580, 352, 96, 43, 1, 224, 3,
381 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
382 /* 31 1856x1392-75 VESA */
383 { NULL, 75, 1856, 1392, 3472, 352, 128, 104, 1, 224, 3,
384 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
385 /* 32 1920x1440-60 VESA */
386 { NULL, 60, 1920, 1440, 4273, 344, 128, 56, 1, 200, 3,
387 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
388 /* 33 1920x1440-75 VESA */
389 { NULL, 60, 1920, 1440, 3367, 352, 144, 56, 1, 224, 3,
390 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
391};
392EXPORT_SYMBOL(vesa_modes);
393#endif /* CONFIG_FB_MODE_HELPERS */
394
395static int my_atoi(const char *name)
396{
397 int val = 0;
398
399 for (;; name++) {
400 switch (*name) {
401 case '0'...'9':
402 val = 10*val+(*name-'0');
403 break;
404 default:
405 return val;
406 }
407 }
408}
409
410/**
411 * fb_try_mode - test a video mode
412 * @var: frame buffer user defined part of display
413 * @info: frame buffer info structure
414 * @mode: frame buffer video mode structure
415 * @bpp: color depth in bits per pixel
416 *
417 * Tries a video mode to test it's validity for device @info.
418 *
419 * Returns 1 on success.
420 *
421 */
422
423static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
424 const struct fb_videomode *mode, unsigned int bpp)
425{
426 int err = 0;
427
428 DPRINTK("Trying mode %s %dx%d-%d@%d\n", mode->name ? mode->name : "noname",
429 mode->xres, mode->yres, bpp, mode->refresh);
430 var->xres = mode->xres;
431 var->yres = mode->yres;
432 var->xres_virtual = mode->xres;
433 var->yres_virtual = mode->yres;
434 var->xoffset = 0;
435 var->yoffset = 0;
436 var->bits_per_pixel = bpp;
437 var->activate |= FB_ACTIVATE_TEST;
438 var->pixclock = mode->pixclock;
439 var->left_margin = mode->left_margin;
440 var->right_margin = mode->right_margin;
441 var->upper_margin = mode->upper_margin;
442 var->lower_margin = mode->lower_margin;
443 var->hsync_len = mode->hsync_len;
444 var->vsync_len = mode->vsync_len;
445 var->sync = mode->sync;
446 var->vmode = mode->vmode;
447 if (info->fbops->fb_check_var)
448 err = info->fbops->fb_check_var(var, info);
449 var->activate &= ~FB_ACTIVATE_TEST;
450 return err;
451}
452
453/**
454 * fb_find_mode - finds a valid video mode
455 * @var: frame buffer user defined part of display
456 * @info: frame buffer info structure
457 * @mode_option: string video mode to find
458 * @db: video mode database
459 * @dbsize: size of @db
460 * @default_mode: default video mode to fall back to
461 * @default_bpp: default color depth in bits per pixel
462 *
463 * Finds a suitable video mode, starting with the specified mode
464 * in @mode_option with fallback to @default_mode. If
465 * @default_mode fails, all modes in the video mode database will
466 * be tried.
467 *
468 * Valid mode specifiers for @mode_option:
469 *
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700470 * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 * <name>[-<bpp>][@<refresh>]
472 *
473 * with <xres>, <yres>, <bpp> and <refresh> decimal numbers and
474 * <name> a string.
475 *
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700476 * If 'M' is present after yres (and before refresh/bpp if present),
477 * the function will compute the timings using VESA(tm) Coordinated
478 * Video Timings (CVT). If 'R' is present after 'M', will compute with
479 * reduced blanking (for flatpanels). If 'i' is present, compute
480 * interlaced mode. If 'm' is present, add margins equal to 1.8%
481 * of xres rounded down to 8 pixels, and 1.8% of yres. The char
482 * 'i' and 'm' must be after 'M' and 'R'. Example:
483 *
484 * 1024x768MR-8@60m - Reduced blank with margins at 60Hz.
485 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 * NOTE: The passed struct @var is _not_ cleared! This allows you
487 * to supply values for e.g. the grayscale and accel_flags fields.
488 *
489 * Returns zero for failure, 1 if using specified @mode_option,
490 * 2 if using specified @mode_option with an ignored refresh rate,
491 * 3 if default mode is used, 4 if fall back to any valid mode.
492 *
493 */
494
495int fb_find_mode(struct fb_var_screeninfo *var,
496 struct fb_info *info, const char *mode_option,
497 const struct fb_videomode *db, unsigned int dbsize,
498 const struct fb_videomode *default_mode,
499 unsigned int default_bpp)
500{
501 int i;
502
503 /* Set up defaults */
504 if (!db) {
505 db = modedb;
Tobias Klauserd1ae4182006-03-27 01:17:39 -0800506 dbsize = ARRAY_SIZE(modedb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 }
508 if (!default_mode)
509 default_mode = &modedb[DEFAULT_MODEDB_INDEX];
510 if (!default_bpp)
511 default_bpp = 8;
512
513 /* Did the user specify a video mode? */
514 if (mode_option || (mode_option = global_mode_option)) {
515 const char *name = mode_option;
516 unsigned int namelen = strlen(name);
517 int res_specified = 0, bpp_specified = 0, refresh_specified = 0;
518 unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0;
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700519 int yres_specified = 0, cvt = 0, rb = 0, interlace = 0, margins = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 u32 best, diff;
521
522 for (i = namelen-1; i >= 0; i--) {
523 switch (name[i]) {
524 case '@':
525 namelen = i;
526 if (!refresh_specified && !bpp_specified &&
527 !yres_specified) {
528 refresh = my_atoi(&name[i+1]);
529 refresh_specified = 1;
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700530 if (cvt || rb)
531 cvt = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 } else
533 goto done;
534 break;
535 case '-':
536 namelen = i;
537 if (!bpp_specified && !yres_specified) {
538 bpp = my_atoi(&name[i+1]);
539 bpp_specified = 1;
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700540 if (cvt || rb)
541 cvt = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 } else
543 goto done;
544 break;
545 case 'x':
546 if (!yres_specified) {
547 yres = my_atoi(&name[i+1]);
548 yres_specified = 1;
549 } else
550 goto done;
551 break;
552 case '0'...'9':
553 break;
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700554 case 'M':
555 if (!yres_specified)
556 cvt = 1;
557 break;
558 case 'R':
559 if (!cvt)
560 rb = 1;
561 break;
562 case 'm':
563 if (!cvt)
564 margins = 1;
565 break;
566 case 'i':
567 if (!cvt)
568 interlace = 1;
569 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 default:
571 goto done;
572 }
573 }
574 if (i < 0 && yres_specified) {
575 xres = my_atoi(name);
576 res_specified = 1;
577 }
578done:
Antonino A. Daplas96fe6a22005-09-09 13:09:58 -0700579 if (cvt) {
580 struct fb_videomode cvt_mode;
581 int ret;
582
583 DPRINTK("CVT mode %dx%d@%dHz%s%s%s\n", xres, yres,
584 (refresh) ? refresh : 60, (rb) ? " reduced blanking" :
585 "", (margins) ? " with margins" : "", (interlace) ?
586 " interlaced" : "");
587
588 cvt_mode.xres = xres;
589 cvt_mode.yres = yres;
590 cvt_mode.refresh = (refresh) ? refresh : 60;
591
592 if (interlace)
593 cvt_mode.vmode |= FB_VMODE_INTERLACED;
594 else
595 cvt_mode.vmode &= ~FB_VMODE_INTERLACED;
596
597 ret = fb_find_mode_cvt(&cvt_mode, margins, rb);
598
599 if (!ret && !fb_try_mode(var, info, &cvt_mode, bpp)) {
600 DPRINTK("modedb CVT: CVT mode ok\n");
601 return 1;
602 }
603
604 DPRINTK("CVT mode invalid, getting mode from database\n");
605 }
606
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 DPRINTK("Trying specified video mode%s %ix%i\n",
608 refresh_specified ? "" : " (ignoring refresh rate)", xres, yres);
609
610 diff = refresh;
611 best = -1;
612 for (i = 0; i < dbsize; i++) {
613 if ((name_matches(db[i], name, namelen) &&
614 !fb_try_mode(var, info, &db[i], bpp)))
615 return 1;
616 if (res_specified && res_matches(db[i], xres, yres)) {
617 if(!fb_try_mode(var, info, &db[i], bpp)) {
618 if(!refresh_specified || db[i].refresh == refresh)
619 return 1;
620 else {
621 if(diff > abs(db[i].refresh - refresh)) {
622 diff = abs(db[i].refresh - refresh);
623 best = i;
624 }
625 }
626 }
627 }
628 }
629 if (best != -1) {
630 fb_try_mode(var, info, &db[best], bpp);
631 return 2;
632 }
633
634 diff = xres + yres;
635 best = -1;
636 DPRINTK("Trying best-fit modes\n");
637 for (i = 0; i < dbsize; i++) {
638 if (xres <= db[i].xres && yres <= db[i].yres) {
639 DPRINTK("Trying %ix%i\n", db[i].xres, db[i].yres);
640 if (!fb_try_mode(var, info, &db[i], bpp)) {
641 if (diff > (db[i].xres - xres) + (db[i].yres - yres)) {
642 diff = (db[i].xres - xres) + (db[i].yres - yres);
643 best = i;
644 }
645 }
646 }
647 }
648 if (best != -1) {
649 fb_try_mode(var, info, &db[best], bpp);
650 return 5;
651 }
652 }
653
654 DPRINTK("Trying default video mode\n");
655 if (!fb_try_mode(var, info, default_mode, default_bpp))
656 return 3;
657
658 DPRINTK("Trying all modes\n");
659 for (i = 0; i < dbsize; i++)
660 if (!fb_try_mode(var, info, &db[i], default_bpp))
661 return 4;
662
663 DPRINTK("No valid mode found\n");
664 return 0;
665}
666
667/**
668 * fb_var_to_videomode - convert fb_var_screeninfo to fb_videomode
669 * @mode: pointer to struct fb_videomode
670 * @var: pointer to struct fb_var_screeninfo
671 */
672void fb_var_to_videomode(struct fb_videomode *mode,
673 struct fb_var_screeninfo *var)
674{
675 u32 pixclock, hfreq, htotal, vtotal;
676
677 mode->name = NULL;
678 mode->xres = var->xres;
679 mode->yres = var->yres;
680 mode->pixclock = var->pixclock;
681 mode->hsync_len = var->hsync_len;
682 mode->vsync_len = var->vsync_len;
683 mode->left_margin = var->left_margin;
684 mode->right_margin = var->right_margin;
685 mode->upper_margin = var->upper_margin;
686 mode->lower_margin = var->lower_margin;
687 mode->sync = var->sync;
688 mode->vmode = var->vmode & FB_VMODE_MASK;
689 mode->flag = FB_MODE_IS_FROM_VAR;
Michal Januszewski8fb65672005-11-07 01:00:47 -0800690 mode->refresh = 0;
691
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 if (!var->pixclock)
693 return;
694
695 pixclock = PICOS2KHZ(var->pixclock) * 1000;
696
697 htotal = var->xres + var->right_margin + var->hsync_len +
698 var->left_margin;
699 vtotal = var->yres + var->lower_margin + var->vsync_len +
700 var->upper_margin;
701
702 if (var->vmode & FB_VMODE_INTERLACED)
703 vtotal /= 2;
704 if (var->vmode & FB_VMODE_DOUBLE)
705 vtotal *= 2;
706
707 hfreq = pixclock/htotal;
708 mode->refresh = hfreq/vtotal;
709}
710
711/**
712 * fb_videomode_to_var - convert fb_videomode to fb_var_screeninfo
713 * @var: pointer to struct fb_var_screeninfo
714 * @mode: pointer to struct fb_videomode
715 */
716void fb_videomode_to_var(struct fb_var_screeninfo *var,
717 struct fb_videomode *mode)
718{
719 var->xres = mode->xres;
720 var->yres = mode->yres;
721 var->pixclock = mode->pixclock;
722 var->left_margin = mode->left_margin;
723 var->hsync_len = mode->hsync_len;
724 var->vsync_len = mode->vsync_len;
725 var->right_margin = mode->right_margin;
726 var->upper_margin = mode->upper_margin;
727 var->lower_margin = mode->lower_margin;
728 var->sync = mode->sync;
729 var->vmode = mode->vmode & FB_VMODE_MASK;
730}
731
732/**
733 * fb_mode_is_equal - compare 2 videomodes
734 * @mode1: first videomode
735 * @mode2: second videomode
736 *
737 * RETURNS:
738 * 1 if equal, 0 if not
739 */
740int fb_mode_is_equal(struct fb_videomode *mode1,
741 struct fb_videomode *mode2)
742{
743 return (mode1->xres == mode2->xres &&
744 mode1->yres == mode2->yres &&
745 mode1->pixclock == mode2->pixclock &&
746 mode1->hsync_len == mode2->hsync_len &&
747 mode1->vsync_len == mode2->vsync_len &&
748 mode1->left_margin == mode2->left_margin &&
749 mode1->right_margin == mode2->right_margin &&
750 mode1->upper_margin == mode2->upper_margin &&
751 mode1->lower_margin == mode2->lower_margin &&
752 mode1->sync == mode2->sync &&
753 mode1->vmode == mode2->vmode);
754}
755
756/**
757 * fb_find_best_mode - find best matching videomode
758 * @var: pointer to struct fb_var_screeninfo
759 * @head: pointer to struct list_head of modelist
760 *
761 * RETURNS:
762 * struct fb_videomode, NULL if none found
763 *
764 * IMPORTANT:
765 * This function assumes that all modelist entries in
766 * info->modelist are valid.
767 *
768 * NOTES:
769 * Finds best matching videomode which has an equal or greater dimension than
770 * var->xres and var->yres. If more than 1 videomode is found, will return
771 * the videomode with the highest refresh rate
772 */
773struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
774 struct list_head *head)
775{
776 struct list_head *pos;
777 struct fb_modelist *modelist;
778 struct fb_videomode *mode, *best = NULL;
779 u32 diff = -1;
780
781 list_for_each(pos, head) {
782 u32 d;
783
784 modelist = list_entry(pos, struct fb_modelist, list);
785 mode = &modelist->mode;
786
787 if (mode->xres >= var->xres && mode->yres >= var->yres) {
788 d = (mode->xres - var->xres) +
789 (mode->yres - var->yres);
790 if (diff > d) {
791 diff = d;
792 best = mode;
Antonino A. Daplas17cc62812006-06-26 00:26:44 -0700793 } else if (diff == d && best &&
794 mode->refresh > best->refresh)
795 best = mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796 }
797 }
798 return best;
799}
800
801/**
Michal Januszewski8fb65672005-11-07 01:00:47 -0800802 * fb_find_nearest_mode - find closest videomode
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 *
Michal Januszewski8fb65672005-11-07 01:00:47 -0800804 * @mode: pointer to struct fb_videomode
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 * @head: pointer to modelist
806 *
807 * Finds best matching videomode, smaller or greater in dimension.
808 * If more than 1 videomode is found, will return the videomode with
Michal Januszewski8fb65672005-11-07 01:00:47 -0800809 * the closest refresh rate.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 */
Michal Januszewski8fb65672005-11-07 01:00:47 -0800811struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 struct list_head *head)
813{
814 struct list_head *pos;
815 struct fb_modelist *modelist;
Michal Januszewski8fb65672005-11-07 01:00:47 -0800816 struct fb_videomode *cmode, *best = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 u32 diff = -1, diff_refresh = -1;
818
819 list_for_each(pos, head) {
820 u32 d;
821
822 modelist = list_entry(pos, struct fb_modelist, list);
Michal Januszewski8fb65672005-11-07 01:00:47 -0800823 cmode = &modelist->mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824
Michal Januszewski8fb65672005-11-07 01:00:47 -0800825 d = abs(cmode->xres - mode->xres) +
826 abs(cmode->yres - mode->yres);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 if (diff > d) {
828 diff = d;
Michal Januszewski8fb65672005-11-07 01:00:47 -0800829 best = cmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830 } else if (diff == d) {
Michal Januszewski8fb65672005-11-07 01:00:47 -0800831 d = abs(cmode->refresh - mode->refresh);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832 if (diff_refresh > d) {
833 diff_refresh = d;
Michal Januszewski8fb65672005-11-07 01:00:47 -0800834 best = cmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 }
836 }
837 }
838
839 return best;
840}
841
842/**
843 * fb_match_mode - find a videomode which exactly matches the timings in var
844 * @var: pointer to struct fb_var_screeninfo
845 * @head: pointer to struct list_head of modelist
846 *
847 * RETURNS:
848 * struct fb_videomode, NULL if none found
849 */
850struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var,
851 struct list_head *head)
852{
853 struct list_head *pos;
854 struct fb_modelist *modelist;
855 struct fb_videomode *m, mode;
856
857 fb_var_to_videomode(&mode, var);
858 list_for_each(pos, head) {
859 modelist = list_entry(pos, struct fb_modelist, list);
860 m = &modelist->mode;
861 if (fb_mode_is_equal(m, &mode))
862 return m;
863 }
864 return NULL;
865}
866
867/**
868 * fb_add_videomode: adds videomode entry to modelist
869 * @mode: videomode to add
870 * @head: struct list_head of modelist
871 *
872 * NOTES:
873 * Will only add unmatched mode entries
874 */
875int fb_add_videomode(struct fb_videomode *mode, struct list_head *head)
876{
877 struct list_head *pos;
878 struct fb_modelist *modelist;
879 struct fb_videomode *m;
880 int found = 0;
881
882 list_for_each(pos, head) {
883 modelist = list_entry(pos, struct fb_modelist, list);
884 m = &modelist->mode;
885 if (fb_mode_is_equal(m, mode)) {
886 found = 1;
887 break;
888 }
889 }
890 if (!found) {
891 modelist = kmalloc(sizeof(struct fb_modelist),
892 GFP_KERNEL);
893
894 if (!modelist)
895 return -ENOMEM;
896 modelist->mode = *mode;
897 list_add(&modelist->list, head);
898 }
899 return 0;
900}
901
902/**
903 * fb_delete_videomode: removed videomode entry from modelist
904 * @mode: videomode to remove
905 * @head: struct list_head of modelist
906 *
907 * NOTES:
908 * Will remove all matching mode entries
909 */
910void fb_delete_videomode(struct fb_videomode *mode, struct list_head *head)
911{
912 struct list_head *pos, *n;
913 struct fb_modelist *modelist;
914 struct fb_videomode *m;
915
916 list_for_each_safe(pos, n, head) {
917 modelist = list_entry(pos, struct fb_modelist, list);
918 m = &modelist->mode;
919 if (fb_mode_is_equal(m, mode)) {
920 list_del(pos);
921 kfree(pos);
922 }
923 }
924}
925
926/**
927 * fb_destroy_modelist: destroy modelist
928 * @head: struct list_head of modelist
929 */
930void fb_destroy_modelist(struct list_head *head)
931{
932 struct list_head *pos, *n;
933
934 list_for_each_safe(pos, n, head) {
935 list_del(pos);
936 kfree(pos);
937 }
938}
939
940/**
941 * fb_videomode_to_modelist: convert mode array to mode list
942 * @modedb: array of struct fb_videomode
943 * @num: number of entries in array
944 * @head: struct list_head of modelist
945 */
946void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
947 struct list_head *head)
948{
949 int i;
950
951 INIT_LIST_HEAD(head);
952
953 for (i = 0; i < num; i++) {
954 if (fb_add_videomode(&modedb[i], head))
955 return;
956 }
957}
958
Antonino A. Daplas003cfc02005-11-07 01:00:54 -0800959struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs,
960 struct list_head *head)
961{
962 struct list_head *pos;
963 struct fb_modelist *modelist;
964 struct fb_videomode *m, *m1 = NULL, *md = NULL, *best = NULL;
965 int first = 0;
966
967 if (!head->prev || !head->next || list_empty(head))
968 goto finished;
969
970 /* get the first detailed mode and the very first mode */
971 list_for_each(pos, head) {
972 modelist = list_entry(pos, struct fb_modelist, list);
973 m = &modelist->mode;
974
975 if (!first) {
976 m1 = m;
977 first = 1;
978 }
979
980 if (m->flag & FB_MODE_IS_FIRST) {
981 md = m;
982 break;
983 }
984 }
985
986 /* first detailed timing is preferred */
987 if (specs->misc & FB_MISC_1ST_DETAIL) {
988 best = md;
989 goto finished;
990 }
991
992 /* find best mode based on display width and height */
993 if (specs->max_x && specs->max_y) {
994 struct fb_var_screeninfo var;
995
996 memset(&var, 0, sizeof(struct fb_var_screeninfo));
997 var.xres = (specs->max_x * 7200)/254;
998 var.yres = (specs->max_y * 7200)/254;
999 m = fb_find_best_mode(&var, head);
1000 if (m) {
1001 best = m;
1002 goto finished;
1003 }
1004 }
1005
1006 /* use first detailed mode */
1007 if (md) {
1008 best = md;
1009 goto finished;
1010 }
1011
1012 /* last resort, use the very first mode */
1013 best = m1;
1014finished:
1015 return best;
1016}
1017EXPORT_SYMBOL(fb_find_best_display);
1018
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019EXPORT_SYMBOL(fb_videomode_to_var);
1020EXPORT_SYMBOL(fb_var_to_videomode);
1021EXPORT_SYMBOL(fb_mode_is_equal);
1022EXPORT_SYMBOL(fb_add_videomode);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001023EXPORT_SYMBOL(fb_match_mode);
1024EXPORT_SYMBOL(fb_find_best_mode);
1025EXPORT_SYMBOL(fb_find_nearest_mode);
1026EXPORT_SYMBOL(fb_videomode_to_modelist);
1027EXPORT_SYMBOL(fb_find_mode);