Commit c42f7c1f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fbdev: monitor detection fixes

From: James Simmons <jsimmons@infradead.org>,
      Kronos <kronos@kronoz.cjb.net>

Various fixes and enhancements to the monitor hardware detection code.  The
only driver that uses it is the radeon driver.

Old EDID parsing code was very verbose, half of the patch address this (ie.
print lots of stuff iff DEBUG).  The other big change is the FB_MODE_IS_*
stuff: we really need a way to know the origin of a video mode.  In this way
we can select video mode that comes from EDID instead of VESA or GTF.

Drivers other than radeonfb won't be affected because they cannot (yet) get
EDID from the monitor and don't use EDID related code.
parent 787bc776
...@@ -757,7 +757,7 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_ ...@@ -757,7 +757,7 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_
&& rinfo->mon1_EDID) { && rinfo->mon1_EDID) {
struct fb_var_screeninfo var; struct fb_var_screeninfo var;
RTRACE("Parsing EDID data for panel info\n"); RTRACE("Parsing EDID data for panel info\n");
if (parse_edid(rinfo->mon1_EDID, &var) == 0) { if (fb_parse_edid(rinfo->mon1_EDID, &var) == 0) {
if (var.xres >= rinfo->panel_info.xres && if (var.xres >= rinfo->panel_info.xres &&
var.yres >= rinfo->panel_info.yres) var.yres >= rinfo->panel_info.yres)
radeon_var_to_panel_info(rinfo, &var); radeon_var_to_panel_info(rinfo, &var);
......
This diff is collapsed.
...@@ -39,7 +39,7 @@ const char *global_mode_option = NULL; ...@@ -39,7 +39,7 @@ const char *global_mode_option = NULL;
#define DEFAULT_MODEDB_INDEX 0 #define DEFAULT_MODEDB_INDEX 0
static const struct fb_videomode modedb[] __initdata = { static const struct fb_videomode modedb[] = {
{ {
/* 640x400 @ 70 Hz, 31.5 kHz hsync */ /* 640x400 @ 70 Hz, 31.5 kHz hsync */
NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2, NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
...@@ -130,11 +130,11 @@ static const struct fb_videomode modedb[] __initdata = { ...@@ -130,11 +130,11 @@ static const struct fb_videomode modedb[] __initdata = {
0, FB_VMODE_NONINTERLACED 0, FB_VMODE_NONINTERLACED
}, { }, {
/* 1400x1050 @ 75,107 Hz, 82,392 kHz +hsync +vsync*/ /* 1400x1050 @ 75,107 Hz, 82,392 kHz +hsync +vsync*/
"LCD_XGA_75", 75, 1400, 1050, 9271, 120, 56, 13, 0, 112, 3, NULL, 75, 1400, 1050, 9271, 120, 56, 13, 0, 112, 3,
FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
}, { }, {
/* 1400x1050 @ 60 Hz, ? kHz +hsync +vsync*/ /* 1400x1050 @ 60 Hz, ? kHz +hsync +vsync*/
"LCD_XGA_60", 60, 1400, 1050, 9259, 128, 40, 12, 0, 112, 3, NULL, 60, 1400, 1050, 9259, 128, 40, 12, 0, 112, 3,
FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
}, { }, {
/* 1024x768 @ 85 Hz, 70.24 kHz hsync */ /* 1024x768 @ 85 Hz, 70.24 kHz hsync */
...@@ -254,109 +254,128 @@ static const struct fb_videomode modedb[] __initdata = { ...@@ -254,109 +254,128 @@ static const struct fb_videomode modedb[] __initdata = {
const struct fb_videomode vesa_modes[] = { const struct fb_videomode vesa_modes[] = {
/* 0 640x350-85 VESA */ /* 0 640x350-85 VESA */
{ NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3, { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3,
FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA},
/* 1 640x400-85 VESA */ /* 1 640x400-85 VESA */
{ NULL, 85, 640, 400, 31746, 96, 32, 41, 01, 64, 3, { NULL, 85, 640, 400, 31746, 96, 32, 41, 01, 64, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 2 720x400-85 VESA */ /* 2 720x400-85 VESA */
{ NULL, 85, 721, 400, 28169, 108, 36, 42, 01, 72, 3, { NULL, 85, 721, 400, 28169, 108, 36, 42, 01, 72, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 3 640x480-60 VESA */ /* 3 640x480-60 VESA */
{ NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
0, FB_VMODE_NONINTERLACED }, 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 4 640x480-72 VESA */ /* 4 640x480-72 VESA */
{ NULL, 72, 640, 480, 31746, 128, 24, 29, 9, 40, 2, { NULL, 72, 640, 480, 31746, 128, 24, 29, 9, 40, 2,
0, FB_VMODE_NONINTERLACED }, 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 5 640x480-75 VESA */ /* 5 640x480-75 VESA */
{ NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3, { NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3,
0, FB_VMODE_NONINTERLACED }, 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 6 640x480-85 VESA */ /* 6 640x480-85 VESA */
{ NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3, { NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3,
0, FB_VMODE_NONINTERLACED }, 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 7 800x600-56 VESA */ /* 7 800x600-56 VESA */
{ NULL, 56, 800, 600, 27777, 128, 24, 22, 01, 72, 2, { NULL, 56, 800, 600, 27777, 128, 24, 22, 01, 72, 2,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 8 800x600-60 VESA */ /* 8 800x600-60 VESA */
{ NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4, { NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 9 800x600-72 VESA */ /* 9 800x600-72 VESA */
{ NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6, { NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 10 800x600-75 VESA */ /* 10 800x600-75 VESA */
{ NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3, { NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 11 800x600-85 VESA */ /* 11 800x600-85 VESA */
{ NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3, { NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 12 1024x768i-43 VESA */ /* 12 1024x768i-43 VESA */
{ NULL, 53, 1024, 768, 22271, 56, 8, 41, 0, 176, 8, { NULL, 53, 1024, 768, 22271, 56, 8, 41, 0, 176, 8,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_INTERLACED, FB_MODE_IS_VESA },
/* 13 1024x768-60 VESA */ /* 13 1024x768-60 VESA */
{ NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6, { NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6,
0, FB_VMODE_NONINTERLACED }, 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 14 1024x768-70 VESA */ /* 14 1024x768-70 VESA */
{ NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6, { NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6,
0, FB_VMODE_NONINTERLACED }, 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 15 1024x768-75 VESA */ /* 15 1024x768-75 VESA */
{ NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3, { NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 16 1024x768-85 VESA */ /* 16 1024x768-85 VESA */
{ NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3, { NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 17 1152x864-75 VESA */ /* 17 1152x864-75 VESA */
{ NULL, 75, 1153, 864, 9259, 256, 64, 32, 1, 128, 3, { NULL, 75, 1153, 864, 9259, 256, 64, 32, 1, 128, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 18 1280x960-60 VESA */ /* 18 1280x960-60 VESA */
{ NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3, { NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 19 1280x960-85 VESA */ /* 19 1280x960-85 VESA */
{ NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3, { NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 20 1280x1024-60 VESA */ /* 20 1280x1024-60 VESA */
{ NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3, { NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 21 1280x1024-75 VESA */ /* 21 1280x1024-75 VESA */
{ NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3, { NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 22 1280x1024-85 VESA */ /* 22 1280x1024-85 VESA */
{ NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3, { NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 23 1600x1200-60 VESA */ /* 23 1600x1200-60 VESA */
{ NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3, { NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 24 1600x1200-65 VESA */ /* 24 1600x1200-65 VESA */
{ NULL, 65, 1600, 1200, 5698, 304, 64, 46, 1, 192, 3, { NULL, 65, 1600, 1200, 5698, 304, 64, 46, 1, 192, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 25 1600x1200-70 VESA */ /* 25 1600x1200-70 VESA */
{ NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3, { NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 26 1600x1200-75 VESA */ /* 26 1600x1200-75 VESA */
{ NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3, { NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 27 1600x1200-85 VESA */ /* 27 1600x1200-85 VESA */
{ NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3, { NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3,
FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 28 1792x1344-60 VESA */ /* 28 1792x1344-60 VESA */
{ NULL, 60, 1792, 1344, 4882, 328, 128, 46, 1, 200, 3, { NULL, 60, 1792, 1344, 4882, 328, 128, 46, 1, 200, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 29 1792x1344-75 VESA */ /* 29 1792x1344-75 VESA */
{ NULL, 75, 1792, 1344, 3831, 352, 96, 69, 1, 216, 3, { NULL, 75, 1792, 1344, 3831, 352, 96, 69, 1, 216, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 30 1856x1392-60 VESA */ /* 30 1856x1392-60 VESA */
{ NULL, 60, 1856, 1392, 4580, 352, 96, 43, 1, 224, 3, { NULL, 60, 1856, 1392, 4580, 352, 96, 43, 1, 224, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 31 1856x1392-75 VESA */ /* 31 1856x1392-75 VESA */
{ NULL, 75, 1856, 1392, 3472, 352, 128, 104, 1, 224, 3, { NULL, 75, 1856, 1392, 3472, 352, 128, 104, 1, 224, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 32 1920x1440-60 VESA */ /* 32 1920x1440-60 VESA */
{ NULL, 60, 1920, 1440, 4273, 344, 128, 56, 1, 200, 3, { NULL, 60, 1920, 1440, 4273, 344, 128, 56, 1, 200, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
/* 33 1920x1440-75 VESA */ /* 33 1920x1440-75 VESA */
{ NULL, 60, 1920, 1440, 3367, 352, 144, 56, 1, 224, 3, { NULL, 60, 1920, 1440, 3367, 352, 144, 56, 1, 224, 3,
FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
}; };
static int __init my_atoi(const char *name) static int my_atoi(const char *name)
{ {
int val = 0; int val = 0;
...@@ -447,7 +466,7 @@ int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, ...@@ -447,7 +466,7 @@ int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
* *
*/ */
int __init fb_find_mode(struct fb_var_screeninfo *var, int fb_find_mode(struct fb_var_screeninfo *var,
struct fb_info *info, const char *mode_option, struct fb_info *info, const char *mode_option,
const struct fb_videomode *db, unsigned int dbsize, const struct fb_videomode *db, unsigned int dbsize,
const struct fb_videomode *default_mode, const struct fb_videomode *default_mode,
......
...@@ -236,15 +236,71 @@ struct fb_con2fbmap { ...@@ -236,15 +236,71 @@ struct fb_con2fbmap {
#define VESA_HSYNC_SUSPEND 2 #define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3 #define VESA_POWERDOWN 3
/* Definitions below are used in the parsed monitor specs */
#define FB_DPMS_ACTIVE_OFF 1
#define FB_DPMS_SUSPEND 2
#define FB_DPMS_STANDBY 4
#define FB_DISP_DDI 1
#define FB_DISP_ANA_700_300 2
#define FB_DISP_ANA_714_286 4
#define FB_DISP_ANA_1000_400 8
#define FB_DISP_ANA_700_000 16
#define FB_DISP_MONO 32
#define FB_DISP_RGB 64
#define FB_DISP_MULTI 128
#define FB_DISP_UNKNOWN 256
#define FB_SIGNAL_NONE 0
#define FB_SIGNAL_BLANK_BLANK 1
#define FB_SIGNAL_SEPARATE 2
#define FB_SIGNAL_COMPOSITE 4
#define FB_SIGNAL_SYNC_ON_GREEN 8
#define FB_SIGNAL_SERRATION_ON 16
#define FB_MISC_PRIM_COLOR 1
#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */
struct fb_chroma {
__u32 redx; /* in fraction of 1024 */
__u32 greenx;
__u32 bluex;
__u32 whitex;
__u32 redy;
__u32 greeny;
__u32 bluey;
__u32 whitey;
};
struct fb_monspecs { struct fb_monspecs {
struct fb_chroma chroma;
struct fb_videomode *modedb; /* mode database */
__u8 manufacturer[4]; /* Manufacturer */
__u8 monitor[14]; /* Monitor String */
__u8 serial_no[14]; /* Serial Number */
__u8 ascii[14]; /* ? */
__u32 modedb_len; /* mode database length */
__u32 model; /* Monitor Model */
__u32 serial; /* Serial Number - Integer */
__u32 year; /* Year manufactured */
__u32 week; /* Week Manufactured */
__u32 hfmin; /* hfreq lower limit (Hz) */ __u32 hfmin; /* hfreq lower limit (Hz) */
__u32 hfmax; /* hfreq upper limit (Hz) */ __u32 hfmax; /* hfreq upper limit (Hz) */
__u16 vfmin; /* vfreq lower limit (Hz) */
__u16 vfmax; /* vfreq upper limit (Hz) */
__u32 dclkmin; /* pixelclock lower limit (Hz) */ __u32 dclkmin; /* pixelclock lower limit (Hz) */
__u32 dclkmax; /* pixelclock upper limit (Hz) */ __u32 dclkmax; /* pixelclock upper limit (Hz) */
unsigned gtf : 1; /* supports GTF */ __u16 input; /* display type - see FB_DISP_* */
unsigned dpms : 1; /* supports DPMS */ __u16 dpms; /* DPMS support - see FB_DPMS_ */
__u16 signal; /* Signal Type - see FB_SIGNAL_* */
__u16 vfmin; /* vfreq lower limit (Hz) */
__u16 vfmax; /* vfreq upper limit (Hz) */
__u16 gamma; /* Gamma - in fractions of 100 */
__u16 gtf : 1; /* supports GTF */
__u16 misc; /* Misc flags - see FB_MISC_* */
__u8 version; /* EDID version... */
__u8 revision; /* ...and revision */
__u8 max_x; /* Maximum horizontal size (cm) */
__u8 max_y; /* Maximum vertical size (cm) */
}; };
#define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ #define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */
...@@ -384,8 +440,13 @@ struct fb_pixmap { ...@@ -384,8 +440,13 @@ struct fb_pixmap {
u8 (*inbuf) (struct fb_info *info, u8 *addr); u8 (*inbuf) (struct fb_info *info, u8 *addr);
}; };
/*
/*
* Frame buffer operations * Frame buffer operations
*
* LOCKING NOTE: those functions must _ALL_ be called with the console
* semaphore held, this is the only suitable locking mecanism we have
* in 2.6. Some may be called at interrupt time at this point though.
*/ */
struct fb_ops { struct fb_ops {
...@@ -394,13 +455,16 @@ struct fb_ops { ...@@ -394,13 +455,16 @@ struct fb_ops {
int (*fb_open)(struct fb_info *info, int user); int (*fb_open)(struct fb_info *info, int user);
int (*fb_release)(struct fb_info *info, int user); int (*fb_release)(struct fb_info *info, int user);
/* For framebuffers with strange non linear layouts */ /* For framebuffers with strange non linear layouts or that do not
* work with normal memory mapped access
*/
ssize_t (*fb_read)(struct file *file, char *buf, size_t count, loff_t *ppos); ssize_t (*fb_read)(struct file *file, char *buf, size_t count, loff_t *ppos);
ssize_t (*fb_write)(struct file *file, const char *buf, size_t count, loff_t *ppos); ssize_t (*fb_write)(struct file *file, const char *buf, size_t count, loff_t *ppos);
/* checks var and eventually tweaks it to something supported, /* checks var and eventually tweaks it to something supported,
* DO NOT MODIFY PAR */ * DO NOT MODIFY PAR */
int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info); int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
/* set the video mode according to info->var */ /* set the video mode according to info->var */
int (*fb_set_par)(struct fb_info *info); int (*fb_set_par)(struct fb_info *info);
...@@ -441,15 +505,14 @@ struct fb_ops { ...@@ -441,15 +505,14 @@ struct fb_ops {
struct fb_info { struct fb_info {
int node; int node;
int flags; int flags;
int open; /* Has this been open already ? */
#define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */ #define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */
struct fb_var_screeninfo var; /* Current var */ struct fb_var_screeninfo var; /* Current var */
struct fb_fix_screeninfo fix; /* Current fix */ struct fb_fix_screeninfo fix; /* Current fix */
struct fb_monspecs monspecs; /* Current Monitor specs */ struct fb_monspecs monspecs; /* Current Monitor specs */
struct fb_cursor cursor; /* Current cursor */ struct fb_cursor cursor; /* Current cursor */
struct work_struct queue; /* Framebuffer event queue */ struct work_struct queue; /* Framebuffer event queue */
struct fb_pixmap pixmap; /* Image Hardware Mapper */ struct fb_pixmap pixmap; /* Image hardware mapper */
struct fb_pixmap sprite; /* Cursor hardware Mapper */ struct fb_pixmap sprite; /* Cursor hardware mapper */
struct fb_cmap cmap; /* Current cmap */ struct fb_cmap cmap; /* Current cmap */
struct fb_ops *fbops; struct fb_ops *fbops;
char *screen_base; /* Virtual address */ char *screen_base; /* Virtual address */
...@@ -459,6 +522,7 @@ struct fb_info { ...@@ -459,6 +522,7 @@ struct fb_info {
#define FBINFO_STATE_RUNNING 0 #define FBINFO_STATE_RUNNING 0
#define FBINFO_STATE_SUSPENDED 1 #define FBINFO_STATE_SUSPENDED 1
u32 state; /* Hardware state i.e suspend */ u32 state; /* Hardware state i.e suspend */
/* From here on everything is device dependent */ /* From here on everything is device dependent */
void *par; void *par;
}; };
...@@ -469,12 +533,14 @@ struct fb_info { ...@@ -469,12 +533,14 @@ struct fb_info {
#define FBINFO_FLAG_DEFAULT 0 #define FBINFO_FLAG_DEFAULT 0
#endif #endif
// This will go away
#if defined(__sparc__) #if defined(__sparc__)
/* We map all of our framebuffers such that big-endian accesses /* We map all of our framebuffers such that big-endian accesses
* are what we want, so the following is sufficient. * are what we want, so the following is sufficient.
*/ */
// This will go away
#define fb_readb sbus_readb #define fb_readb sbus_readb
#define fb_readw sbus_readw #define fb_readw sbus_readw
#define fb_readl sbus_readl #define fb_readl sbus_readl
...@@ -485,7 +551,7 @@ struct fb_info { ...@@ -485,7 +551,7 @@ struct fb_info {
#define fb_writeq sbus_writeq #define fb_writeq sbus_writeq
#define fb_memset sbus_memset_io #define fb_memset sbus_memset_io
#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__)
#define fb_readb __raw_readb #define fb_readb __raw_readb
#define fb_readw __raw_readw #define fb_readw __raw_readw
...@@ -552,18 +618,26 @@ extern void framebuffer_release(struct fb_info *info); ...@@ -552,18 +618,26 @@ extern void framebuffer_release(struct fb_info *info);
#define FB_DCLKTIMINGS 3 #define FB_DCLKTIMINGS 3
#define FB_IGNOREMON 0x100 #define FB_IGNOREMON 0x100
#define FB_MODE_IS_UNKNOWN 0
#define FB_MODE_IS_DETAILED 1
#define FB_MODE_IS_STANDARD 2
#define FB_MODE_IS_VESA 4
#define FB_MODE_IS_CALCULATED 8
#define FB_MODE_IS_FIRST 16
extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
const struct fb_info *fb_info); const struct fb_info *fb_info);
extern int fbmon_dpms(const struct fb_info *fb_info); extern int fbmon_dpms(const struct fb_info *fb_info);
extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
struct fb_info *info); struct fb_info *info);
extern int fb_validate_mode(struct fb_var_screeninfo *var, extern int fb_validate_mode(const struct fb_var_screeninfo *var,
struct fb_info *info); struct fb_info *info);
extern int parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs);
extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs); extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
extern struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize); extern struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize);
extern void fb_destroy_modedb(struct fb_videomode *modedb); extern void fb_destroy_modedb(struct fb_videomode *modedb);
extern void show_edid(unsigned char *edid);
/* drivers/video/modedb.c */ /* drivers/video/modedb.c */
#define VESA_MODEDB_SIZE 34 #define VESA_MODEDB_SIZE 34
...@@ -591,45 +665,15 @@ struct fb_videomode { ...@@ -591,45 +665,15 @@ struct fb_videomode {
u32 vsync_len; u32 vsync_len;
u32 sync; u32 sync;
u32 vmode; u32 vmode;
u32 flag;
}; };
#ifdef MODULE extern int fb_find_mode(struct fb_var_screeninfo *var,
static inline int fb_find_mode(struct fb_var_screeninfo *var, struct fb_info *info, const char *mode_option,
struct fb_info *info,
const char *mode_option,
const struct fb_videomode *db,
unsigned int dbsize,
const struct fb_videomode *default_mode,
unsigned int default_bpp)
{
extern int __fb_try_mode(struct fb_var_screeninfo *var,
struct fb_info *info,
const struct fb_videomode *mode,
unsigned int bpp);
/*
* FIXME: How to make the compiler optimize vga640x400 away if
* default_mode is non-NULL?
*/
static const struct fb_videomode vga640x400 = {
/* 640x400 @ 70 Hz, 31.5 kHz hsync */
NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
0, FB_VMODE_NONINTERLACED
};
if (!default_mode)
default_mode = &vga640x400;
if (!default_bpp)
default_bpp = 8;
return __fb_try_mode(var, info, default_mode, default_bpp);
}
#else
extern int __init fb_find_mode(struct fb_var_screeninfo *var,
struct fb_info *info,
const char *mode_option,
const struct fb_videomode *db, const struct fb_videomode *db,
unsigned int dbsize, unsigned int dbsize,
const struct fb_videomode *default_mode, const struct fb_videomode *default_mode,
unsigned int default_bpp); unsigned int default_bpp);
#endif
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment