Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

viafb: Automatic OLPC XO-1.5 configuration

Currently, a long set of viafb options are needed to get the XO-1.5
laptop to output video (there is only 1 configuration that works, that
can't really be autodetected).

This patch automatically detects and configures viafb for the XO-1.5
laptop, meaning all that is required for working display is that
viafb is loaded.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>

authored by

Daniel Drake and committed by
Florian Tobias Schandinat
8aa4d96f e01255d6

+30 -9
+30 -9
drivers/video/via/viafbdev.c
··· 24 24 #include <linux/slab.h> 25 25 #include <linux/stat.h> 26 26 #include <linux/via-core.h> 27 + #include <asm/olpc.h> 27 28 28 29 #define _MASTER_FILE 29 30 #include "global.h" ··· 1012 1011 /* Note: The previous of active_dev is primary device, 1013 1012 and the following is secondary device. */ 1014 1013 if (!viafb_active_dev) { 1015 - viafb_CRT_ON = STATE_ON; 1016 - viafb_SAMM_ON = STATE_OFF; 1014 + if (machine_is_olpc()) { /* LCD only */ 1015 + viafb_LCD_ON = STATE_ON; 1016 + viafb_SAMM_ON = STATE_OFF; 1017 + } else { 1018 + viafb_CRT_ON = STATE_ON; 1019 + viafb_SAMM_ON = STATE_OFF; 1020 + } 1017 1021 } else if (!strcmp(viafb_active_dev, "CRT+DVI")) { 1018 1022 /* CRT+DVI */ 1019 1023 viafb_CRT_ON = STATE_ON; ··· 1671 1665 char *ptr; 1672 1666 1673 1667 if (!str) { 1674 - *xres = 640; 1675 - *yres = 480; 1668 + if (machine_is_olpc()) { 1669 + *xres = 1200; 1670 + *yres = 900; 1671 + } else { 1672 + *xres = 640; 1673 + *yres = 480; 1674 + } 1676 1675 return 0; 1677 1676 } 1678 1677 ··· 1933 1922 } 1934 1923 1935 1924 #ifndef MODULE 1936 - static int __init viafb_setup(char *options) 1925 + static int __init viafb_setup(void) 1937 1926 { 1938 1927 char *this_opt; 1928 + char *options; 1929 + 1939 1930 DEBUG_MSG(KERN_INFO "viafb_setup!\n"); 1931 + 1932 + if (fb_get_options("viafb", &options)) 1933 + return -ENODEV; 1940 1934 1941 1935 if (!options || !*options) 1942 1936 return 0; ··· 2016 2000 int __init viafb_init(void) 2017 2001 { 2018 2002 u32 dummy_x, dummy_y; 2003 + int r; 2004 + 2005 + if (machine_is_olpc()) 2006 + /* Apply XO-1.5-specific configuration. */ 2007 + viafb_lcd_panel_id = 23; 2008 + 2019 2009 #ifndef MODULE 2020 - char *option = NULL; 2021 - if (fb_get_options("viafb", &option)) 2022 - return -ENODEV; 2023 - viafb_setup(option); 2010 + r = viafb_setup(); 2011 + if (r < 0) 2012 + return r; 2024 2013 #endif 2025 2014 if (parse_mode(viafb_mode, &dummy_x, &dummy_y) 2026 2015 || !viafb_get_mode(dummy_x, dummy_y)