aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-06-16 09:53:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-19 11:50:17 -0400
commit96e9cfeb9692b0bc6e03f9b6f9cb3c67a40b76d1 (patch)
treec64eee66425c46d34c266dc106c1a8f51e4cafca
parent06d5caf47ef4fbd9efdceae33293c42778cb7b0c (diff)
eeepc-laptop: read rfkill soft-blocked state on resume
This will respect state changes over hibernation, e.g. if the user disables the wireless in the BIOS setup screen. It reveals an issue where ACPI silently kills the wireless on suspend. Normally, the BIOS restores the correct state from non-volatile storage on boot. But when hibernation is aborted, the wireless would remain killed. Fortunately we can work around this in the resume handler by simply writing back the same value we read from NVS. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/platform/x86/eeepc-laptop.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 01682eca4360..8153b3e59189 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -180,6 +180,7 @@ static struct key_entry eeepc_keymap[] = {
180 */ 180 */
181static int eeepc_hotk_add(struct acpi_device *device); 181static int eeepc_hotk_add(struct acpi_device *device);
182static int eeepc_hotk_remove(struct acpi_device *device, int type); 182static int eeepc_hotk_remove(struct acpi_device *device, int type);
183static int eeepc_hotk_resume(struct acpi_device *device);
183 184
184static const struct acpi_device_id eeepc_device_ids[] = { 185static const struct acpi_device_id eeepc_device_ids[] = {
185 {EEEPC_HOTK_HID, 0}, 186 {EEEPC_HOTK_HID, 0},
@@ -194,6 +195,7 @@ static struct acpi_driver eeepc_hotk_driver = {
194 .ops = { 195 .ops = {
195 .add = eeepc_hotk_add, 196 .add = eeepc_hotk_add,
196 .remove = eeepc_hotk_remove, 197 .remove = eeepc_hotk_remove,
198 .resume = eeepc_hotk_resume,
197 }, 199 },
198}; 200};
199 201
@@ -512,15 +514,12 @@ static int notify_brn(void)
512 return -1; 514 return -1;
513} 515}
514 516
515static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 517static void eeepc_rfkill_hotplug(void)
516{ 518{
517 struct pci_dev *dev; 519 struct pci_dev *dev;
518 struct pci_bus *bus = pci_find_bus(0, 1); 520 struct pci_bus *bus = pci_find_bus(0, 1);
519 bool blocked; 521 bool blocked;
520 522
521 if (event != ACPI_NOTIFY_BUS_CHECK)
522 return;
523
524 if (!bus) { 523 if (!bus) {
525 printk(EEEPC_WARNING "Unable to find PCI bus 1?\n"); 524 printk(EEEPC_WARNING "Unable to find PCI bus 1?\n");
526 return; 525 return;
@@ -551,6 +550,14 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
551 rfkill_set_sw_state(ehotk->eeepc_wlan_rfkill, blocked); 550 rfkill_set_sw_state(ehotk->eeepc_wlan_rfkill, blocked);
552} 551}
553 552
553static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
554{
555 if (event != ACPI_NOTIFY_BUS_CHECK)
556 return;
557
558 eeepc_rfkill_hotplug();
559}
560
554static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) 561static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
555{ 562{
556 static struct key_entry *key; 563 static struct key_entry *key;
@@ -734,6 +741,33 @@ static int eeepc_hotk_remove(struct acpi_device *device, int type)
734 return 0; 741 return 0;
735} 742}
736 743
744static int eeepc_hotk_resume(struct acpi_device *device)
745{
746 if (ehotk->eeepc_wlan_rfkill) {
747 bool wlan;
748
749 /* Workaround - it seems that _PTS disables the wireless
750 without notification or changing the value read by WLAN.
751 Normally this is fine because the correct value is restored
752 from the non-volatile storage on resume, but we need to do
753 it ourself if case suspend is aborted, or we lose wireless.
754 */
755 wlan = get_acpi(CM_ASL_WLAN);
756 set_acpi(CM_ASL_WLAN, wlan);
757
758 rfkill_set_sw_state(ehotk->eeepc_wlan_rfkill,
759 wlan != 1);
760
761 eeepc_rfkill_hotplug();
762 }
763
764 if (ehotk->eeepc_bluetooth_rfkill)
765 rfkill_set_sw_state(ehotk->eeepc_bluetooth_rfkill,
766 get_acpi(CM_ASL_BLUETOOTH) != 1);
767
768 return 0;
769}
770
737/* 771/*
738 * Hwmon 772 * Hwmon
739 */ 773 */