All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] asus-wireless: LED control
@ 2016-02-08 17:05 João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 1/5] asus-wireless: Toggle airplane mode LED João Paulo Rechi Vita
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-08 17:05 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

This series adds support for controlling the airplane-mode indicator LED
present in some Asus laptops. It also creates a quirk in asus-wmi so it does not
create RFKill devices for platforms that use asus-wireless and where there is a
competition for the LED control (see "asus-wmi: Create quirk for airplane_mode
LED" for more details).

João Paulo Rechi Vita (5):
  asus-wireless: Toggle airplane mode LED
  asus-wmi: Create quirk for airplane_mode LED
  asus-wmi: Add quirk_no_rfkill for the Asus X552VW
  asus-wmi: Add quirk_no_rfkill for the Asus U303LB
  asus-wmi: Add quirk_no_rfkill for the Asus Z550MA

 drivers/platform/x86/Kconfig         |  2 +
 drivers/platform/x86/asus-nb-wmi.c   | 40 ++++++++++++++++
 drivers/platform/x86/asus-wireless.c | 92 +++++++++++++++++++++++++++++++++++-
 drivers/platform/x86/asus-wmi.c      |  8 ++--
 drivers/platform/x86/asus-wmi.h      |  1 +
 5 files changed, 139 insertions(+), 4 deletions(-)

-- 
2.5.0

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

* [PATCH 1/5] asus-wireless: Toggle airplane mode LED
  2016-02-08 17:05 [PATCH 0/5] asus-wireless: LED control João Paulo Rechi Vita
@ 2016-02-08 17:05 ` João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED João Paulo Rechi Vita
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-08 17:05 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

In the ASHS device we have the HSWC method, which basically calls either
OWGD or OWGS, depending on its parameter:

	Device (ASHS)
	{
		Name (_HID, "ATK4002")  // _HID: Hardware ID
		Method (HSWC, 1, Serialized)
		{
			If ((Arg0 < 0x02))
			{
				OWGD (Arg0)
				Return (One)
			}
			If ((Arg0 == 0x02))
			{
				Local0 = OWGS ()
				If (Local0)
				{
					Return (0x05)
				}
				Else
				{
					Return (0x04)
				}
			}
			If ((Arg0 == 0x03))
			{
				Return (0xFF)
			}
			If ((Arg0 == 0x04))
			{
				OWGD (Zero)
				Return (One)
			}
			If ((Arg0 == 0x05))
			{
				OWGD (One)
				Return (One)
			}
			If ((Arg0 == 0x80))
			{
				Return (One)
			}
		}
		Method (_STA, 0, NotSerialized)  // _STA: Status
		{
			If ((MSOS () >= OSW8))
			{
				Return (0x0F)
			}
			Else
			{
				Return (Zero)
			}
		}
	}

On the Asus E202SA laptop, which does not have an airplane mode LED,
OWGD has an empty implementation and OWGS simply returns 0. On the Asus
X555UB these methods have the following implementation:

	Method (OWGD, 1, Serialized)
	{
		SGPL (0x0203000F, Arg0)
		SGPL (0x0203000F, Arg0)
	}

	Method (OWGS, 0, Serialized)
	{
		Store (RGPL (0x0203000F), Local0)
		Return (Local0)
	}

Where OWGD(1) sets the airplane mode LED ON, OWGD(0) set it off, and
OWGS() returns its state.

This commit makes use of a newly implemented RFKill LED trigger to
trigger the LED when the system enters or exits "Airplane Mode", there
is, when all radios are blocked.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 drivers/platform/x86/Kconfig         |  2 +
 drivers/platform/x86/asus-wireless.c | 92 +++++++++++++++++++++++++++++++++++-
 2 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 69f93a5..9c1b46b 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -591,6 +591,8 @@ config ASUS_WIRELESS
 	tristate "Asus Wireless Radio Control Driver"
 	depends on ACPI
 	depends on INPUT
+	select NEW_LEDS
+	select LEDS_CLASS
 	---help---
 	  The Asus Wireless Radio Control handles the airplane mode hotkey
 	  present on some Asus laptops.
diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
index 9ec721e..5bb3ad3 100644
--- a/drivers/platform/x86/asus-wireless.c
+++ b/drivers/platform/x86/asus-wireless.c
@@ -15,11 +15,78 @@
 #include <linux/acpi.h>
 #include <linux/input.h>
 #include <linux/pci_ids.h>
+#include <linux/leds.h>
+
+#define ASUS_WIRELESS_LED_STATUS 0x2
+#define ASUS_WIRELESS_LED_OFF 0x4
+#define ASUS_WIRELESS_LED_ON 0x5
 
 struct asus_wireless_data {
 	struct input_dev *idev;
+	struct acpi_device *adev;
+	struct workqueue_struct *wq;
+	struct work_struct led_work;
+	struct led_classdev led;
+	int led_state;
 };
 
+static u64 asus_wireless_method(acpi_handle handle, const char *method,
+				int param)
+{
+	union acpi_object obj;
+	struct acpi_object_list p;
+	acpi_status s;
+	u64 ret;
+
+	acpi_handle_debug(handle, "Evaluating method %s, parameter %#x\n",
+			  method, param);
+	obj.type = ACPI_TYPE_INTEGER;
+	obj.integer.value = param;
+	p.count = 1;
+	p.pointer = &obj;
+
+	s = acpi_evaluate_integer(handle, (acpi_string) method, &p, &ret);
+	if (ACPI_FAILURE(s))
+		acpi_handle_err(handle,
+				"Failed to eval method %s, param %#x (%d)\n",
+				method, param, s);
+	acpi_handle_debug(handle, "%s returned %#x\n", method, (uint) ret);
+	return ret;
+}
+
+static enum led_brightness asus_wireless_led_get(struct led_classdev *led)
+{
+	struct asus_wireless_data *data;
+	int s;
+
+	data = container_of(led, struct asus_wireless_data, led);
+	s = asus_wireless_method(acpi_device_handle(data->adev), "HSWC",
+				 ASUS_WIRELESS_LED_STATUS);
+	if (s == ASUS_WIRELESS_LED_ON)
+		return LED_FULL;
+	return LED_OFF;
+}
+
+static void asus_wireless_led_update(struct work_struct *work)
+{
+	struct asus_wireless_data *data;
+
+	data = container_of(work, struct asus_wireless_data, led_work);
+	asus_wireless_method(acpi_device_handle(data->adev), "HSWC",
+			     data->led_state);
+}
+
+static void asus_wireless_led_set(struct led_classdev *led,
+				  enum led_brightness value)
+{
+	struct asus_wireless_data *data;
+
+	data = container_of(led, struct asus_wireless_data, led);
+	data->led_state = value == LED_OFF ? ASUS_WIRELESS_LED_OFF :
+					     ASUS_WIRELESS_LED_ON;
+	queue_work(data->wq, &data->led_work);
+}
+
 static void asus_wireless_notify(struct acpi_device *adev, u32 event)
 {
 	struct asus_wireless_data *data = acpi_driver_data(adev);
@@ -37,6 +104,7 @@ static void asus_wireless_notify(struct acpi_device *adev, u32 event)
 static int asus_wireless_add(struct acpi_device *adev)
 {
 	struct asus_wireless_data *data;
+	int err;
 
 	data = devm_kzalloc(&adev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
@@ -52,11 +120,33 @@ static int asus_wireless_add(struct acpi_device *adev)
 	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);
+	err = input_register_device(data->idev);
+	if (err)
+		return err;
+
+	data->adev = adev;
+	data->wq = create_singlethread_workqueue("asus_wireless_workqueue");
+	if (!data->wq)
+		return -ENOMEM;
+	INIT_WORK(&data->led_work, asus_wireless_led_update);
+	data->led.name = "asus-wireless::airplane_mode";
+	data->led.brightness_set = asus_wireless_led_set;
+	data->led.brightness_get = asus_wireless_led_get;
+	data->led.flags = LED_CORE_SUSPENDRESUME;
+	data->led.max_brightness = 1;
+	data->led.default_trigger = "rfkill-airplane_mode";
+	err = devm_led_classdev_register(&adev->dev, &data->led);
+	if (err)
+		destroy_workqueue(data->wq);
+	return err;
 }
 
 static int asus_wireless_remove(struct acpi_device *adev)
 {
+	struct asus_wireless_data *data = acpi_driver_data(adev);
+
+	if (data->wq)
+		destroy_workqueue(data->wq);
 	return 0;
 }
 
-- 
2.5.0

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

* [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
  2016-02-08 17:05 [PATCH 0/5] asus-wireless: LED control João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 1/5] asus-wireless: Toggle airplane mode LED João Paulo Rechi Vita
@ 2016-02-08 17:05 ` João Paulo Rechi Vita
  2016-05-25  7:13   ` Corentin Chary
  2016-02-08 17:05 ` [PATCH 3/5] asus-wmi: Add quirk_no_rfkill for the Asus X552VW João Paulo Rechi Vita
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-08 17:05 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

Some Asus laptops that have an "airplane mode" indicator LED, also have
the WMI WLAN user bit set, and the following bits in their DSDT:

Scope (_SB)
{
  (...)
  Device (ATKD)
  {
    (...)
    Method (WMNB, 3, Serialized)
    {
      (...)
      If (LEqual (IIA0, 0x00010002))
      {
        OWGD (IIA1)
        Return (One)
      }
    }
  }
}

So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
wlan state, it drives the airplane mode indicator LED (through the call
to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
(since wlan is ON), and vice-versa.

This commit creates a quirk to not register a RFKill switch at all for
these laptops, to allow the asus-wireless driver to drive the airplane
mode LED correctly. It also adds a match to that quirk for the Asus
X555UB.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++++
 drivers/platform/x86/asus-wmi.c    |  8 +++++---
 drivers/platform/x86/asus-wmi.h    |  1 +
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 131fee2..cfee863 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -78,6 +78,10 @@ static struct quirk_entry quirk_asus_x200ca = {
 	.wapf = 2,
 };
 
+static struct quirk_entry quirk_no_rfkill = {
+	.no_rfkill = true,
+};
+
 static int dmi_matched(const struct dmi_system_id *dmi)
 {
 	quirks = dmi->driver_data;
@@ -297,6 +301,15 @@ static const struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_asus_x200ca,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK COMPUTER INC. X555UB",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X555UB"),
+		},
+		.driver_data = &quirk_no_rfkill,
+	},
 	{},
 };
 
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index a96630d..370fa347 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -2064,9 +2064,11 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_leds;
 
-	err = asus_wmi_rfkill_init(asus);
-	if (err)
-		goto fail_rfkill;
+	if (!asus->driver->quirks->no_rfkill) {
+		err = asus_wmi_rfkill_init(asus);
+		if (err)
+			goto fail_rfkill;
+	}
 
 	/* Some Asus desktop boards export an acpi-video backlight interface,
 	   stop this from showing up */
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index 4da4c8b..5de1df5 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -38,6 +38,7 @@ struct key_entry;
 struct asus_wmi;
 
 struct quirk_entry {
+	bool no_rfkill;
 	bool hotplug_wireless;
 	bool scalar_panel_brightness;
 	bool store_backlight_power;
-- 
2.5.0

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

* [PATCH 3/5] asus-wmi: Add quirk_no_rfkill for the Asus X552VW
  2016-02-08 17:05 [PATCH 0/5] asus-wireless: LED control João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 1/5] asus-wireless: Toggle airplane mode LED João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED João Paulo Rechi Vita
@ 2016-02-08 17:05 ` João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 4/5] asus-wmi: Add quirk_no_rfkill for the Asus U303LB João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA João Paulo Rechi Vita
  4 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-08 17:05 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index cfee863..86c0ae6 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -310,6 +310,15 @@ static const struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_no_rfkill,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK COMPUTER INC. X552VW",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X552VW"),
+		},
+		.driver_data = &quirk_no_rfkill,
+	},
 	{},
 };
 
-- 
2.5.0

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

* [PATCH 4/5] asus-wmi: Add quirk_no_rfkill for the Asus U303LB
  2016-02-08 17:05 [PATCH 0/5] asus-wireless: LED control João Paulo Rechi Vita
                   ` (2 preceding siblings ...)
  2016-02-08 17:05 ` [PATCH 3/5] asus-wmi: Add quirk_no_rfkill for the Asus X552VW João Paulo Rechi Vita
@ 2016-02-08 17:05 ` João Paulo Rechi Vita
  2016-02-08 17:05 ` [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA João Paulo Rechi Vita
  4 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-08 17:05 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Reported-by: Mousou Yuu <guogaishiwo@gmail.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 86c0ae6..4ded187 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -319,6 +319,15 @@ static const struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_no_rfkill,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK COMPUTER INC. U303LB",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "U303LB"),
+		},
+		.driver_data = &quirk_no_rfkill,
+	},
 	{},
 };
 
-- 
2.5.0

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

* [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA
  2016-02-08 17:05 [PATCH 0/5] asus-wireless: LED control João Paulo Rechi Vita
                   ` (3 preceding siblings ...)
  2016-02-08 17:05 ` [PATCH 4/5] asus-wmi: Add quirk_no_rfkill for the Asus U303LB João Paulo Rechi Vita
@ 2016-02-08 17:05 ` João Paulo Rechi Vita
  2016-02-08 21:03   ` Darren Hart
  4 siblings, 1 reply; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-08 17:05 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Reported-by: Ming Shuo Chiu <chiu@endlessm.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 4ded187..5adb842 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -328,6 +328,15 @@ static const struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_no_rfkill,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK COMPUTER INC. Z550MA",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Z550MA"),
+		},
+		.driver_data = &quirk_no_rfkill,
+	},
 	{},
 };
 
-- 
2.5.0

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

* Re: [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA
  2016-02-08 17:05 ` [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA João Paulo Rechi Vita
@ 2016-02-08 21:03   ` Darren Hart
  2016-02-09 21:39     ` João Paulo Rechi Vita
  0 siblings, 1 reply; 14+ messages in thread
From: Darren Hart @ 2016-02-08 21:03 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	linux-kernel, linux, João Paulo Rechi Vita

On Mon, Feb 08, 2016 at 12:05:23PM -0500, João Paulo Rechi Vita wrote:

I'm waiting for the RFKILL reviews to complete, but quickly, patches 4 and 5
require a commit message. There is always something you can add here, for
example, do these not have a switch or is it handled by a different driver? Etc.

> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
> Reported-by: Ming Shuo Chiu <chiu@endlessm.com>
> ---
>  drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
> index 4ded187..5adb842 100644
> --- a/drivers/platform/x86/asus-nb-wmi.c
> +++ b/drivers/platform/x86/asus-nb-wmi.c
> @@ -328,6 +328,15 @@ static const struct dmi_system_id asus_quirks[] = {
>  		},
>  		.driver_data = &quirk_no_rfkill,
>  	},
> +	{
> +		.callback = dmi_matched,
> +		.ident = "ASUSTeK COMPUTER INC. Z550MA",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "Z550MA"),
> +		},
> +		.driver_data = &quirk_no_rfkill,
> +	},
>  	{},
>  };
>  
> -- 
> 2.5.0
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

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

* Re: [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA
  2016-02-08 21:03   ` Darren Hart
@ 2016-02-09 21:39     ` João Paulo Rechi Vita
  0 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-02-09 21:39 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user, LKML, linux,
	João Paulo Rechi Vita

On 8 February 2016 at 16:03, Darren Hart <dvhart@infradead.org> wrote:
> On Mon, Feb 08, 2016 at 12:05:23PM -0500, João Paulo Rechi Vita wrote:
>
> I'm waiting for the RFKILL reviews to complete, but quickly, patches 4 and 5
> require a commit message. There is always something you can add here, for
> example, do these not have a switch or is it handled by a different driver? Etc.
>

All right, I'll work on the commit messages. Thanks!

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

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

* Re: [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
  2016-02-08 17:05 ` [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED João Paulo Rechi Vita
@ 2016-05-25  7:13   ` Corentin Chary
  2016-05-25 16:20       ` João Paulo Rechi Vita
  2016-05-25 21:24     ` Darren Hart
  0 siblings, 2 replies; 14+ messages in thread
From: Corentin Chary @ 2016-05-25  7:13 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Darren Hart, platform-driver-x86, acpi4asus-user, LKML, linux,
	João Paulo Rechi Vita

On Mon, Feb 8, 2016 at 6:05 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
> Some Asus laptops that have an "airplane mode" indicator LED, also have
> the WMI WLAN user bit set, and the following bits in their DSDT:
>
> Scope (_SB)
> {
>   (...)
>   Device (ATKD)
>   {
>     (...)
>     Method (WMNB, 3, Serialized)
>     {
>       (...)
>       If (LEqual (IIA0, 0x00010002))
>       {
>         OWGD (IIA1)
>         Return (One)
>       }
>     }
>   }
> }
>
> So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
> wlan state, it drives the airplane mode indicator LED (through the call
> to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
> (since wlan is ON), and vice-versa.
>
> This commit creates a quirk to not register a RFKill switch at all for
> these laptops, to allow the asus-wireless driver to drive the airplane
> mode LED correctly. It also adds a match to that quirk for the Asus
> X555UB.

This is really something that should get merged, multiple users are
affected by this. I do not own any of these laptops, but would there
be a way to detect this behavior instead of having static quircks ?

> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
> ---
>  drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++++
>  drivers/platform/x86/asus-wmi.c    |  8 +++++---
>  drivers/platform/x86/asus-wmi.h    |  1 +
>  3 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
> index 131fee2..cfee863 100644
> --- a/drivers/platform/x86/asus-nb-wmi.c
> +++ b/drivers/platform/x86/asus-nb-wmi.c
> @@ -78,6 +78,10 @@ static struct quirk_entry quirk_asus_x200ca = {
>         .wapf = 2,
>  };
>
> +static struct quirk_entry quirk_no_rfkill = {
> +       .no_rfkill = true,
> +};
> +
>  static int dmi_matched(const struct dmi_system_id *dmi)
>  {
>         quirks = dmi->driver_data;
> @@ -297,6 +301,15 @@ static const struct dmi_system_id asus_quirks[] = {
>                 },
>                 .driver_data = &quirk_asus_x200ca,
>         },
> +       {
> +               .callback = dmi_matched,
> +               .ident = "ASUSTeK COMPUTER INC. X555UB",
> +               .matches = {
> +                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> +                       DMI_MATCH(DMI_PRODUCT_NAME, "X555UB"),
> +               },
> +               .driver_data = &quirk_no_rfkill,
> +       },
>         {},
>  };
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index a96630d..370fa347 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -2064,9 +2064,11 @@ static int asus_wmi_add(struct platform_device *pdev)
>         if (err)
>                 goto fail_leds;
>
> -       err = asus_wmi_rfkill_init(asus);
> -       if (err)
> -               goto fail_rfkill;
> +       if (!asus->driver->quirks->no_rfkill) {
> +               err = asus_wmi_rfkill_init(asus);
> +               if (err)
> +                       goto fail_rfkill;
> +       }
>
>         /* Some Asus desktop boards export an acpi-video backlight interface,
>            stop this from showing up */
> diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
> index 4da4c8b..5de1df5 100644
> --- a/drivers/platform/x86/asus-wmi.h
> +++ b/drivers/platform/x86/asus-wmi.h
> @@ -38,6 +38,7 @@ struct key_entry;
>  struct asus_wmi;
>
>  struct quirk_entry {
> +       bool no_rfkill;
>         bool hotplug_wireless;
>         bool scalar_panel_brightness;
>         bool store_backlight_power;
> --
> 2.5.0
>



-- 
Corentin Chary
http://xf.iksaif.net

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

* Re: [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
  2016-05-25  7:13   ` Corentin Chary
@ 2016-05-25 16:20       ` João Paulo Rechi Vita
  2016-05-25 21:24     ` Darren Hart
  1 sibling, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-05-25 16:20 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Darren Hart, platform-driver-x86, acpi4asus-user, LKML, linux,
	João Paulo Rechi Vita

On 25 May 2016 at 03:13, Corentin Chary <corentin.chary@gmail.com> wrote:
> On Mon, Feb 8, 2016 at 6:05 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
>> Some Asus laptops that have an "airplane mode" indicator LED, also have
>> the WMI WLAN user bit set, and the following bits in their DSDT:
>>
>> Scope (_SB)
>> {
>>   (...)
>>   Device (ATKD)
>>   {
>>     (...)
>>     Method (WMNB, 3, Serialized)
>>     {
>>       (...)
>>       If (LEqual (IIA0, 0x00010002))
>>       {
>>         OWGD (IIA1)
>>         Return (One)
>>       }
>>     }
>>   }
>> }
>>
>> So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
>> wlan state, it drives the airplane mode indicator LED (through the call
>> to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
>> (since wlan is ON), and vice-versa.
>>
>> This commit creates a quirk to not register a RFKill switch at all for
>> these laptops, to allow the asus-wireless driver to drive the airplane
>> mode LED correctly. It also adds a match to that quirk for the Asus
>> X555UB.
>
> This is really something that should get merged, multiple users are
> affected by this. I do not own any of these laptops, but would there
> be a way to detect this behavior instead of having static quircks ?
>

I could not come up with a way to detect this, but I can probably
gather most (if not all) of the DSDTs if want to have a look at them.
In any case, I must say the asus-wireless patches that actually drive
the LED are still blocked on a couple of rfkill patches that implement
a new airplane-mode led trigger, which I'm trying to have merged for
the past two kernel releases. I can send a new series with only the
asus-wmi patches if you want to have them merged first, but in this
case the LED will not work (I imagine it will be always OFF) instead
of working in an inverted fashion. Just let me know!

Regards,

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

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

* Re: [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
@ 2016-05-25 16:20       ` João Paulo Rechi Vita
  0 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-05-25 16:20 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Darren Hart, platform-driver-x86, acpi4asus-user, LKML, linux,
	João Paulo Rechi Vita

On 25 May 2016 at 03:13, Corentin Chary <corentin.chary@gmail.com> wrote:
> On Mon, Feb 8, 2016 at 6:05 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
>> Some Asus laptops that have an "airplane mode" indicator LED, also have
>> the WMI WLAN user bit set, and the following bits in their DSDT:
>>
>> Scope (_SB)
>> {
>>   (...)
>>   Device (ATKD)
>>   {
>>     (...)
>>     Method (WMNB, 3, Serialized)
>>     {
>>       (...)
>>       If (LEqual (IIA0, 0x00010002))
>>       {
>>         OWGD (IIA1)
>>         Return (One)
>>       }
>>     }
>>   }
>> }
>>
>> So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
>> wlan state, it drives the airplane mode indicator LED (through the call
>> to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
>> (since wlan is ON), and vice-versa.
>>
>> This commit creates a quirk to not register a RFKill switch at all for
>> these laptops, to allow the asus-wireless driver to drive the airplane
>> mode LED correctly. It also adds a match to that quirk for the Asus
>> X555UB.
>
> This is really something that should get merged, multiple users are
> affected by this. I do not own any of these laptops, but would there
> be a way to detect this behavior instead of having static quircks ?
>

I could not come up with a way to detect this, but I can probably
gather most (if not all) of the DSDTs if want to have a look at them.
In any case, I must say the asus-wireless patches that actually drive
the LED are still blocked on a couple of rfkill patches that implement
a new airplane-mode led trigger, which I'm trying to have merged for
the past two kernel releases. I can send a new series with only the
asus-wmi patches if you want to have them merged first, but in this
case the LED will not work (I imagine it will be always OFF) instead
of working in an inverted fashion. Just let me know!

Regards,

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

* Re: [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
  2016-05-25  7:13   ` Corentin Chary
  2016-05-25 16:20       ` João Paulo Rechi Vita
@ 2016-05-25 21:24     ` Darren Hart
  2016-06-13 21:02         ` João Paulo Rechi Vita
  1 sibling, 1 reply; 14+ messages in thread
From: Darren Hart @ 2016-05-25 21:24 UTC (permalink / raw)
  To: Corentin Chary
  Cc: João Paulo Rechi Vita, platform-driver-x86, acpi4asus-user,
	LKML, linux, João Paulo Rechi Vita

On Wed, May 25, 2016 at 09:13:23AM +0200, Corentin Chary wrote:
> On Mon, Feb 8, 2016 at 6:05 PM, João Paulo Rechi Vita <jprvita@gmail.com> wrote:
> > Some Asus laptops that have an "airplane mode" indicator LED, also have
> > the WMI WLAN user bit set, and the following bits in their DSDT:
> >
> > Scope (_SB)
> > {
> >   (...)
> >   Device (ATKD)
> >   {
> >     (...)
> >     Method (WMNB, 3, Serialized)
> >     {
> >       (...)
> >       If (LEqual (IIA0, 0x00010002))
> >       {
> >         OWGD (IIA1)
> >         Return (One)
> >       }
> >     }
> >   }
> > }
> >
> > So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
> > wlan state, it drives the airplane mode indicator LED (through the call
> > to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
> > (since wlan is ON), and vice-versa.
> >
> > This commit creates a quirk to not register a RFKill switch at all for
> > these laptops, to allow the asus-wireless driver to drive the airplane
> > mode LED correctly. It also adds a match to that quirk for the Asus
> > X555UB.
> 
> This is really something that should get merged, multiple users are
> affected by this. I do not own any of these laptops, but would there
> be a way to detect this behavior instead of having static quircks ?

I believe this is all still blocked on the underlying RFKILL support. João,
correct me if I'm mistaken.

-- 
Darren Hart
Intel Open Source Technology Center

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

* Re: [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
  2016-05-25 21:24     ` Darren Hart
@ 2016-06-13 21:02         ` João Paulo Rechi Vita
  0 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-06-13 21:02 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user, LKML, linux,
	João Paulo Rechi Vita

On 25 May 2016 at 17:24, Darren Hart <dvhart@infradead.org> wrote:
>

(...)

> I believe this is all still blocked on the underlying RFKILL support. João,
> correct me if I'm mistaken.
>

That was true at the time of this message, but the RFKill
infrastructure that I was planning to use here is not going to be
merged. So the new plan is now to simply expose the LED to userspace
under a meaningful name ("asus-wireless::airplane") and have the
userspace people look for LEDs with this suffix and drive then
accordingly.

I have just sent an updated patchset.

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

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

* Re: [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED
@ 2016-06-13 21:02         ` João Paulo Rechi Vita
  0 siblings, 0 replies; 14+ messages in thread
From: João Paulo Rechi Vita @ 2016-06-13 21:02 UTC (permalink / raw)
  To: Darren Hart
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user, LKML, linux,
	João Paulo Rechi Vita

On 25 May 2016 at 17:24, Darren Hart <dvhart@infradead.org> wrote:
>

(...)

> I believe this is all still blocked on the underlying RFKILL support. João,
> correct me if I'm mistaken.
>

That was true at the time of this message, but the RFKill
infrastructure that I was planning to use here is not going to be
merged. So the new plan is now to simply expose the LED to userspace
under a meaningful name ("asus-wireless::airplane") and have the
userspace people look for LEDs with this suffix and drive then
accordingly.

I have just sent an updated patchset.

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

end of thread, other threads:[~2016-06-13 21:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 17:05 [PATCH 0/5] asus-wireless: LED control João Paulo Rechi Vita
2016-02-08 17:05 ` [PATCH 1/5] asus-wireless: Toggle airplane mode LED João Paulo Rechi Vita
2016-02-08 17:05 ` [PATCH 2/5] asus-wmi: Create quirk for airplane_mode LED João Paulo Rechi Vita
2016-05-25  7:13   ` Corentin Chary
2016-05-25 16:20     ` João Paulo Rechi Vita
2016-05-25 16:20       ` João Paulo Rechi Vita
2016-05-25 21:24     ` Darren Hart
2016-06-13 21:02       ` João Paulo Rechi Vita
2016-06-13 21:02         ` João Paulo Rechi Vita
2016-02-08 17:05 ` [PATCH 3/5] asus-wmi: Add quirk_no_rfkill for the Asus X552VW João Paulo Rechi Vita
2016-02-08 17:05 ` [PATCH 4/5] asus-wmi: Add quirk_no_rfkill for the Asus U303LB João Paulo Rechi Vita
2016-02-08 17:05 ` [PATCH 5/5] asus-wmi: Add quirk_no_rfkill for the Asus Z550MA João Paulo Rechi Vita
2016-02-08 21:03   ` Darren Hart
2016-02-09 21:39     ` João Paulo Rechi Vita

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.