Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@linux.it>
To: linux-mips@linux-mips.org
Cc: source@embeddedalley.com
Subject: [PATCH] au1100fb suspend/resume support
Date: Mon, 10 Apr 2006 22:25:58 +0200	[thread overview]
Message-ID: <20060410202558.GS23424@enneenne.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

Hello,

here a patch for au1100fb.c in order to add suspend/resume support.

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

[-- Attachment #2: patch-au1100fb-pm --]
[-- Type: text/plain, Size: 2248 bytes --]

Index: drivers/video/au1100fb.c
===================================================================
RCS file: /home/develop/cvs_private/linux-mips-exadron/drivers/video/au1100fb.c,v
retrieving revision 1.7
diff -u -r1.7 au1100fb.c
--- a/drivers/video/au1100fb.c	2 Jan 2006 16:53:11 -0000	1.7
+++ b/drivers/video/au1100fb.c	10 Apr 2006 20:18:40 -0000
@@ -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
@@ -648,17 +650,66 @@
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static u32 sys_clksrc;
+static struct au1100fb_regs fbregs;
 int au1100fb_drv_suspend(struct device *dev, u32 state, u32 level)
 {
-	/* TODO */
+	struct au1100fb_device *fbdev = (struct au1100fb_device*) dev_get_drvdata(dev);
+
+	if (!fbdev)
+		return 0;
+
+	switch (level) {
+	case SUSPEND_DISABLE :
+		/* 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_MUD_MASK, SYS_CLKSRC);
+
+		break;
+
+	case SUSPEND_SAVE_STATE :
+		memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
+
+		break;
+
+	case SUSPEND_POWER_DOWN :
+
+		break;
+	}
+
 	return 0;
 }
 
 int au1100fb_drv_resume(struct device *dev, u32 level)
 {
-	/* TODO */
+	struct au1100fb_device *fbdev = (struct au1100fb_device*) dev_get_drvdata(dev);
+
+	if (!fbdev)
+		return 0;
+
+	switch (level) {
+	case RESUME_RESTORE_STATE :
+		memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
+
+		break;
+
+	case RESUME_ENABLE :
+		au_writel(sys_clksrc, SYS_CLKSRC);
+
+		au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
+
+		break;
+	}
+
 	return 0;
 }
+#endif
 
 static struct device_driver au1100fb_driver = {
 	.name		= "au1100-lcd",
@@ -666,8 +717,10 @@
 
 	.probe		= au1100fb_drv_probe,
         .remove		= au1100fb_drv_remove,
+#ifdef CONFIG_PM
 	.suspend	= au1100fb_drv_suspend,
         .resume		= au1100fb_drv_resume,
+#endif
 };
     
 /*-------------------------------------------------------------------------*/

                 reply	other threads:[~2006-04-10 20:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060410202558.GS23424@enneenne.com \
    --to=giometti@linux.it \
    --cc=linux-mips@linux-mips.org \
    --cc=source@embeddedalley.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox