public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] eeepc-laptop: add 3G and Wimax CM_ASL values and acpi method names
       [not found] <cover.1244845758.git.j@jannau.net>
@ 2009-06-12 22:33 ` Janne Grunau
  2009-06-12 22:33 ` [PATCH 2/2] eeepc-laptop: add rfkill support for the 3G modem in Eee PC 901 Go Janne Grunau
  1 sibling, 0 replies; 2+ messages in thread
From: Janne Grunau @ 2009-06-12 22:33 UTC (permalink / raw)
  To: acpi4asus-user; +Cc: linux-kernel, Corentin Chary

The asus_acpi module as found in the eeepc 901go redefines the control
methods bits. Bits indicating 3G modem and wimax are added between
CM_ASL_CARDREADER and CM_ASL_LID. As CM_ASL_LID was unused this does
not changes behaviour for older models.

Signed-off-by: Janne Grunau <j@jannau.net>
---
 drivers/platform/x86/eeepc-laptop.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 2c58641..8d1ecc0 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -85,6 +85,8 @@ enum {
 	CM_ASL_USBPORT3,
 	CM_ASL_MODEM,
 	CM_ASL_CARDREADER,
+	CM_ASL_3G,
+	CM_ASL_WIMAX,
 	CM_ASL_LID
 };
 
@@ -94,7 +96,7 @@ static const char *cm_getv[] = {
 	NULL, "PBLG", NULL, NULL,
 	"CFVG", NULL, NULL, NULL,
 	"USBG", NULL, NULL, "MODG",
-	"CRDG", "LIDG"
+	"CRDG", "M3GG", "WIMG", "LIDG"
 };
 
 static const char *cm_setv[] = {
@@ -103,7 +105,7 @@ static const char *cm_setv[] = {
 	"SDSP", "PBLS", "HDPS", NULL,
 	"CFVS", NULL, NULL, NULL,
 	"USBG", NULL, NULL, "MODS",
-	"CRDS", NULL
+	"CRDS", "M3GS", "WIMS", NULL
 };
 
 #define EEEPC_EC	"\\_SB.PCI0.SBRG.EC0."
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] eeepc-laptop: add rfkill support for the 3G modem in Eee PC 901 Go
       [not found] <cover.1244845758.git.j@jannau.net>
  2009-06-12 22:33 ` [PATCH 1/2] eeepc-laptop: add 3G and Wimax CM_ASL values and acpi method names Janne Grunau
@ 2009-06-12 22:33 ` Janne Grunau
  1 sibling, 0 replies; 2+ messages in thread
From: Janne Grunau @ 2009-06-12 22:33 UTC (permalink / raw)
  To: acpi4asus-user; +Cc: linux-kernel, Corentin Chary

Signed-off-by: Janne Grunau <j@jannau.net>
---
 drivers/platform/x86/eeepc-laptop.c |   56 +++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 8d1ecc0..288a4c8 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -132,6 +132,7 @@ struct eeepc_hotk {
 	u16 *keycode_map;
 	struct rfkill *eeepc_wlan_rfkill;
 	struct rfkill *eeepc_bluetooth_rfkill;
+	struct rfkill *eeepc_wwan3g_rfkill;
 	struct hotplug_slot *hotplug_slot;
 };
 
@@ -352,6 +353,23 @@ static void __init eeepc_enable_camera(void)
 	set_acpi(CM_ASL_CAMERA, 1);
 }
 
+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;
+}
+
 /*
  * Sys helpers
  */
@@ -869,6 +887,35 @@ static int eeepc_hotk_add(struct acpi_device *device)
 			goto bluetooth_fail;
 	}
 
+	if (get_acpi(CM_ASL_3G) != -1) {
+		ehotk->eeepc_wwan3g_rfkill =
+			rfkill_allocate(&device->dev, RFKILL_TYPE_WWAN);
+
+		if (!ehotk->eeepc_wwan3g_rfkill)
+			goto wwan_fail;
+
+		ehotk->eeepc_wwan3g_rfkill->name = "eeepc-3g";
+		ehotk->eeepc_wwan3g_rfkill->toggle_radio =
+			eeepc_wwan3g_rfkill_set;
+		ehotk->eeepc_wwan3g_rfkill->get_state =
+			eeepc_wwan3g_rfkill_state;
+		if (get_acpi(CM_ASL_3G) == 1) {
+			ehotk->eeepc_wwan3g_rfkill->state =
+				RFKILL_STATE_UNBLOCKED;
+			rfkill_set_default(RFKILL_TYPE_WWAN,
+					   RFKILL_STATE_UNBLOCKED);
+		} else {
+			ehotk->eeepc_wwan3g_rfkill->state =
+				RFKILL_STATE_SOFT_BLOCKED;
+			rfkill_set_default(RFKILL_TYPE_WWAN,
+					   RFKILL_STATE_SOFT_BLOCKED);
+		}
+
+		result = rfkill_register(ehotk->eeepc_wwan3g_rfkill);
+		if (result)
+			goto wwan_fail;
+	}
+
 	result = eeepc_setup_pci_hotplug();
 	/*
 	 * If we get -EBUSY then something else is handling the PCI hotplug -
@@ -882,6 +929,13 @@ static int eeepc_hotk_add(struct acpi_device *device)
 	return 0;
 
  pci_fail:
+	if (ehotk->eeepc_wwan3g_rfkill)
+		rfkill_unregister(ehotk->eeepc_wwan3g_rfkill);
+wwan_fail:
+	if (ehotk->eeepc_wwan3g_rfkill) {
+		rfkill_free(ehotk->eeepc_wwan3g_rfkill);
+		ehotk->eeepc_wwan3g_rfkill = NULL;
+	}
 	if (ehotk->eeepc_bluetooth_rfkill)
 		rfkill_unregister(ehotk->eeepc_bluetooth_rfkill);
  bluetooth_fail:
@@ -1041,6 +1095,8 @@ static void eeepc_rfkill_exit(void)
 		rfkill_unregister(ehotk->eeepc_wlan_rfkill);
 	if (ehotk->eeepc_bluetooth_rfkill)
 		rfkill_unregister(ehotk->eeepc_bluetooth_rfkill);
+	if (ehotk->eeepc_wwan3g_rfkill)
+		rfkill_unregister(ehotk->eeepc_wwan3g_rfkill);
 }
 
 static void eeepc_input_exit(void)
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-12 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1244845758.git.j@jannau.net>
2009-06-12 22:33 ` [PATCH 1/2] eeepc-laptop: add 3G and Wimax CM_ASL values and acpi method names Janne Grunau
2009-06-12 22:33 ` [PATCH 2/2] eeepc-laptop: add rfkill support for the 3G modem in Eee PC 901 Go Janne Grunau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox