From patchwork Tue Dec 7 02:29:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 381432 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 oB72ViUE001315 for ; Tue, 7 Dec 2010 02:31:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755024Ab0LGCbg (ORCPT ); Mon, 6 Dec 2010 21:31:36 -0500 Received: from mail-qy0-f174.google.com ([209.85.216.174]:49521 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755011Ab0LGCbe (ORCPT ); Mon, 6 Dec 2010 21:31:34 -0500 Received: by qyk11 with SMTP id 11so4401554qyk.19 for ; Mon, 06 Dec 2010 18:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=L0+5f/xR4yz9bUIpbLxu3WCI2drBaSf14LEi3s3WUw0=; b=adTfn7DPt+P8j2loCOKuGTRiNMDlFV43Xm1Ls1mhyVyC07JdHLjPWbABXuNYsS4Phg AQkSnt/uty43FTJtW3477UXBEk90ERK/wESUFYUSVVPRbgdW8OkNMoWxVfNnrfG5NI8n bq8Moj8MRMI3+PC41H3jeRxyz7AvpLOweE4XM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=QHn1tbPZQVTqdN8ef0POzUTwFDoK49jiraRq+4MrqF3qry0Qu1gr1WKTO30Nob/p1u TM6nfrMqVtdWcEtcuEA/9/eZSOkRHNIokaAD0ucddkazoXRfw5a0Dw76Wo5MJ8moHVZa gpe4Jz89443iJ3nwc4hc1lKynZCcGPcBBWrlQ= Received: by 10.220.178.72 with SMTP id bl8mr1671124vcb.126.1291689093573; Mon, 06 Dec 2010 18:31:33 -0800 (PST) Received: from localhost.localdomain ([61.14.133.18]) by mx.google.com with ESMTPS id j21sm740922vcr.10.2010.12.06.18.31.28 (version=SSLv3 cipher=RC4-MD5); Mon, 06 Dec 2010 18:31:33 -0800 (PST) From: "Lee, Chun-Yi" To: mjg59@srcf.ucam.org Cc: dmitry.torokhov@gmail.com, corentin.chary@gmail.com, corentincj@iksaif.net, tiwai@novell.com, carlos@strangeworlds.co.uk, jbenc@suse.cz, jdelvare@suse.de, trenn@suse.de, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, "Lee, Chun-Yi" Subject: [PATCH 4/4] acer-wmi: Detect the WiFi/Bluetooth/3G devices available Date: Tue, 7 Dec 2010 10:29:23 +0800 Message-Id: <1291688963-23232-5-git-send-email-jlee@novell.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1291688963-23232-4-git-send-email-jlee@novell.com> References: <1291688963-23232-1-git-send-email-jlee@novell.com> <1291688963-23232-2-git-send-email-jlee@novell.com> <1291688963-23232-3-git-send-email-jlee@novell.com> <1291688963-23232-4-git-send-email-jlee@novell.com> 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]); Tue, 07 Dec 2010 02:31:45 +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); }