All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Asus Wireless Radio Control driver
@ 2016-01-05 13:25 João Paulo Rechi Vita
  2016-01-05 13:26 ` [PATCH 1/2] platform/x86: Add " João Paulo Rechi Vita
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: João Paulo Rechi Vita @ 2016-01-05 13:25 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, andy.shevchenko, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

This series implements the driver for the "Asus Wireless Radio Control" device,
as named on the vendor website, which handles notifications from the airplane
mode hotkey and drives the airplane mode indicator LED. This device appears in
the DSDT as "ASHS".

I decided to split the series and move the commits that drive the LED to a
separate series, so this part can be merged without waiting for feedback on the
new airplane mode RFKill LED trigger.

Regards,

Joao Paulo

João Paulo Rechi Vita (2):
  platform/x86: Add Asus Wireless Radio Control driver
  asus-wireless: Add ACPI HID ATK4001

 MAINTAINERS                          |  6 +++
 drivers/platform/x86/Kconfig         | 15 +++++++
 drivers/platform/x86/Makefile        |  1 +
 drivers/platform/x86/asus-wireless.c | 84 ++++++++++++++++++++++++++++++++++++
 4 files changed, 106 insertions(+)
 create mode 100644 drivers/platform/x86/asus-wireless.c

-- 
2.5.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] platform/x86: Add Asus Wireless Radio Control driver
  2016-01-05 13:25 [PATCH 0/2] Asus Wireless Radio Control driver João Paulo Rechi Vita
@ 2016-01-05 13:26 ` João Paulo Rechi Vita
  2016-01-05 13:50   ` Andy Shevchenko
  2016-01-05 13:26 ` [PATCH 2/2] asus-wireless: Add ACPI HID ATK4001 João Paulo Rechi Vita
  2016-01-05 13:58 ` [PATCH 0/2] Asus Wireless Radio Control driver Andy Shevchenko
  2 siblings, 1 reply; 10+ messages in thread
From: João Paulo Rechi Vita @ 2016-01-05 13:26 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, andy.shevchenko, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

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>
---
 MAINTAINERS                          |  6 +++
 drivers/platform/x86/Kconfig         | 15 +++++++
 drivers/platform/x86/Makefile        |  1 +
 drivers/platform/x86/asus-wireless.c | 83 ++++++++++++++++++++++++++++++++++++
 4 files changed, 105 insertions(+)
 create mode 100644 drivers/platform/x86/asus-wireless.c

diff --git a/MAINTAINERS b/MAINTAINERS
index c984136..e1860f2 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 d0bfcf8..d3a088b 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -587,6 +587,21 @@ 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
+	default m
+	---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 4410e91..8b8df29 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 0000000..c7279e9
--- /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 *inputdev;
+};
+
+static void asus_wireless_notify(struct acpi_device *device, u32 event)
+{
+	struct asus_wireless_data *data = acpi_driver_data(device);
+
+	dev_dbg(&device->dev, "event=0x%X\n", event);
+	if (event != 0x88) {
+		dev_notice(&device->dev, "Unknown ASHS event: 0x%X\n", event);
+		return;
+	}
+	input_report_key(data->inputdev, KEY_RFKILL, 1);
+	input_report_key(data->inputdev, KEY_RFKILL, 0);
+	input_sync(data->inputdev);
+}
+
+static int asus_wireless_add(struct acpi_device *device)
+{
+	struct asus_wireless_data *data;
+
+	data = devm_kzalloc(&device->dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+	device->driver_data = data;
+
+	data->inputdev = devm_input_allocate_device(&device->dev);
+	if (!data->inputdev)
+		return -ENOMEM;
+	data->inputdev->name = "Asus Wireless Radio Control";
+	data->inputdev->phys = "asus-wireless/input0";
+	data->inputdev->id.bustype = BUS_HOST;
+	data->inputdev->id.vendor = PCI_VENDOR_ID_ASUSTEK;
+	set_bit(EV_KEY, data->inputdev->evbit);
+	set_bit(KEY_RFKILL, data->inputdev->keybit);
+	return input_register_device(data->inputdev);
+}
+
+static int asus_wireless_remove(struct acpi_device *device)
+{
+	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");
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] asus-wireless: Add ACPI HID ATK4001
  2016-01-05 13:25 [PATCH 0/2] Asus Wireless Radio Control driver João Paulo Rechi Vita
  2016-01-05 13:26 ` [PATCH 1/2] platform/x86: Add " João Paulo Rechi Vita
