Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86:
wmi: use memcmp instead of strncmp to compare GUIDs
ACPI, hp-wmi: Fix memory leak in acpi query
msi-wmi: fix semantically incorrect use of keycode instead of scancode
msi-wmi: Add mute key support
asus-laptop: add wimax and wwan support
eeepc-wmi: fix compiler warning
ibm_rtl: _RTL_ is not available in UEFI mode
ibm_rtl: Loosen the DMI criteria to all IBM machines
drivers/platform/x86/thinkpad_acpi.c: delete double assignment
eeepc-wmi: add cpufv sysfs documentation
toshiba_acpi.c: Add key_entry for a lone FN keypress
ibm_rtl: fix printk format warning

+144 -39
+15 -1
Documentation/ABI/testing/sysfs-platform-asus-laptop
··· 47 KernelVersion: 2.6.20 48 Contact: "Corentin Chary" <corentincj@iksaif.net> 49 Description: 50 - Control the bluetooth device. 1 means on, 0 means off. 51 This may control the led, the device or both. 52 Users: Lapsus
··· 47 KernelVersion: 2.6.20 48 Contact: "Corentin Chary" <corentincj@iksaif.net> 49 Description: 50 + Control the wlan device. 1 means on, 0 means off. 51 This may control the led, the device or both. 52 Users: Lapsus 53 + 54 + What: /sys/devices/platform/asus_laptop/wimax 55 + Date: October 2010 56 + KernelVersion: 2.6.37 57 + Contact: "Corentin Chary" <corentincj@iksaif.net> 58 + Description: 59 + Control the wimax device. 1 means on, 0 means off. 60 + 61 + What: /sys/devices/platform/asus_laptop/wwan 62 + Date: October 2010 63 + KernelVersion: 2.6.37 64 + Contact: "Corentin Chary" <corentincj@iksaif.net> 65 + Description: 66 + Control the wwan (3G) device. 1 means on, 0 means off.
+10
Documentation/ABI/testing/sysfs-platform-eeepc-wmi
···
··· 1 + What: /sys/devices/platform/eeepc-wmi/cpufv 2 + Date: Oct 2010 3 + KernelVersion: 2.6.37 4 + Contact: "Corentin Chary" <corentincj@iksaif.net> 5 + Description: 6 + Change CPU clock configuration (write-only). 7 + There are three available clock configuration: 8 + * 0 -> Super Performance Mode 9 + * 1 -> High Performance Mode 10 + * 2 -> Power Saving Mode
+96 -1
drivers/platform/x86/asus-laptop.c
··· 81 82 static int wlan_status = 1; 83 static int bluetooth_status = 1; 84 85 module_param(wlan_status, int, 0444); 86 MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " ··· 91 92 module_param(bluetooth_status, int, 0444); 93 MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " 94 "(0 = disabled, 1 = enabled, -1 = don't do anything). " 95 "default is 1"); 96 ··· 126 */ 127 #define WL_RSTS 0x01 /* internal Wifi */ 128 #define BT_RSTS 0x02 /* internal Bluetooth */ 129 130 /* LED */ 131 #define METHOD_MLED "MLED" ··· 146 */ 147 #define METHOD_WLAN "WLED" 148 #define METHOD_BLUETOOTH "BLED" 149 #define METHOD_WL_STATUS "RSTS" 150 151 /* Brightness */ ··· 902 } 903 904 /* 905 * Display 906 */ 907 static void asus_set_display(struct asus_laptop *asus, int value) ··· 1279 static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); 1280 static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, 1281 show_bluetooth, store_bluetooth); 1282 static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); 1283 static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); 1284 static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); ··· 1291 &dev_attr_infos.attr, 1292 &dev_attr_wlan.attr, 1293 &dev_attr_bluetooth.attr, 1294 &dev_attr_display.attr, 1295 &dev_attr_ledd.attr, 1296 &dev_attr_ls_level.attr, ··· 1319 1320 } else if (attr == &dev_attr_display.attr) { 1321 supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); 1322 1323 } else if (attr == &dev_attr_ledd.attr) { 1324 supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); ··· 1485 1486 /* 1487 * The HWRS method return informations about the hardware. 1488 - * 0x80 bit is for WLAN, 0x100 for Bluetooth. 1489 * The significance of others is yet to be found. 1490 */ 1491 status = ··· 1528 1529 if (wlan_status >= 0) 1530 asus_wlan_set(asus, !!wlan_status); 1531 1532 /* Keyboard Backlight is on by default */ 1533 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))
··· 81 82 static int wlan_status = 1; 83 static int bluetooth_status = 1; 84 + static int wimax_status = -1; 85 + static int wwan_status = -1; 86 87 module_param(wlan_status, int, 0444); 88 MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " ··· 89 90 module_param(bluetooth_status, int, 0444); 91 MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " 92 + "(0 = disabled, 1 = enabled, -1 = don't do anything). " 93 + "default is 1"); 94 + 95 + module_param(wimax_status, int, 0444); 96 + MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot " 97 + "(0 = disabled, 1 = enabled, -1 = don't do anything). " 98 + "default is 1"); 99 + 100 + module_param(wwan_status, int, 0444); 101 + MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot " 102 "(0 = disabled, 1 = enabled, -1 = don't do anything). " 103 "default is 1"); 104 ··· 114 */ 115 #define WL_RSTS 0x01 /* internal Wifi */ 116 #define BT_RSTS 0x02 /* internal Bluetooth */ 117 + #define WM_RSTS 0x08 /* internal wimax */ 118 + #define WW_RSTS 0x20 /* internal wwan */ 119 120 /* LED */ 121 #define METHOD_MLED "MLED" ··· 132 */ 133 #define METHOD_WLAN "WLED" 134 #define METHOD_BLUETOOTH "BLED" 135 + 136 + /* WWAN and WIMAX */ 137 + #define METHOD_WWAN "GSMC" 138 + #define METHOD_WIMAX "WMXC" 139 + 140 #define METHOD_WL_STATUS "RSTS" 141 142 /* Brightness */ ··· 883 } 884 885 /* 886 + * Wimax 887 + */ 888 + static int asus_wimax_set(struct asus_laptop *asus, int status) 889 + { 890 + if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) { 891 + pr_warning("Error setting wimax status to %d", status); 892 + return -EIO; 893 + } 894 + return 0; 895 + } 896 + 897 + static ssize_t show_wimax(struct device *dev, 898 + struct device_attribute *attr, char *buf) 899 + { 900 + struct asus_laptop *asus = dev_get_drvdata(dev); 901 + 902 + return sprintf(buf, "%d\n", asus_wireless_status(asus, WM_RSTS)); 903 + } 904 + 905 + static ssize_t store_wimax(struct device *dev, 906 + struct device_attribute *attr, const char *buf, 907 + size_t count) 908 + { 909 + struct asus_laptop *asus = dev_get_drvdata(dev); 910 + 911 + return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX); 912 + } 913 + 914 + /* 915 + * Wwan 916 + */ 917 + static int asus_wwan_set(struct asus_laptop *asus, int status) 918 + { 919 + if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) { 920 + pr_warning("Error setting wwan status to %d", status); 921 + return -EIO; 922 + } 923 + return 0; 924 + } 925 + 926 + static ssize_t show_wwan(struct device *dev, 927 + struct device_attribute *attr, char *buf) 928 + { 929 + struct asus_laptop *asus = dev_get_drvdata(dev); 930 + 931 + return sprintf(buf, "%d\n", asus_wireless_status(asus, WW_RSTS)); 932 + } 933 + 934 + static ssize_t store_wwan(struct device *dev, 935 + struct device_attribute *attr, const char *buf, 936 + size_t count) 937 + { 938 + struct asus_laptop *asus = dev_get_drvdata(dev); 939 + 940 + return sysfs_acpi_set(asus, buf, count, METHOD_WWAN); 941 + } 942 + 943 + /* 944 * Display 945 */ 946 static void asus_set_display(struct asus_laptop *asus, int value) ··· 1202 static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); 1203 static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, 1204 show_bluetooth, store_bluetooth); 1205 + static DEVICE_ATTR(wimax, S_IRUGO | S_IWUSR, show_wimax, store_wimax); 1206 + static DEVICE_ATTR(wwan, S_IRUGO | S_IWUSR, show_wwan, store_wwan); 1207 static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); 1208 static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); 1209 static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); ··· 1212 &dev_attr_infos.attr, 1213 &dev_attr_wlan.attr, 1214 &dev_attr_bluetooth.attr, 1215 + &dev_attr_wimax.attr, 1216 + &dev_attr_wwan.attr, 1217 &dev_attr_display.attr, 1218 &dev_attr_ledd.attr, 1219 &dev_attr_ls_level.attr, ··· 1238 1239 } else if (attr == &dev_attr_display.attr) { 1240 supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); 1241 + 1242 + } else if (attr == &dev_attr_wimax.attr) { 1243 + supported = 1244 + !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL); 1245 + 1246 + } else if (attr == &dev_attr_wwan.attr) { 1247 + supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL); 1248 1249 } else if (attr == &dev_attr_ledd.attr) { 1250 supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); ··· 1397 1398 /* 1399 * The HWRS method return informations about the hardware. 1400 + * 0x80 bit is for WLAN, 0x100 for Bluetooth, 1401 + * 0x40 for WWAN, 0x10 for WIMAX. 1402 * The significance of others is yet to be found. 1403 */ 1404 status = ··· 1439 1440 if (wlan_status >= 0) 1441 asus_wlan_set(asus, !!wlan_status); 1442 + 1443 + if (wimax_status >= 0) 1444 + asus_wimax_set(asus, !!wimax_status); 1445 + 1446 + if (wwan_status >= 0) 1447 + asus_wwan_set(asus, !!wwan_status); 1448 1449 /* Keyboard Backlight is on by default */ 1450 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))
+2 -2
drivers/platform/x86/eeepc-wmi.c
··· 298 kfree(obj); 299 } 300 301 - static int store_cpufv(struct device *dev, struct device_attribute *attr, 302 - const char *buf, size_t count) 303 { 304 int value; 305 struct acpi_buffer input = { (acpi_size)sizeof(value), &value };
··· 298 kfree(obj); 299 } 300 301 + static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr, 302 + const char *buf, size_t count) 303 { 304 int value; 305 struct acpi_buffer input = { (acpi_size)sizeof(value), &value };
+2
drivers/platform/x86/hp-wmi.c
··· 172 bios_return = *((struct bios_return *)obj->buffer.pointer); 173 174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); 175 return 0; 176 } 177
··· 172 bios_return = *((struct bios_return *)obj->buffer.pointer); 173 174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); 175 + 176 + kfree(obj); 177 return 0; 178 } 179
+8 -26
drivers/platform/x86/ibm_rtl.c
··· 28 #include <linux/io.h> 29 #include <linux/sysdev.h> 30 #include <linux/dmi.h> 31 #include <linux/mutex.h> 32 #include <asm/bios_ebda.h> 33 ··· 221 sysdev_class_unregister(&class_rtl); 222 } 223 224 - static int dmi_check_cb(const struct dmi_system_id *id) 225 - { 226 - RTL_DEBUG("found IBM server '%s'\n", id->ident); 227 - return 0; 228 - } 229 - 230 - #define ibm_dmi_entry(NAME, TYPE) \ 231 - { \ 232 - .ident = NAME, \ 233 - .matches = { \ 234 - DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ 235 - DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \ 236 - }, \ 237 - .callback = dmi_check_cb \ 238 - } 239 240 static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { 241 - ibm_dmi_entry("BladeCenter LS21", "7971"), 242 - ibm_dmi_entry("BladeCenter LS22", "7901"), 243 - ibm_dmi_entry("BladeCenter HS21 XM", "7995"), 244 - ibm_dmi_entry("BladeCenter HS22", "7870"), 245 - ibm_dmi_entry("BladeCenter HS22V", "7871"), 246 - ibm_dmi_entry("System x3550 M2", "7946"), 247 - ibm_dmi_entry("System x3650 M2", "7947"), 248 - ibm_dmi_entry("System x3550 M3", "7944"), 249 - ibm_dmi_entry("System x3650 M3", "7945"), 250 { } 251 }; 252 ··· 239 if (force) 240 pr_warning("ibm-rtl: module loaded by force\n"); 241 /* first ensure that we are running on IBM HW */ 242 - else if (!dmi_check_system(ibm_rtl_dmi_table)) 243 return -ENODEV; 244 245 /* Get the address for the Extended BIOS Data Area */ ··· 284 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", 285 rtl_cmd_width, rtl_cmd_type); 286 addr = ioread32(&rtl_table->cmd_port_address); 287 - RTL_DEBUG("addr = %#llx\n", addr); 288 plen = rtl_cmd_width/sizeof(char); 289 rtl_cmd_addr = rtl_port_map(addr, plen); 290 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
··· 28 #include <linux/io.h> 29 #include <linux/sysdev.h> 30 #include <linux/dmi.h> 31 + #include <linux/efi.h> 32 #include <linux/mutex.h> 33 #include <asm/bios_ebda.h> 34 ··· 220 sysdev_class_unregister(&class_rtl); 221 } 222 223 224 static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { 225 + { \ 226 + .matches = { \ 227 + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ 228 + }, \ 229 + }, 230 { } 231 }; 232 ··· 257 if (force) 258 pr_warning("ibm-rtl: module loaded by force\n"); 259 /* first ensure that we are running on IBM HW */ 260 + else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table)) 261 return -ENODEV; 262 263 /* Get the address for the Extended BIOS Data Area */ ··· 302 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", 303 rtl_cmd_width, rtl_cmd_type); 304 addr = ioread32(&rtl_table->cmd_port_address); 305 + RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr); 306 plen = rtl_cmd_width/sizeof(char); 307 rtl_cmd_addr = rtl_port_map(addr, plen); 308 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
+9 -7
drivers/platform/x86/msi-wmi.c
··· 43 44 #define dprintk(msg...) pr_debug(DRV_PFX msg) 45 46 - #define KEYCODE_BASE 0xD0 47 - #define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE 48 - #define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1) 49 - #define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2) 50 - #define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3) 51 static struct key_entry msi_wmi_keymap[] = { 52 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, 53 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, 54 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, 55 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, 56 { KE_END, 0} 57 }; 58 static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; ··· 171 ktime_t diff; 172 cur = ktime_get_real(); 173 diff = ktime_sub(cur, last_pressed[key->code - 174 - KEYCODE_BASE]); 175 /* Ignore event if the same event happened in a 50 ms 176 timeframe -> Key press may result in 10-20 GPEs */ 177 if (ktime_to_us(diff) < 1000 * 50) { ··· 180 key->code, ktime_to_us(diff)); 181 return; 182 } 183 - last_pressed[key->code - KEYCODE_BASE] = cur; 184 185 if (key->type == KE_KEY && 186 /* Brightness is served via acpi video driver */
··· 43 44 #define dprintk(msg...) pr_debug(DRV_PFX msg) 45 46 + #define SCANCODE_BASE 0xD0 47 + #define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE 48 + #define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1) 49 + #define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2) 50 + #define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3) 51 + #define MSI_WMI_MUTE (SCANCODE_BASE + 4) 52 static struct key_entry msi_wmi_keymap[] = { 53 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, 54 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, 55 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, 56 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, 57 + { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} }, 58 { KE_END, 0} 59 }; 60 static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; ··· 169 ktime_t diff; 170 cur = ktime_get_real(); 171 diff = ktime_sub(cur, last_pressed[key->code - 172 + SCANCODE_BASE]); 173 /* Ignore event if the same event happened in a 50 ms 174 timeframe -> Key press may result in 10-20 GPEs */ 175 if (ktime_to_us(diff) < 1000 * 50) { ··· 178 key->code, ktime_to_us(diff)); 179 return; 180 } 181 + last_pressed[key->code - SCANCODE_BASE] = cur; 182 183 if (key->type == KE_KEY && 184 /* Brightness is served via acpi video driver */
-1
drivers/platform/x86/thinkpad_acpi.c
··· 8497 ibm->acpi->type, 8498 dispatch_acpi_notify); 8499 ibm->flags.acpi_notify_installed = 0; 8500 - ibm->flags.acpi_notify_installed = 0; 8501 } 8502 8503 if (ibm->flags.proc_created) {
··· 8497 ibm->acpi->type, 8498 dispatch_acpi_notify); 8499 ibm->flags.acpi_notify_installed = 0; 8500 } 8501 8502 if (ibm->flags.proc_created) {
+1
drivers/platform/x86/toshiba_acpi.c
··· 135 { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, 136 { KE_KEY, 0x142, { KEY_WLAN } }, 137 { KE_KEY, 0x143, { KEY_PROG1 } }, 138 { KE_KEY, 0xb05, { KEY_PROG2 } }, 139 { KE_KEY, 0xb06, { KEY_WWW } }, 140 { KE_KEY, 0xb07, { KEY_MAIL } },
··· 135 { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, 136 { KE_KEY, 0x142, { KEY_WLAN } }, 137 { KE_KEY, 0x143, { KEY_PROG1 } }, 138 + { KE_KEY, 0x17f, { KEY_FN } }, 139 { KE_KEY, 0xb05, { KEY_PROG2 } }, 140 { KE_KEY, 0xb06, { KEY_WWW } }, 141 { KE_KEY, 0xb07, { KEY_MAIL } },
+1 -1
drivers/platform/x86/wmi.c
··· 755 struct wmi_block *wblock; 756 757 list_for_each_entry(wblock, &wmi_block_list, list) 758 - if (strncmp(wblock->gblock.guid, guid_string, 16) == 0) 759 return true; 760 761 return false;
··· 755 struct wmi_block *wblock; 756 757 list_for_each_entry(wblock, &wmi_block_list, list) 758 + if (memcmp(wblock->gblock.guid, guid_string, 16) == 0) 759 return true; 760 761 return false;