diff options
-rw-r--r-- | MAINTAINERS | 6 | ||||
-rw-r--r-- | drivers/platform/x86/Kconfig | 14 | ||||
-rw-r--r-- | drivers/platform/x86/Makefile | 1 | ||||
-rw-r--r-- | drivers/platform/x86/asus-wireless.c | 83 |
4 files changed, 104 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index c9841368fbed..e1860f2c5f65 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1791,6 +1791,12 @@ S: Maintained F: drivers/platform/x86/asus*.c F: drivers/platform/x86/eeepc*.c +ASUS WIRELESS RADIO CONTROL DRIVER +M: João Paulo Rechi Vita <jprvita@gmail.com> +L: platform-driver-x86@vger.kernel.org +S: Maintained +F: drivers/platform/x86/asus-wireless.c + ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API R: Dan Williams <dan.j.williams@intel.com> W: http://sourceforge.net/projects/xscaleiop 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 If you have an ACPI-WMI compatible Eee PC laptop (>= 1000), say Y or M here. +config ASUS_WIRELESS + tristate "Asus Wireless Radio Control Driver" + depends on ACPI + depends on INPUT + ---help--- + The Asus Wireless Radio Control handles the airplane mode hotkey + present on some Asus laptops. + + Say Y or M here if you have an ASUS notebook with an airplane mode + hotkey. + + If you choose to compile this driver as a module the module will be + called asus-wireless. + config ACPI_WMI tristate "WMI" 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 @@ obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o obj-$(CONFIG_ASUS_WMI) += asus-wmi.o obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o +obj-$(CONFIG_ASUS_WIRELESS) += asus-wireless.o obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o obj-$(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 @@ +/* + * Asus Wireless Radio Control Driver + * + * Copyright (C) 2015-2016 Endless Mobile, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/types.h> +#include <linux/acpi.h> +#include <linux/input.h> +#include <linux/pci_ids.h> + +struct asus_wireless_data { + struct input_dev *idev; +}; + +static void asus_wireless_notify(struct acpi_device *adev, u32 event) +{ + struct asus_wireless_data *data = acpi_driver_data(adev); + + dev_dbg(&adev->dev, "event=%#x\n", event); + if (event != 0x88) { + dev_notice(&adev->dev, "Unknown ASHS event: %#x\n", event); + return; + } + input_report_key(data->idev, KEY_RFKILL, 1); + input_report_key(data->idev, KEY_RFKILL, 0); + input_sync(data->idev); +} + +static int asus_wireless_add(struct acpi_device *adev) +{ + struct asus_wireless_data *data; + + data = devm_kzalloc(&adev->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + adev->driver_data = data; + + data->idev = devm_input_allocate_device(&adev->dev); + if (!data->idev) + return -ENOMEM; + data->idev->name = "Asus Wireless Radio Control"; + data->idev->phys = "asus-wireless/input0"; + data->idev->id.bustype = BUS_HOST; + data->idev->id.vendor = PCI_VENDOR_ID_ASUSTEK; + set_bit(EV_KEY, data->idev->evbit); + set_bit(KEY_RFKILL, data->idev->keybit); + return input_register_device(data->idev); +} + +static int asus_wireless_remove(struct acpi_device *adev) +{ + return 0; +} + +static const struct acpi_device_id device_ids[] = { + {"ATK4002", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, device_ids); + +static struct acpi_driver asus_wireless_driver = { + .name = "Asus Wireless Radio Control Driver", + .class = "hotkey", + .ids = device_ids, + .ops = { + .add = asus_wireless_add, + .remove = asus_wireless_remove, + .notify = asus_wireless_notify, + }, +}; +module_acpi_driver(asus_wireless_driver); + +MODULE_DESCRIPTION("Asus Wireless Radio Control Driver"); +MODULE_AUTHOR("João Paulo Rechi Vita <jprvita@gmail.com>"); +MODULE_LICENSE("GPL"); |