@ 2016-01-05 13:26 ` João Paulo Rechi Vita
  2016-01-05 17:27   ` Darren Hart
  2016-01-05 13:58 ` [PATCH 0/2] Asus Wireless Radio Control driver Andy Shevchenko
  2 siblings, 1 reply; 10+ messages in thread
From: João Paulo Rechi Vita @ 2016-01-05 13:26 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, andy.shevchenko, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

As reported in https://bugzilla.kernel.org/show_bug.cgi?id=98931#c22 in
the Asus UX31A the Asus Wireless Radio Control device (ASHS) uses the
HID "ATK4001".

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Reported-by: Tasev Nikola <tasev.stefanoska@skynet.be>
---
 drivers/platform/x86/asus-wireless.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
index c7279e9..0e500e6 100644
--- a/drivers/platform/x86/asus-wireless.c
+++ b/drivers/platform/x86/asus-wireless.c
@@ -61,6 +61,7 @@ static int asus_wireless_remove(struct acpi_device *device)
 }
 
 static const struct acpi_device_id device_ids[] = {
+	{"ATK4001", 0},
 	{"ATK4002", 0},
 	{"", 0},
 };
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] platform/x86: Add Asus Wireless Radio Control driver
  2016-01-05 13:26 ` [PATCH 1/2] platform/x86: Add " João Paulo Rechi Vita
@ 2016-01-05 13:50   ` Andy Shevchenko
  2016-01-05 16:16     ` [PATCH] " João Paulo Rechi Vita
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2016-01-05 13:50 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Darren Hart, Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, João Paulo Rechi Vita

On Tue, Jan 5, 2016 at 3:26 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
> 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
>                         {
>                                 (...)
>                         }
>                 }
>         }

Few nitpicks below. In any case looks fine to me.

> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -587,6 +587,21 @@ 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

> +       default m

Hmm… Usually we leave this for OSVs (OS Vendors) to decide. Or, like
you mentioned below, to the user.

> +       ---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.

…here is inconsistency with default value.

> +
> +         If you choose to compile this driver as a module the module will be
> +         called asus-wireless.
> +


> +++ 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 *inputdev;

I would suggest
*inputdev -> *idev

> +};
> +
> +static void asus_wireless_notify(struct acpi_device *device, u32 event)

In ACPI code and drivers we usually use struct acpi_device *adev.

> +{
> +       struct asus_wireless_data *data = acpi_driver_data(device);
> +
> +       dev_dbg(&device->dev, "event=0x%X\n", event);
> +       if (event != 0x88) {
> +               dev_notice(&device->dev, "Unknown ASHS event: 0x%X\n", event);
> +               return;

I believe %#X will work in both cases instead of 0x%X

> +       }
> +       input_report_key(data->inputdev, KEY_RFKILL, 1);
> +       input_report_key(data->inputdev, KEY_RFKILL, 0);
> +       input_sync(data->inputdev);
> +}
> +
> +static int asus_wireless_add(struct acpi_device *device)
> +{
> +       struct asus_wireless_data *data;
> +
> +       data = devm_kzalloc(&device->dev, sizeof(*data), GFP_KERNEL);
> +       if (!data)
> +               return -ENOMEM;
> +       device->driver_data = data;
> +
> +       data->inputdev = devm_input_allocate_device(&device->dev);
> +       if (!data->inputdev)
> +               return -ENOMEM;
> +       data->inputdev->name = "Asus Wireless Radio Control";
> +       data->inputdev->phys = "asus-wireless/input0";
> +       data->inputdev->id.bustype = BUS_HOST;
> +       data->inputdev->id.vendor = PCI_VENDOR_ID_ASUSTEK;
> +       set_bit(EV_KEY, data->inputdev->evbit);
> +       set_bit(KEY_RFKILL, data->inputdev->keybit);
> +       return input_register_device(data->inputdev);
> +}
> +
> +static int asus_wireless_remove(struct acpi_device *device)
> +{
> +       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");
> --
> 2.5.0
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] Asus Wireless Radio Control driver
  2016-01-05 13:25 [PATCH 0/2] Asus Wireless Radio Control driver João Paulo Rechi Vita
  2016-01-05 13:26 ` [PATCH 1/2] platform/x86: Add " João Paulo Rechi Vita
  2016-01-05 13:26 ` [PATCH 2/2] asus-wireless: Add ACPI HID ATK4001 João Paulo Rechi Vita
@ 2016-01-05 13:58 ` Andy Shevchenko
  2016-01-05 16:18   ` João Paulo Rechi Vita
  2016-01-05 17:18   ` Darren Hart
  2 siblings, 2 replies; 10+ messages in thread
From: Andy Shevchenko @ 2016-01-05 13:58 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Darren Hart, Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, João Paulo Rechi Vita

On Tue, Jan 5, 2016 at 3:25 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
> This series implements the driver for the "Asus Wireless Radio Control" device,
> as named on the vendor website, which handles notifications from the airplane
> mode hotkey and drives the airplane mode indicator LED. This device appears in
> the DSDT as "ASHS".
>
> I decided to split the series and move the commits that drive the LED to a
> separate series, so this part can be merged without waiting for feedback on the
> new airplane mode RFKill LED trigger.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

(I'm fine with current version but please take into consideration
comments to the first patch, most important 'default m' thing)

>
> Regards,
>
> Joao Paulo
>
> João Paulo Rechi Vita (2):
>   platform/x86: Add Asus Wireless Radio Control driver
>   asus-wireless: Add ACPI HID ATK4001
>
>  MAINTAINERS                          |  6 +++
>  drivers/platform/x86/Kconfig         | 15 +++++++
>  drivers/platform/x86/Makefile        |  1 +
>  drivers/platform/x86/asus-wireless.c | 84 ++++++++++++++++++++++++++++++++++++
>  4 files changed, 106 insertions(+)
>  create mode 100644 drivers/platform/x86/asus-wireless.c
>
> --
> 2.5.0
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] platform/x86: Add Asus Wireless Radio Control driver
  2016-01-05 13:50   ` Andy Shevchenko
@ 2016-01-05 16:16     ` João Paulo Rechi Vita
  2016-01-05 17:26       ` Darren Hart
  0 siblings, 1 reply; 10+ messages in thread
From: João Paulo Rechi Vita @ 2016-01-05 16:16 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, andy.shevchenko, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

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>
---
 MAINTAINERS                          |  6 +++
 drivers/platform/x86/Kconfig         | 14 ++++++
 drivers/platform/x86/Makefile        |  1 +
 drivers/platform/x86/asus-wireless.c | 83 ++++++++++++++++++++++++++++++++++++
 4 files changed, 104 insertions(+)
 create mode 100644 drivers/platform/x86/asus-wireless.c

diff --git a/MAINTAINERS b/MAINTAINERS
index c984136..e1860f2 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 d0bfcf8..749684e 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 4410e91..8b8df29 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 0000000..5058d48
--- /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");
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] Asus Wireless Radio Control driver
  2016-01-05 13:58 ` [PATCH 0/2] Asus Wireless Radio Control driver Andy Shevchenko
@ 2016-01-05 16:18   ` João Paulo Rechi Vita
  2016-01-05 17:18   ` Darren Hart
  1 sibling, 0 replies; 10+ messages in thread
From: João Paulo Rechi Vita @ 2016-01-05 16:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Darren Hart, Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, João Paulo Rechi Vita

On 5 January 2016 at 08:58, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Tue, Jan 5, 2016 at 3:25 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
>> This series implements the driver for the "Asus Wireless Radio Control" device,
>> as named on the vendor website, which handles notifications from the airplane
>> mode hotkey and drives the airplane mode indicator LED. This device appears in
>> the DSDT as "ASHS".
>>
>> I decided to split the series and move the commits that drive the LED to a
>> separate series, so this part can be merged without waiting for feedback on the
>> new airplane mode RFKill LED trigger.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> (I'm fine with current version but please take into consideration
> comments to the first patch, most important 'default m' thing)
>

I wasn't really sure about the "default m", so I've followed your
suggestions and just sent an updated patch in reply to that one.
Thanks for your review, it certainly made the code a lot better.

--
João Paulo Rechi Vita
http://about.me/jprvita

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] Asus Wireless Radio Control driver
  2016-01-05 13:58 ` [PATCH 0/2] Asus Wireless Radio Control driver Andy Shevchenko
  2016-01-05 16:18   ` João Paulo Rechi Vita
@ 2016-01-05 17:18   ` Darren Hart
  1 sibling, 0 replies; 10+ messages in thread
