From patchwork Sat Oct 30 16:36:33 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: 292122 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 o9UGZWeL027721 for ; Sat, 30 Oct 2010 16:37:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754841Ab0J3Qhw (ORCPT ); Sat, 30 Oct 2010 12:37:52 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:53875 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754813Ab0J3Qhv (ORCPT ); Sat, 30 Oct 2010 12:37:51 -0400 Received: by mail-wy0-f174.google.com with SMTP id 28so4136032wyf.19 for ; Sat, 30 Oct 2010 09:37:51 -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:in-reply-to:references; bh=MN4kQY1TXWVRnjbqPE2t8dWqIwj+2p21Jcr3/3Xgvqg=; b=ih35v1iQziFRW0JkHzdBPm6CinDEAtTUW4RGAm8noT9FH5C6l+zEGte439GucBJMSU CXZk0pgFKARRopuc4G3Cgpgbn8gUbXIJJDPlPxVYgwBejP8HKjOL2Hkhtz0Fh4bGPofi Wa8kobvvla/VXW/oWJO3dkQN031UIDnbp4n7A= 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=vxt5FTH3X99xD7OOy1RRz28xcS3WNaYdXcwHU/Xhi9QTezeN/VkQVWMu39SNiJry2r dvF5z59okFXZ7LyvyIZRXJLvIuOT4UDGeewCUbM2KBgoJKIWKyc24vI2fi/Vy9988eCx 9LRxAPkA60+6zdOThHMCmrOThoDrCyENSbioI= Received: by 10.216.7.194 with SMTP id 44mr13510085wep.7.1288456670882; Sat, 30 Oct 2010 09:37:50 -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 x15sm2491487weq.31.2010.10.30.09.37.45 (version=SSLv3 cipher=RC4-MD5); Sat, 30 Oct 2010 09:37:50 -0700 (PDT) From: "Lee, Chun-Yi" To: platform-driver-x86@vger.kernel.org Cc: linux-input@vger.kernel.org, carlos@strangeworlds.co.uk, corentin.chary@gmail.com, dmitry.torokhov@gmail.com, tiwai@novell.com, trenn@novell.com, mjg59@srcf.ucam.org, jbenc@suse.cz, "Lee, Chun-Yi" Subject: [PATCH 4/4] Detect the WiFi/Bluetooth/3G devices available Date: Sun, 31 Oct 2010 00:36:33 +0800 Message-Id: <1288456593-6868-4-git-send-email-jlee@novell.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1288456593-6868-3-git-send-email-jlee@novell.com> References: <1288456593-6868-1-git-send-email-jlee@novell.com> <1288456593-6868-2-git-send-email-jlee@novell.com> <1288456593-6868-3-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]); Sat, 30 Oct 2010 16:37:53 +0000 (UTC) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 9656464..0247a70 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 ec_raw_mode; +static struct hotkey_function_type_aa *type_aa; module_param(mailled, int, 0444); module_param(brightness, int, 0444); @@ -824,6 +837,18 @@ 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); +} + static acpi_status WMID_set_capabilities(void) { struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; @@ -844,16 +869,24 @@ 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) { + 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; + } else { + 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 +965,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); }