aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-05-10 17:34:11 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-05-11 03:27:37 -0400
commit8aa4d96fe3e4cda9a6469b22b3f017ed30996b10 (patch)
tree62d50518bee8d05b5d27b25327f964cb4aeae637 /drivers
parente01255d698ad00a6f4c6b3e0bf061e27ab238969 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/via/viafbdev.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index eace9a4257f..3114a8755c1 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -24,6 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/stat.h> 25#include <linux/stat.h>
26#include <linux/via-core.h> 26#include <linux/via-core.h>
27#include <asm/olpc.h>
27 28
28#define _MASTER_FILE 29#define _MASTER_FILE
29#include "global.h" 30#include "global.h"
@@ -1011,8 +1012,13 @@ static int __init parse_active_dev(void)
1011 /* Note: The previous of active_dev is primary device, 1012 /* Note: The previous of active_dev is primary device,
1012 and the following is secondary device. */ 1013 and the following is secondary device. */
1013 if (!viafb_active_dev) { 1014 if (!viafb_active_dev) {
1014 viafb_CRT_ON = STATE_ON; 1015 if (machine_is_olpc()) { /* LCD only */
1015 viafb_SAMM_ON = STATE_OFF; 1016 viafb_LCD_ON = STATE_ON;
1017 viafb_SAMM_ON = STATE_OFF;
1018 } else {
1019 viafb_CRT_ON = STATE_ON;
1020 viafb_SAMM_ON = STATE_OFF;
1021 }
1016 } else if (!strcmp(viafb_active_dev, "CRT+DVI")) { 1022 } else if (!strcmp(viafb_active_dev, "CRT+DVI")) {
1017 /* CRT+DVI */ 1023 /* CRT+DVI */
1018 viafb_CRT_ON = STATE_ON; 1024 viafb_CRT_ON = STATE_ON;
@@ -1665,8 +1671,13 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
1665 char *ptr; 1671 char *ptr;
1666 1672
1667 if (!str) { 1673 if (!str) {
1668 *xres = 640; 1674 if (machine_is_olpc()) {
1669 *yres = 480; 1675 *xres = 1200;
1676 *yres = 900;
1677 } else {
1678 *xres = 640;
1679 *yres = 480;
1680 }
1670 return 0; 1681 return 0;
1671 } 1682 }
1672 1683
@@ -1922,11 +1933,16 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev)
1922} 1933}
1923 1934
1924#ifndef MODULE 1935#ifndef MODULE
1925static int __init viafb_setup(char *options) 1936static int __init viafb_setup(void)
1926{ 1937{
1927 char *this_opt; 1938 char *this_opt;
1939 char *options;
1940
1928 DEBUG_MSG(KERN_INFO "viafb_setup!\n"); 1941 DEBUG_MSG(KERN_INFO "viafb_setup!\n");
1929 1942
1943 if (fb_get_options("viafb", &options))
1944 return -ENODEV;
1945
1930 if (!options || !*options) 1946 if (!options || !*options)
1931 return 0; 1947 return 0;
1932 1948
@@ -2000,11 +2016,16 @@ static int __init viafb_setup(char *options)
2000int __init viafb_init(void) 2016int __init viafb_init(void)
2001{ 2017{
2002 u32 dummy_x, dummy_y; 2018 u32 dummy_x, dummy_y;
2019 int r;
2020
2021 if (machine_is_olpc())
2022 /* Apply XO-1.5-specific configuration. */
2023 viafb_lcd_panel_id = 23;
2024
2003#ifndef MODULE 2025#ifndef MODULE
2004 char *option = NULL; 2026 r = viafb_setup();
2005 if (fb_get_options("viafb", &option)) 2027 if (r < 0)
2006 return -ENODEV; 2028 return r;
2007 viafb_setup(option);
2008#endif 2029#endif
2009 if (parse_mode(viafb_mode, &dummy_x, &dummy_y) 2030 if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
2010 || !viafb_get_mode(dummy_x, dummy_y) 2031 || !viafb_get_mode(dummy_x, dummy_y)