From patchwork Tue May 10 19:55:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 775232 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4AJu6Fp015938 for ; Tue, 10 May 2011 19:56:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752392Ab1EJTzw (ORCPT ); Tue, 10 May 2011 15:55:52 -0400 Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]:3327 "EHLO mtaout01-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752379Ab1EJTzv (ORCPT ); Tue, 10 May 2011 15:55:51 -0400 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110510195549.YVEB14839.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Tue, 10 May 2011 20:55:49 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110510195549.THVQ5924.aamtaout02-winn.ispmail.ntl.com@zog.reactivated.net>; Tue, 10 May 2011 20:55:49 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id 728739D401C; Tue, 10 May 2011 20:55:46 +0100 (BST) From: Daniel Drake To: FlorianSchandinat@gmx.de Cc: linux-fbdev@vger.kernel.org Cc: dilinger@queued.net Subject: [PATCH v2] viafb: Automatic OLPC XO-1.5 configuration Message-Id: <20110510195546.728739D401C@zog.reactivated.net> Date: Tue, 10 May 2011 20:55:46 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=7Mx1WeIPI7YA:10 a=vJ1w_8FsMGIA:10 a=Op-mwl0xAAAA:8 a=SCB9gXaqu6wprwPImVIA:9 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 10 May 2011 19:56:07 +0000 (UTC) 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 --- drivers/video/via/viafbdev.c | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-) v2: incorporates all feedback from Florian diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 7b4390e..7a4dd0e 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -24,6 +24,7 @@ #include #include #include +#include #define _MASTER_FILE #include "global.h" @@ -1011,8 +1012,13 @@ static int __init parse_active_dev(void) /* Note: The previous of active_dev is primary device, and the following is secondary device. */ if (!viafb_active_dev) { - viafb_CRT_ON = STATE_ON; - viafb_SAMM_ON = STATE_OFF; + if (machine_is_olpc()) { /* LCD only */ + viafb_LCD_ON = STATE_ON; + viafb_SAMM_ON = STATE_OFF; + } else { + viafb_CRT_ON = STATE_ON; + viafb_SAMM_ON = STATE_OFF; + } } else if (!strcmp(viafb_active_dev, "CRT+DVI")) { /* CRT+DVI */ viafb_CRT_ON = STATE_ON; @@ -1665,8 +1671,13 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres) char *ptr; if (!str) { - *xres = 640; - *yres = 480; + if (machine_is_olpc()) { + *xres = 1200; + *yres = 900; + } else { + *xres = 640; + *yres = 480; + } return 0; } @@ -1922,11 +1933,16 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev) } #ifndef MODULE -static int __init viafb_setup(char *options) +static int __init viafb_setup(void) { char *this_opt; + char *options; + DEBUG_MSG(KERN_INFO "viafb_setup!\n"); + if (fb_get_options("viafb", &options)) + return -ENODEV; + if (!options || !*options) return 0; @@ -2000,11 +2016,18 @@ static int __init viafb_setup(char *options) int __init viafb_init(void) { u32 dummy_x, dummy_y; + int r; + + if (machine_is_olpc()) { + /* Apply XO-1.5-specific configuration. */ + viafb_lcd_panel_id = 23; + viafb_bpp = 24; + } + #ifndef MODULE - char *option = NULL; - if (fb_get_options("viafb", &option)) - return -ENODEV; - viafb_setup(option); + r = viafb_setup(); + if (r < 0) + return r; #endif if (parse_mode(viafb_mode, &dummy_x, &dummy_y) || !viafb_get_mode(dummy_x, dummy_y)