aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/asus-laptop.c97
-rw-r--r--drivers/platform/x86/eeepc-wmi.c4
-rw-r--r--drivers/platform/x86/hp-wmi.c2
-rw-r--r--drivers/platform/x86/ibm_rtl.c34
-rw-r--r--drivers/platform/x86/msi-wmi.c16
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c1
-rw-r--r--drivers/platform/x86/toshiba_acpi.c1
-rw-r--r--drivers/platform/x86/wmi.c2
8 files changed, 119 insertions, 38 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 60a5a5c6b50a..d235f44fd7a3 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -81,6 +81,8 @@ MODULE_PARM_DESC(wapf, "WAPF value");
81 81
82static int wlan_status = 1; 82static int wlan_status = 1;
83static int bluetooth_status = 1; 83static int bluetooth_status = 1;
84static int wimax_status = -1;
85static int wwan_status = -1;
84 86
85module_param(wlan_status, int, 0444); 87module_param(wlan_status, int, 0444);
86MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " 88MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot "
@@ -92,6 +94,16 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
92 "(0 = disabled, 1 = enabled, -1 = don't do anything). " 94 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
93 "default is 1"); 95 "default is 1");
94 96
97module_param(wimax_status, int, 0444);
98MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot "
99 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
100 "default is 1");
101
102module_param(wwan_status, int, 0444);
103MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot "
104 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
105 "default is 1");
106
95/* 107/*
96 * Some events we use, same for all Asus 108 * Some events we use, same for all Asus
97 */ 109 */
@@ -114,6 +126,8 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
114 */ 126 */
115#define WL_RSTS 0x01 /* internal Wifi */ 127#define WL_RSTS 0x01 /* internal Wifi */
116#define BT_RSTS 0x02 /* internal Bluetooth */ 128#define BT_RSTS 0x02 /* internal Bluetooth */
129#define WM_RSTS 0x08 /* internal wimax */
130#define WW_RSTS 0x20 /* internal wwan */
117 131
118/* LED */ 132/* LED */
119#define METHOD_MLED "MLED" 133#define METHOD_MLED "MLED"
@@ -132,6 +146,11 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
132 */ 146 */
133#define METHOD_WLAN "WLED" 147#define METHOD_WLAN "WLED"
134#define METHOD_BLUETOOTH "BLED" 148#define METHOD_BLUETOOTH "BLED"
149
150/* WWAN and WIMAX */
151#define METHOD_WWAN "GSMC"
152#define METHOD_WIMAX "WMXC"
153
135#define METHOD_WL_STATUS "RSTS" 154#define METHOD_WL_STATUS "RSTS"
136 155
137/* Brightness */ 156/* Brightness */
@@ -883,6 +902,64 @@ static ssize_t store_bluetooth(struct device *dev,
883} 902}
884 903
885/* 904/*
905 * Wimax
906 */
907static int asus_wimax_set(struct asus_laptop *asus, int status)
908{
909 if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) {
910 pr_warning("Error setting wimax status to %d", status);
911 return -EIO;
912 }
913 return 0;
914}
915
916static ssize_t show_wimax(struct device *dev,
917 struct device_attribute *attr, char *buf)
918{
919 struct asus_laptop *asus = dev_get_drvdata(dev);
920
921 return sprintf(buf, "%d\n", asus_wireless_status(asus, WM_RSTS));
922}
923
924static ssize_t store_wimax(struct device *dev,
925 struct device_attribute *attr, const char *buf,
926 size_t count)
927{
928 struct asus_laptop *asus = dev_get_drvdata(dev);
929
930 return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX);
931}
932
933/*
934 * Wwan
935 */
936static int asus_wwan_set(struct asus_laptop *asus, int status)
937{
938 if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) {
939 pr_warning("Error setting wwan status to %d", status);
940 return -EIO;
941 }
942 return 0;
943}
944
945static ssize_t show_wwan(struct device *dev,
946 struct device_attribute *attr, char *buf)
947{
948 struct asus_laptop *asus = dev_get_drvdata(dev);
949
950 return sprintf(buf, "%d\n", asus_wireless_status(asus, WW_RSTS));
951}
952
953static ssize_t store_wwan(struct device *dev,
954 struct device_attribute *attr, const char *buf,
955 size_t count)
956{
957 struct asus_laptop *asus = dev_get_drvdata(dev);
958
959 return sysfs_acpi_set(asus, buf, count, METHOD_WWAN);
960}
961
962/*
886 * Display 963 * Display
887 */ 964 */
888static void asus_set_display(struct asus_laptop *asus, int value) 965static void asus_set_display(struct asus_laptop *asus, int value)
@@ -1202,6 +1279,8 @@ static DEVICE_ATTR(infos, S_IRUGO, show_infos, NULL);
1202static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); 1279static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan);
1203static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, 1280static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR,
1204 show_bluetooth, store_bluetooth); 1281 show_bluetooth, store_bluetooth);
1282static DEVICE_ATTR(wimax, S_IRUGO | S_IWUSR, show_wimax, store_wimax);
1283static DEVICE_ATTR(wwan, S_IRUGO | S_IWUSR, show_wwan, store_wwan);
1205static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); 1284static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp);
1206static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); 1285static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd);
1207static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); 1286static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl);
@@ -1212,6 +1291,8 @@ static struct attribute *asus_attributes[] = {
1212 &dev_attr_infos.attr, 1291 &dev_attr_infos.attr,
1213 &dev_attr_wlan.attr, 1292 &dev_attr_wlan.attr,
1214 &dev_attr_bluetooth.attr, 1293 &dev_attr_bluetooth.attr,
1294 &dev_attr_wimax.attr,
1295 &dev_attr_wwan.attr,
1215 &dev_attr_display.attr, 1296 &dev_attr_display.attr,
1216 &dev_attr_ledd.attr, 1297 &dev_attr_ledd.attr,
1217 &dev_attr_ls_level.attr, 1298 &dev_attr_ls_level.attr,
@@ -1239,6 +1320,13 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj,
1239 } else if (attr == &dev_attr_display.attr) { 1320 } else if (attr == &dev_attr_display.attr) {
1240 supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); 1321 supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL);
1241 1322
1323 } else if (attr == &dev_attr_wimax.attr) {
1324 supported =
1325 !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL);
1326
1327 } else if (attr == &dev_attr_wwan.attr) {
1328 supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL);
1329
1242 } else if (attr == &dev_attr_ledd.attr) { 1330 } else if (attr == &dev_attr_ledd.attr) {
1243 supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); 1331 supported = !acpi_check_handle(handle, METHOD_LEDD, NULL);
1244 1332
@@ -1397,7 +1485,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1397 1485
1398 /* 1486 /*
1399 * The HWRS method return informations about the hardware. 1487 * The HWRS method return informations about the hardware.
1400 * 0x80 bit is for WLAN, 0x100 for Bluetooth. 1488 * 0x80 bit is for WLAN, 0x100 for Bluetooth,
1489 * 0x40 for WWAN, 0x10 for WIMAX.
1401 * The significance of others is yet to be found. 1490 * The significance of others is yet to be found.
1402 */ 1491 */
1403 status = 1492 status =
@@ -1440,6 +1529,12 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
1440 if (wlan_status >= 0) 1529 if (wlan_status >= 0)
1441 asus_wlan_set(asus, !!wlan_status); 1530 asus_wlan_set(asus, !!wlan_status);
1442 1531
1532 if (wimax_status >= 0)
1533 asus_wimax_set(asus, !!wimax_status);
1534
1535 if (wwan_status >= 0)
1536 asus_wwan_set(asus, !!wwan_status);
1537
1443 /* Keyboard Backlight is on by default */ 1538 /* Keyboard Backlight is on by default */
1444 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) 1539 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))
1445 asus_kled_set(asus, 1); 1540 asus_kled_set(asus, 1);
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 462ceab93f87..0d50fbbe2478 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -298,8 +298,8 @@ static void eeepc_wmi_notify(u32 value, void *context)
298 kfree(obj); 298 kfree(obj);
299} 299}
300 300
301static int store_cpufv(struct device *dev, struct device_attribute *attr, 301static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
302 const char *buf, size_t count) 302 const char *buf, size_t count)
303{ 303{
304 int value; 304 int value;
305 struct acpi_buffer input = { (acpi_size)sizeof(value), &value }; 305 struct acpi_buffer input = { (acpi_size)sizeof(value), &value };
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 1dac659b5e0c..9e05af9c41cb 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -172,6 +172,8 @@ static int hp_wmi_perform_query(int query, int write, u32 *buffer,
172 bios_return = *((struct bios_return *)obj->buffer.pointer); 172 bios_return = *((struct bios_return *)obj->buffer.pointer);
173 173
174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); 174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value));
175
176 kfree(obj);
175 return 0; 177 return 0;
176} 178}
177 179
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 3c2c6b91ecb3..94a114aa8e28 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -28,6 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/dmi.h> 30#include <linux/dmi.h>
31#include <linux/efi.h>
31#include <linux/mutex.h> 32#include <linux/mutex.h>
32#include <asm/bios_ebda.h> 33#include <asm/bios_ebda.h>
33 34
@@ -220,32 +221,13 @@ static void rtl_teardown_sysfs(void) {
220 sysdev_class_unregister(&class_rtl); 221 sysdev_class_unregister(&class_rtl);
221} 222}
222 223
223static int dmi_check_cb(const struct dmi_system_id *id)
224{
225 RTL_DEBUG("found IBM server '%s'\n", id->ident);
226 return 0;
227}
228
229#define ibm_dmi_entry(NAME, TYPE) \
230{ \
231 .ident = NAME, \
232 .matches = { \
233 DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
234 DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \
235 }, \
236 .callback = dmi_check_cb \
237}
238 224
239static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { 225static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
240 ibm_dmi_entry("BladeCenter LS21", "7971"), 226 { \
241 ibm_dmi_entry("BladeCenter LS22", "7901"), 227 .matches = { \
242 ibm_dmi_entry("BladeCenter HS21 XM", "7995"), 228 DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
243 ibm_dmi_entry("BladeCenter HS22", "7870"), 229 }, \
244 ibm_dmi_entry("BladeCenter HS22V", "7871"), 230 },
245 ibm_dmi_entry("System x3550 M2", "7946"),
246 ibm_dmi_entry("System x3650 M2", "7947"),
247 ibm_dmi_entry("System x3550 M3", "7944"),
248 ibm_dmi_entry("System x3650 M3", "7945"),
249 { } 231 { }
250}; 232};
251 233
@@ -257,7 +239,7 @@ static int __init ibm_rtl_init(void) {
257 if (force) 239 if (force)
258 pr_warning("ibm-rtl: module loaded by force\n"); 240 pr_warning("ibm-rtl: module loaded by force\n");
259 /* first ensure that we are running on IBM HW */ 241 /* first ensure that we are running on IBM HW */
260 else if (!dmi_check_system(ibm_rtl_dmi_table)) 242 else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table))
261 return -ENODEV; 243 return -ENODEV;
262 244
263 /* Get the address for the Extended BIOS Data Area */ 245 /* Get the address for the Extended BIOS Data Area */
@@ -302,7 +284,7 @@ static int __init ibm_rtl_init(void) {
302 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", 284 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n",
303 rtl_cmd_width, rtl_cmd_type); 285 rtl_cmd_width, rtl_cmd_type);
304 addr = ioread32(&rtl_table->cmd_port_address); 286 addr = ioread32(&rtl_table->cmd_port_address);
305 RTL_DEBUG("addr = %#llx\n", addr); 287 RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr);
306 plen = rtl_cmd_width/sizeof(char); 288 plen = rtl_cmd_width/sizeof(char);
307 rtl_cmd_addr = rtl_port_map(addr, plen); 289 rtl_cmd_addr = rtl_port_map(addr, plen);
308 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr); 290 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index 42a5469a2459..35278ad7e628 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -43,16 +43,18 @@ MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2");
43 43
44#define dprintk(msg...) pr_debug(DRV_PFX msg) 44#define dprintk(msg...) pr_debug(DRV_PFX msg)
45 45
46#define KEYCODE_BASE 0xD0 46#define SCANCODE_BASE 0xD0
47#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE 47#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE
48#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1) 48#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1)
49#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2) 49#define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2)
50#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3) 50#define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3)
51#define MSI_WMI_MUTE (SCANCODE_BASE + 4)
51static struct key_entry msi_wmi_keymap[] = { 52static struct key_entry msi_wmi_keymap[] = {
52 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, 53 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
53 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, 54 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
54 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, 55 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} },
55 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, 56 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
57 { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} },
56 { KE_END, 0} 58 { KE_END, 0}
57}; 59};
58static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; 60static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
@@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context)
169 ktime_t diff; 171 ktime_t diff;
170 cur = ktime_get_real(); 172 cur = ktime_get_real();
171 diff = ktime_sub(cur, last_pressed[key->code - 173 diff = ktime_sub(cur, last_pressed[key->code -
172 KEYCODE_BASE]); 174 SCANCODE_BASE]);
173 /* Ignore event if the same event happened in a 50 ms 175 /* Ignore event if the same event happened in a 50 ms
174 timeframe -> Key press may result in 10-20 GPEs */ 176 timeframe -> Key press may result in 10-20 GPEs */
175 if (ktime_to_us(diff) < 1000 * 50) { 177 if (ktime_to_us(diff) < 1000 * 50) {
@@ -178,7 +180,7 @@ static void msi_wmi_notify(u32 value, void *context)
178 key->code, ktime_to_us(diff)); 180 key->code, ktime_to_us(diff));
179 return; 181 return;
180 } 182 }
181 last_pressed[key->code - KEYCODE_BASE] = cur; 183 last_pressed[key->code - SCANCODE_BASE] = cur;
182 184
183 if (key->type == KE_KEY && 185 if (key->type == KE_KEY &&
184 /* Brightness is served via acpi video driver */ 186 /* Brightness is served via acpi video driver */
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 2d61186ad5a2..e8c21994b36d 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8497,7 +8497,6 @@ static void ibm_exit(struct ibm_struct *ibm)
8497 ibm->acpi->type, 8497 ibm->acpi->type,
8498 dispatch_acpi_notify); 8498 dispatch_acpi_notify);
8499 ibm->flags.acpi_notify_installed = 0; 8499 ibm->flags.acpi_notify_installed = 0;
8500 ibm->flags.acpi_notify_installed = 0;
8501 } 8500 }
8502 8501
8503 if (ibm->flags.proc_created) { 8502 if (ibm->flags.proc_created) {
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 06f304f46e02..4276da7291b8 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -135,6 +135,7 @@ static const struct key_entry toshiba_acpi_keymap[] __initconst = {
135 { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, 135 { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } },
136 { KE_KEY, 0x142, { KEY_WLAN } }, 136 { KE_KEY, 0x142, { KEY_WLAN } },
137 { KE_KEY, 0x143, { KEY_PROG1 } }, 137 { KE_KEY, 0x143, { KEY_PROG1 } },
138 { KE_KEY, 0x17f, { KEY_FN } },
138 { KE_KEY, 0xb05, { KEY_PROG2 } }, 139 { KE_KEY, 0xb05, { KEY_PROG2 } },
139 { KE_KEY, 0xb06, { KEY_WWW } }, 140 { KE_KEY, 0xb06, { KEY_WWW } },
140 { KE_KEY, 0xb07, { KEY_MAIL } }, 141 { KE_KEY, 0xb07, { KEY_MAIL } },
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 104b77c87ef5..aecd9a9b549f 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -755,7 +755,7 @@ static bool guid_already_parsed(const char *guid_string)
755 struct wmi_block *wblock; 755 struct wmi_block *wblock;
756 756
757 list_for_each_entry(wblock, &wmi_block_list, list) 757 list_for_each_entry(wblock, &wmi_block_list, list)
758 if (strncmp(wblock->gblock.guid, guid_string, 16) == 0) 758 if (memcmp(wblock->gblock.guid, guid_string, 16) == 0)
759 return true; 759 return true;
760 760
761 return false; 761 return false;