From 3c71f0c2a93cd10d56ddfc8fabd0d2cdfe9e10c6 Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Tue, 7 Dec 2010 10:29:23 +0800 Subject: [PATCH] --- yaml --- r: 227879 b: refs/heads/master c: 6c3df88f19375217f0dbfc6160e8c2a635f56c53 h: refs/heads/master i: 227877: 777cccbc948e419cce684d8fd61b08346daf4cc2 227875: 3658c05cd53cc1539eec6462b894162dfa5b23f8 227871: b8ad06f1bb20df82f3d44aae9e7a2d6a7a157c98 v: v3 --- [refs] | 2 +- trunk/drivers/platform/x86/acer-wmi.c | 49 +++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index d79c962c9556..0ee76f1b991e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b3c9092b2fed427d45117d23ceb577ad8dc46a9a +refs/heads/master: 6c3df88f19375217f0dbfc6160e8c2a635f56c53 diff --git a/trunk/drivers/platform/x86/acer-wmi.c b/trunk/drivers/platform/x86/acer-wmi.c index 85d263349aac..583565a8bbce 100644 --- a/trunk/drivers/platform/x86/acer-wmi.c +++ b/trunk/drivers/platform/x86/acer-wmi.c @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -124,7 +125,9 @@ struct event_return_value { /* * GUID3 Get Device Status device flags */ +#define ACER_WMID3_GDS_WIRELESS (1<<0) /* WiFi */ #define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ +#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */ struct wmid3_gds_input_param { /* Get Device Status input parameter */ u8 function_num; /* Function Number */ @@ -139,6 +142,13 @@ struct wmid3_gds_return_value { /* Get Device Status return value*/ u32 reserved; } __attribute__((packed)); +struct hotkey_function_type_aa { + u8 type; + u8 length; + u16 handle; + u16 commun_func_bitmap; +} __attribute__((packed)); + /* * Interface capability flags */ @@ -169,6 +179,7 @@ static int mailled = -1; static int brightness = -1; static int threeg = -1; static int force_series; +static bool has_type_aa; module_param(mailled, int, 0444); module_param(brightness, int, 0444); @@ -807,6 +818,28 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface) return WMI_execute_u32(method_id, (u32)value, NULL); } +static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy) +{ + struct hotkey_function_type_aa *type_aa; + + /* We are looking for OEM-specific Type AAh */ + if (header->type != 0xAA) + return; + + has_type_aa = true; + type_aa = (struct hotkey_function_type_aa *) header; + + printk(ACER_INFO "Function bitmap for Communication Button: 0x%x\n", + type_aa->commun_func_bitmap); + + if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_WIRELESS) + interface->capability |= ACER_CAP_WIRELESS; + if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_THREEG) + interface->capability |= ACER_CAP_THREEG; + if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH) + interface->capability |= ACER_CAP_BLUETOOTH; +} + static acpi_status WMID_set_capabilities(void) { struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; @@ -827,16 +860,17 @@ static acpi_status WMID_set_capabilities(void) return AE_ERROR; } - /* Not sure on the meaning of the relevant bits yet to detect these */ - interface->capability |= ACER_CAP_WIRELESS; - interface->capability |= ACER_CAP_THREEG; + dmi_walk(type_aa_dmi_decode, NULL); + if (!has_type_aa) { + interface->capability |= ACER_CAP_WIRELESS; + interface->capability |= ACER_CAP_THREEG; + if (devices & 0x10) + interface->capability |= ACER_CAP_BLUETOOTH; + } /* WMID always provides brightness methods */ interface->capability |= ACER_CAP_BRIGHTNESS; - if (devices & 0x10) - interface->capability |= ACER_CAP_BLUETOOTH; - if (!(devices & 0x20)) max_brightness = 0x9; @@ -915,7 +949,8 @@ static void __init acer_commandline_init(void) * capability isn't available on the given interface */ set_u32(mailled, ACER_CAP_MAILLED); - set_u32(threeg, ACER_CAP_THREEG); + if (!has_type_aa) + set_u32(threeg, ACER_CAP_THREEG); set_u32(brightness, ACER_CAP_BRIGHTNESS); }