aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorJoão Paulo Rechi Vita <jprvita@gmail.com>2016-01-05 11:16:53 -0500
committerDarren Hart <dvhart@linux.intel.com>2016-01-19 20:35:46 -0500
commitf6a6bbae0471fdfb824a86d1808eae33e8819254 (patch)
tree0cf526582eba31b0d5d596efd93f3909f4bdf0c8 /drivers/platform
parentf5b3f66548b72f8ab77fea5867bd45ad91ed2143 (diff)
platform/x86: Add Asus Wireless Radio Control driver
Some Asus notebooks like the Asus E202SA and the Asus X555UB have a separate ACPI device for notifications from the airplane mode hotkey. This device is called "Wireless Radio Control" in Asus websites and ASHS in the DSDT, and its ACPI _HID is ATK4002 in the two models mentioned above. For these models, when the airplane mode hotkey (Fn+F2) is pressed, a query 0x0B is started in the Embedded Controller, and all this query does is a notify ASHS with the value 0x88 (for acpi_osi >= "Windows 2012"): Scope (_SB.PCI0.SBRG.EC0) { (...) Method (_Q0B, 0, NotSerialized) // _Qxx: EC Query { If ((MSOS () >= OSW8)) { Notify (ASHS, 0x88) // Device-Specific } Else { (...) } } } Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/Kconfig14
-rw-r--r--drivers/platform/x86/Makefile1
-rw-r--r--drivers/platform/x86/asus-wireless.c83
3 files changed, 98 insertions, 0 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 9d7704e51366..f37821f004f9 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -587,6 +587,20 @@ config EEEPC_WMI
587 If you have an ACPI-WMI compatible Eee PC laptop (>= 1000), say Y or M 587 If you have an ACPI-WMI compatible Eee PC laptop (>= 1000), say Y or M
588 here. 588 here.
589 589
590config ASUS_WIRELESS
591 tristate "Asus Wireless Radio Control Driver"
592 depends on ACPI
593 depends on INPUT
594 ---help---
595 The Asus Wireless Radio Control handles the airplane mode hotkey
596 present on some Asus laptops.
597
598 Say Y or M here if you have an ASUS notebook with an airplane mode
599 hotkey.
600
601 If you choose to compile this driver as a module the module will be
602 called asus-wireless.
603
590config ACPI_WMI 604config ACPI_WMI
591 tristate "WMI" 605 tristate "WMI"
592 depends on ACPI 606 depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 4410e91627ac..8b8df29dc502 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -5,6 +5,7 @@
5obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o 5obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
6obj-$(CONFIG_ASUS_WMI) += asus-wmi.o 6obj-$(CONFIG_ASUS_WMI) += asus-wmi.o
7obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o 7obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o
8obj-$(CONFIG_ASUS_WIRELESS) += asus-wireless.o
8obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o 9obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
9obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o 10obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o
10obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 11obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
new file mode 100644
index 000000000000..5058d48f2909
--- /dev/null
+++ b/drivers/platform/x86/asus-wireless.c
@@ -0,0 +1,83 @@
1/*
2 * Asus Wireless Radio Control Driver
3 *
4 * Copyright (C) 2015-2016 Endless Mobile, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/types.h>
15#include <linux/acpi.h>
16#include <linux/input.h>
17#include <linux/pci_ids.h>
18
19struct asus_wireless_data {
20 struct input_dev *idev;
21};
22
23static void asus_wireless_notify(struct acpi_device *adev, u32 event)
24{
25 struct asus_wireless_data *data = acpi_driver_data(adev);
26
27 dev_dbg(&adev->dev, "event=%#x\n", event);
28 if (event != 0x88) {
29 dev_notice(&adev->dev, "Unknown ASHS event: %#x\n", event);
30 return;
31 }
32 input_report_key(data->idev, KEY_RFKILL, 1);
33 input_report_key(data->idev, KEY_RFKILL, 0);
34 input_sync(data->idev);
35}
36
37static int asus_wireless_add(struct acpi_device *adev)
38{
39 struct asus_wireless_data *data;
40
41 data = devm_kzalloc(&adev->dev, sizeof(*data), GFP_KERNEL);
42 if (!data)
43 return -ENOMEM;
44 adev->driver_data = data;
45
46 data->idev = devm_input_allocate_device(&adev->dev);
47 if (!data->idev)
48 return -ENOMEM;
49 data->idev->name = "Asus Wireless Radio Control";
50 data->idev->phys = "asus-wireless/input0";
51 data->idev->id.bustype = BUS_HOST;
52 data->idev->id.vendor = PCI_VENDOR_ID_ASUSTEK;
53 set_bit(EV_KEY, data->idev->evbit);
54 set_bit(KEY_RFKILL, data->idev->keybit);
55 return input_register_device(data->idev);
56}
57
58static int asus_wireless_remove(struct acpi_device *adev)
59{
60 return 0;
61}
62
63static const struct acpi_device_id device_ids[] = {
64 {"ATK4002", 0},
65 {"", 0},
66};
67MODULE_DEVICE_TABLE(acpi, device_ids);
68
69static struct acpi_driver asus_wireless_driver = {
70 .name = "Asus Wireless Radio Control Driver",
71 .class = "hotkey",
72 .ids = device_ids,
73 .ops = {
74 .add = asus_wireless_add,
75 .remove = asus_wireless_remove,
76 .notify = asus_wireless_notify,
77 },
78};
79module_acpi_driver(asus_wireless_driver);
80
81MODULE_DESCRIPTION("Asus Wireless Radio Control Driver");
82MODULE_AUTHOR("João Paulo Rechi Vita <jprvita@gmail.com>");
83MODULE_LICENSE("GPL");