From: Fabien Crespel <fabien-czgx1wgAc3rR7s880joybQ@public.gmane.org>
To: Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH] asus-laptop: add suspend/resume handlers
Date: Sun, 17 Feb 2008 17:48:51 +0100 [thread overview]
Message-ID: <47B86573.9080202@crespel.net> (raw)
Hello,
here is a patch to add platform suspend/resume handlers to the asus-laptop
driver, for WLAN/Bluetooth LEDs.
Please note that it needs to be applied after my previous patch "asus-laptop add
kill switch support", posted in the linux-acpi and acpi4asus mailing lists.
I tested it on my laptop (ASUS F3JC) with s2ram and s2disk, and it works well.
It's quite simple, so it should work on most (if not all) ASUS laptops without
any problem.
Regards,
- Fabien.
---
From: Fabien Crespel <fabien-czgx1wgAc3rR7s880joybQ@public.gmane.org>
This patch adds simple suspend/resume handlers to store/restore the
WLAN/Bluetooth LEDs status.
Signed-off-by: Fabien Crespel <fabien-czgx1wgAc3rR7s880joybQ@public.gmane.org>
---
asus-laptop.git.suspend.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
--- a/drivers/misc/asus-laptop.c 2008-02-17 16:41:02.000000000 +0100
+++ b/drivers/misc/asus-laptop.c 2008-02-17 16:52:08.000000000 +0100
@@ -31,7 +31,7 @@
* Josh Green - Light Sens support
* Thomas Tuttle - His first patch for led support was very helpfull
* Sam Lin - GPS support
- * Fabien Crespel - Kill Switch support
+ * Fabien Crespel - Kill Switch and suspend/resume support
*/
#include <linux/kernel.h>
@@ -926,7 +926,12 @@ static struct attribute_group asuspf_att
.attrs = asuspf_attributes
};
+static int asus_hotk_suspend(struct platform_device *dev, pm_message_t state);
+static int asus_hotk_resume(struct platform_device *dev);
+
static struct platform_driver asuspf_driver = {
+ .suspend = asus_hotk_suspend,
+ .resume = asus_hotk_resume,
.driver = {
.name = ASUS_HOTK_FILE,
.owner = THIS_MODULE,
@@ -1211,6 +1216,40 @@ static int asus_hotk_remove(struct acpi_
return 0;
}
+static int asus_hotk_suspend(struct platform_device *dev, pm_message_t state)
+{
+ /* Refresh the internal status before suspending, to restore it later */
+ if (!read_killswitch_status()) {
+ write_status(NULL, read_wireless_status(BT_ON), BT_ON);
+ write_status(NULL, read_wireless_status(WL_ON), WL_ON);
+ }
+
+ return 0;
+}
+
+static int asus_hotk_resume(struct platform_device *dev)
+{
+ if (read_killswitch_status()) {
+ /* Make sure to turn off the LEDs if Kill Switch is ON */
+ if (write_acpi_int(wl_switch_handle, NULL, 0, NULL))
+ printk(ASUS_WARNING "resume: failed to disable WLAN\n");
+ if (write_acpi_int(bt_switch_handle, NULL, 0, NULL))
+ printk(ASUS_WARNING "resume: failed to disable BT\n");
+ } else {
+ /* Restore the previous status */
+ int status;
+ status = hotk->status & WL_ON ? 1 : 0;
+ if (write_acpi_int(wl_switch_handle, NULL, status, NULL))
+ printk(ASUS_WARNING "resume: failed to restore WLAN\n");
+
+ status = hotk->status & BT_ON ? 1 : 0;
+ if (write_acpi_int(bt_switch_handle, NULL, status, NULL))
+ printk(ASUS_WARNING "resume: failed to restore BT\n");
+ }
+
+ return 0;
+}
+
static void asus_backlight_exit(void)
{
if (asus_backlight_device)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next reply other threads:[~2008-02-17 16:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-17 16:48 Fabien Crespel [this message]
2008-02-18 8:25 ` [PATCH] asus-laptop: add suspend/resume handlers Corentin CHARY
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=47B86573.9080202@crespel.net \
--to=fabien-czgx1wgac3rr7s880joybq@public.gmane.org \
--cc=acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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