aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-03-21 13:01:07 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-03-21 13:01:07 -0400
commit3f086fe93f734ba76f2e130777687f81e0cbb318 (patch)
treee2ec91df0cae6cc69333bb425280c26ef0723506 /drivers/video/via
parent726abbc7957a2feeaf6f5e3d72579b3fd0211134 (diff)
viafb: initialize margins correct
This patch initializes the margins for the initial mode correct. This is required to get the desired initial refresh rate. Also do more verbose sanity checking to prevent misbehavior. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/viafbdev.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index fd6a15f0decd..9d9bb9b4ed3f 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1806,14 +1806,9 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1806 default_var.xres_virtual = default_xres; 1806 default_var.xres_virtual = default_xres;
1807 default_var.yres_virtual = default_yres; 1807 default_var.yres_virtual = default_yres;
1808 default_var.bits_per_pixel = viafb_bpp; 1808 default_var.bits_per_pixel = viafb_bpp;
1809 default_var.pixclock = 1809 viafb_fill_var_timing_info(&default_var, viafb_get_refresh(
1810 viafb_get_pixclock(default_xres, default_yres, viafb_refresh); 1810 default_var.xres, default_var.yres, viafb_refresh),
1811 default_var.left_margin = (default_xres >> 3) & 0xf8; 1811 viafb_get_mode(default_var.xres, default_var.yres));
1812 default_var.right_margin = 32;
1813 default_var.upper_margin = 16;
1814 default_var.lower_margin = 4;
1815 default_var.hsync_len = default_var.left_margin;
1816 default_var.vsync_len = 4;
1817 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); 1812 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo);
1818 viafbinfo->var = default_var; 1813 viafbinfo->var = default_var;
1819 1814
@@ -1852,15 +1847,9 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1852 default_var.xres_virtual = viafb_second_virtual_xres; 1847 default_var.xres_virtual = viafb_second_virtual_xres;
1853 default_var.yres_virtual = viafb_second_virtual_yres; 1848 default_var.yres_virtual = viafb_second_virtual_yres;
1854 default_var.bits_per_pixel = viafb_bpp1; 1849 default_var.bits_per_pixel = viafb_bpp1;
1855 default_var.pixclock = 1850 viafb_fill_var_timing_info(&default_var, viafb_get_refresh(
1856 viafb_get_pixclock(viafb_second_xres, viafb_second_yres, 1851 default_var.xres, default_var.yres, viafb_refresh1),
1857 viafb_refresh1); 1852 viafb_get_mode(default_var.xres, default_var.yres));
1858 default_var.left_margin = (viafb_second_xres >> 3) & 0xf8;
1859 default_var.right_margin = 32;
1860 default_var.upper_margin = 16;
1861 default_var.lower_margin = 4;
1862 default_var.hsync_len = default_var.left_margin;
1863 default_var.vsync_len = 4;
1864 1853
1865 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); 1854 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1);
1866 viafb_check_var(&default_var, viafbinfo1); 1855 viafb_check_var(&default_var, viafbinfo1);
@@ -2015,15 +2004,17 @@ static int __init viafb_setup(char *options)
2015 */ 2004 */
2016int __init viafb_init(void) 2005int __init viafb_init(void)
2017{ 2006{
2018 u32 dummy; 2007 u32 dummy_x, dummy_y;
2019#ifndef MODULE 2008#ifndef MODULE
2020 char *option = NULL; 2009 char *option = NULL;
2021 if (fb_get_options("viafb", &option)) 2010 if (fb_get_options("viafb", &option))
2022 return -ENODEV; 2011 return -ENODEV;
2023 viafb_setup(option); 2012 viafb_setup(option);
2024#endif 2013#endif
2025 if (parse_mode(viafb_mode, &dummy, &dummy) 2014 if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
2026 || parse_mode(viafb_mode1, &dummy, &dummy) 2015 || !viafb_get_mode(dummy_x, dummy_y)
2016 || parse_mode(viafb_mode1, &dummy_x, &dummy_y)
2017 || !viafb_get_mode(dummy_x, dummy_y)
2027 || viafb_bpp < 0 || viafb_bpp > 32 2018 || viafb_bpp < 0 || viafb_bpp > 32
2028 || viafb_bpp1 < 0 || viafb_bpp1 > 32 2019 || viafb_bpp1 < 0 || viafb_bpp1 > 32
2029 || parse_active_dev()) 2020 || parse_active_dev())