diff options
-rw-r--r-- | drivers/video/via/viafbdev.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index b1569a73e4bd..902f8a1ac6b1 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -31,13 +31,13 @@ static char *viafb_name = "Via"; | |||
31 | static u32 pseudo_pal[17]; | 31 | static u32 pseudo_pal[17]; |
32 | 32 | ||
33 | /* video mode */ | 33 | /* video mode */ |
34 | static char *viafb_mode = "640x480"; | 34 | static char *viafb_mode; |
35 | static char *viafb_mode1 = "640x480"; | 35 | static char *viafb_mode1; |
36 | 36 | ||
37 | static int viafb_accel = 1; | 37 | static int viafb_accel = 1; |
38 | 38 | ||
39 | /* Added for specifying active devices.*/ | 39 | /* Added for specifying active devices.*/ |
40 | char *viafb_active_dev = ""; | 40 | char *viafb_active_dev; |
41 | 41 | ||
42 | /*Added for specify lcd output port*/ | 42 | /*Added for specify lcd output port*/ |
43 | char *viafb_lcd_port = ""; | 43 | char *viafb_lcd_port = ""; |
@@ -1327,7 +1327,7 @@ static void retrieve_device_setting(struct viafb_ioctl_setting | |||
1327 | setting_info->lcd_attributes.lcd_mode = viafb_lcd_mode; | 1327 | setting_info->lcd_attributes.lcd_mode = viafb_lcd_mode; |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | static void parse_active_dev(void) | 1330 | static int parse_active_dev(void) |
1331 | { | 1331 | { |
1332 | viafb_CRT_ON = STATE_OFF; | 1332 | viafb_CRT_ON = STATE_OFF; |
1333 | viafb_DVI_ON = STATE_OFF; | 1333 | viafb_DVI_ON = STATE_OFF; |
@@ -1338,60 +1338,63 @@ static void parse_active_dev(void) | |||
1338 | IGA path to devices in SAMM case. */ | 1338 | IGA path to devices in SAMM case. */ |
1339 | /* Note: The previous of active_dev is primary device, | 1339 | /* Note: The previous of active_dev is primary device, |
1340 | and the following is secondary device. */ | 1340 | and the following is secondary device. */ |
1341 | if (!strncmp(viafb_active_dev, "CRT+DVI", 7)) { | 1341 | if (!viafb_active_dev) { |
1342 | viafb_CRT_ON = STATE_ON; | ||
1343 | viafb_SAMM_ON = STATE_OFF; | ||
1344 | } else if (!strcmp(viafb_active_dev, "CRT+DVI")) { | ||
1342 | /* CRT+DVI */ | 1345 | /* CRT+DVI */ |
1343 | viafb_CRT_ON = STATE_ON; | 1346 | viafb_CRT_ON = STATE_ON; |
1344 | viafb_DVI_ON = STATE_ON; | 1347 | viafb_DVI_ON = STATE_ON; |
1345 | viafb_primary_dev = CRT_Device; | 1348 | viafb_primary_dev = CRT_Device; |
1346 | } else if (!strncmp(viafb_active_dev, "DVI+CRT", 7)) { | 1349 | } else if (!strcmp(viafb_active_dev, "DVI+CRT")) { |
1347 | /* DVI+CRT */ | 1350 | /* DVI+CRT */ |
1348 | viafb_CRT_ON = STATE_ON; | 1351 | viafb_CRT_ON = STATE_ON; |
1349 | viafb_DVI_ON = STATE_ON; | 1352 | viafb_DVI_ON = STATE_ON; |
1350 | viafb_primary_dev = DVI_Device; | 1353 | viafb_primary_dev = DVI_Device; |
1351 | } else if (!strncmp(viafb_active_dev, "CRT+LCD", 7)) { | 1354 | } else if (!strcmp(viafb_active_dev, "CRT+LCD")) { |
1352 | /* CRT+LCD */ | 1355 | /* CRT+LCD */ |
1353 | viafb_CRT_ON = STATE_ON; | 1356 | viafb_CRT_ON = STATE_ON; |
1354 | viafb_LCD_ON = STATE_ON; | 1357 | viafb_LCD_ON = STATE_ON; |
1355 | viafb_primary_dev = CRT_Device; | 1358 | viafb_primary_dev = CRT_Device; |
1356 | } else if (!strncmp(viafb_active_dev, "LCD+CRT", 7)) { | 1359 | } else if (!strcmp(viafb_active_dev, "LCD+CRT")) { |
1357 | /* LCD+CRT */ | 1360 | /* LCD+CRT */ |
1358 | viafb_CRT_ON = STATE_ON; | 1361 | viafb_CRT_ON = STATE_ON; |
1359 | viafb_LCD_ON = STATE_ON; | 1362 | viafb_LCD_ON = STATE_ON; |
1360 | viafb_primary_dev = LCD_Device; | 1363 | viafb_primary_dev = LCD_Device; |
1361 | } else if (!strncmp(viafb_active_dev, "DVI+LCD", 7)) { | 1364 | } else if (!strcmp(viafb_active_dev, "DVI+LCD")) { |
1362 | /* DVI+LCD */ | 1365 | /* DVI+LCD */ |
1363 | viafb_DVI_ON = STATE_ON; | 1366 | viafb_DVI_ON = STATE_ON; |
1364 | viafb_LCD_ON = STATE_ON; | 1367 | viafb_LCD_ON = STATE_ON; |
1365 | viafb_primary_dev = DVI_Device; | 1368 | viafb_primary_dev = DVI_Device; |
1366 | } else if (!strncmp(viafb_active_dev, "LCD+DVI", 7)) { | 1369 | } else if (!strcmp(viafb_active_dev, "LCD+DVI")) { |
1367 | /* LCD+DVI */ | 1370 | /* LCD+DVI */ |
1368 | viafb_DVI_ON = STATE_ON; | 1371 | viafb_DVI_ON = STATE_ON; |
1369 | viafb_LCD_ON = STATE_ON; | 1372 | viafb_LCD_ON = STATE_ON; |
1370 | viafb_primary_dev = LCD_Device; | 1373 | viafb_primary_dev = LCD_Device; |
1371 | } else if (!strncmp(viafb_active_dev, "LCD+LCD2", 8)) { | 1374 | } else if (!strcmp(viafb_active_dev, "LCD+LCD2")) { |
1372 | viafb_LCD_ON = STATE_ON; | 1375 | viafb_LCD_ON = STATE_ON; |
1373 | viafb_LCD2_ON = STATE_ON; | 1376 | viafb_LCD2_ON = STATE_ON; |
1374 | viafb_primary_dev = LCD_Device; | 1377 | viafb_primary_dev = LCD_Device; |
1375 | } else if (!strncmp(viafb_active_dev, "LCD2+LCD", 8)) { | 1378 | } else if (!strcmp(viafb_active_dev, "LCD2+LCD")) { |
1376 | viafb_LCD_ON = STATE_ON; | 1379 | viafb_LCD_ON = STATE_ON; |
1377 | viafb_LCD2_ON = STATE_ON; | 1380 | viafb_LCD2_ON = STATE_ON; |
1378 | viafb_primary_dev = LCD2_Device; | 1381 | viafb_primary_dev = LCD2_Device; |
1379 | } else if (!strncmp(viafb_active_dev, "CRT", 3)) { | 1382 | } else if (!strcmp(viafb_active_dev, "CRT")) { |
1380 | /* CRT only */ | 1383 | /* CRT only */ |
1381 | viafb_CRT_ON = STATE_ON; | 1384 | viafb_CRT_ON = STATE_ON; |
1382 | viafb_SAMM_ON = STATE_OFF; | 1385 | viafb_SAMM_ON = STATE_OFF; |
1383 | } else if (!strncmp(viafb_active_dev, "DVI", 3)) { | 1386 | } else if (!strcmp(viafb_active_dev, "DVI")) { |
1384 | /* DVI only */ | 1387 | /* DVI only */ |
1385 | viafb_DVI_ON = STATE_ON; | 1388 | viafb_DVI_ON = STATE_ON; |
1386 | viafb_SAMM_ON = STATE_OFF; | 1389 | viafb_SAMM_ON = STATE_OFF; |
1387 | } else if (!strncmp(viafb_active_dev, "LCD", 3)) { | 1390 | } else if (!strcmp(viafb_active_dev, "LCD")) { |
1388 | /* LCD only */ | 1391 | /* LCD only */ |
1389 | viafb_LCD_ON = STATE_ON; | 1392 | viafb_LCD_ON = STATE_ON; |
1390 | viafb_SAMM_ON = STATE_OFF; | 1393 | viafb_SAMM_ON = STATE_OFF; |
1391 | } else { | 1394 | } else |
1392 | viafb_CRT_ON = STATE_ON; | 1395 | return -EINVAL; |
1393 | viafb_SAMM_ON = STATE_OFF; | 1396 | |
1394 | } | 1397 | return 0; |
1395 | } | 1398 | } |
1396 | 1399 | ||
1397 | static int parse_port(char *opt_str, int *output_interface) | 1400 | static int parse_port(char *opt_str, int *output_interface) |
@@ -1820,24 +1823,25 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry) | |||
1820 | remove_proc_entry("viafb", NULL); | 1823 | remove_proc_entry("viafb", NULL); |
1821 | } | 1824 | } |
1822 | 1825 | ||
1823 | static void parse_mode(const char *str, u32 *xres, u32 *yres) | 1826 | static int parse_mode(const char *str, u32 *xres, u32 *yres) |
1824 | { | 1827 | { |
1825 | char *ptr; | 1828 | char *ptr; |
1826 | 1829 | ||
1830 | if (!str) { | ||
1831 | *xres = 640; | ||
1832 | *yres = 480; | ||
1833 | return 0; | ||
1834 | } | ||
1835 | |||
1827 | *xres = simple_strtoul(str, &ptr, 10); | 1836 | *xres = simple_strtoul(str, &ptr, 10); |
1828 | if (ptr[0] != 'x') | 1837 | if (ptr[0] != 'x') |
1829 | goto out_default; | 1838 | return -EINVAL; |
1830 | 1839 | ||
1831 | *yres = simple_strtoul(&ptr[1], &ptr, 10); | 1840 | *yres = simple_strtoul(&ptr[1], &ptr, 10); |
1832 | if (ptr[0]) | 1841 | if (ptr[0]) |
1833 | goto out_default; | 1842 | return -EINVAL; |
1834 | |||
1835 | return; | ||
1836 | 1843 | ||
1837 | out_default: | 1844 | return 0; |
1838 | printk(KERN_WARNING "viafb received invalid mode string: %s\n", str); | ||
1839 | *xres = 640; | ||
1840 | *yres = 480; | ||
1841 | } | 1845 | } |
1842 | 1846 | ||
1843 | static int __devinit via_pci_probe(struct pci_dev *pdev, | 1847 | static int __devinit via_pci_probe(struct pci_dev *pdev, |
@@ -1874,7 +1878,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, | |||
1874 | 1878 | ||
1875 | if (viafb_dual_fb) | 1879 | if (viafb_dual_fb) |
1876 | viafb_SAMM_ON = 1; | 1880 | viafb_SAMM_ON = 1; |
1877 | parse_active_dev(); | ||
1878 | parse_lcd_port(); | 1881 | parse_lcd_port(); |
1879 | parse_dvi_port(); | 1882 | parse_dvi_port(); |
1880 | 1883 | ||
@@ -2192,12 +2195,18 @@ static struct pci_driver viafb_driver = { | |||
2192 | 2195 | ||
2193 | static int __init viafb_init(void) | 2196 | static int __init viafb_init(void) |
2194 | { | 2197 | { |
2198 | u32 dummy; | ||
2195 | #ifndef MODULE | 2199 | #ifndef MODULE |
2196 | char *option = NULL; | 2200 | char *option = NULL; |
2197 | if (fb_get_options("viafb", &option)) | 2201 | if (fb_get_options("viafb", &option)) |
2198 | return -ENODEV; | 2202 | return -ENODEV; |
2199 | viafb_setup(option); | 2203 | viafb_setup(option); |
2200 | #endif | 2204 | #endif |
2205 | if (parse_mode(viafb_mode, &dummy, &dummy) | ||
2206 | || parse_mode(viafb_mode1, &dummy, &dummy) | ||
2207 | || parse_active_dev()) | ||
2208 | return -EINVAL; | ||
2209 | |||
2201 | printk(KERN_INFO | 2210 | printk(KERN_INFO |
2202 | "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n", | 2211 | "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n", |
2203 | VERSION_MAJOR, VERSION_MINOR); | 2212 | VERSION_MAJOR, VERSION_MINOR); |