linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] au1200fb: fixup PM support.
@ 2008-08-05 12:42 Manuel Lauss
  2008-08-05 12:45 ` [PATCH] au1200fb: make framebuffer config runtime selectable Manuel Lauss
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Manuel Lauss @ 2008-08-05 12:42 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: L-M-O, Kevin Hickey

Remove last traces of the custom Alchemy linux-2.4 PM code, implement
suspend/resume callbacks.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
---
 drivers/video/au1200fb.c |  164 ++++++++++++----------------------------------
 1 files changed, 41 insertions(+), 123 deletions(-)

diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index 03e57ef..be945ab 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -45,10 +45,6 @@
 #include <asm/mach-au1x00/au1000.h>
 #include "au1200fb.h"
 
-#ifdef CONFIG_PM
-#include <asm/mach-au1x00/au1xxx_pm.h>
-#endif
-
 #ifndef CONFIG_FB_AU1200_DEVS
 #define CONFIG_FB_AU1200_DEVS 4
 #endif
@@ -204,12 +200,6 @@ struct window_settings {
 extern int board_au1200fb_panel_init (void);
 extern int board_au1200fb_panel_shutdown (void);
 
-#ifdef CONFIG_PM
-int au1200fb_pm_callback(au1xxx_power_dev_t *dev,
-		au1xxx_request_t request, void *data);
-au1xxx_power_dev_t *LCD_pm_dev;
-#endif
-
 /*
  * Default window configurations
  */
@@ -651,25 +641,6 @@ static struct panel_settings known_lcd_panels[] =
 
 /********************************************************************/
 
-#ifdef CONFIG_PM
-static int set_brightness(unsigned int brightness)
-{
-	unsigned int hi1, divider;
-
-	/* limit brightness pwm duty to >= 30/1600 */
-	if (brightness < 30) {
-		brightness = 30;
-	}
-	divider = (lcd->pwmdiv & 0x3FFFF) + 1;
-	hi1 = (lcd->pwmhi >> 16) + 1;
-	hi1 = (((brightness & 0xFF) + 1) * divider >> 8);
-	lcd->pwmhi &= 0xFFFF;
-	lcd->pwmhi |= (hi1 << 16);
-
-	return brightness;
-}
-#endif /* CONFIG_PM */
-
 static int winbpp (unsigned int winctrl1)
 {
 	int bits = 0;
@@ -1247,10 +1218,6 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 	unsigned long start=0, off;
 	struct au1200fb_device *fbdev = (struct au1200fb_device *) info;
 
-#ifdef CONFIG_PM
-	au1xxx_pm_access(LCD_pm_dev);
-#endif
-
 	if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
 		return -EINVAL;
 	}
@@ -1460,10 +1427,6 @@ static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd,
 	int plane;
 	int val;
 
-#ifdef CONFIG_PM
-	au1xxx_pm_access(LCD_pm_dev);
-#endif
-
 	plane = fbinfo2index(info);
 	print_dbg("au1200fb: ioctl %d on plane %d\n", cmd, plane);
 
@@ -1622,14 +1585,14 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
 
 /* AU1200 LCD controller device driver */
 
-static int au1200fb_drv_probe(struct device *dev)
+static int au1200fb_drv_probe(struct platform_device *pdev)
 {
 	struct au1200fb_device *fbdev;
 	unsigned long page;
 	int bpp, plane, ret;
 
-	if (!dev)
-		return -EINVAL;
+	/* Kickstart the panel */
+	au1200_setpanel(panel);
 
 	for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) {
 		bpp = winbpp(win->w[plane].mode_winctrl1);
@@ -1645,7 +1608,7 @@ static int au1200fb_drv_probe(struct device *dev)
 		/* Allocate the framebuffer to the maximum screen size */
 		fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8;
 
-		fbdev->fb_mem = dma_alloc_noncoherent(dev,
+		fbdev->fb_mem = dma_alloc_noncoherent(&pdev->dev,
 				PAGE_ALIGN(fbdev->fb_len),
 				&fbdev->fb_phys, GFP_KERNEL);
 		if (!fbdev->fb_mem) {
@@ -1693,7 +1656,7 @@ static int au1200fb_drv_probe(struct device *dev)
 
 	/* Now hook interrupt too */
 	if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq,
-		 	  IRQF_DISABLED | IRQF_SHARED, "lcd", (void *)dev)) < 0) {
+			IRQF_DISABLED | IRQF_SHARED, "lcd", (void *)pdev)) < 0) {
 		print_err("fail to request interrupt line %d (err: %d)",
 			  AU1200_LCD_INT, ret);
 		goto failed;
@@ -1704,25 +1667,22 @@ static int au1200fb_drv_probe(struct device *dev)
 failed:
 	/* NOTE: This only does the current plane/window that failed; others are still active */
 	if (fbdev->fb_mem)
-		dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),
+		dma_free_noncoherent(&pdev->dev, PAGE_ALIGN(fbdev->fb_len),
 				fbdev->fb_mem, fbdev->fb_phys);
 	if (fbdev->fb_info.cmap.len != 0)
 		fb_dealloc_cmap(&fbdev->fb_info.cmap);
 	if (fbdev->fb_info.pseudo_palette)
 		kfree(fbdev->fb_info.pseudo_palette);
 	if (plane == 0)
-		free_irq(AU1200_LCD_INT, (void*)dev);
+		free_irq(AU1200_LCD_INT, (void *)pdev);
 	return ret;
 }
 
-static int au1200fb_drv_remove(struct device *dev)
+static int au1200fb_drv_remove(struct platform_device *pdev)
 {
 	struct au1200fb_device *fbdev;
 	int plane;
 
-	if (!dev)
-		return -ENODEV;
-
 	/* Turn off the panel */
 	au1200_setpanel(NULL);
 
@@ -1733,7 +1693,8 @@ static int au1200fb_drv_remove(struct device *dev)
 		/* Clean up all probe data */
 		unregister_framebuffer(&fbdev->fb_info);
 		if (fbdev->fb_mem)
-			dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),
+			dma_free_noncoherent(&pdev->dev,
+					PAGE_ALIGN(fbdev->fb_len),
 					fbdev->fb_mem, fbdev->fb_phys);
 		if (fbdev->fb_info.cmap.len != 0)
 			fb_dealloc_cmap(&fbdev->fb_info.cmap);
@@ -1741,34 +1702,52 @@ static int au1200fb_drv_remove(struct device *dev)
 			kfree(fbdev->fb_info.pseudo_palette);
 	}
 
-	free_irq(AU1200_LCD_INT, (void *)dev);
+	free_irq(AU1200_LCD_INT, (void *)pdev);
 
 	return 0;
 }
 
 #ifdef CONFIG_PM
-static int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level)
-{
-	/* TODO */
+static int au1200fb_drv_suspend(struct platform_device *pdev,
+				pm_message_t state)
+ {
+	au1200_setpanel(NULL);
+
+	lcd->outmask = 0;
+	au_sync();
+
 	return 0;
 }
 
-static int au1200fb_drv_resume(struct device *dev, u32 level)
+static int au1200fb_drv_resume(struct platform_device *pdev)
 {
-	/* TODO */
+	struct au1200fb_device *fbdev;
+	int i;
+
+	/* Kickstart the panel */
+	au1200_setpanel(panel);
+
+	for (i = 0; i < CONFIG_FB_AU1200_DEVS; i++) {
+		fbdev = &_au1200fb_devices[i];
+		au1200fb_fb_set_par(&fbdev->fb_info);
+	}
+
 	return 0;
 }
+#else
+#define au1200fb_drv_suspend	NULL
+#define au1200fb_drv_resume	NULL
 #endif /* CONFIG_PM */
 
-static struct device_driver au1200fb_driver = {
-	.name		= "au1200-lcd",
-	.bus		= &platform_bus_type,
+static struct platform_driver au1200fb_driver = {
+	.driver	= {
+		.name	= "au1200-lcd",
+		.owner	= THIS_MODULE,
+	},
 	.probe		= au1200fb_drv_probe,
 	.remove		= au1200fb_drv_remove,
-#ifdef CONFIG_PM
 	.suspend	= au1200fb_drv_suspend,
 	.resume		= au1200fb_drv_resume,
-#endif
 };
 
 /*-------------------------------------------------------------------------*/
@@ -1831,56 +1810,6 @@ static void au1200fb_setup(void)
 	}
 }
 
-#ifdef CONFIG_PM
-static int au1200fb_pm_callback(au1xxx_power_dev_t *dev,
-		au1xxx_request_t request, void *data) {
-	int retval = -1;
-	unsigned int d = 0;
-	unsigned int brightness = 0;
-
-	if (request == AU1XXX_PM_SLEEP) {
-		board_au1200fb_panel_shutdown();
-	}
-	else if (request == AU1XXX_PM_WAKEUP) {
-		if(dev->prev_state == SLEEP_STATE)
-		{
-			int plane;
-			au1200_setpanel(panel);
-			for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) 	{
-				struct au1200fb_device *fbdev;
-				fbdev = &_au1200fb_devices[plane];
-				au1200fb_fb_set_par(&fbdev->fb_info);
-			}
-		}
-
-		d = *((unsigned int*)data);
-		if(d <=10) brightness = 26;
-		else if(d<=20) brightness = 51;
-		else if(d<=30) brightness = 77;
-		else if(d<=40) brightness = 102;
-		else if(d<=50) brightness = 128;
-		else if(d<=60) brightness = 153;
-		else if(d<=70) brightness = 179;
-		else if(d<=80) brightness = 204;
-		else if(d<=90) brightness = 230;
-		else brightness = 255;
-		set_brightness(brightness);
-	} else if (request == AU1XXX_PM_GETSTATUS) {
-		return dev->cur_state;
-	} else if (request == AU1XXX_PM_ACCESS) {
-		if (dev->cur_state != SLEEP_STATE)
-			return retval;
-		else {
-			au1200_setpanel(panel);
-		}
-	} else if (request == AU1XXX_PM_IDLE) {
-	} else if (request == AU1XXX_PM_CLEANUP) {
-	}
-
-	return retval;
-}
-#endif
-
 static int __init au1200fb_init(void)
 {
 	print_info("" DRIVER_DESC "");
@@ -1895,23 +1824,12 @@ static int __init au1200fb_init(void)
 	printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name);
 	printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name);
 
-	/* Kickstart the panel, the framebuffers/windows come soon enough */
-	au1200_setpanel(panel);
-
-	#ifdef CONFIG_PM
-	LCD_pm_dev = new_au1xxx_power_device("LCD", &au1200fb_pm_callback, NULL);
-	if ( LCD_pm_dev == NULL)
-		printk(KERN_INFO "Unable to create a power management device entry for the au1200fb.\n");
-	else
-		printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n");
-	#endif
-
-	return driver_register(&au1200fb_driver);
+	return platform_driver_register(&au1200fb_driver);
 }
 
 static void __exit au1200fb_cleanup(void)
 {
-	driver_unregister(&au1200fb_driver);
+	platform_driver_unregister(&au1200fb_driver);
 }
 
 module_init(au1200fb_init);
-- 
1.5.6.4


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] au1200fb: make framebuffer config runtime selectable.
  2008-08-05 12:42 [PATCH] au1200fb: fixup PM support Manuel Lauss
@ 2008-08-05 12:45 ` Manuel Lauss
  2008-08-05 15:25   ` Krzysztof Helt
  2008-08-05 15:22 ` [PATCH] au1200fb: fixup PM support Krzysztof Helt
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Manuel Lauss @ 2008-08-05 12:45 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: L-M-O, Kevin Hickey

