Skip to contentSkip to conversation

acer-wmi patches for 2.6.27

PATCH In review Carlos Corbacho 2 participants 9 messages Jun 21, 2008 – Jun 26, 2008

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

cover acer-wmi patches for 2.6.27

Len,

The following series is the latest set of updates for acer-wmi.

For the most part, these are just a few minor tweaks, fixes for Fujitsu Siemens laptops, and the addition of some debugfs output for future reverse engineering.

-Carlos
---

Carlos Corbacho (7):
acer-wmi: Remove version number
acer-wmi: Add debugfs file for device detection
acer-wmi: Disable device autodetection on Fujitsu Siemens Amilo Li2732
acer-wmi: Add EC quirk for Fujitsu Siemens Amilo Li 1718
acer-wmi: Respect framebuffer blanking in backlight
acer-wmi: Blacklist backlight on Acer Aspire 1520 & 1360 series
acer-wmi: Remove LED colour comment from documentation

 Documentation/laptops/acer-wmi.txt |    2 
 drivers/misc/acer-wmi.c            |  145 ++++++++++++++++++++++++++++++++++--
 2 files changed, 135 insertions(+), 12 deletions(-)
#1 lore raw

PATCH 1/7 acer-wmi: Remove LED colour comment from documentation

This should have been removed when the colour was removed from the LED device name.

---

 Documentation/laptops/acer-wmi.txt |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
Documentation/laptops/acer-wmi.txt +0 -2
index 79b7dbd..69b5dd4 100644
@@ -174,8 +174,6 @@ The LED is exposed through the LED subsystem, and can be found in:
 The mail LED is autodetected, so if you don't have one, the LED device won't
 be registered.
 
-If you have a mail LED that is not green, please report this to me.
-
 Backlight
 *********
 
#2 lore raw

PATCH 2/7 acer-wmi: Blacklist backlight on Acer Aspire 1520 & 1360 series

In reply to Carlos Corbacho

A newer BIOS for these laptops adds ACPI-WMI support to them. However, it does not add support for the backlight via the EC, and we have no way to detect this on older machines, so blacklist it from them.

---

 drivers/misc/acer-wmi.c |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)
drivers/misc/acer-wmi.c +27 -4
index dd13a37..b82ff25 100644
@@ -174,7 +174,7 @@ static struct wmi_interface *interface;
 struct quirk_entry {
 	u8 wireless;
 	u8 mailled;
-	u8 brightness;
+	s8 brightness;
 	u8 bluetooth;
 };
 
@@ -198,6 +198,10 @@ static int dmi_matched(const struct dmi_system_id *dmi)
 static struct quirk_entry quirk_unknown = {
 };
 
+static struct quirk_entry quirk_acer_aspire_1520 = {
+	.brightness = -1,
+};
+
 static struct quirk_entry quirk_acer_travelmate_2490 = {
 	.mailled = 1,
 };
@@ -210,6 +214,24 @@ static struct quirk_entry quirk_medion_md_98300 = {
 static struct dmi_system_id acer_quirks[] = {
 	{
 		.callback = dmi_matched,
+		.ident = "Acer Aspire 1360",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
+		},
+		.driver_data = &quirk_acer_aspire_1520,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "Acer Aspire 1520",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1520"),
+		},
+		.driver_data = &quirk_acer_aspire_1520,
+	},
+	{
+		.callback = dmi_matched,
 		.ident = "Acer Aspire 3100",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -552,7 +574,8 @@ static acpi_status AMW0_set_capabilities(void)
 	 * appear to use the same EC register for brightness, even if they
 	 * differ for wireless, etc
 	 */
-	interface->capability |= ACER_CAP_BRIGHTNESS;
+	if (quirks->brightness >= 0)
+		interface->capability |= ACER_CAP_BRIGHTNESS;
 
 	return AE_OK;
 }
@@ -1059,6 +1082,8 @@ static int __init acer_wmi_init(void)
 	printk(ACER_INFO "Acer Laptop ACPI-WMI Extras version %s\n",
 			ACER_WMI_VERSION);
 
+	find_quirks();
+
 	/*
 	 * Detect which ACPI-WMI interface we're using.
 	 */
@@ -1092,8 +1117,6 @@ static int __init acer_wmi_init(void)
 	if (wmi_has_guid(AMW0_GUID1))
 		AMW0_find_mailled();
 