From: Darren Hart @ 2016-01-05 17:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: João Paulo Rechi Vita, Corentin Chary, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

On Tue, Jan 05, 2016 at 03:58:46PM +0200, Andy Shevchenko wrote:
> On Tue, Jan 5, 2016 at 3:25 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
> > This series implements the driver for the "Asus Wireless Radio Control" device,
> > as named on the vendor website, which handles notifications from the airplane
> > mode hotkey and drives the airplane mode indicator LED. This device appears in
> > the DSDT as "ASHS".
> >
> > I decided to split the series and move the commits that drive the LED to a
> > separate series, so this part can be merged without waiting for feedback on the
> > new airplane mode RFKill LED trigger.
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> (I'm fine with current version but please take into consideration
> comments to the first patch, most important 'default m' thing)

Agreed on the 'default m' thing. Thank you for the review Andy.

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] platform/x86: Add Asus Wireless Radio Control driver
  2016-01-05 16:16     ` [PATCH] " João Paulo Rechi Vita
@ 2016-01-05 17:26       ` Darren Hart
  0 siblings, 0 replies; 10+ messages in thread
From: Darren Hart @ 2016-01-05 17:26 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Corentin Chary, andy.shevchenko, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

On Tue, Jan 05, 2016 at 11:16:53AM -0500, João Paulo Rechi Vita wrote:
> 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>

Queued to testing, thanks!

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] asus-wireless: Add ACPI HID ATK4001
  2016-01-05 13:26 ` [PATCH 2/2] asus-wireless: Add ACPI HID ATK4001 João Paulo Rechi Vita
@ 2016-01-05 17:27   ` Darren Hart
  0 siblings, 0 replies; 10+ messages in thread
From: Darren Hart @ 2016-01-05 17:27 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Corentin Chary, andy.shevchenko, platform-driver-x86,
	acpi4asus-user, linux-kernel, João Paulo Rechi Vita

On Tue, Jan 05, 2016 at 08:26:01AM -0500, João Paulo Rechi Vita wrote:
> As reported in https://bugzilla.kernel.org/show_bug.cgi?id=98931#c22 in
> the Asus UX31A the Asus Wireless Radio Control device (ASHS) uses the
> HID "ATK4001".
> 
> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
> Reported-by: Tasev Nikola <tasev.stefanoska@skynet.be>

Queued to testing, thanks.

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-01-05 17:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05 13:25 [PATCH 0/2] Asus Wireless Radio Control driver João Paulo Rechi Vita
2016-01-05 13:26 ` [PATCH 1/2] platform/x86: Add " João Paulo Rechi Vita
2016-01-05 13:50   ` Andy Shevchenko
2016-01-05 16:16     ` [PATCH] " João Paulo Rechi Vita
2016-01-05 17:26       ` Darren Hart
2016-01-05 13:26 ` [PATCH 2/2] asus-wireless: Add ACPI HID ATK4001 João Paulo Rechi Vita
2016-01-05 17:27   ` Darren Hart
2016-01-05 13:58 ` [PATCH 0/2] Asus Wireless Radio Control driver Andy Shevchenko
2016-01-05 16:18   ` João Paulo Rechi Vita
2016-01-05 17:18   ` Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.