From patchwork Fri Jun 10 15:23:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Lauss X-Patchwork-Id: 869942 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5AFNGMN029930 for ; Fri, 10 Jun 2011 15:23:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757753Ab1FJPXX (ORCPT ); Fri, 10 Jun 2011 11:23:23 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:42114 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757745Ab1FJPXW (ORCPT ); Fri, 10 Jun 2011 11:23:22 -0400 Received: by wwa36 with SMTP id 36so2896152wwa.1 for ; Fri, 10 Jun 2011 08:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=scFbYp3dReDqFyi2esbU9s5lLM/md0krCLX6bu4gRY0=; b=kGL+C0a8HwXoQq1zXrDqV/ZKKeY9XULdVUUgp2T5cwpMCZhqo3+aEqwy8yX0bFESHk pLVIwIGjZBpMaYrjWxeP7SHAa96DDAXoltNZNQs8sKrxS8vuW5zKZglzyHSwqmoHerlc m5l2bAhuSqw8elgiz7WntB2Y9G6etVc8wE8qY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=cosWmCHD968EvQuPFp3P/ysjKXc7ynLc+0lvHX7XboTWv4u1YW8l8B2+KzICELUddm j89wbp08wj9qs4souDOWSttW9WGH05CwvJwAdnbpCfFeNjbzY3cyF2mn55edWzLK5+XS TqmvtXDNYlJyK1n06s3hMArBH0Y5rxEe8qpgA= Received: by 10.216.230.138 with SMTP id j10mr3566499weq.46.1307719401241; Fri, 10 Jun 2011 08:23:21 -0700 (PDT) Received: from localhost.localdomain (178-191-6-93.adsl.highway.telekom.at [178.191.6.93]) by mx.google.com with ESMTPS id d7sm1461054wek.21.2011.06.10.08.23.19 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Jun 2011 08:23:20 -0700 (PDT) From: Manuel Lauss To: linux-fbdev Cc: Manuel Lauss Subject: [PATCH 3/4] au1200fb: make number of windows configurable at load time. Date: Fri, 10 Jun 2011 17:23:03 +0200 Message-Id: <1307719384-23702-4-git-send-email-manuel.lauss@googlemail.com> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1307719384-23702-1-git-send-email-manuel.lauss@googlemail.com> References: <1307719384-23702-1-git-send-email-manuel.lauss@googlemail.com> 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]); Fri, 10 Jun 2011 15:23:23 +0000 (UTC) Make the number of framebuffer windows and the window configuration selectable at the kernel commandline instead of hardcoding it in the kernel config. Signed-off-by: Manuel Lauss --- drivers/video/au1200fb.c | 53 +++++++++++++++++++++++++++++++++------------ 1 files changed, 39 insertions(+), 14 deletions(-) diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 480ecb1..4b58f7b 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c @@ -46,10 +46,6 @@ #include #include "au1200fb.h" -#ifndef CONFIG_FB_AU1200_DEVS -#define CONFIG_FB_AU1200_DEVS 4 -#endif - #define DRIVER_NAME "au1200fb" #define DRIVER_DESC "LCD controller driver for AU1200 processors" @@ -154,7 +150,6 @@ struct au1200fb_device { dma_addr_t fb_phys; }; -static struct fb_info *_au1200fb_infos[CONFIG_FB_AU1200_DEVS]; /********************************************************************/ /* LCD controller restrictions */ @@ -167,10 +162,18 @@ static struct fb_info *_au1200fb_infos[CONFIG_FB_AU1200_DEVS]; /* Default number of visible screen buffer to allocate */ #define AU1200FB_NBR_VIDEO_BUFFERS 1 +/* Default maximum number of fb devices to create */ +#define MAX_DEVICE_COUNT 4 + +/* Default window configuration entry to use (see windows[]) */ +#define DEFAULT_WINDOW_INDEX 2 + /********************************************************************/ +static struct fb_info *_au1200fb_infos[MAX_DEVICE_COUNT]; static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR; -static int window_index = 2; /* default is zero */ +static int device_count = MAX_DEVICE_COUNT; +static int window_index = DEFAULT_WINDOW_INDEX; /* default is zero */ static int panel_index = 2; /* default is zero */ static struct window_settings *win; static struct panel_settings *panel; @@ -683,7 +686,7 @@ static int fbinfo2index (struct fb_info *fb_info) { int i; - for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i) { + for (i = 0; i < device_count; ++i) { if (fb_info == _au1200fb_infos[i]) return i; } @@ -1599,7 +1602,7 @@ static int __devinit au1200fb_drv_probe(struct platform_device *dev) /* Kickstart the panel */ au1200_setpanel(panel); - for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { + for (plane = 0; plane < device_count; ++plane) { bpp = winbpp(win->w[plane].mode_winctrl1); if (win->w[plane].xres == 0) win->w[plane].xres = panel->Xres; @@ -1699,7 +1702,7 @@ static int __devexit au1200fb_drv_remove(struct platform_device *dev) /* Turn off the panel */ au1200_setpanel(NULL); - for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { + for (plane = 0; plane < device_count; ++plane) { fbi = _au1200fb_infos[plane]; fbdev = fbi->par; @@ -1741,7 +1744,7 @@ static int au1200fb_drv_resume(struct device *dev) /* Kickstart the panel */ au1200_setpanel(panel); - for (i = 0; i < CONFIG_FB_AU1200_DEVS; i++) { + for (i = 0; i < device_count; i++) { fbi = _au1200fb_infos[i]; au1200fb_fb_set_par(fbi); } @@ -1776,10 +1779,10 @@ static struct platform_driver au1200fb_driver = { /* Kernel driver */ -static void au1200fb_setup(void) +static int au1200fb_setup(void) { - char* options = NULL; - char* this_opt; + char *options = NULL; + char *this_opt, *endptr; int num_panels = ARRAY_SIZE(known_lcd_panels); int panel_idx = -1; @@ -1824,12 +1827,33 @@ static void au1200fb_setup(void) nohwcursor = 1; } + else if (strncmp(this_opt, "devices:", 8) == 0) { + this_opt += 8; + device_count = simple_strtol(this_opt, + &endptr, 0); + if ((device_count < 0) || + (device_count > MAX_DEVICE_COUNT)) + device_count = MAX_DEVICE_COUNT; + } + + else if (strncmp(this_opt, "wincfg:", 7) == 0) { + this_opt += 7; + window_index = simple_strtol(this_opt, + &endptr, 0); + if ((window_index < 0) || + (window_index >= ARRAY_SIZE(windows))) + window_index = DEFAULT_WINDOW_INDEX; + } + + else if (strncmp(this_opt, "off", 3) == 0) + return 1; /* Unsupported option */ else { print_warn("Unsupported option \"%s\"", this_opt); } } } + return 0; } static int __init au1200fb_init(void) @@ -1837,7 +1861,8 @@ static int __init au1200fb_init(void) print_info("" DRIVER_DESC ""); /* Setup driver with options */ - au1200fb_setup(); + if (au1200fb_setup()) + return -ENODEV; /* Point to the panel selected */ panel = &known_lcd_panels[panel_index];