-	find_quirks();
-
 	if (!interface) {
 		printk(ACER_ERR "No or unsupported WMI interface, unable to "
 				"load\n");
#3 lore raw

PATCH 3/7 acer-wmi: Respect framebuffer blanking in backlight

In reply to Carlos Corbacho

If the framebuffer has requested blanking, turn the backlight down. Also offer the user the option to do this.

---

 drivers/misc/acer-wmi.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
drivers/misc/acer-wmi.c +12 -2
index b82ff25..e35825f 100644
@@ -29,6 +29,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/dmi.h>
+#include <linux/fb.h>
 #include <linux/backlight.h>
 #include <linux/leds.h>
 #include <linux/platform_device.h>
@@ -830,7 +831,15 @@ static int read_brightness(struct backlight_device *bd)
 
 static int update_bl_status(struct backlight_device *bd)
 {
-	set_u32(bd->props.brightness, ACER_CAP_BRIGHTNESS);
+	int intensity = bd->props.brightness;
+
+	if (bd->props.power != FB_BLANK_UNBLANK)
+		intensity = 0;
+	if (bd->props.fb_blank != FB_BLANK_UNBLANK)
+		intensity = 0;
+
+	set_u32(intensity, ACER_CAP_BRIGHTNESS);
+
 	return 0;
 }
 
@@ -852,8 +861,9 @@ static int __devinit acer_backlight_init(struct device *dev)
 
 	acer_backlight_device = bd;
 
+	bd->props.power = FB_BLANK_UNBLANK;
+	bd->props.brightness = max_brightness;
 	bd->props.max_brightness = max_brightness;
-	bd->props.brightness = read_brightness(NULL);
 	backlight_update_status(bd);
 	return 0;
 }
#4 lore raw

PATCH 4/7 acer-wmi: Add EC quirk for Fujitsu Siemens Amilo Li 1718

In reply to Carlos Corbacho

This laptop needs a different EC quirk from the standard Acer one to read the wireless status.

---

 drivers/misc/acer-wmi.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/misc/acer-wmi.c +19 -0
index e35825f..5b7c5fc 100644
@@ -212,6 +212,10 @@ static struct quirk_entry quirk_medion_md_98300 = {
 	.wireless = 1,
 };
 
+static struct quirk_entry quirk_fujitsu_amilo_li_1718 = {
+	.wireless = 2,
+};
+
 static struct dmi_system_id acer_quirks[] = {
 	{
 		.callback = dmi_matched,
@@ -323,6 +327,15 @@ static struct dmi_system_id acer_quirks[] = {
 	},
 	{
 		.callback = dmi_matched,
+		.ident = "Fujitsu Siemens Amilo Li 1718",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Li 1718"),
+		},
+		.driver_data = &quirk_fujitsu_amilo_li_1718,
+	},
+	{
+		.callback = dmi_matched,
 		.ident = "Medion MD 98300",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
@@ -416,6 +429,12 @@ struct wmi_interface *iface)
 				return AE_ERROR;
 			*value = result & 0x1;
 			return AE_OK;
+		case 2:
+			err = ec_read(0x71, &result);
+			if (err)
+				return AE_ERROR;
+			*value = result & 0x1;
+			return AE_OK;
 		default:
 			err = ec_read(0xA, &result);
 			if (err)
#5 lore raw

PATCH 5/7 acer-wmi: Disable device autodetection on Fujitsu Siemens Amilo Li2732

In reply to Carlos Corbacho

The AMW0 (V1) device detection method doesn't work properly on this laptop, so disable it, and for other laptops that may have this problem, by switching on a strange GUID.

---

 drivers/misc/acer-wmi.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/misc/acer-wmi.c +10 -0
index 5b7c5fc..dd0b8d8 100644
@@ -88,6 +88,7 @@ struct acer_quirks {
  * Acer ACPI method GUIDs
  */
 #define AMW0_GUID1		"67C3371D-95A3-4C37-BB61-DD47B491DAAB"
+#define AMW0_GUID2		"431F16ED-0C2B-444C-B267-27DEB140CF9C"
 #define WMID_GUID1		"6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3"
 #define WMID_GUID2		"95764E09-FB56-4e83-B31A-37761F60994A"
 
@@ -548,6 +549,15 @@ static acpi_status AMW0_set_capabilities(void)
 	struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
 
+	/*
+	 * On laptops with this strange GUID (non Acer), normal probing doesn't
+	 * work.
+	 */
+	if (wmi_has_guid(AMW0_GUID2)) {
+		interface->capability |= ACER_CAP_WIRELESS;
+		return AE_OK;
+	}
+
 	args.eax = ACER_AMW0_WRITE;
 	args.ecx = args.edx = 0;
 
#6 lore raw

PATCH 6/7 acer-wmi: Add debugfs file for device detection

In reply to Carlos Corbacho

Add a debugfs file for showing the full results of the method we use to detect devices on WMID laptops.

This should be useful in the case that a Linux user gets an Acer laptop with 3G support (and/ or people who enjoy ripping their wireless cards out) so we can get some feedback on how this value changes in these cases.

(At the moment, we always enable the wireless and 3G control. In the case of the former, this is fairly safe. In the case of the latter though, trying to toggle this device if it doesn't exist on a laptop causes ACPI warnings/ errors).

To summarise: If you have an Acer laptop with a built in 3G card, please report back the value from this file.

---

 drivers/misc/acer-wmi.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)
drivers/misc/acer-wmi.c +66 -0
index dd0b8d8..d8b8574 100644
@@ -35,6 +35,7 @@
 #include <linux/platform_device.h>
 #include <linux/acpi.h>
 #include <linux/i8042.h>
+#include <linux/debugfs.h>
 
 #include <acpi/acpi_drivers.h>
 
@@ -152,6 +153,12 @@ struct acer_data {
 	int brightness;
 };
 
+struct acer_debug {
+	struct dentry *root;
+	struct dentry *devices;
+	u32 wmid_devices;
+};
+
 /* Each low-level interface must define at least some of the following */
 struct wmi_interface {
 	/* The WMI device type */
@@ -162,6 +169,9 @@ struct wmi_interface {
 
 	/* Private data for the current interface */
 	struct acer_data data;
+
+	/* debugfs entries associated with this interface */
+	struct acer_debug debug;
 };
 
 /* The static interface pointer, points to the currently detected interface */
@@ -956,6 +966,28 @@ static DEVICE_ATTR(interface, S_IWUGO | S_IRUGO | S_IWUSR,
 	show_interface, NULL);
 
 /*
+ * debugfs functions
+ */
+static u32 get_wmid_devices(void)
+{
+	struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
+	union acpi_object *obj;
+	acpi_status status;
+
+	status = wmi_query_block(WMID_GUID2, 1, &out);
+	if (ACPI_FAILURE(status))
+		return 0;
+
+	obj = (union acpi_object *) out.pointer;
+	if (obj && obj->type == ACPI_TYPE_BUFFER &&
+		obj->buffer.length == sizeof(u32)) {
+		return *((u32 *) obj->buffer.pointer);
+	} else {
+		return 0;
+	}
+}
+
+/*
  * Platform device
  */
 static int __devinit acer_platform_probe(struct platform_device *device)
@@ -1114,6 +1146,33 @@ error_sysfs:
 	return retval;
 }
 
+static void remove_debugfs(void)
+{
+	debugfs_remove(interface->debug.devices);
+	debugfs_remove(interface->debug.root);
+}
+
+static int create_debugfs(void)
+{
+	interface->debug.root = debugfs_create_dir("acer-wmi", NULL);
+	if (!interface->debug.root) {
+		printk(ACER_ERR "Failed to create debugfs directory");
+		return -ENOMEM;
+	}
+
+	interface->debug.devices = debugfs_create_u32("devices", S_IRUGO,
+					interface->debug.root,
+					&interface->debug.wmid_devices);
+	if (!interface->debug.devices)
+		goto error_debugfs;
+
+	return 0;
+
+error_debugfs:
+		remove_debugfs();
+	return -ENOMEM;
+}
+
 static int __init acer_wmi_init(void)
 {
 	int err;
@@ -1173,6 +1232,13 @@ static int __init acer_wmi_init(void)
 	if (err)
 		return err;
 
+	if (wmi_has_guid(WMID_GUID2)) {
+		interface->debug.wmid_devices = get_wmid_devices();
+		err = create_debugfs();
+		if (err)
+			return err;
+	}
+
 	/* Override any initial settings with values from the commandline */
 	acer_commandline_init();
 
#7 lore raw

PATCH 7/7 acer-wmi: Remove version number

In reply to Carlos Corbacho

It doesn't make much sense these days.

---

 drivers/misc/acer-wmi.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/misc/acer-wmi.c +1 -4
index d8b8574..e7a3fe5 100644
@@ -22,8 +22,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define ACER_WMI_VERSION	"0.1"
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -1177,8 +1175,7 @@ static int __init acer_wmi_init(void)
 {
 	int err;
 
-	printk(ACER_INFO "Acer Laptop ACPI-WMI Extras version %s\n",
-			ACER_WMI_VERSION);
+	printk(ACER_INFO "Acer Laptop ACPI-WMI Extras\n");
 
 	find_quirks();
 
reviewer
#8 lore raw
In reply to Carlos Corbacho
Quoted 20 lines

The following series is the latest set of updates for acer-wmi.

For the most part, these are just a few minor tweaks, fixes for Fujitsu Siemens laptops, and the addition of some debugfs output for future reverse engineering.

-Carlos
---

Carlos Corbacho (7):
acer-wmi: Remove version number
acer-wmi: Add debugfs file for device detection
acer-wmi: Disable device autodetection on Fujitsu Siemens Amilo Li2732
acer-wmi: Add EC quirk for Fujitsu Siemens Amilo Li 1718
acer-wmi: Respect framebuffer blanking in backlight
acer-wmi: Blacklist backlight on Acer Aspire 1520 & 1360 series
acer-wmi: Remove LED colour comment from documentation

Quoted 4 lines
 Documentation/laptops/acer-wmi.txt |    2 
 drivers/misc/acer-wmi.c            |  145 ++++++++++++++++++++++++++++++++++--
 2 files changed, 135 insertions(+), 12 deletions(-)

Thanks Carolos,
1-7 applied to acpi-test.

-len