diff options
-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) |