From patchwork Mon Nov 8 04:54:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Lee X-Patchwork-Id: 307612 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA84sTfO007376 for ; Mon, 8 Nov 2010 04:54:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751566Ab0KHEy1 (ORCPT ); Sun, 7 Nov 2010 23:54:27 -0500 Received: from novprvlin0050.provo.novell.com ([137.65.248.33]:19359 "EHLO novprvlin0050.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036Ab0KHEy0 (ORCPT ); Sun, 7 Nov 2010 23:54:26 -0500 Received: from INET-PRV1-MTA by novprvlin0050.provo.novell.com with Novell_GroupWise; Sun, 07 Nov 2010 21:54:25 -0700 Message-Id: <4CD81D2E02000023000237A6@novprvlin0050.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.2 Date: Sun, 07 Nov 2010 21:54:22 -0700 From: "Joey Lee" To: Cc: , , "Takashi Iwai" , "Thomas Renninger" , , , , , , Subject: Re: [PATCH 4/4] Detect the WiFi/Bluetooth/3G devices available Mime-Version: 1.0 Content-Disposition: inline Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 08 Nov 2010 04:54:29 +0000 (UTC) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 6ac4656..dc23140 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -138,7 +139,9 @@ struct lm_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 */ @@ -153,6 +156,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 */ @@ -184,6 +194,7 @@ static int brightness = -1; static int threeg = -1; static int force_series; static bool ec_raw_mode; +static bool has_type_aa; module_param(mailled, int, 0444); module_param(brightness, int, 0444); @@ -824,6 +835,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}; @@ -844,16 +877,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; @@ -932,7 +966,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); }