summary refs log tree commit diff
path: root/drivers/platform
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-11-29 08:14:14 +0100
committerMatthew Garrett <mjg@redhat.com>2011-01-07 17:03:44 -0500
commitd358cb55a4cc83c37fbaebc0e4401a573777c6ac (patch)
treedea68be54d3005fcfab2ce45f7028e6eef8cb5ec /drivers/platform
parent62a75d83131c8887237d26a36ffeabd53c3640fd (diff)
downloadlinux-d358cb55a4cc83c37fbaebc0e4401a573777c6ac.tar.gz
eeepc-wmi: never load if legacy device is enabled
If legacy device (SB.ATKD - ASUS010) used by eeepc-laptop
is enabled, don't allow eeepc-wmi to load because:
- eeepc-laptop may be loaded, and can conflict with
  eeepc-wmi (they both try to register eeepc::touchpad
  led for example).
- the WMI interface is inteded to be used when the OS is
  not detected as Win 7. And when this is the case, the
  ASUS010 device is disabled.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/eeepc-wmi.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 52274e21ee89..4d38f98aa976 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -49,6 +49,8 @@ MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>");
 MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver");
 MODULE_LICENSE("GPL");
 
+#define EEEPC_ACPI_HID		"ASUS010" /* old _HID used in eeepc-laptop */
+
 #define EEEPC_WMI_EVENT_GUID	"ABBC0F72-8EA1-11D1-00A0-C90629100000"
 #define EEEPC_WMI_MGMT_GUID	"97845ED0-4E6D-11DE-8A39-0800200C9A66"
 
@@ -861,6 +863,27 @@ static struct platform_driver platform_driver = {
 	},
 };
 
+static acpi_status __init eeepc_wmi_parse_device(acpi_handle handle, u32 level,
+						 void *context, void **retval)
+{
+	pr_warning("Found legacy ATKD device (%s)", EEEPC_ACPI_HID);
+	*(bool *)context = true;
+	return AE_CTRL_TERMINATE;
+}
+
+static int __init eeepc_wmi_check_atkd(void)
+{
+	acpi_status status;
+	bool found = false;
+
+	status = acpi_get_devices(EEEPC_ACPI_HID, eeepc_wmi_parse_device,
+				  &found, NULL);
+
+	if (ACPI_FAILURE(status) || !found)
+		return 0;
+	return -1;
+}
+
 static int __init eeepc_wmi_init(void)
 {
 	int err;
@@ -871,6 +894,16 @@ static int __init eeepc_wmi_init(void)
 		return -ENODEV;
 	}
 
+	if (eeepc_wmi_check_atkd()) {
+		pr_warning("WMI device present, but legacy ATKD device is also "
+			   "present and enabled.");
+		pr_warning("You probably booted with acpi_osi=\"Linux\" or "
+			   "acpi_osi=\"!Windows 2009\"");
+		pr_warning("Can't load eeepc-wmi, use default acpi_osi "
+			   "(preferred) or eeepc-laptop");
+		return -ENODEV;
+	}
+
 	platform_device = eeepc_wmi_add();
 	if (IS_ERR(platform_device)) {
 		err = PTR_ERR(platform_device);