aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-07 07:13:39 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-07 07:22:32 -0400
commit4fbf4bfe6fb5460bfd4a18ca7c7f21ffec941b07 (patch)
treea733edd7b5580597afd91dc0e4287086ff26ad02 /drivers/video/via
parentebb29fb47e198787b8b47a74cb10334cd9647a9d (diff)
viafb: seperate hardware initialization
This patch splits the hardware initialization out of the modesetting function which will make it easier to make it conditional and not require starting from scratch for every mode change, which is especially annoying in dual framebuffer mode. This required some minor reordering but it should not influence its functionality. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/hw.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 6845c82db3cb..76fad92600f0 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1769,24 +1769,9 @@ static u8 get_sync(struct fb_info *info)
1769 return polarity; 1769 return polarity;
1770} 1770}
1771 1771
1772int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp, 1772static void hw_init(void)
1773 struct VideoModeTable *vmode_tbl1, int video_bpp1)
1774{ 1773{
1775 int i, j; 1774 int i;
1776 int port;
1777 u32 devices = viaparinfo->shared->iga1_devices
1778 | viaparinfo->shared->iga2_devices;
1779 u8 value, index, mask;
1780 struct crt_mode_table *crt_timing;
1781 struct crt_mode_table *crt_timing1 = NULL;
1782 struct fb_var_screeninfo var2;
1783
1784 device_screen_off();
1785 crt_timing = vmode_tbl->crtc;
1786
1787 if (viafb_SAMM_ON == 1) {
1788 crt_timing1 = vmode_tbl1->crtc;
1789 }
1790 1775
1791 inb(VIAStatus); 1776 inb(VIAStatus);
1792 outb(0x00, VIAAR); 1777 outb(0x00, VIAAR);
@@ -1825,9 +1810,8 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
1825 break; 1810 break;
1826 } 1811 }
1827 1812
1813 /* probably this should go to the scaling code one day */
1828 viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters)); 1814 viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters));
1829 device_off();
1830 via_set_state(devices, VIA_STATE_OFF);
1831 1815
1832 /* Fill VPIT Parameters */ 1816 /* Fill VPIT Parameters */
1833 /* Write Misc Register */ 1817 /* Write Misc Register */
@@ -1853,6 +1837,31 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
1853 inb(VIAStatus); 1837 inb(VIAStatus);
1854 outb(0x20, VIAAR); 1838 outb(0x20, VIAAR);
1855 1839
1840 load_fix_bit_crtc_reg();
1841}
1842
1843int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
1844 struct VideoModeTable *vmode_tbl1, int video_bpp1)
1845{
1846 int j;
1847 int port;
1848 u32 devices = viaparinfo->shared->iga1_devices
1849 | viaparinfo->shared->iga2_devices;
1850 u8 value, index, mask;
1851 struct crt_mode_table *crt_timing;
1852 struct crt_mode_table *crt_timing1 = NULL;
1853 struct fb_var_screeninfo var2;
1854
1855 device_screen_off();
1856 crt_timing = vmode_tbl->crtc;
1857 if (viafb_SAMM_ON == 1)
1858 crt_timing1 = vmode_tbl1->crtc;
1859
1860 device_off();
1861 via_set_state(devices, VIA_STATE_OFF);
1862
1863 hw_init();
1864
1856 /* Update Patch Register */ 1865 /* Update Patch Register */
1857 1866
1858 if ((viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266 1867 if ((viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266
@@ -1868,7 +1877,6 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
1868 } 1877 }
1869 } 1878 }
1870 1879
1871 load_fix_bit_crtc_reg();
1872 via_set_primary_pitch(viafbinfo->fix.line_length); 1880 via_set_primary_pitch(viafbinfo->fix.line_length);
1873 via_set_secondary_pitch(viafb_dual_fb ? viafbinfo1->fix.line_length 1881 via_set_secondary_pitch(viafb_dual_fb ? viafbinfo1->fix.line_length
1874 : viafbinfo->fix.line_length); 1882 : viafbinfo->fix.line_length);