diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2005-11-07 04:00:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:51 -0500 |
commit | 1013d26663199f8c1c31e1fe8e9352da09630d69 (patch) | |
tree | 51b7a8eb48e553dc514c016a8522d8ac4209bc33 | |
parent | eba50850458cf6e907b6b751cb18711666819406 (diff) |
[PATCH] atyfb: Get initial mode timings from LCD BIOS
Reported by: Jean-Philippe Guérard (Bugzilla Bug 1782)
"I've tried with video=atyfb:debug and video=atyfb:debug,mode:1280x600, \
nomtrr.
In both case, the screen stays black, but seems divided into 4 vertical bands.
Some white lines pop up randomly on each vertical band."
The problem is a combination of an incorrect xclk plus lack of timing
information. The adapter is attached to an LCD device that can do 1280x600
(which is not a standard resolution). The global mode database does not have
an entry for it. Fortunately, the Video BIOS contains the complete timing
info for this display, however, atyfb is not making use of it.
Add support to get the timing information from the BIOS, if available.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 5e4523ae85b1..08edbfcfca58 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2156,11 +2156,38 @@ static void __init aty_calc_mem_refresh(struct atyfb_par *par, int xclk) | |||
2156 | 2156 | ||
2157 | static struct fb_info *fb_list = NULL; | 2157 | static struct fb_info *fb_list = NULL; |
2158 | 2158 | ||
2159 | #if defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) | ||
2160 | static int __devinit atyfb_get_timings_from_lcd(struct atyfb_par *par, | ||
2161 | struct fb_var_screeninfo *var) | ||
2162 | { | ||
2163 | int ret = -EINVAL; | ||
2164 | |||
2165 | if (par->lcd_table != 0 && (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | ||
2166 | *var = default_var; | ||
2167 | var->xres = var->xres_virtual = par->lcd_hdisp; | ||
2168 | var->right_margin = par->lcd_right_margin; | ||
2169 | var->left_margin = par->lcd_hblank_len - | ||
2170 | (par->lcd_right_margin + par->lcd_hsync_dly + | ||
2171 | par->lcd_hsync_len); | ||
2172 | var->hsync_len = par->lcd_hsync_len + par->lcd_hsync_dly; | ||
2173 | var->yres = var->yres_virtual = par->lcd_vdisp; | ||
2174 | var->lower_margin = par->lcd_lower_margin; | ||
2175 | var->upper_margin = par->lcd_vblank_len - | ||
2176 | (par->lcd_lower_margin + par->lcd_vsync_len); | ||
2177 | var->vsync_len = par->lcd_vsync_len; | ||
2178 | var->pixclock = par->lcd_pixclock; | ||
2179 | ret = 0; | ||
2180 | } | ||
2181 | |||
2182 | return ret; | ||
2183 | } | ||
2184 | #endif /* defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) */ | ||
2185 | |||
2159 | static int __init aty_init(struct fb_info *info, const char *name) | 2186 | static int __init aty_init(struct fb_info *info, const char *name) |
2160 | { | 2187 | { |
2161 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 2188 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
2162 | const char *ramname = NULL, *xtal; | 2189 | const char *ramname = NULL, *xtal; |
2163 | int gtb_memsize; | 2190 | int gtb_memsize, has_var = 0; |
2164 | struct fb_var_screeninfo var; | 2191 | struct fb_var_screeninfo var; |
2165 | u8 pll_ref_div; | 2192 | u8 pll_ref_div; |
2166 | u32 i; | 2193 | u32 i; |
@@ -2468,8 +2495,8 @@ static int __init aty_init(struct fb_info *info, const char *name) | |||
2468 | * applies to all Mac video cards | 2495 | * applies to all Mac video cards |
2469 | */ | 2496 | */ |
2470 | if (mode) { | 2497 | if (mode) { |
2471 | if (!mac_find_mode(&var, info, mode, 8)) | 2498 | if (mac_find_mode(&var, info, mode, 8)) |
2472 | var = default_var; | 2499 | has_var = 1; |
2473 | } else { | 2500 | } else { |
2474 | if (default_vmode == VMODE_CHOOSE) { | 2501 | if (default_vmode == VMODE_CHOOSE) { |
2475 | if (M64_HAS(G3_PB_1024x768)) | 2502 | if (M64_HAS(G3_PB_1024x768)) |
@@ -2491,20 +2518,23 @@ static int __init aty_init(struct fb_info *info, const char *name) | |||
2491 | default_vmode = VMODE_640_480_60; | 2518 | default_vmode = VMODE_640_480_60; |
2492 | if (default_cmode < CMODE_8 || default_cmode > CMODE_32) | 2519 | if (default_cmode < CMODE_8 || default_cmode > CMODE_32) |
2493 | default_cmode = CMODE_8; | 2520 | default_cmode = CMODE_8; |
2494 | if (mac_vmode_to_var(default_vmode, default_cmode, &var)) | 2521 | if (!mac_vmode_to_var(default_vmode, default_cmode, |
2495 | var = default_var; | 2522 | &var)) |
2523 | has_var = 1; | ||
2496 | } | 2524 | } |
2497 | } else | 2525 | } |
2526 | |||
2498 | #endif /* !CONFIG_PPC */ | 2527 | #endif /* !CONFIG_PPC */ |
2499 | if ( | 2528 | |
2500 | #if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) | 2529 | #if defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) |
2501 | /* On Sparc, unless the user gave a specific mode | 2530 | if (!atyfb_get_timings_from_lcd(par, &var)) |
2502 | * specification, use the PROM probed values in | 2531 | has_var = 1; |
2503 | * default_var. | ||
2504 | */ | ||
2505 | !mode || | ||
2506 | #endif | 2532 | #endif |
2507 | !fb_find_mode(&var, info, mode, NULL, 0, &defmode, 8)) | 2533 | |
2534 | if (mode && fb_find_mode(&var, info, mode, NULL, 0, &defmode, 8)) | ||
2535 | has_var = 1; | ||
2536 | |||
2537 | if (!has_var) | ||
2508 | var = default_var; | 2538 | var = default_var; |
2509 | 2539 | ||
2510 | if (noaccel) | 2540 | if (noaccel) |