Make the number of framebuffer windows and the window configuration
selectable at the kernel commandline instead of hardcoding it
in the kernel config.

This patch does not directly depend on the previous one ("au1200fb: fixup PM
support"), but it only applies cleanly on top of it.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
---
 drivers/video/au1200fb.c |   55 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index be945ab..7127aa7 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -45,10 +45,6 @@
 #include <asm/mach-au1x00/au1000.h>
 #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"
 
@@ -153,7 +149,7 @@ struct au1200fb_device {
 	dma_addr_t    		fb_phys;
 };
 
-static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
+static struct au1200fb_device _au1200fb_devices[4];
 /********************************************************************/
 
 /* LCD controller restrictions */
@@ -166,10 +162,17 @@ static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
 /* Default number of visible screen buffer to allocate */
 #define AU1200FB_NBR_VIDEO_BUFFERS 1
 
+/* Default number of fb devices to create */
+#define DEFAULT_DEVICE_COUNT	4
+
+/* Default window configuration entry to use (see windows[]) */
+#define DEFAULT_WINDOW_INDEX	2
+
 /********************************************************************/
 
 static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR;
-static int window_index = 2; /* default is zero */
+static int device_count = DEFAULT_DEVICE_COUNT;	/* number of fb devices to create */
+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;
@@ -682,7 +685,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 == (struct fb_info *)(&_au1200fb_devices[i].fb_info))
 			return i;
 	}
