Skip to contentSkip to conversation

WMI patches for 2.6.28 (Resend)

PATCH In review Carlos Corbacho 3 participants 6 messages Oct 8, 2008 – Oct 9, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover WMI patches for 2.6.28 (Resend)

Len,

The following are three WMI patches for 2.6.28 (resending them again, this is the same series I sent out a month ago).

The first two add rfkill support to acer-wmi for wireless & bluetooth, and remove the old sysfs interfaces for these.

The third patch, from Matthew Garrett, adds event enabling/ disabling for certain events to WMI, and is required for another WMI driver he's working on.

-Carlos
---

Carlos Corbacho (2):
acer-wmi: Remove wireless and bluetooth sysfs entries
acer-wmi: Add rfkill support for wireless and bluetooth

Matthew Garrett (1):
ACPI: WMI: Enable event methods when registering notifiers

 Documentation/laptops/acer-wmi.txt |   28 +---
 drivers/acpi/wmi.c                 |   39 ++++++
 drivers/misc/Kconfig               |    1 
 drivers/misc/acer-wmi.c            |  229 +++++++++++++++++++++++-------------
 4 files changed, 191 insertions(+), 106 deletions(-)
Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
#1 lore raw

PATCH 1/3 acer-wmi: Add rfkill support for wireless and bluetooth

This patch implements rfkill support for the wireless and bluetooth devices commonly found on Acer laptops.

For now, we will always poll these devices once a second to guarantee we can catch state changes. On newer Acer laptops, it may be possible to rely on WMI events to do this instead, and experimental support for this will be added in a later patch.

3G has been deliberately left off for now, as we still have no way to detect it, (nor, AFAIK, has any Linux user tried the code) and on laptops that don't support 3G, trying to poll for the status will leave the logs full of ACPI tracebacks.

The old sysfs interface for wireless and bluetooth will be removed in a later patch.

(Thanks to Henrique de Moraes Holschuh and Dmitry Torokhov for reviewing this patch).

---

 drivers/misc/Kconfig    |    1 
 drivers/misc/acer-wmi.c |  130 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+), 1 deletions(-)
drivers/misc/Kconfig +1 -0
index a726f3b..6abb959 100644
@@ -145,6 +145,7 @@ config ACER_WMI
 	depends on NEW_LEDS
 	depends on BACKLIGHT_CLASS_DEVICE
 	depends on SERIO_I8042
+	depends on RFKILL
 	select ACPI_WMI
 	---help---
 	  This is a driver for newer Acer (and Wistron) laptops. It adds
drivers/misc/acer-wmi.c +129 -1

160 lines not on this page · raw message

#2 lore raw

Re: [PATCH 1/3] acer-wmi: Add rfkill support for wireless and bluetooth

Hi Carlos,

drivers/misc/acer-wmi.c static void acer_backlight_exit(void) · line 1042

Quoted 13 lines · Carlos Corbacho
drivers/misc/acer-wmi.c +13 -0
+
+	rfkill_workqueue = create_singlethread_workqueue("rfkill_workqueue");
+	if (!rfkill_workqueue) {
+		if (has_cap(ACER_CAP_BLUETOOTH)) {
+			kfree(bluetooth_rfkill->data);
+			rfkill_unregister(bluetooth_rfkill);
+		}
+		kfree(wireless_rfkill->data);
+		rfkill_unregister(wireless_rfkill);
+		return -ENOMEM;
+	}
+	queue_delayed_work(rfkill_workqueue, &acer_rfkill_work, HZ);
+

Do we really need a private workqueue here? acer_rfkill_work seems to be a 'quickie' and so keventd should work pretty well here, shouldn't it?

Thanks!

Signature · 1 line
Dmitry
#3 lore raw

PATCH 2/3 acer-wmi: Remove wireless and bluetooth sysfs entries

In reply to Carlos Corbacho

These are now replaced by the rfkill interface.

---

 Documentation/laptops/acer-wmi.txt |   28 +---------
 drivers/misc/acer-wmi.c            |  101 +++++++-----------------------------
 2 files changed, 25 insertions(+), 104 deletions(-)
Documentation/laptops/acer-wmi.txt +4 -24
index 69b5dd4..2b3a6b5 100644
@@ -1,7 +1,7 @@
 Acer Laptop WMI Extras Driver
 http://code.google.com/p/aceracpi
-Version 0.1
-9th February 2008
+Version 0.2
+18th August 2008
 
 Copyright 2007-2008 Carlos Corbacho <[email protected]>
 
@@ -87,17 +87,7 @@ acer-wmi come with built-in wireless. However, should you feel so inclined to
 ever wish to remove the card, or swap it out at some point, please get in touch
 with me, as we may well be able to gain some data on wireless card detection.
 
-To read the status of the wireless radio (0=off, 1=on):
-cat /sys/devices/platform/acer-wmi/wireless
-
-To enable the wireless radio:
-echo 1 > /sys/devices/platform/acer-wmi/wireless
-
-To disable the wireless radio:
-echo 0 > /sys/devices/platform/acer-wmi/wireless
-
-To set the state of the wireless radio when loading acer-wmi, pass:
-wireless=X (where X is 0 or 1)
+The wireless radio is exposed through rfkill.
 
 Bluetooth
 *********
@@ -117,17 +107,7 @@ For the adventurously minded - if you want to buy an internal bluetooth
 module off the internet that is compatible with your laptop and fit it, then
 it will work just fine with acer-wmi.
 
-To read the status of the bluetooth module (0=off, 1=on):
-cat /sys/devices/platform/acer-wmi/wireless
-
-To enable the bluetooth module:
-echo 1 > /sys/devices/platform/acer-wmi/bluetooth
-
-To disable the bluetooth module:
-echo 0 > /sys/devices/platform/acer-wmi/bluetooth
-
-To set the state of the bluetooth module when loading acer-wmi, pass:
-bluetooth=X (where X is 0 or 1)
+Bluetooth is exposed through rfkill.
 
 3G
 **
drivers/misc/acer-wmi.c +21 -80

161 lines not on this page · raw message

#4 lore raw

PATCH 3/3 ACPI: WMI: Enable event methods when registering notifiers

In reply to Carlos Corbacho

From: Matthew Garrett <[email protected]>

According to the ACPI-WMI spec, event blocks may provide a function call for enabling/disabling them. This patch adds support for making these calls when registering or removing notifications. Without this, my Dell firmware provides no data in the event notification.

---

 drivers/acpi/wmi.c |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)
drivers/acpi/wmi.c +37 -2
index cfe2c83..5464cfc 100644
@@ -217,6 +217,35 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
 	return 0;
 }
 
+static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
+{
+	struct guid_block *block = NULL;
+	char method[5];
+	struct acpi_object_list input;
+	union acpi_object params[1];
+	acpi_status status;
+	acpi_handle handle;
+
+	block = &wblock->gblock;
+	handle = wblock->handle;
+
+	if (!block)
+		return AE_NOT_EXIST;
+
+	input.count = 1;
+	input.pointer = params;
+	params[0].type = ACPI_TYPE_INTEGER;
+	params[0].integer.value = enable;
+
+	snprintf(method, 5, "WE%02X", block->notify_id);
+	status = acpi_evaluate_object(handle, method, &input, NULL);
+
+	if (status != AE_OK && status != AE_NOT_FOUND)
+		return status;
+	else
+		return AE_OK;
+}
+
 /*
  * Exported WMI functions
  */
@@ -427,6 +456,7 @@ acpi_status wmi_install_notify_handler(const char *guid,
 wmi_notify_handler handler, void *data)
 {
 	struct wmi_block *block;
+	acpi_status status;
 
 	if (!guid || !handler)
 		return AE_BAD_PARAMETER;
@@ -441,7 +471,9 @@ wmi_notify_handler handler, void *data)
 	block->handler = handler;
 	block->handler_data = data;
 
-	return AE_OK;
+	status = wmi_method_enable(block, 1);
+
+	return status;
 }
 EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
 
@@ -453,6 +485,7 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
 acpi_status wmi_remove_notify_handler(const char *guid)
 {
 	struct wmi_block *block;
+	acpi_status status;
 
 	if (!guid)
 		return AE_BAD_PARAMETER;
@@ -464,10 +497,12 @@ acpi_status wmi_remove_notify_handler(const char *guid)
 	if (!block->handler)
 		return AE_NULL_ENTRY;
 
+	status = wmi_method_enable(block, 0);
+
 	block->handler = NULL;
 	block->handler_data = NULL;
 
-	return AE_OK;
+	return status;
 }
 EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
 
reviewer
#5 lore raw
In reply to Carlos Corbacho

series applied to acpi-test.

thanks,
-len

Quoted 38 lines · Carlos Corbacho

Len,

The following are three WMI patches for 2.6.28 (resending them again, this is the same series I sent out a month ago).

The first two add rfkill support to acer-wmi for wireless & bluetooth, and remove the old sysfs interfaces for these.

The third patch, from Matthew Garrett, adds event enabling/ disabling for certain events to WMI, and is required for another WMI driver he's working on.

-Carlos
---

Carlos Corbacho (2):
acer-wmi: Remove wireless and bluetooth sysfs entries
acer-wmi: Add rfkill support for wireless and bluetooth

Matthew Garrett (1):
ACPI: WMI: Enable event methods when registering notifiers

 Documentation/laptops/acer-wmi.txt |   28 +---
 drivers/acpi/wmi.c                 |   39 ++++++
 drivers/misc/Kconfig               |    1 
 drivers/misc/acer-wmi.c            |  229 +++++++++++++++++++++++-------------
 4 files changed, 191 insertions(+), 106 deletions(-)
Signature · 7 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html