Skip to content

Commit 8aa4d96

Browse files
Daniel Drakeschandinat
Daniel Drake
authored andcommitted
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 <[email protected]> Signed-off-by: Florian Tobias Schandinat <[email protected]>
1 parent e01255d commit 8aa4d96

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

drivers/video/via/viafbdev.c

+30-9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/slab.h>
2525
#include <linux/stat.h>
2626
#include <linux/via-core.h>
27+
#include <asm/olpc.h>
2728

2829
#define _MASTER_FILE
2930
#include "global.h"
@@ -1011,8 +1012,13 @@ static int __init parse_active_dev(void)
10111012
/* Note: The previous of active_dev is primary device,
10121013
and the following is secondary device. */
10131014
if (!viafb_active_dev) {
1014-
viafb_CRT_ON = STATE_ON;
1015-
viafb_SAMM_ON = STATE_OFF;
1015+
if (machine_is_olpc()) { /* LCD only */
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+
}
10161022
} else if (!strcmp(viafb_active_dev, "CRT+DVI")) {
10171023
/* CRT+DVI */
10181024
viafb_CRT_ON = STATE_ON;
@@ -1665,8 +1671,13 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
16651671
char *ptr;
16661672

16671673
if (!str) {
1668-
*xres = 640;
1669-
*yres = 480;
1674+
if (machine_is_olpc()) {
1675+
*xres = 1200;
1676+
*yres = 900;
1677+
} else {
1678+
*xres = 640;
1679+
*yres = 480;
1680+
}
16701681
return 0;
16711682
}
16721683

@@ -1922,11 +1933,16 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev)
19221933
}
19231934

19241935
#ifndef MODULE
1925-
static int __init viafb_setup(char *options)
1936+
static int __init viafb_setup(void)
19261937
{
19271938
char *this_opt;
1939+
char *options;
1940+
19281941
DEBUG_MSG(KERN_INFO "viafb_setup!\n");
19291942

1943+
if (fb_get_options("viafb", &options))
1944+
return -ENODEV;
1945+
19301946
if (!options || !*options)
19311947
return 0;
19321948

@@ -2000,11 +2016,16 @@ static int __init viafb_setup(char *options)
20002016
int __init viafb_init(void)
20012017
{
20022018
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+
20032025
#ifndef MODULE
2004-
char *option = NULL;
2005-
if (fb_get_options("viafb", &option))
2006-
return -ENODEV;
2007-
viafb_setup(option);
2026+
r = viafb_setup();
2027+
if (r < 0)
2028+
return r;
20082029
#endif
20092030
if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
20102031
|| !viafb_get_mode(dummy_x, dummy_y)

0 commit comments

Comments
 (0)