[<prev] [next>] [day] [month] [year] [list]
Message-Id: <6af33d6c42ba4de9eea27316c64f81b96e01c948.1260281599.git.wuzhangjin@gmail.com>
Date: Tue, 8 Dec 2009 22:15:55 +0800
From: Wu Zhangjin <wuzhangjin@...il.com>
To: Ralf Baechle <ralf@...ux-mips.org>
Cc: akpm@...ux-foundation.org, Wu Zhangjin <wuzhangjin@...il.com>,
linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
"Rafael J . Wysocki" <rjw@...k.pl>, zhangfx@...ote.com,
linux-laptop@...r.kernel.org,
Stephen Rothwell <sfr@...b.auug.org.au>,
Pavel Machek <pavel@....cz>
Subject: [PATCH v9 7/8] Loongson: YeeLoong: add suspend support
From: Wu Zhangjin <wuzhangjin@...il.com>
This patch add support to suspend the yeeloong platform specific
devices(LCD, CRT, USB...).
Acked-by: Rafael J. Wysocki <rjw@...k.pl>
Acked-by: Pavel Machek <pavel@....cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists