From patchwork Mon Oct 18 15:07:43 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: 262331 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 o9IFCQJh021831 for ; Mon, 18 Oct 2010 15:12:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755487Ab0JRPMZ (ORCPT ); Mon, 18 Oct 2010 11:12:25 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:53623 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755405Ab0JRPMZ (ORCPT ); Mon, 18 Oct 2010 11:12:25 -0400 Received: by gyg13 with SMTP id 13so446896gyg.19 for ; Mon, 18 Oct 2010 08:12:24 -0700 (PDT) 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; bh=n+AvO83MkuVZEUdewAZyaULbSuMQCR6Y8K8qB5rNVVM=; b=XsuUOsZLjsPDTt/rkVvcEFpTxJTgbGNRgeGn0Z2+PhcR2FGBUGZeDmR/KyXDyDa5kG ekip+JrSRdRJqVbLn9MDnfGdB8ZVMJP7XuZP3lQweSQRXJmv7D8586CWi06glOx/sPgq XVBvbsn2IfLb6VQklqkFpWUSP/LlTH54V6HOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=hv22X0zmcPHXlWLdLk74XZ2MNqyOxnVpTumz2bGHEQOzVvHxMDsLAF42P3VYNynz05 mkBWqJMmcRH551hLluW+QUzwpaiWvP40IgfLHim2hw/5c9k8O7bm8lK6XNTMn2Run/aI PN4+DHqJ27VH9cJ5nleE90ExECo/vZWD4uogU= Received: by 10.204.103.207 with SMTP id l15mr4474184bko.196.1287414742771; Mon, 18 Oct 2010 08:12:22 -0700 (PDT) Received: from localhost.localdomain (124-11-22-254.dynamic.tfn.net.tw [124.11.22.254]) by mx.google.com with ESMTPS id o12sm15925572bkb.21.2010.10.18.08.12.15 (version=SSLv3 cipher=RC4-MD5); Mon, 18 Oct 2010 08:12:19 -0700 (PDT) From: "Lee, Chun-Yi" To: platform-driver-x86@vger.kernel.org Cc: mjg59@srcf.ucam.org, carlos@strangeworlds.co.uk, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com, tiwai@novell.com, trenn@novell.com, jbenc@suse.cz, corentin.chary@gmail.com, GregKH@novell.com, "Lee, Chun-Yi" Subject: [PATCH 4/4] Detect the WiFi/Bluetooth/3G devices available Date: Mon, 18 Oct 2010 23:07:43 +0800 Message-Id: <1287414463-13973-1-git-send-email-jlee@novell.com> X-Mailer: git-send-email 1.6.0.2 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, 18 Oct 2010 15:12:26 +0000 (UTC) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 7a17ebe..24f31b4 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_THREEG (1<<6) /* 3G */ +#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,15 @@ struct wmid3_gds_return_value { /* Get Device Status return value*/ u32 reserved; } __attribute__((packed)); +#define ACER_DMI_DEV_TYPE_AA 170 + +struct hotkey_function_type_aa { + u8 type; + u8 length; + u16 handle; + u16 commun_func_bitmap; +} __attribute__((packed)); + /* * Interface capability flags */ @@ -184,6 +196,7 @@ static int brightness = -1; static int threeg = -1; static int force_series; static bool launch_manager; +static struct hotkey_function_type_aa *type_aa; module_param(mailled, int, 0444); module_param(brightness, int, 0444); @@ -824,6 +837,24 @@ 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) +{ + /* We are looking for OEM-specific Type Aah */ + if (header->type != ACER_DMI_DEV_TYPE_AA) + return; + + type_aa = (struct hotkey_function_type_aa *) header; + + printk(ACER_INFO "Function biti map 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 +875,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 (!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 +964,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 (!type_aa) + set_u32(threeg, ACER_CAP_THREEG); set_u32(brightness, ACER_CAP_BRIGHTNESS); }