mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
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
This commit is contained in:
commit
ff43fa8b41
@ -47,6 +47,20 @@ Date: January 2007
|
||||
KernelVersion: 2.6.20
|
||||
Contact: "Corentin Chary" <corentincj@iksaif.net>
|
||||
Description:
|
||||
Control the bluetooth device. 1 means on, 0 means off.
|
||||
Control the wlan device. 1 means on, 0 means off.
|
||||
This may control the led, the device or both.
|
||||
Users: Lapsus
|
||||
|
||||
What: /sys/devices/platform/asus_laptop/wimax
|
||||
Date: October 2010
|
||||
KernelVersion: 2.6.37
|
||||
Contact: "Corentin Chary" <corentincj@iksaif.net>
|
||||
Description:
|
||||
Control the wimax device. 1 means on, 0 means off.
|
||||
|
||||
What: /sys/devices/platform/asus_laptop/wwan
|
||||
Date: October 2010
|
||||
KernelVersion: 2.6.37
|
||||
Contact: "Corentin Chary" <corentincj@iksaif.net>
|
||||
Description:
|
||||
Control the wwan (3G) device. 1 means on, 0 means off.
|
||||
|
10
Documentation/ABI/testing/sysfs-platform-eeepc-wmi
Normal file
10
Documentation/ABI/testing/sysfs-platform-eeepc-wmi
Normal file
@ -0,0 +1,10 @@
|
||||
What: /sys/devices/platform/eeepc-wmi/cpufv
|
||||
Date: Oct 2010
|
||||
KernelVersion: 2.6.37
|
||||
Contact: "Corentin Chary" <corentincj@iksaif.net>
|
||||
Description:
|
||||
Change CPU clock configuration (write-only).
|
||||
There are three available clock configuration:
|
||||
* 0 -> Super Performance Mode
|
||||
* 1 -> High Performance Mode
|
||||
* 2 -> Power Saving Mode
|
@ -81,6 +81,8 @@ MODULE_PARM_DESC(wapf, "WAPF value");
|
||||
|
||||
static int wlan_status = 1;
|
||||
static int bluetooth_status = 1;
|
||||
static int wimax_status = -1;
|
||||
static int wwan_status = -1;
|
||||
|
||||
module_param(wlan_status, int, 0444);
|
||||
MODULE_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 "
|
||||
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
|
||||
"default is 1");
|
||||
|
||||
module_param(wimax_status, int, 0444);
|
||||
MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot "
|
||||
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
|
||||
"default is 1");
|
||||
|
||||
module_param(wwan_status, int, 0444);
|
||||
MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot "
|
||||
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
|
||||
"default is 1");
|
||||
|
||||
/*
|
||||
* Some events we use, same for all Asus
|
||||
*/
|
||||
@ -114,6 +126,8 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
|
||||
*/
|
||||
#define WL_RSTS 0x01 /* internal Wifi */
|
||||
#define BT_RSTS 0x02 /* internal Bluetooth */
|
||||
#define WM_RSTS 0x08 /* internal wimax */
|
||||
#define WW_RSTS 0x20 /* internal wwan */
|
||||
|
||||
/* LED */
|
||||
#define METHOD_MLED "MLED"
|
||||
@ -132,6 +146,11 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
|
||||
*/
|
||||
#define METHOD_WLAN "WLED"
|
||||
#define METHOD_BLUETOOTH "BLED"
|
||||
|
||||
/* WWAN and WIMAX */
|
||||
#define METHOD_WWAN "GSMC"
|
||||
#define METHOD_WIMAX "WMXC"
|
||||
|
||||
#define METHOD_WL_STATUS "RSTS"
|
||||
|
||||
/* Brightness */
|
||||
@ -882,6 +901,64 @@ static ssize_t store_bluetooth(struct device *dev,
|
||||
return sysfs_acpi_set(asus, buf, count, METHOD_BLUETOOTH);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wimax
|
||||
*/
|
||||
static int asus_wimax_set(struct asus_laptop *asus, int status)
|
||||
{
|
||||
if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) {
|
||||
pr_warning("Error setting wimax status to %d", status);
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t show_wimax(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct asus_laptop *asus = dev_get_drvdata(dev);
|
||||
|
||||
return sprintf(buf, "%d\n", asus_wireless_status(asus, WM_RSTS));
|
||||
}
|
||||
|
||||
static ssize_t store_wimax(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct asus_laptop *asus = dev_get_drvdata(dev);
|
||||
|
||||
return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wwan
|
||||
*/
|
||||
static int asus_wwan_set(struct asus_laptop *asus, int status)
|
||||
{
|
||||
if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) {
|
||||
pr_warning("Error setting wwan status to %d", status);
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t show_wwan(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct asus_laptop *asus = dev_get_drvdata(dev);
|
||||
|
||||
return sprintf(buf, "%d\n", asus_wireless_status(asus, WW_RSTS));
|
||||
}
|
||||
|
||||
static ssize_t store_wwan(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct asus_laptop *asus = dev_get_drvdata(dev);
|
||||
|
||||
return sysfs_acpi_set(asus, buf, count, METHOD_WWAN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display
|
||||
*/
|
||||
@ -1202,6 +1279,8 @@ static DEVICE_ATTR(infos, S_IRUGO, show_infos, NULL);
|
||||
static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan);
|
||||
static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR,
|
||||
show_bluetooth, store_bluetooth);
|
||||
static DEVICE_ATTR(wimax, S_IRUGO | S_IWUSR, show_wimax, store_wimax);
|
||||
static DEVICE_ATTR(wwan, S_IRUGO | S_IWUSR, show_wwan, store_wwan);
|
||||
static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp);
|
||||
static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd);
|
||||
static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl);
|
||||
@ -1212,6 +1291,8 @@ static struct attribute *asus_attributes[] = {
|
||||
&dev_attr_infos.attr,
|
||||
&dev_attr_wlan.attr,
|
||||
&dev_attr_bluetooth.attr,
|
||||
&dev_attr_wimax.attr,
|
||||
&dev_attr_wwan.attr,
|
||||
&dev_attr_display.attr,
|
||||
&dev_attr_ledd.attr,
|
||||
&dev_attr_ls_level.attr,
|
||||
@ -1239,6 +1320,13 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj,
|
||||
} else if (attr == &dev_attr_display.attr) {
|
||||
supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL);
|
||||
|
||||
} else if (attr == &dev_attr_wimax.attr) {
|
||||
supported =
|
||||
!acpi_check_handle(asus->handle, METHOD_WIMAX, NULL);
|
||||
|
||||
} else if (attr == &dev_attr_wwan.attr) {
|
||||
supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL);
|
||||
|
||||
} else if (attr == &dev_attr_ledd.attr) {
|
||||
supported = !acpi_check_handle(handle, METHOD_LEDD, NULL);
|
||||
|
||||
@ -1397,7 +1485,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
|
||||
|
||||
/*
|
||||
* The HWRS method return informations about the hardware.
|
||||
* 0x80 bit is for WLAN, 0x100 for Bluetooth.
|
||||
* 0x80 bit is for WLAN, 0x100 for Bluetooth,
|
||||
* 0x40 for WWAN, 0x10 for WIMAX.
|
||||
* The significance of others is yet to be found.
|
||||
*/
|
||||
status =
|
||||
@ -1440,6 +1529,12 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
|
||||
if (wlan_status >= 0)
|
||||
asus_wlan_set(asus, !!wlan_status);
|
||||
|
||||
if (wimax_status >= 0)
|
||||
asus_wimax_set(asus, !!wimax_status);
|
||||
|
||||
if (wwan_status >= 0)
|
||||
asus_wwan_set(asus, !!wwan_status);
|
||||
|
||||
/* Keyboard Backlight is on by default */
|
||||
if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))
|
||||
asus_kled_set(asus, 1);
|
||||
|
@ -298,8 +298,8 @@ static void eeepc_wmi_notify(u32 value, void *context)
|
||||
kfree(obj);
|
||||
}
|
||||
|
||||
static int store_cpufv(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int value;
|
||||
struct acpi_buffer input = { (acpi_size)sizeof(value), &value };
|
||||
|
@ -172,6 +172,8 @@ static int hp_wmi_perform_query(int query, int write, u32 *buffer,
|
||||
bios_return = *((struct bios_return *)obj->buffer.pointer);
|
||||
|
||||
memcpy(buffer, &bios_return.value, sizeof(bios_return.value));
|
||||
|
||||
kfree(obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/efi.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <asm/bios_ebda.h>
|
||||
|
||||
@ -220,32 +221,13 @@ static void rtl_teardown_sysfs(void) {
|
||||
sysdev_class_unregister(&class_rtl);
|
||||
}
|
||||
|
||||
static int dmi_check_cb(const struct dmi_system_id *id)
|
||||
{
|
||||
RTL_DEBUG("found IBM server '%s'\n", id->ident);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ibm_dmi_entry(NAME, TYPE) \
|
||||
{ \
|
||||
.ident = NAME, \
|
||||
.matches = { \
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \
|
||||
}, \
|
||||
.callback = dmi_check_cb \
|
||||
}
|
||||
|
||||
static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
|
||||
ibm_dmi_entry("BladeCenter LS21", "7971"),
|
||||
ibm_dmi_entry("BladeCenter LS22", "7901"),
|
||||
ibm_dmi_entry("BladeCenter HS21 XM", "7995"),
|
||||
ibm_dmi_entry("BladeCenter HS22", "7870"),
|
||||
ibm_dmi_entry("BladeCenter HS22V", "7871"),
|
||||
ibm_dmi_entry("System x3550 M2", "7946"),
|
||||
ibm_dmi_entry("System x3650 M2", "7947"),
|
||||
ibm_dmi_entry("System x3550 M3", "7944"),
|
||||
ibm_dmi_entry("System x3650 M3", "7945"),
|
||||
{ \
|
||||
.matches = { \
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
|
||||
}, \
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -257,7 +239,7 @@ static int __init ibm_rtl_init(void) {
|
||||
if (force)
|
||||
pr_warning("ibm-rtl: module loaded by force\n");
|
||||
/* first ensure that we are running on IBM HW */
|
||||
else if (!dmi_check_system(ibm_rtl_dmi_table))
|
||||
else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table))
|
||||
return -ENODEV;
|
||||
|
||||
/* Get the address for the Extended BIOS Data Area */
|
||||
@ -302,7 +284,7 @@ static int __init ibm_rtl_init(void) {
|
||||
RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n",
|
||||
rtl_cmd_width, rtl_cmd_type);
|
||||
addr = ioread32(&rtl_table->cmd_port_address);
|
||||
RTL_DEBUG("addr = %#llx\n", addr);
|
||||
RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr);
|
||||
plen = rtl_cmd_width/sizeof(char);
|
||||
rtl_cmd_addr = rtl_port_map(addr, plen);
|
||||
RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
|
||||
|
@ -43,16 +43,18 @@ MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2");
|
||||
|
||||
#define dprintk(msg...) pr_debug(DRV_PFX msg)
|
||||
|
||||
#define KEYCODE_BASE 0xD0
|
||||
#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE
|
||||
#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1)
|
||||
#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2)
|
||||
#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3)
|
||||
#define SCANCODE_BASE 0xD0
|
||||
#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE
|
||||
#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1)
|
||||
#define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2)
|
||||
#define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3)
|
||||
#define MSI_WMI_MUTE (SCANCODE_BASE + 4)
|
||||
static struct key_entry msi_wmi_keymap[] = {
|
||||
{ KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
|
||||
{ KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
|
||||
{ KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} },
|
||||
{ KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
|
||||
{ KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} },
|
||||
{ KE_END, 0}
|
||||
};
|
||||
static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
|
||||
@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context)
|
||||
ktime_t diff;
|
||||
cur = ktime_get_real();
|
||||
diff = ktime_sub(cur, last_pressed[key->code -
|
||||
KEYCODE_BASE]);
|
||||
SCANCODE_BASE]);
|
||||
/* Ignore event if the same event happened in a 50 ms
|
||||
timeframe -> Key press may result in 10-20 GPEs */
|
||||
if (ktime_to_us(diff) < 1000 * 50) {
|
||||
@ -178,7 +180,7 @@ static void msi_wmi_notify(u32 value, void *context)
|
||||
key->code, ktime_to_us(diff));
|
||||
return;
|
||||
}
|
||||
last_pressed[key->code - KEYCODE_BASE] = cur;
|
||||
last_pressed[key->code - SCANCODE_BASE] = cur;
|
||||
|
||||
if (key->type == KE_KEY &&
|
||||
/* Brightness is served via acpi video driver */
|
||||
|
@ -8497,7 +8497,6 @@ static void ibm_exit(struct ibm_struct *ibm)
|
||||
ibm->acpi->type,
|
||||
dispatch_acpi_notify);
|
||||
ibm->flags.acpi_notify_installed = 0;
|
||||
ibm->flags.acpi_notify_installed = 0;
|
||||
}
|
||||
|
||||
if (ibm->flags.proc_created) {
|
||||
|
@ -135,6 +135,7 @@ static const struct key_entry toshiba_acpi_keymap[] __initconst = {
|
||||
{ KE_KEY, 0x141, { KEY_BRIGHTNESSUP } },
|
||||
{ KE_KEY, 0x142, { KEY_WLAN } },
|
||||
{ KE_KEY, 0x143, { KEY_PROG1 } },
|
||||
{ KE_KEY, 0x17f, { KEY_FN } },
|
||||
{ KE_KEY, 0xb05, { KEY_PROG2 } },
|
||||
{ KE_KEY, 0xb06, { KEY_WWW } },
|
||||
{ KE_KEY, 0xb07, { KEY_MAIL } },
|
||||
|
@ -755,7 +755,7 @@ static bool guid_already_parsed(const char *guid_string)
|
||||
struct wmi_block *wblock;
|
||||
|
||||
list_for_each_entry(wblock, &wmi_block_list, list)
|
||||
if (strncmp(wblock->gblock.guid, guid_string, 16) == 0)
|
||||
if (memcmp(wblock->gblock.guid, guid_string, 16) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user