@@ -1594,7 +1597,7 @@ static int au1200fb_drv_probe(struct platform_device *pdev)
 	/* 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;
@@ -1686,7 +1689,7 @@ static int au1200fb_drv_remove(struct platform_device *pdev)
 	/* Turn off the panel */
 	au1200_setpanel(NULL);
 
-	for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)
+	for (plane = 0; plane < device_count; ++plane)
 	{
 		fbdev = &_au1200fb_devices[plane];
 
@@ -1727,7 +1730,7 @@ static int au1200fb_drv_resume(struct platform_device *pdev)
 	/* Kickstart the panel */
 	au1200_setpanel(panel);
 
-	for (i = 0; i < CONFIG_FB_AU1200_DEVS; i++) {
+	for (i = 0; i < device_count; i++) {
 		fbdev = &_au1200fb_devices[i];
 		au1200fb_fb_set_par(&fbdev->fb_info);
 	}
@@ -1754,10 +1757,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;
 
@@ -1802,12 +1805,29 @@ 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 > 4))
+					device_count = DEFAULT_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)
@@ -1815,7 +1835,14 @@ static int __init au1200fb_init(void)
 	print_info("" DRIVER_DESC "");
 
 	/* Setup driver with options */
-	au1200fb_setup();
+	if (au1200fb_setup())
+		return -ENODEV;
+
+	if ((device_count < 0) || (device_count > 4))
+		device_count = DEFAULT_DEVICE_COUNT;
+
+	if ((window_index < 0) || (window_index >= ARRAY_SIZE(windows)))
+		window_index = DEFAULT_WINDOW_INDEX;
 
 	/* Point to the panel selected */
 	panel = &known_lcd_panels[panel_index];
