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 04/14] Wistron - add support for Acer Aspire notebooks
Date: Sun, 20 Nov 2005 01:36:15 -0500 [thread overview]
Message-ID: <20051120064419.796980000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20051120063611.269343000.dtor_core@ameritech.net
[-- Attachment #1: wistron-buttons-acer-aspire-support.patch --]
[-- Type: text/plain, Size: 5176 bytes --]
From: Bernhard Rosenkraenzer <bero@arklinux.org>
Input: wistron - add support for Acer Aspire 1500 notebooks
Also fix a potential issue with some notebooks:
The current code assumes the response to bios_wifi_get_default_setting is
either 1 (disabled) or 3 (enabled), or wifi isn't supported. The BIOS
response appears to be a bit field w/ 0x1 indicating hardware presence, 0x2
indicating actiation status, and the other 6 bits being unknown/reserved --
with the patch, these 6 bits are ignored.
Signed-off-by: Bernhard Rosenkraenzer <bero@arklinux.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/misc/wistron_btns.c | 79 ++++++++++++++++++++++++++++----------
1 files changed, 59 insertions(+), 20 deletions(-)
Index: work/drivers/input/misc/wistron_btns.c
===================================================================
--- work.orig/drivers/input/misc/wistron_btns.c
+++ work/drivers/input/misc/wistron_btns.c
@@ -1,6 +1,7 @@
/*
* Wistron laptop button driver
* Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
+ * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
*
* 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
@@ -40,6 +41,10 @@
#error "POLL_FREQUENCY too high"
#endif
+/* BIOS subsystem IDs */
+#define WIFI 0x35
+#define BLUETOOTH 0x34
+
MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>");
MODULE_DESCRIPTION("Wistron laptop button driver");
MODULE_LICENSE("GPL v2");
@@ -197,29 +202,29 @@ static u8 __init bios_get_cmos_address(v
return regs.ecx;
}
-static u16 __init bios_wifi_get_default_setting(void)
+static u16 __init bios_get_default_setting(u8 subsys)
{
struct regs regs;
memset(®s, 0, sizeof (regs));
regs.eax = 0x9610;
- regs.ebx = 0x0235;
+ regs.ebx = 0x0200 | subsys;
call_bios(®s);
return regs.eax;
}
-static void bios_wifi_set_state(int enable)
+static void bios_set_state(u8 subsys, int enable)
{
struct regs regs;
memset(®s, 0, sizeof (regs));
regs.eax = 0x9610;
- regs.ebx = enable ? 0x0135 : 0x0035;
+ regs.ebx = (enable ? 0x0100 : 0x0000) | subsys;
call_bios(®s);
}
- /* Hardware database */
+/* Hardware database */
struct key_entry {
char type; /* See KE_* below */
@@ -227,10 +232,11 @@ struct key_entry {
unsigned keycode; /* For KE_KEY */
};
-enum { KE_END, KE_KEY, KE_WIFI };
+enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH };
static const struct key_entry *keymap; /* = NULL; Current key map */
static int have_wifi;
+static int have_bluetooth;
static int __init dmi_matched(struct dmi_system_id *dmi)
{
@@ -241,6 +247,9 @@ static int __init dmi_matched(struct dmi
if (key->type == KE_WIFI) {
have_wifi = 1;
break;
+ } else if (key->type == KE_BLUETOOTH) {
+ have_bluetooth = 1;
+ break;
}
}
return 1;
@@ -273,6 +282,16 @@ static struct key_entry keymap_wistron_m
{ KE_END, 0 }
};
+static struct key_entry keymap_acer_aspire_1500[] = {
+ { KE_KEY, 0x11, KEY_PROG1 },
+ { KE_KEY, 0x12, KEY_PROG2 },
+ { KE_WIFI, 0x30, 0 },
+ { KE_KEY, 0x31, KEY_MAIL },
+ { KE_KEY, 0x36, KEY_WWW },
+ { KE_BLUETOOTH, 0x44, 0 },
+ { KE_END, 0 }
+};
+
/*
* If your machine is not here (which is currently rather likely), please send
* a list of buttons and their key codes (reported when loading this module
@@ -288,6 +307,15 @@ static struct dmi_system_id dmi_ids[] =
},
.driver_data = keymap_fs_amilo_pro_v2000
},
+ {
+ .callback = dmi_matched,
+ .ident = "Acer Aspire 1500",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"),
+ },
+ .driver_data = keymap_acer_aspire_1500
+ },
{ 0, }
};
@@ -344,6 +372,7 @@ static void report_key(unsigned keycode)
/* Driver core */
static int wifi_enabled;
+static int bluetooth_enabled;
static void poll_bios(unsigned long);
@@ -363,7 +392,14 @@ static void handle_key(u8 code)
case KE_WIFI:
if (have_wifi) {
wifi_enabled = !wifi_enabled;
- bios_wifi_set_state(wifi_enabled);
+ bios_set_state(WIFI, wifi_enabled);
+ }
+ break;
+
+ case KE_BLUETOOTH:
+ if (have_bluetooth) {
+ bluetooth_enabled = !bluetooth_enabled;
+ bios_set_state(BLUETOOTH, bluetooth_enabled);
}
break;
@@ -407,21 +443,24 @@ static int __init wb_module_init(void)
bios_attach();
cmos_address = bios_get_cmos_address();
if (have_wifi) {
- switch (bios_wifi_get_default_setting()) {
- case 0x01:
- wifi_enabled = 0;
- break;
-
- case 0x03:
- wifi_enabled = 1;
- break;
-
- default:
+ u16 wifi = bios_get_default_setting(WIFI);
+ if (wifi & 1)
+ wifi_enabled = (wifi & 2) ? 1 : 0;
+ else
have_wifi = 0;
- break;
- }
+
if (have_wifi)
- bios_wifi_set_state(wifi_enabled);
+ bios_set_state(WIFI, wifi_enabled);
+ }
+ if (have_bluetooth) {
+ u16 bt = bios_get_default_setting(BLUETOOTH);
+ if (bt & 1)
+ bluetooth_enabled = (bt & 2) ? 1 : 0;
+ else
+ have_bluetooth = 0;
+
+ if (have_bluetooth)
+ bios_set_state(BLUETOOTH, bluetooth_enabled);
}
setup_input_dev();
next prev parent reply other threads:[~2005-11-20 6:47 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 ` Dmitry Torokhov [this message]
2005-11-20 6:36 ` [git pull 05/14] Wistron - convert to dynamic input_dev allocation Dmitry Torokhov
2005-11-20 6:36 ` [git pull 06/14] Wistron - add PM support Dmitry Torokhov
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=20051120064419.796980000.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox