From patchwork Mon Dec 13 02:02:41 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: 404042 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 oBD24jqo028788 for ; Mon, 13 Dec 2010 02:04:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756540Ab0LMCEm (ORCPT ); Sun, 12 Dec 2010 21:04:42 -0500 Received: from mail-qw0-f46.google.com ([209.85.216.46]:47321 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756189Ab0LMCEk (ORCPT ); Sun, 12 Dec 2010 21:04:40 -0500 Received: by qwa26 with SMTP id 26so5701725qwa.19 for ; Sun, 12 Dec 2010 18:04:39 -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; bh=Mb82FII0lTFuzCzKJ9mcPRm4yQrECayftTVDj87FiEY=; b=USzZWseaxYYkxc3rsrJTtSTLcJ5mvRaV1Hoka3CBBbTaC3z710ssyXFXsfKcLCh+g4 GnJ5fXCC/UH0BEoQG5VfL7NN3zEptmtC5oxYEAIx40r8OZW7YdmXlaWXtk00YsTtmGNA iBM1urmATi8hUAimHxyimj4tiSv4oyosSoXvo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=ao/5W+Y4iRs51Yf8va4cNi27uMRMCwbQYR6fZVRMBW64Dt5eHEhe+R3mso/PPn+TCr ip4W3cvbRzLl2agG02LaHy2njLnHT1PC7GPEdK2OTm6jMJXFttI5NJIknNsz2WkVegww 3nMeRpONh+Co2vbRJDBzjIQfYA1Gol6ekR/VI= Received: by 10.224.73.206 with SMTP id r14mr3410820qaj.353.1292205879611; Sun, 12 Dec 2010 18:04:39 -0800 (PST) Received: from localhost.localdomain ([61.14.133.18]) by mx.google.com with ESMTPS id g28sm211531qck.13.2010.12.12.18.04.32 (version=SSLv3 cipher=RC4-MD5); Sun, 12 Dec 2010 18:04:38 -0800 (PST) From: "Lee, Chun-Yi" To: platform-driver-x86@vger.kernel.org Cc: mjg59@srcf.ucam.org, 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, "Lee, Chun-Yi" Subject: acer-wmi: Initialize wlan/bluetooth/wwan rfkill software block state Date: Mon, 13 Dec 2010 10:02:41 +0800 Message-Id: <1292205761-13001-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, 13 Dec 2010 02:04:45 +0000 (UTC) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index dc23140..52426ca 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1102,6 +1102,31 @@ static acpi_status wmid3_get_device_status(u32 *value, u16 device) return status; } +static acpi_status get_device_status(u32 *value, u32 cap) +{ + if (wmi_has_guid(WMID_GUID3)) { + u16 device; + + switch (cap) { + case ACER_CAP_WIRELESS: + device = ACER_WMID3_GDS_WIRELESS; + break; + case ACER_CAP_BLUETOOTH: + device = ACER_WMID3_GDS_BLUETOOTH; + break; + case ACER_CAP_THREEG: + device = ACER_WMID3_GDS_THREEG; + break; + default: + return AE_ERROR; + } + return wmid3_get_device_status(value, device); + + } else { + return get_u32(value, cap); + } +} + /* * Rfkill devices */ @@ -1152,6 +1177,8 @@ static struct rfkill *acer_rfkill_register(struct device *dev, { int err; struct rfkill *rfkill_dev; + u32 state; + acpi_status status; rfkill_dev = rfkill_alloc(name, dev, type, &acer_rfkill_ops, @@ -1159,6 +1186,10 @@ static struct rfkill *acer_rfkill_register(struct device *dev, if (!rfkill_dev) return ERR_PTR(-ENOMEM); + status = get_device_status(&state, cap); + if (ACPI_SUCCESS(status)) + rfkill_init_sw_state(rfkill_dev, !state); + err = rfkill_register(rfkill_dev); if (err) { rfkill_destroy(rfkill_dev);