From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Vojtech Pavlik <vojtech@suse.cz>, Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [git pull 06/14] Wistron - add PM support
Date: Sun, 20 Nov 2005 01:36:17 -0500 [thread overview]
Message-ID: <20051120064420.028262000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20051120063611.269343000.dtor_core@ameritech.net
[-- Attachment #1: wistron-platform-device.patch --]
[-- Type: text/plain, Size: 3650 bytes --]
Input: wistron - add PM support
Register wistron-bios as a platform device, restore WIFI and
Bluetooth state upon resume.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/misc/wistron_btns.c | 62 ++++++++++++++++++++++++++++++++++----
1 files changed, 57 insertions(+), 5 deletions(-)
Index: work/drivers/input/misc/wistron_btns.c
===================================================================
--- work.orig/drivers/input/misc/wistron_btns.c
+++ work/drivers/input/misc/wistron_btns.c
@@ -2,6 +2,7 @@
* Wistron laptop button driver
* Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
* Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
+ * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
*
* You can redistribute and/or modify this program under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -28,6 +29,7 @@
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/types.h>
+#include <linux/platform_device.h>
/*
* Number of attempts to read data from queue per poll;
@@ -58,6 +60,8 @@ static char *keymap_name; /* = NULL; */
module_param_named(keymap, keymap_name, charp, 0);
MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected");
+static struct platform_device *wistron_device;
+
/* BIOS interface implementation */
static void __iomem *bios_entry_point; /* BIOS routine entry point */
@@ -356,6 +360,7 @@ static int __init setup_input_dev(void)
input_dev->name = "Wistron laptop buttons";
input_dev->phys = "wistron/input0";
input_dev->id.bustype = BUS_HOST;
+ input_dev->cdev.dev = &wistron_device->dev;
for (key = keymap; key->type != KE_END; key++) {
if (key->type == KE_KEY) {
@@ -442,6 +447,34 @@ static void poll_bios(unsigned long disc
mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY);
}
+static int wistron_suspend(struct platform_device *dev, pm_message_t state)
+{
+ del_timer_sync(&poll_timer);
+
+ return 0;
+}
+
+static int wistron_resume(struct platform_device *dev)
+{
+ if (have_wifi)
+ bios_set_state(WIFI, wifi_enabled);
+
+ if (have_bluetooth)
+ bios_set_state(BLUETOOTH, bluetooth_enabled);
+
+ poll_bios(1);
+
+ return 0;
+}
+
+static struct platform_driver wistron_driver = {
+ .suspend = wistron_suspend,
+ .resume = wistron_resume,
+ .driver = {
+ .name = "wistron-bios",
+ },
+};
+
static int __init wb_module_init(void)
{
int err;
@@ -457,6 +490,16 @@ static int __init wb_module_init(void)
bios_attach();
cmos_address = bios_get_cmos_address();
+ err = platform_driver_register(&wistron_driver);
+ if (err)
+ goto err_detach_bios;
+
+ wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0);
+ if (IS_ERR(wistron_device)) {
+ err = PTR_ERR(wistron_device);
+ goto err_unregister_driver;
+ }
+
if (have_wifi) {
u16 wifi = bios_get_default_setting(WIFI);
if (wifi & 1)
@@ -480,21 +523,30 @@ static int __init wb_module_init(void)
}
err = setup_input_dev();
- if (err) {
- bios_detach();
- unmap_bios();
- return err;
- }
+ if (err)
+ goto err_unregister_device;
poll_bios(1); /* Flush stale event queue and arm timer */
return 0;
+
+ err_unregister_device:
+ platform_device_unregister(wistron_device);
+ err_unregister_driver:
+ platform_driver_unregister(&wistron_driver);
+ err_detach_bios:
+ bios_detach();
+ unmap_bios();
+
+ return err;
}
static void __exit wb_module_exit(void)
{
del_timer_sync(&poll_timer);
input_unregister_device(input_dev);
+ platform_device_unregister(wistron_device);
+ platform_driver_unregister(&wistron_driver);
bios_detach();
unmap_bios();
}
next prev parent reply other threads:[~2005-11-20 7:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-20 6:36 [git pull 00/14] Input updates for 2.6.15 Dmitry Torokhov
2005-11-20 6:36 ` [git pull 01/14] atkbd - speed up setting leds/repeat state Dmitry Torokhov
2005-11-20 6:36 ` [git pull 02/14] Add Wistron driver Dmitry Torokhov
2005-11-20 6:36 ` [git pull 03/14] Wistron - disable for x86_64 Dmitry Torokhov
2005-11-20 9:52 ` Geert Uytterhoeven
2005-11-22 3:42 ` Dmitry Torokhov
2005-11-20 6:36 ` [git pull 04/14] Wistron - add support for Acer Aspire notebooks Dmitry Torokhov
2005-11-20 6:36 ` [git pull 05/14] Wistron - convert to dynamic input_dev allocation Dmitry Torokhov
2005-11-20 6:36 ` Dmitry Torokhov [this message]
2005-11-20 6:36 ` [git pull 07/14] wistron - disable wifi/bluetooth on suspend Dmitry Torokhov
2005-11-20 6:36 ` [git pull 08/14] Uinput: convert to dynalloc allocation Dmitry Torokhov
2005-11-20 6:36 ` [git pull 09/14] Uinput: add UI_SET_SWBIT ioctl Dmitry Torokhov
2005-11-23 22:53 ` Benjamin Herrenschmidt
2005-11-23 23:06 ` Benjamin Herrenschmidt
2005-11-23 23:13 ` Dmitry Torokhov
2005-11-23 23:01 ` Benjamin Herrenschmidt
2005-11-23 23:12 ` Dmitry Torokhov
2005-11-23 23:28 ` Benjamin Herrenschmidt
2005-11-20 6:36 ` [git pull 10/14] Uinput: dont use "interruptible" in FF code Dmitry Torokhov
2005-11-20 6:36 ` [git pull 11/14] Handle failures in input_register_device() Dmitry Torokhov
2005-11-20 6:36 ` [git pull 12/14] Input - help swsusp Dmitry Torokhov
2005-11-20 6:36 ` [git pull 13/14] Input updates for 2.6.15 Dmitry Torokhov
2005-11-20 6:36 ` [git pull 14/14] Fix missing initialization in ir-kbd-gpio.c Dmitry Torokhov
2005-11-20 8:37 ` [git pull 00/14] Input updates for 2.6.15 Vojtech Pavlik
2005-11-20 17:04 ` Dmitry Torokhov
2005-11-20 17:19 ` Linus Torvalds
2005-11-20 17:42 ` Dmitry Torokhov
2005-11-20 18:17 ` Linus Torvalds
2005-11-22 3:40 ` Dmitry Torokhov
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=20051120064420.028262000.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=vojtech@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.