-- 
1.5.6.4


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] au1200fb: fixup PM support.
  2008-08-05 12:42 [PATCH] au1200fb: fixup PM support Manuel Lauss
  2008-08-05 12:45 ` [PATCH] au1200fb: make framebuffer config runtime selectable Manuel Lauss
@ 2008-08-05 15:22 ` Krzysztof Helt
  2008-08-05 16:02 ` Kevin Hickey
       [not found] ` <1217952137.23188.2.camel@kh-ubuntu.razamicroelectronics.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2008-08-05 15:22 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: L-M-O, Kevin Hickey, linux-fbdev-devel

On Tue, 5 Aug 2008 14:42:21 +0200
Manuel Lauss <mano@roarinelk.homelinux.net> wrote:

> Remove last traces of the custom Alchemy linux-2.4 PM code, implement
> suspend/resume callbacks.
> 
> Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
> ---
>  drivers/video/au1200fb.c |  164 ++++++++++++----------------------------------
>  1 files changed, 41 insertions(+), 123 deletions(-)
> 

Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>

If you don't want to push this patch through the mips tree you may post this patch
to Andrew Morton <akpm@linux-foundation.org> with my acked-by.

Regards,
Krzysztof

----------------------------------------------------------------------
Te newsy nakreca Cie na caly dzien!
Sprawdz >>> http://link.interia.pl/f1e94


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] au1200fb: make framebuffer config runtime selectable.
  2008-08-05 12:45 ` [PATCH] au1200fb: make framebuffer config runtime selectable Manuel Lauss
@ 2008-08-05 15:25   ` Krzysztof Helt
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2008-08-05 15:25 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: L-M-O, Kevin Hickey, linux-fbdev-devel

On Tue, 5 Aug 2008 14:45:22 +0200
Manuel Lauss <mano@roarinelk.homelinux.net> wrote:

> Make the number of framebuffer windows and the window configuration
> selectable at the kernel commandline instead of hardcoding it
> in the kernel config.
> 
> This patch does not directly depend on the previous one ("au1200fb: fixup PM
> support"), but it only applies cleanly on top of it.
> 
> Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
> ---
>  drivers/video/au1200fb.c |   55 ++++++++++++++++++++++++++++++++++-----------
>  1 files changed, 41 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
> index be945ab..7127aa7 100644
> --- a/drivers/video/au1200fb.c
> +++ b/drivers/video/au1200fb.c
> @@ -45,10 +45,6 @@
>  #include <asm/mach-au1x00/au1000.h>
>  #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"
>  
> @@ -153,7 +149,7 @@ struct au1200fb_device {
>  	dma_addr_t    		fb_phys;
>  };
>  
> -static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
> +static struct au1200fb_device _au1200fb_devices[4];

Please use the constant here.

>  /********************************************************************/
>  
>  /* LCD controller restrictions */
> @@ -166,10 +162,17 @@ static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
>  /* Default number of visible screen buffer to allocate */
>  #define AU1200FB_NBR_VIDEO_BUFFERS 1
>  
> +/* Default number of fb devices to create */
> +#define DEFAULT_DEVICE_COUNT	4
> +

This one can be renamed to MAX_DEVICE_COUNT and used in the declaration
above and various checks. There is nothing wrong with the default value being
the maximum value.

> +/* Default window configuration entry to use (see windows[]) */
> +#define DEFAULT_WINDOW_INDEX	2
> +
>  /********************************************************************/
>  
>  static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR;
> -static int window_index = 2; /* default is zero */
> +static int device_count = DEFAULT_DEVICE_COUNT;	/* number of fb devices to create */
> +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;
> @@ -682,7 +685,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 == (struct fb_info *)(&_au1200fb_devices[i].fb_info))
>  			return i;
>  	}
> @@ -1594,7 +1597,7 @@ static int au1200fb_drv_probe(struct platform_device *pdev)
>  	/* 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;
> @@ -1686,7 +1689,7 @@ static int au1200fb_drv_remove(struct platform_device *pdev)
>  	/* Turn off the panel */
>  	au1200_setpanel(NULL);
>  
> -	for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)
> +	for (plane = 0; plane < device_count; ++plane)
>  	{
>  		fbdev = &_au1200fb_devices[plane];
>  
> @@ -1727,7 +1730,7 @@ static int au1200fb_drv_resume(struct platform_device *pdev)
>  	/* Kickstart the panel */
>  	au1200_setpanel(panel);
>  
> -	for (i = 0; i < CONFIG_FB_AU1200_DEVS; i++) {
> +	for (i = 0; i < device_count; i++) {
>  		fbdev = &_au1200fb_devices[i];
>  		au1200fb_fb_set_par(&fbdev->fb_info);
>  	}
> @@ -1754,10 +1757,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;
>  
> @@ -1802,12 +1805,29 @@ 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 > 4))
> +					device_count = DEFAULT_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)
> @@ -1815,7 +1835,14 @@ static int __init au1200fb_init(void)
>  	print_info("" DRIVER_DESC "");
>  
>  	/* Setup driver with options */
> -	au1200fb_setup();
> +	if (au1200fb_setup())
> +		return -ENODEV;
> +
> +	if ((device_count < 0) || (device_count > 4))
> +		device_count = DEFAULT_DEVICE_COUNT;
> +

The au1200fb_setup does this check before so it is not needed
to repeat it.

The patch looks fine otherwise.

Kind regards,
Krzysztof

----------------------------------------------------------------------
Te newsy nakreca Cie na caly dzien!
Sprawdz >>> http://link.interia.pl/f1e94


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] au1200fb: fixup PM support.
  2008-08-05 12:42 [PATCH] au1200fb: fixup PM support Manuel Lauss
  2008-08-05 12:45 ` [PATCH] au1200fb: make framebuffer config runtime selectable Manuel Lauss
  2008-08-05 15:22 ` [PATCH] au1200fb: fixup PM support Krzysztof Helt
@ 2008-08-05 16:02 ` Kevin Hickey
       [not found] ` <1217952137.23188.2.camel@kh-ubuntu.razamicroelectronics.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Kevin Hickey @ 2008-08-05 16:02 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: L-M-O, linux-fbdev-devel

On Tue, 2008-08-05 at 14:42 +0200, Manuel Lauss wrote:
> Remove last traces of the custom Alchemy linux-2.4 PM code, implement
> suspend/resume callbacks.
> 
> Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
> ---
>  drivers/video/au1200fb.c |  164 ++++++++++++----------------------------------
>  1 files changed, 41 insertions(+), 123 deletions(-)
> 
This looks good.  It applied to my tree and appears functional on my
board.  One question: what about dynamic brightness?  It was part of the
old PM interface and you seem to have removed it.  Any ideas about
re-integrating that into the current PM model?

Acked-by: Kevin Hickey <khickey@rmicorp.com>

-- 
Kevin Hickey
Alchemy Solutions
RMI Corporation
khickey@RMICorp.com
P: 512.691.8044

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Linux-fbdev-devel mailing list
Linux-fbdev-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] au1200fb: fixup PM support.
       [not found] ` <1217952137.23188.2.camel@kh-ubuntu.razamicroelectronics.com>
@ 2008-08-05 16:08   ` Manuel Lauss
  0 siblings, 0 replies; 6+ messages in thread
From: Manuel Lauss @ 2008-08-05 16:08 UTC (permalink / raw)
  To: Kevin Hickey; +Cc: L-M-O, linux-fbdev-devel

Kevin Hickey wrote:
> On Tue, 2008-08-05 at 14:42 +0200, Manuel Lauss wrote:
>> Remove last traces of the custom Alchemy linux-2.4 PM code, implement
>> suspend/resume callbacks.
>>
>> Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
>> ---
>>  drivers/video/au1200fb.c |  164 ++++++++++++----------------------------------
>>  1 files changed, 41 insertions(+), 123 deletions(-)
>>
> This looks good.  It applied to my tree and appears functional on my
> board.  One question: what about dynamic brightness?  It was part of the
> old PM interface and you seem to have removed it.  Any ideas about
> re-integrating that into the current PM model?

Hm, good point.  Let me see if I can hook the 2 PWMs into the backlight
framework somehow...   I'll repost once this works.


> Acked-by: Kevin Hickey <khickey@rmicorp.com>

MfG,
	Manuel Lauss

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-05 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-05 12:42 [PATCH] au1200fb: fixup PM support Manuel Lauss
2008-08-05 12:45 ` [PATCH] au1200fb: make framebuffer config runtime selectable Manuel Lauss
2008-08-05 15:25   ` Krzysztof Helt
2008-08-05 15:22 ` [PATCH] au1200fb: fixup PM support Krzysztof Helt
2008-08-05 16:02 ` Kevin Hickey
     [not found] ` <1217952137.23188.2.camel@kh-ubuntu.razamicroelectronics.com>
2008-08-05 16:08   ` Manuel Lauss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).