Linux laptop Discussion Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: akpm@linux-foundation.org, Wu Zhangjin <wuzhangjin@gmail.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>,
	zhangfx@lemote.com, linux-laptop@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v9 7/8] Loongson: YeeLoong: add suspend support
Date: Tue,  8 Dec 2009 22:15:55 +0800	[thread overview]
Message-ID: <6af33d6c42ba4de9eea27316c64f81b96e01c948.1260281599.git.wuzhangjin@gmail.com> (raw)
In-Reply-To: <234c5ecd475b05e3eb17ead3ae107cfe3426e0e0.1260281599.git.wuzhangjin@gmail.com>
In-Reply-To: <cover.1260281599.git.wuzhangjin@gmail.com>

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch add support to suspend the yeeloong platform specific
devices(LCD, CRT, USB...).

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/platform/mips/yeeloong_laptop.c |   42 ++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/mips/yeeloong_laptop.c b/drivers/platform/mips/yeeloong_laptop.c
index f8907da..baf3e81 100644
--- a/drivers/platform/mips/yeeloong_laptop.c
+++ b/drivers/platform/mips/yeeloong_laptop.c
@@ -512,6 +512,39 @@ static void yeeloong_vo_exit(void)
 	}
 }
 
+#ifdef CONFIG_PM
+static void usb_ports_set(int status)
+{
+	status = !!status;
+
+	ec_write(REG_USB0_FLAG, status);
+	ec_write(REG_USB1_FLAG, status);
+	ec_write(REG_USB2_FLAG, status);
+}
+
+static int yeeloong_suspend(struct device *dev)
+
+{
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_OFF);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_UNPLUG);
+	usb_ports_set(BIT_USB_FLAG_OFF);
+
+	return 0;
+}
+
+static int yeeloong_resume(struct device *dev)
+{
+	yeeloong_lcd_vo_set(BIT_DISPLAY_LCD_ON);
+	yeeloong_crt_vo_set(BIT_CRT_DETECT_PLUG);
+	usb_ports_set(BIT_USB_FLAG_ON);
+
+	return 0;
+}
+
+static const SIMPLE_DEV_PM_OPS(yeeloong_pm_ops, yeeloong_suspend,
+	yeeloong_resume);
+#endif
+
 static struct platform_device_id platform_device_ids[] = {
 	{
 		.name = "yeeloong_laptop",
@@ -523,9 +556,12 @@ MODULE_DEVICE_TABLE(platform, platform_device_ids);
 
 static struct platform_driver platform_driver = {
 	.driver = {
-		   .name = "yeeloong_laptop",
-		   .owner = THIS_MODULE,
-		   },
+		.name = "yeeloong_laptop",
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &yeeloong_pm_ops,
+#endif
+	},
 	.id_table = platform_device_ids,
 };
 
-- 
1.6.2.1

  parent reply	other threads:[~2009-12-08 14:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 14:15 [PATCH v9 0/8] Loongson: YeeLoong: add platform drivers Wu Zhangjin
     [not found] ` <cover.1260281599.git.wuzhangjin@gmail.com>
2009-12-08 14:15   ` [PATCH v9 1/8] MIPS: add subdirectory for platform extension drivers Wu Zhangjin
2009-12-08 14:15   ` [PATCH v9 2/8] Loongson: YeeLoong: add platform driver Wu Zhangjin
2009-12-08 14:15   ` [PATCH v9 3/8] Loongson: YeeLoong: add backlight driver Wu Zhangjin
2009-12-08 14:15   ` [PATCH v9 4/8] Loongson: YeeLoong: add battery driver Wu Zhangjin
2009-12-08 14:15   ` [PATCH v9 5/8] Loongson: YeeLoong: add hardware monitoring driver Wu Zhangjin
2009-12-08 15:02     ` Pavel Machek
2009-12-09 10:59       ` Wu Zhangjin
2009-12-08 14:15   ` [PATCH v9 6/8] Loongson: YeeLoong: add video output driver Wu Zhangjin
2009-12-08 14:15   ` Wu Zhangjin [this message]
2009-12-08 14:15   ` [PATCH v9 8/8] Loongson: YeeLoong: add input/hotkey driver Wu Zhangjin
2009-12-11  2:47     ` Wu Zhangjin

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=6af33d6c42ba4de9eea27316c64f81b96e01c948.1260281599.git.wuzhangjin@gmail.com \
    --to=wuzhangjin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-laptop@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=pavel@ucw.cz \
    --cc=ralf@linux-mips.org \
    --cc=rjw@sisk.pl \
    --cc=sfr@canb.auug.org.au \
    --cc=zhangfx@lemote.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).