linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/5] au1100fb: Add power management support
@ 2006-05-28  0:42 Antonino A. Daplas
  2006-05-28  6:21 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Antonino A. Daplas @ 2006-05-28  0:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Fbdev development list, Ralf Baechle

From: Rodolfo Giometti <giometti@linux.it>

Add power management support.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 drivers/video/au1100fb.c |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index f55c16a..0a800bf 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -7,6 +7,8 @@
  *  	Karl Lessard <klessard@sunrisetelecom.com>
  *  	<c.pellegrin@exadron.com>
  *
+ * PM support added by Rodolfo Giometti <giometti@linux.it>
+ *
  * Copyright 2002 MontaVista Software
  * Author: MontaVista Software, Inc.
  *		ppopov@mvista.com or source@mvista.com
@@ -602,17 +604,49 @@ int au1100fb_drv_remove(struct device *d
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static u32 sys_clksrc;
+static struct au1100fb_regs fbregs;
+
 int au1100fb_drv_suspend(struct device *dev, pm_message_t state)
 {
-	/* TODO */
+	struct au1100fb_device *fbdev = (struct au1100fb_device*) dev_get_drvdata(dev);
+
+	if (!fbdev)
+		return 0;
+
+	/* Save the clock source state */
+	sys_clksrc = au_readl(SYS_CLKSRC);
+
+	/* Blank the LCD */
+	au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
+
+	/* Stop LCD clocking */
+	au_writel(sys_clksrc & ~SYS_CS_ML_MASK, SYS_CLKSRC);
+
+	memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
+
 	return 0;
 }
 
 int au1100fb_drv_resume(struct device *dev)
 {
-	/* TODO */
+	struct au1100fb_device *fbdev = (struct au1100fb_device*) dev_get_drvdata(dev);
+
+	if (!fbdev)
+		return 0;
+
+	memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
+
+	/* Restart LCD clocking */
+	au_writel(sys_clksrc, SYS_CLKSRC);
+
+	/* Unblank the LCD */
+	au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
+
 	return 0;
 }
+#endif
 
 static struct device_driver au1100fb_driver = {
 	.name		= "au1100-lcd",
@@ -620,8 +654,10 @@ static struct device_driver au1100fb_dri
 
 	.probe		= au1100fb_drv_probe,
         .remove		= au1100fb_drv_remove,
+#ifdef CONFIG_PM
 	.suspend	= au1100fb_drv_suspend,
         .resume		= au1100fb_drv_resume,
+#endif
 };
 
 /*-------------------------------------------------------------------------*/




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642

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

* Re: [PATCH 3/5] au1100fb: Add power management support
  2006-05-28  0:42 [PATCH 3/5] au1100fb: Add power management support Antonino A. Daplas
@ 2006-05-28  6:21 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2006-05-28  6:21 UTC (permalink / raw)
  To: Antonino A. Daplas; +Cc: linux-fbdev-devel, ralf

On Sun, 28 May 2006 08:42:37 +0800
"Antonino A. Daplas" <adaplas@gmail.com> wrote:

> From: Rodolfo Giometti <giometti@linux.it>
> 
> Add power management support.
> 
>  int au1100fb_drv_suspend(struct device *dev, pm_message_t state)
>  {
> -	/* TODO */
> +	struct au1100fb_device *fbdev = (struct au1100fb_device*) dev_get_drvdata(dev);
>  
>  int au1100fb_drv_resume(struct device *dev)
>  {
> -	/* TODO */
> +	struct au1100fb_device *fbdev = (struct au1100fb_device*) dev_get_drvdata(dev);

These typecasts of void* are unneeded.  They are in fact undesirable - if
someone were to change the type of dev_get_drvdata() to return some
non-pointer type then this code would still silently swallow it without
warning us of the bug.

Plus typecasts are ugly.


This patch doesn't apply, probably due to the earlier mangled one whihc I dropped.
Please redo and resend this one as well.



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642

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

end of thread, other threads:[~2006-05-28  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-28  0:42 [PATCH 3/5] au1100fb: Add power management support Antonino A. Daplas
2006-05-28  6:21 ` Andrew Morton

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).