16 #include <linux/slab.h>
18 #define FB_CVT_CELLSIZE 8
19 #define FB_CVT_GTF_C 40
20 #define FB_CVT_GTF_J 20
21 #define FB_CVT_GTF_K 128
22 #define FB_CVT_GTF_M 600
23 #define FB_CVT_MIN_VSYNC_BP 550
24 #define FB_CVT_MIN_VPORCH 3
25 #define FB_CVT_MIN_BPORCH 6
27 #define FB_CVT_RB_MIN_VBLANK 460
28 #define FB_CVT_RB_HBLANK 160
29 #define FB_CVT_RB_V_FPORCH 3
31 #define FB_CVT_FLAG_REDUCED_BLANK 1
32 #define FB_CVT_FLAG_MARGINS 2
33 #define FB_CVT_FLAG_INTERLACED 4
61 static const unsigned char fb_cvt_vbi_tab[] = {
98 return (1000 * c_prime - ((m_prime * h_period_est)/1000))/256;
108 u32 ideal_duty_cycle = fb_cvt_ideal_duty_cycle(cvt);
111 if (ideal_duty_cycle < 20000)
112 hblank = (active_pixels * 20000)/
115 hblank = (active_pixels * ideal_duty_cycle)/
116 (100000 - ideal_duty_cycle);
140 u32 vbi_lines, min_vbi_lines, act_vbi_lines;
154 if (vbi_lines < min_vbi_lines)
155 act_vbi_lines = min_vbi_lines;
157 act_vbi_lines = vbi_lines;
159 return act_vbi_lines;
194 if (xres == (yres * 4)/3 && !((yres * 4) % 3))
196 else if (xres == (yres * 16)/9 && !((yres * 16) % 9))
198 else if (xres == (yres * 16)/10 && !((yres * 16) % 10))
200 else if (xres == (yres * 5)/4 && !((yres * 5) % 4))
202 else if (xres == (yres * 15)/9 && !((yres * 15) % 9))
214 static void fb_cvt_print_name(
struct fb_cvt_data *cvt)
216 u32 pixcount, pixcount_mod;
225 pixcount_mod /= 1000;
234 "Pixel Image\n", pixcount, pixcount_mod);
270 static void fb_cvt_convert_to_mode(
struct fb_cvt_data *cvt,
309 memset(&cvt, 0,
sizeof(cvt));
348 "advised for reduced blanking\n");
361 cvt.
hperiod = fb_cvt_hperiod(&cvt);
363 cvt.
vtotal = fb_cvt_vtotal(&cvt);
364 cvt.
hblank = fb_cvt_hblank(&cvt);
366 cvt.
hsync = fb_cvt_hsync(&cvt);
367 cvt.
pixclock = fb_cvt_pixclock(&cvt);
375 fb_cvt_print_name(&cvt);
376 fb_cvt_convert_to_mode(&cvt, mode);