diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2012-02-17 02:55:06 -0500 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2012-03-08 13:41:35 -0500 |
commit | 9864ca20c50c2fcaba63767a336e16c88b46d7ad (patch) | |
tree | 9fa6b91a21415cd5dc5abbb1933555ae365ede5d /drivers/video/via/hw.c | |
parent | 91dc1be8f698eb016343d534159a919678e3889c (diff) |
viafb: modetable conversion
This patch converts the modetables used in viafb to
- remove the strange thing that sync_end and blanking_end contained
the length and not the absolute value
- remove hundreds of useless defines
- use fb_videomode and not our own definition so modes defined in
the subsystem and received via EDID are compatible with ours
As the modes are now stored in a flat structure and no longer in a
tree like thing the lookup time was increased but as it is a rare
event anyway it shouldn't matter. Otherwise the behaviour should be
the same as before.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via/hw.c')
-rw-r--r-- | drivers/video/via/hw.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index da80d202f52a..1372ef4b9798 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c | |||
@@ -1467,7 +1467,8 @@ void viafb_set_vclock(u32 clk, int set_iga) | |||
1467 | via_write_misc_reg_mask(0x0C, 0x0C); /* select external clock */ | 1467 | via_write_misc_reg_mask(0x0C, 0x0C); /* select external clock */ |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | static struct display_timing var_to_timing(const struct fb_var_screeninfo *var, u16 cxres, u16 cyres) | 1470 | struct display_timing var_to_timing(const struct fb_var_screeninfo *var, |
1471 | u16 cxres, u16 cyres) | ||
1471 | { | 1472 | { |
1472 | struct display_timing timing; | 1473 | struct display_timing timing; |
1473 | u16 dx = (var->xres - cxres) / 2, dy = (var->yres - cyres) / 2; | 1474 | u16 dx = (var->xres - cxres) / 2, dy = (var->yres - cyres) / 2; |
@@ -2007,20 +2008,20 @@ int viafb_setmode(void) | |||
2007 | 2008 | ||
2008 | int viafb_get_refresh(int hres, int vres, u32 long_refresh) | 2009 | int viafb_get_refresh(int hres, int vres, u32 long_refresh) |
2009 | { | 2010 | { |
2010 | struct crt_mode_table *best; | 2011 | const struct fb_videomode *best; |
2011 | 2012 | ||
2012 | best = viafb_get_best_mode(hres, vres, long_refresh); | 2013 | best = viafb_get_best_mode(hres, vres, long_refresh); |
2013 | if (!best) | 2014 | if (!best) |
2014 | return 60; | 2015 | return 60; |
2015 | 2016 | ||
2016 | if (abs(best->refresh_rate - long_refresh) > 3) { | 2017 | if (abs(best->refresh - long_refresh) > 3) { |
2017 | if (hres == 1200 && vres == 900) | 2018 | if (hres == 1200 && vres == 900) |
2018 | return 49; /* OLPC DCON only supports 50 Hz */ | 2019 | return 49; /* OLPC DCON only supports 50 Hz */ |
2019 | else | 2020 | else |
2020 | return 60; | 2021 | return 60; |
2021 | } | 2022 | } |
2022 | 2023 | ||
2023 | return best->refresh_rate; | 2024 | return best->refresh; |
2024 | } | 2025 | } |
2025 | 2026 | ||
2026 | static void device_off(void) | 2027 | static void device_off(void) |
@@ -2114,26 +2115,16 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\ | |||
2114 | } | 2115 | } |
2115 | 2116 | ||
2116 | void viafb_fill_var_timing_info(struct fb_var_screeninfo *var, | 2117 | void viafb_fill_var_timing_info(struct fb_var_screeninfo *var, |
2117 | struct crt_mode_table *mode) | 2118 | const struct fb_videomode *mode) |
2118 | { | 2119 | { |
2119 | struct display_timing crt_reg; | 2120 | var->pixclock = mode->pixclock; |
2120 | 2121 | var->xres = mode->xres; | |
2121 | crt_reg = mode->crtc; | 2122 | var->yres = mode->yres; |
2122 | var->pixclock = 1000000000 / (crt_reg.hor_total * crt_reg.ver_total) | 2123 | var->left_margin = mode->left_margin; |
2123 | * 1000 / mode->refresh_rate; | 2124 | var->right_margin = mode->right_margin; |
2124 | var->xres = crt_reg.hor_addr; | 2125 | var->hsync_len = mode->hsync_len; |
2125 | var->yres = crt_reg.ver_addr; | 2126 | var->upper_margin = mode->upper_margin; |
2126 | var->left_margin = | 2127 | var->lower_margin = mode->lower_margin; |
2127 | crt_reg.hor_total - (crt_reg.hor_sync_start + crt_reg.hor_sync_end); | 2128 | var->vsync_len = mode->vsync_len; |
2128 | var->right_margin = crt_reg.hor_sync_start - crt_reg.hor_addr; | 2129 | var->sync = mode->sync; |
2129 | var->hsync_len = crt_reg.hor_sync_end; | ||
2130 | var->upper_margin = | ||
2131 | crt_reg.ver_total - (crt_reg.ver_sync_start + crt_reg.ver_sync_end); | ||
2132 | var->lower_margin = crt_reg.ver_sync_start - crt_reg.ver_addr; | ||
2133 | var->vsync_len = crt_reg.ver_sync_end; | ||
2134 | var->sync = 0; | ||
2135 | if (mode->h_sync_polarity == POSITIVE) | ||
2136 | var->sync |= FB_SYNC_HOR_HIGH_ACT; | ||
2137 | if (mode->v_sync_polarity == POSITIVE) | ||
2138 | var->sync |= FB_SYNC_VERT_HIGH_ACT; | ||
2139 | } | 2130 | } |