From patchwork Tue Jun 16 19:28:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 30672 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5GJVQiU004683 for ; Tue, 16 Jun 2009 19:31:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753962AbZFPTbg (ORCPT ); Tue, 16 Jun 2009 15:31:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754076AbZFPTbg (ORCPT ); Tue, 16 Jun 2009 15:31:36 -0400 Received: from iksaif.net ([88.191.73.63]:60981 "EHLO iksaif.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754950AbZFPTb2 (ORCPT ); Tue, 16 Jun 2009 15:31:28 -0400 Received: from localhost.localdomain (cxr69-11-88-180-139-205.fbx.proxad.net [88.180.139.205]) (Authenticated sender: corentincj@iksaif.net) by iksaif.net (Postfix) with ESMTPA id 17877C9003E; Tue, 16 Jun 2009 21:33:57 +0200 (CEST) From: Corentin Chary To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, Corentin Chary Subject: [PATCH 14/15] eeepc-laptop: add rfkill support for the 3G modem in Eee PC 901 Go Date: Tue, 16 Jun 2009 21:28:55 +0200 Message-Id: <1245180536-28009-15-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <1245180536-28009-14-git-send-email-corentincj@iksaif.net> References: <1245180536-28009-1-git-send-email-corentincj@iksaif.net> <1245180536-28009-2-git-send-email-corentincj@iksaif.net> <1245180536-28009-3-git-send-email-corentincj@iksaif.net> <1245180536-28009-4-git-send-email-corentincj@iksaif.net> <1245180536-28009-5-git-send-email-corentincj@iksaif.net> <1245180536-28009-6-git-send-email-corentincj@iksaif.net> <1245180536-28009-7-git-send-email-corentincj@iksaif.net> <1245180536-28009-8-git-send-email-corentincj@iksaif.net> <1245180536-28009-9-git-send-email-corentincj@iksaif.net> <1245180536-28009-10-git-send-email-corentincj@iksaif.net> <1245180536-28009-11-git-send-email-corentincj@iksaif.net> <1245180536-28009-12-git-send-email-corentincj@iksaif.net> <1245180536-28009-13-git-send-email-corentincj@iksaif.net> <1245180536-28009-14-git-send-email-corentincj@iksaif.net> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Signed-off-by: Corentin Chary --- drivers/platform/x86/eeepc-laptop.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 789710a..deb103c 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -141,6 +141,7 @@ struct eeepc_hotk { u16 *keycode_map; struct rfkill *wlan_rfkill; struct rfkill *bluetooth_rfkill; + struct rfkill *wwan3g_rfkill; struct hotplug_slot *hotplug_slot; }; @@ -352,6 +353,23 @@ static int eeepc_bluetooth_rfkill_state(void *data, enum rfkill_state *state) return 0; } +static int eeepc_wwan3g_rfkill_set(void *data, enum rfkill_state state) +{ + if (state == RFKILL_STATE_SOFT_BLOCKED) + return set_acpi(CM_ASL_3G, 0); + else + return set_acpi(CM_ASL_3G, 1); +} + +static int eeepc_wwan3g_rfkill_state(void *data, enum rfkill_state *state) +{ + if (get_acpi(CM_ASL_3G) == 1) + *state = RFKILL_STATE_UNBLOCKED; + else + *state = RFKILL_STATE_SOFT_BLOCKED; + return 0; +} + static void __init eeepc_enable_camera(void) { /* @@ -939,6 +957,8 @@ static void eeepc_rfkill_exit(void) rfkill_unregister(ehotk->wlan_rfkill); if (ehotk->bluetooth_rfkill) rfkill_unregister(ehotk->bluetooth_rfkill); + if (ehotk->wwan3g_rfkill) + rfkill_unregister(ehotk->wwan3g_rfkill); if (ehotk->hotplug_slot) pci_hp_deregister(ehotk->hotplug_slot); } @@ -1036,6 +1056,15 @@ static int eeepc_rfkill_init(struct device *dev) if (result && result != -ENODEV) goto exit; + result = eeepc_new_rfkill(&ehotk->wwan3g_rfkill, + "eeepc-wwan3g", dev, + RFKILL_TYPE_WWAN, CM_ASL_3G, + eeepc_wwan3g_rfkill_set, + eeepc_wwan3g_rfkill_state); + + if (result && result != -ENODEV) + goto exit; + result = eeepc_setup_pci_hotplug(); /* * If we get -EBUSY then something else is handling the PCI hotplug -